The Dink Network

Script(s) Problem(s)

December 23rd 2005, 07:42 AM
fairy.gif
Glennglenn
Peasant He/Him Norway
GlennGlenn doesn't want a custom title. 
Dink is going to get some nut from an alktree for his mother, when he gets back is his village on fire, and after dink has fainted and the fire is gone, can dink go and get more nuts, but then is the village on fire again.

//Nut Script
void main( void )
{
sp_touch_damage(&current_sprite, -1);
}

void touch( void )
{
int &junk = free_items();

if (&junk < 1)
{
say("I'm full! I can't pick up anything else.", 1);
return;
}
Playsound(10,22050,0,0,0);
add_item("item-nut",438, 19);

if (&nuttree < 1)
{
&nuttree = 1;
&story = 2;
}

say("I picked up a nut!",1);
sp_active(&current_sprite, 0);

}

//Vision Script
void main( void )
{

if (&story == 2)
{
&vision = 1;

say("OH NO, My village is on fire!! I need to check if mom is ok!", 1);
}

if (&story >= 3)
{
&vision = 2;
}

}
December 23rd 2005, 01:49 PM
dragon.gif
I had a problem like this once, but then I realised I hadn't declared the global variables in the Main script. I assume you did not make the same mistake?
December 23rd 2005, 02:10 PM
fairy.gif
Glennglenn
Peasant He/Him Norway
GlennGlenn doesn't want a custom title. 
No I everything is declared in the MAIN.c
December 23rd 2005, 02:12 PM
dragon.gif
I thought so, in which case I can't help you since I'm still a newbie really.
December 23rd 2005, 02:13 PM
spike.gif
You never change &story to 3?

Not in these scriopts anyway.
December 23rd 2005, 02:58 PM
knightg.gif
cypry
Peasant He/Him Romania
Chop your own wood, and it will warm you twice. 
scratcher is right. Your vision script should look like this:

//Vision Script
void main( void )
{

if (&story >= 3)
{
&vision = 2;
}

if (&story == 2)
{
&vision = 1;

say("OH NO, My village is on fire!! I need to check if mom is ok!", 1);
&story = 3;
}

}

I changed the "if"s places because if I didn't, the &story would become 3 in the first "if", then the second if would change the vision to 2, in the same script.