A lot of the time, I read the you should put all the scripts inside one script file. Is this just for convenience sake, or does it actualy have an affect on the functionability? It may be just me, but whenever I import a new script, all the others seem to stop working. Is this related at all?
All Scripts In One File?
Started by
SpacemanDan
, Oct 07 2008 12:24 PM
4 replies to this topic
#1
Posted 07 October 2008 - 12:24 PM
#2
Posted 07 October 2008 - 12:30 PM
Surprisignly enough, seeing as that's what everyone says to do, and it breaks when you don't do it... >_<
When you compile a new script file, all old scripts are dis-regarded by the compiler.
There names still appear, but they are not saved by ZQuest.
So yes, you do very much have to include all scripts in the same file.
When you compile a new script file, all old scripts are dis-regarded by the compiler.
There names still appear, but they are not saved by ZQuest.
So yes, you do very much have to include all scripts in the same file.
#3
Posted 07 October 2008 - 12:35 PM
When you import a ZScript script, the previous script is completely overwritten. Now, you can get around this by using a single script to import all the other scripts you want to use. For example, if you want to compile both "coolitem.z" and "crazyffc.z" in a quest, create a new ".z" file and put the lines
CODE
import "std.zh"
import "coolitem.z"
import "crazyffc.z"
and thats it. Then compile that file only. Just make sure that all of the other script files you want to import do NOT have the import "std.zh" in them, since you can only import that file one time, and having that line in the other files would cause the compiler to try and import it multiple times, causing it to go crazy with multiple declarations errors.
import "coolitem.z"
import "crazyffc.z"
Edited by Elmensajero, 07 October 2008 - 12:35 PM.
#4
Posted 07 October 2008 - 12:42 PM
Thanks for the help! That explains why my scripts stop working all of a sudden. I thought the two were related.
#5
Posted 07 October 2008 - 03:51 PM
Good to know to include all the Scripts in one file.
Thanks.
Thanks.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users