The Dink Network

Someone's Profile

2008-01-26 19:35:54
fairy.gif
Someone
Peasant Male Australia
 
I'm not sure, but I'm led to believe 1.08 modified local function calls to act like external(). It does make a difference because local variables can't be accessed, &current_sprite may not work as desired, and there if you were to have a function call itself you may run out of script numbers. It might be possible to call a function locally using set_callback_random, but I haven't tried it.

I'm not sure what you mean by "exit the script". Does it not exit the script when it exits the procedure? Exit does not mean kill. Unless you mean return is causing it to exit a locally called function and return to the calling function. But as you've found they are on different script numbers even if it's called "locally"..

Functions that take variables are very useful. Of course the same effect could be done with global variables in v1.07 but arguments make it easier. It's useful for when you want to do multiple things that are almost identical.

E.g. if you wanted to make 3 bombs, but in different positions.

//bomb.c
void make_bomb(void)
{
create_sprite(&arg1,&arg2,17,?,1);
//sp_strength etc
}

then call
external("bomb","make_bomb",100,200);
external("bomb","make_bomb",300,200);
external("bomb","make_bomb",500,200);

MouseDink uses functions with arguments if you still doubt how useful it is. See the globalX.c files. For example I have code to determine which direction (out of the standard 8 directions) one sprite is relative to another. You can imagine that whenever I want to find this the code is identical except for the sprite numbers for the two sprites, so I can pass them in an argument and use the same code for any use. I also used it determine the gradient of the line between two sprites, as well as to calculate hit damages..

Another use is to pass an indicator of the calling script (sender). E.g. in MouseDink I've got a function that I want to be run slightly different if it's called when the player first starts the game and when he loads a new game. So I sent a 0 for new game and 1 for load game (or something like that) and I can have the code execute slightly differently depending on what script calls it.

Someone has released 11 files

TitleCategoryAvgUpdated
Red ShieldD-Mod, UnfinishedGood 8.0December 4th, 2007
CustomFEMiscellaneous, FrontendExceptional 9.6December 4th, 2007
MouseDink Dev's DemonstrationD-Mod, DevelopmentGood 8.4December 4th, 2007
FIFO & Variables in DinkCDevelopment, TutorialExceptional 9.0December 4th, 2007
Fairy Goodness OnlineD-Mod, MiscellaneousGood 7.8March 22nd, 2002
CustomFE 1 SkinpackMiscellaneous, FrontendGood 8.4November 12th, 2000
DImageDevelopment, UtilityFair 6.9October 22nd, 2000
CEditDevelopment, UtilityExceptional 9.2October 14th, 2000
DMOD ManagerDevelopment, UtilityGood 8.4September 28th, 2000
Run.exeDevelopment, UtilityFair 6.6September 16th, 2000
DinkC TutorialDevelopment, TutorialFair 6.2April 16th, 2000

Someone has written 2 reviews

TitleFileTypeScoreDate
Nice use of Dinkc Platform DinkFeaturedGood 7.7January 23rd, 2010
An original DMOD I, Kara GuFeaturedExceptional 9.7December 10th, 2007