The Dink Network

Help me!!!!! Again...

October 22nd 2006, 04:25 PM
knightgl.gif
CastMan
Peasant He/Him Brazil
Some day I'll finish my mod... Some day... 
I want to know why this variable doesn't works!

___________________________________________________________________
//this script fills life up, touch_damage must be set to -1. (run script mode)

int &secret;

void main( )
{
sp_pseq(&current_sprite, 163);
sp_frame(&current_sprite, 4); //so the seq will start
// sp_brain(&current_sprite, 0);
sp_touch_damage(&current_sprite, -1);
sp_nohit(&current_sprite, 1);

//create shiny thingie
&save_x = sp_x(&current_sprite, -1);
&save_y = sp_y(&current_sprite, -1);
&save_y += random(5,1);
int &startframe = random(5,1);
int &spark = create_sprite(&save_x, &save_y, 15, 165, 1);
sp_seq(&spark, 165);
sp_nohit(&spark, 1);
sp_frame(&spark, &startframe);
sp_brain_parm(&spark, &current_sprite);

}

void touch( void )
{
sp_brain_parm(&current_sprite, 10);
sp_brain(&current_sprite, 12);
sp_touch_damage(&current_sprite, 0);
sp_timing(&current_sprite, 0);

if (&secret == 0)
{
say_stop(" Secret 1", 1);
&secret += 1;
}

if (&secret == 1)
{
say_stop(" Secrets 2", 1);
&secret += 2;
___________________________________________________________________

Please someone help me!! Again...
October 22nd 2006, 05:10 PM
burntree.gif
Striker
Noble She/Her United States
Daniel, there are clowns. 
Well, the most obvious thing is that you lack closing brackets to end void touch() and the last if statement.
October 22nd 2006, 06:02 PM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
It sounds like the variable &secret should be a global. Add this line in main.c: make_global_int("&secret", 0);
Remove the line int &secret; from the script, it doesn't do anything at the place it is right now.

Oh, and do what Striker told you, in fact always do what Striker tells you.
October 25th 2006, 04:41 PM
knightgl.gif
CastMan
Peasant He/Him Brazil
Some day I'll finish my mod... Some day... 
Not exacly Striker, this script continues ends at &secret == 30, the
bracket is closed at the real script and i already done this metatarasal, but the script doesn't works!!

Thanks for the help, but it still doesn't works...
October 25th 2006, 09:20 PM
burntree.gif
Striker
Noble She/Her United States
Daniel, there are clowns. 
Okay, next thing... is sprite set to normal, and not background?

What other information can you provide us with aside from "it doesn't work"? What's it doing right now?
October 26th 2006, 09:07 AM
wizardb.gif
LPJoBo
Peasant He/Him
 
I do not know how the dink.exe interpretes the *.c scripts, but do you know that in real ANSI / ISO C programming, it should never be void main() but int main() and then do not forget return 0; befor the ending curly brace.
- if, int main() is the only way to write this, is beyond my present knowledge.
ex.

int main()
{
/* bla bla bla*/
/* bla bla bla*/
/* bla bla bla*/

return 0;
}

If you have got the patience, you can find this at....

http://www.faqs.org/faqs/C-faq/faq/
October 26th 2006, 10:24 AM
burntree.gif
Striker
Noble She/Her United States
Daniel, there are clowns. 
While that is correct protocol for the C language... it won't work in DinkC. DinkC can only handle procedures that begin with void. That faq won't really help.
October 27th 2006, 06:42 PM
knightgl.gif
CastMan
Peasant He/Him Brazil
Some day I'll finish my mod... Some day... 
This script is used as an item, you touch it and Dink says "Secret 1", but when i get the second "Secret Item" Dink says "Secret 1"!! Is it happening cos' the variable is not working, right??
And another doubt, i don't know how edit the ini file, so... someone could help me?? "load_sequence_now graphics\dink\sword\hit\d-sa8- 108 75 46 109 -17 -16 17 10" "load_sequence_now graphics\dink\sword\hit\d-sa8" Until i know what to do but, which the meaning of the other numbers??
And thanks for the patience.