Jump to content

Photo

All Scripts In One File?


  • Please log in to reply
4 replies to this topic

#1 SpacemanDan

SpacemanDan

  • Members
  • Location:Ontario, Canada

Posted 07 October 2008 - 12:24 PM

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?

#2 Joe123

Joe123

    Retired

  • Members

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.

#3 Elmensajero

Elmensajero

    Doyen(ne)

  • Members
  • Real Name:John
  • Location:Raleigh, North Carolina

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.

Edited by Elmensajero, 07 October 2008 - 12:35 PM.


#4 SpacemanDan

SpacemanDan

  • Members
  • Location:Ontario, Canada

Posted 07 October 2008 - 12:42 PM

Thanks for the help! icon_biggrin.gif That explains why my scripts stop working all of a sudden. I thought the two were related.

#5 lucas92

lucas92

    Defender

  • Members

Posted 07 October 2008 - 03:51 PM

Good to know to include all the Scripts in one file. icon_smile.gif

Thanks.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users