Where is the correct folder to place scripts?
by Jack-S- · in iTorque 2D · 09/25/2011 (4:14 pm) · 4 replies
Hi I was wondering if anyone could clarify this for me. Basically I have written a simple script file and placed it into projectFiles/game/scripts. however when I execute this script I get this warning in the console saying that the file is missing.
However I had a quick look around the forums and found out you could place scripts into the common folder. I then executed the same script except using exec("common/myScript.cs"); and the script got compiled.
The trouble is im wondeirng if this is even the correct folder to place scripts, as when I eventually happen to build and finalise the app im worried that the scripts might not be in the place they're supposed to be and hence the game freaks out.
So does anybody know if placing scripts into the common folder will make any difference?
And as an aside has anyone managed to successfully backward engineering a behavior? im trying to backward engineer the asteroidscontrols.cs behavior so that they will respond to gui touches but had no success whatsoever.
Thanks in advance.
However I had a quick look around the forums and found out you could place scripts into the common folder. I then executed the same script except using exec("common/myScript.cs"); and the script got compiled.
The trouble is im wondeirng if this is even the correct folder to place scripts, as when I eventually happen to build and finalise the app im worried that the scripts might not be in the place they're supposed to be and hence the game freaks out.
So does anybody know if placing scripts into the common folder will make any difference?
And as an aside has anyone managed to successfully backward engineering a behavior? im trying to backward engineer the asteroidscontrols.cs behavior so that they will respond to gui touches but had no success whatsoever.
Thanks in advance.
About the author
#2
Also,
I was wondering if there was a way to execute a script upon a specific level loading, because I have written a sript for an object that exists in a level but the console says that it cant find this object.
This is probably because the first level loaded doesnt contain the object the script is referring to. Is there any way I can bind a script to a specific level or execute it when a specific level is loaded??
09/26/2011 (7:45 am)
@ Michael Sorry Michael I have now gotten the scripts to execute within the scripts folder,I am running under windows 7 64bit and have been experiencing things working some days and randomly not the next.Also,
I was wondering if there was a way to execute a script upon a specific level loading, because I have written a sript for an object that exists in a level but the console says that it cant find this object.
This is probably because the first level loaded doesnt contain the object the script is referring to. Is there any way I can bind a script to a specific level or execute it when a specific level is loaded??
#3
09/26/2011 (10:09 am)
Quote:I was wondering if there was a way to execute a script upon a specific level loadingThis is possible to do, but you will need to write the execution code yourself. This is not typical, automated behavior for the engine. It is expecting all scripts to be executed before a level is loaded. What you can do is modify the level loading code. Compare the name of the level to a list you create prior. If the name matches a condition, execute the script.
#4
So once ive compared level I execute my objectives and other scripts related to that level.
09/26/2011 (10:42 am)
Thanks the idea is that I want different objectives to complete different levels. what kind of code or function should I use to compare if a level is loaded?So once ive compared level I execute my objectives and other scripts related to that level.
Employee Michael Perry
ZombieShortbus