You are not logged in.
I have been designing a game to sort of break me into python a bit and I have been considering one thing: scripting. I need scripting for game events, etc. I was just wondering what you guys thought the best way of doing this is? I want to allow map makers to ship all the scripting they need for their maps in plain python files that can be included in their tarball (I am using tarballs to store maps and all their unique resources)
The only thing I really need advice on is loading the scripts.
Offline
for importing source you can do like this:
_file = open(os.environ['HOME'] + "/.config/my_game/my_script", "r")
my_script = imp.load_source("", os.environ['HOME'] + "/tmp/my_game.swap", _file)
_file.close()
i haven't figured out yet how to make it load the source "without" saving a file as bytecode (it's the .swap file), if anyone else knows please say so,
arch + gentoo + initng + python = enlisy
Offline
Thanks! I tried searching google for this but you can imagine how many nonrelevent results I was getting.
Offline