How can I have construct call external scripts from a folder? I thought this would be a cool idea for modding. Also, while we are on the topic of folders, how do get the game to read the folders in the apppath? I.e.
%AppPath% & "scripts\gameplay\wakawakawaka.py"[/code:2jkarqgx] Or something like that? Also, A video I uploaded not to long ago about the said game I am working on. [youtube video="NjsyoKF1-2k"]
Python has an exec statement that does that:
exec System.AppPath + r'scripts\gameplay\wakawakawaka.py'[/code:2w8c0vef]
Python has an exec statement that does that: exec System.AppPath + r'scripts\gameplay\wakawakawaka.py'[/code:3dbduc55]
exec System.AppPath + r'scripts\gameplay\wakawakawaka.py'[/code:3dbduc55]
Thank you. Now to learn python. xD
Develop games in your browser. Powerful, performant & highly capable.
I'm not sure but I think the system object has a call for that too.
+ System: Start of layout
-> System: Run Script ("")
Old thread, but i need help. When i try executing python code through exec it gives me syntax error.
i used exec(System.AppPath + 'Data\py\array.py')
to exute this file in Data\pycalled array.py
From rojohounds example it is the same error:
<img src="http://uploadpic.org/storage/2011/JlJwDTJXmB63Cb3rhl3Oaxupu.png" border="0" />
Try
execfile(System.AppPath + 'Data\py\array.py')
or
exec(open(System.AppPath + 'Data\py\array.py'))
instead.