I have several script files in my ASS project. At least one of those
files contains handlers that need to be called from other script
files.
How can I do this?
....
In my mind, when the ASS project launches, it already loads my central
script into memory. It seems inefficient to the point of incompetence
for my program to reload it into memory each time I need it.
I'd appreciate any more help.
A somewhat late response:
Declare the loaded script as global. Then, in the other scripts (also
loaded into the main script) declare their needs as global. This way,
it is easy to conveniently and efficiently "share" loaded handlers in
several scripts, making the whole thing very modular. The important
trick is that one script must act as a "main" or "top level" script
that loads the others that need common access to things.
I wrote a mail about this topic here 2004-03-20 on the subject: "Re:
Properties in multiple scripts". Check the archives. Below, I'll just
paste the central paragraph:
"I have a total of 20 scripts in one project. One script will have most
of the GUI handlers (but not all), it will load another script, which
in turn loads a large bunch of other scripts, while also declaring them
all as globals. Each script that needs access to handlers in other
scripts must declare these needs as globals. So, in this way, although
variables in different scripts cannot inherently be shared, the net
effect is almost the same - you just have to be aware of that the
globals you are sharing are the declared ones of the instance that are
loaded (not the ones stored in the script files on disk)."