Passsing args to runtime application via command line

Hi,

I’d like to send to my game runtime some parameter from command line, is it allowed by the blenderplayer and how to access those custom parameters from inside my app ?

For example i’d like to be able to launch the application with this kind of command :

myApp <login> <pass>

Thanks

p.s. : I may have posted this message few minutes ago but i can find it. Sorry if there is two messages, and feel free to delete one of them (or just send me a mp and i will delete :wink: ).

p.p.s. : My previous message just appeared, it’s ok to delete it, it seems i can’t do it myself.
Its title is “passing cmd line arguments to the game runtime and using them”. Sorry again :slight_smile:

write your parameters to a .txt file and read it in your .blend with python

Thanks for the idea. Must i understand there is no way to do it directly ?

From the command line options of a saved 2.49b runtime, acessible with “-h” for help:

  • : all arguments after this are ignored, allowing python to access them from sys.argv

So I guess you could do (I didn’t try, though):

myApp - login pass

And from within the Blender runtime in a script that runs in your game:

import sys
print sys.argv

and see what’s in there. I believe you get returned a list with your values accessible via sys.argv[1], sys.argv[2] etc.

Edit: I just tested, it works nicely. :slight_smile:

Great ! Thanks for the help.

You’re most welcome. :slight_smile: