run .blend with parameters

hey i have a menu.blend and a game.blend… in game you are able to save and load the game… but i dont want every time start new game and then pressing key to load the game… is there any way to run from menu.blend the game.blend with parameter? like: “game.blend -load”

1 word: Python :smiley:

yes i know the basics of the python but can i do that? and if i load with the parameter -load how can it understand its the -load or -somethingelse… how can i manage that the -load will do what i want after load the .blend?

not exactly! but if i am thinking what you are thinking,then there is hope :smiley:

it’s a bad trick!
The trick is to assign a value to the sys.argv variable
like


import sys
sys.argv[0]="-load"

and make sure that this code is executed before the game.blend is loaded

in the other file game.blend

add something like this


import sys
print sys.argv[0]

you should be able to see “-load” printed

And that’s it, the argument passed will be stored as array in sys.argv variable and you can list them with sys.argv[0] , sys.argv[1] etc… (i belive the arguments will be stored as multi-dimentional arrays/lists.

Hope that helps!:smiley:

sorry! for double post:D

heh thank you it’s working now i will go to implement all the needed things :wink: