Global Functions
When a global function is executed, does the game create an additional instance of the script? Basically I'm asking if it would be kosher to pile about 30 global functions into a hypothetical "functions.c" and calling several from that file at a time?
July 20th 2006, 01:23 PM
Ace
Golbal variables can be in any script, and can be used and called upon on other scripts. However, if your creating a D-MOD why not just create your global int's in main.c??
No, I'm talking about Global Functions. Look in the latest DinkC ref in your Develop dir.
EDIT: If you have v1.08, that is.
EDIT: If you have v1.08, that is.
July 20th 2006, 02:46 PM
Ace
In that case, I am not sure... whats the difference in them 2? O.o I am guessing a Function does a function... but even after that asumption I am still confused a bit.
Well the alternative is to create those functions in different scripts, so there will be called 30 scripts anyway. Try to use the scripts_used functions to see how many scripts are used at the moment.
... uh oh.
From some testing I just did and looking at the source code, it looks like I broke global functions sometime before I released 1.08. They used to work...
You're better off just using 'external', then. Like:
external("script", "function");
Etc. 1.08's external supports up to 8 arguments, I think.
From some testing I just did and looking at the source code, it looks like I broke global functions sometime before I released 1.08. They used to work...
You're better off just using 'external', then. Like:
external("script", "function");
Etc. 1.08's external supports up to 8 arguments, I think.
Right now, the global functoins appear to work, but only if only one global function per file is used at one time. (At least that's my theory... I haven't been able to make it work by accessing more than one at a time.)
I think only one is supported, total. And when you use it, the game likes to crash.
I swear that it used to work... but the current implementation is horrible.
LoL. I thought externals didn't support arguments? So will I have to make some globals named &arg1, &arg2, &arg3, etc.?