The Dink Network

procedure thing

September 3rd 2006, 09:43 PM
girl.gif
joshriot
Peasant They/Them United States
keep it real 
Dink rocedure print_thing does not take 2 parms in FRANK, offset 735. ();
?)

what the heck does that mean?

im playing around with procedures and they work. sometimes i think. this one isnt even global its local so what is this error mean?

i write it like this

void main( void )
{
whatever(1,2);
int &elf = &return;
}

void whatever()
{
&arg1 += &arg2;
return(&arg1);
}

it works i just get this error. it works with doing

void whatever( void )

and

void whatever(&arg1,&arg2)

also i just still get the error so how is it done anyone can do me example?
September 4th 2006, 12:07 AM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
That debug statement doesn't really mean anything... Dink'll spit that out for every custom procedure.

This procedure doesn't work because you are not allowed to modify the &arg# pseudo variables. Try this procedure:

void whatever()
{
int &temp = &arg1;
&temp += &arg2;
return(&temp);
}
September 4th 2006, 09:52 AM
girl.gif
joshriot
Peasant They/Them United States
keep it real 
so &arg1-9 are reference parameters? but this is the thing. i dont modify them when i get the error. or even use &arg at all sometimes. i was just making an example not paying attention.

Dink rocedure g_music does not take 1 parms in item-fst, offset 2135. ();
?)
Dink:ERROR: Procedure void d …|( void ); not found in script . (word 2 was item-fst)

the SECOND line, i think, is whats causing the parameter to NOT run. because like you said, the first line will show, no matter what. for any procedure. because i have other ones that work that only show the first line but this one does not work and it shows the second line. all it is is a global procedure. like this

in main.c

make_global_function("global","g_music");

in global.c

void g_music( void )
{
//used to play appropriate song after game is loaded
//called in our item equip procedure
playmidi("100.mid");
if (&song == 100)
{
playmidi("100.mid");
}
if (&song == 103)
{
playmidi("103.mid");
}
if (&song == 104)
{
playmidi("104.mid");
}
}

in item-fst.c

g_music();

DOESNT WORK. i have to use external and it works fine. the weird thing is... it USED to work, just fine. the only thing i can think of is im not initializing or calling the procedure right and it doesnt like it but only sometimes cause i have procedures that send values to &arg and use &return that work PERFECTLY.

is it possible this procedure stopped working as i added more procedures to global.c? when it was the only one it worked but now there are 2 more after it and it doesnt work.

what i want to know is how to initialize and call the procedure.

do you do

void whatever( void )

or do you just do

void whatever() //this is how i do it with local procedures that use args and they work

void whatever(&arg1,&arg2etc) //this also works for the local one

but i want to know the official way its done. the one not working and giving the error is the global music one... that doesnt even use &arg at all.
September 4th 2006, 10:22 AM
girl.gif
joshriot
Peasant They/Them United States
keep it real 
yeah i called the procedure like this

g_music();

in key-75.c and i get the same error

Dink:ERROR: Procedure void d …|( void ); not found in script . (word 2 was key-72)

basically im looking for examples on how to initialize and call them both with and without use of arguments
September 4th 2006, 10:44 AM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
Global functions don't work correctly. Use external. Sorry about that.
September 4th 2006, 11:10 AM
girl.gif
joshriot
Peasant They/Them United States
keep it real 
uh. well fix it. external doesnt give you parameters. how can i make my own add_item procedure for a new inventory screen if i cant tell it what item to add? i guess i could make it a local procedure and copy and paste it into every single script where i add an item but then that defeats the useful/awesomeness of being able to make your own globals. and why does it work fine sometimes but not at all sometimes i dont get it. why did it work before then suddenly stop working. anyway. this sucks.
September 4th 2006, 11:14 AM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
External does give you parameters.

Edit: See this post for more information.
September 4th 2006, 11:16 AM
girl.gif
joshriot
Peasant They/Them United States
keep it real 
oh wow the amazing thought just occured to me that i could make a variable called &assratchet and then do

&assratchet = 4;
external("global","g_whatever");

void g_whatever()
{ say("&assratchet",1);
}

but still thats ghetto and it should be fixed. i would fix it myself and leave you with the greatest dinkc abillities of all time if i knew the first thing about how to even open/edit/save the source code into a game

wait how do you use parameters with external??
September 4th 2006, 11:19 AM
girl.gif
joshriot
Peasant They/Them United States
keep it real 
like how do i send the value?

externmal("global","g_whatever",5,2,3);

i dont get it
September 4th 2006, 11:23 AM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
Pretty much.

From the DinkC Reference (Advanced Procedures):

// passing.c
void main(void)
{
int &two = 2;
// You can specify up to 9 parameters by calling a procedure directly.
// Will cause Dink to say "1, 2, 3, 4, 5, 6, 7, 8, 9"
say_stuff(1, &two, 3, 4, 5, 6, 7, 8, 9);

// You can only pass up to 8 parameters when using external.
// Will cause Dink to say "1, 2, 3, 4, 5, 6, 7, 8, 0"
external("passing", "say_stuff", 1, &two, 3, 4, 5, 6, 7, 8);
}

void say_stuff()
{
say("&arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7, &arg8, &arg9", 1);
}
September 4th 2006, 11:27 AM
girl.gif
joshriot
Peasant They/Them United States
keep it real 
ah ha i guessed right i win. yeah this works.

**ps from what i was doing i had 3 different globals and i think maybe only the last one you initialize works fine because my last one worked fine and the ones i had before it broke so i dont know if you know what the problem is but this is my guess from what i was doing. they worked fine. then i add a different one and i think thats when i had to change the first one to external. then i added a third global and the second one stopped working as well. but the third one i added worked fine. so im guessing if i added a fourth the third one would break and the fourth one would.... work......... fine.
September 4th 2006, 12:09 PM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
Yeah, when I looked into the problem, it appeared that only one global function would work at a time. But, even that one had a tendancy to crash the game.