The Dink Network

Global Functions

July 20th 2006, 12:56 PM
pq_rabbit.gif
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
anon.gif
Ace
Ghost They/Them
 
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??
July 20th 2006, 01:57 PM
pq_rabbit.gif
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.
July 20th 2006, 02:46 PM
anon.gif
Ace
Ghost They/Them
 
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.
July 22nd 2006, 11:38 AM
knightg.gif
cypry
Peasant He/Him Romania
Chop your own wood, and it will warm you twice. 
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.
July 22nd 2006, 12:00 PM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
... 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.
July 22nd 2006, 02:37 PM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
Time for a 1.09 release maybe?
August 5th 2006, 11:24 AM
pq_rabbit.gif
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.)
August 5th 2006, 02:15 PM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
I think only one is supported, total. And when you use it, the game likes to crash.
August 5th 2006, 06:05 PM
bonca.gif
Christiaan
Bard They/Them Netherlands
Lazy bum 
redink, you're full of it.
August 5th 2006, 11:38 PM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
I swear that it used to work... but the current implementation is horrible.
August 6th 2006, 09:45 AM
pq_rabbit.gif
LoL. I thought externals didn't support arguments? So will I have to make some globals named &arg1, &arg2, &arg3, etc.?
August 6th 2006, 10:01 AM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
No. The arguments are pseudo-variables that are automatically created in every function. They don't even take up variable slots.