The Dink Network

Script Trouble

May 15th 2006, 03:28 PM
bonca.gif
Christiaan
Bard They/Them Netherlands
Lazy bum 
I've got a problem with my script for a nut. If I "use" it, the entire game should be stopped, but somehow, it doesn't. Also, when choosing to eat the nut, Dink stays frozen, I don't see what I've done wrong. Help please! Hereby the script:

//item nut

void use( void )
{
freeze(1);
stop_entire_game(1);
say_stop("I think I can eat it. Or I can keep it.", 1);
wait(200);
choice_start()
set_y 240
set_title_color 15
title_start();
Eat the nut?
title_end();
"Yes"
"Nay"
choice_end()

if (&result == 1)
{
&life += 3;
if (&life > &lifemax)
&life = &lifemax;
say("Yum, that nut's mighty tasty.", 1);
kill_cur_item();
unfreeze(1);
}
}

}
if (&result == 2)
{
say("I'd rather keep it.", 1);
unfreeze(1);
}
May 15th 2006, 03:45 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
stop_entire_game() Hehehe...

It stops the game, but only until the script pauses.

say_stop() as well as wait() (and fades, too) pause the script. Try placing stop_entire_game(1); just before choice_start().
May 16th 2006, 01:34 AM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
The script has some bracketerrors as well, try this script:

void use( void )
{
freeze(1);
say_stop("I think I can eat it. Or I can keep it.", 1);
stop_entire_game(1);
wait(200);
choice_start()
set_y 240
set_title_color 15
title_start();
Eat the nut?
title_end();
"Yes"
"Nay"
choice_end()

if (&result == 1)
{
&life += 3;
if (&life > &lifemax)
&life = &lifemax;
say("Yum, that nut's mighty tasty.", 1);
kill_cur_item();
unfreeze(1);
}

//removed two brackets here

if (&result == 2)
{
say("I'd rather keep it.", 1);
unfreeze(1);
}
}
//added one bracket here
May 16th 2006, 10:03 AM
bonca.gif
Christiaan
Bard They/Them Netherlands
Lazy bum 
The script still has the same problems. I'll mess around with a bit again.

EDIT: Ok, I fixed the "stop entire game" bug, but Dink still stays frozen when eating the nut.

EDIT 2: I discovered the bug. When I remove the line "kill_cur_item();", Dink unfreezes. But when I do, ofcourse, the nut won't dissapear from my inventory. Is this a Dink 1.08 related bug?
May 16th 2006, 01:22 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
It seems that kill_cur_item() kills the item, but also the script. Switching kill_cur_item(); with unfreeze(1); might work.
May 16th 2006, 01:41 PM
bonca.gif
Christiaan
Bard They/Them Netherlands
Lazy bum 
Once again, you are correct. Thanks!