Script Trouble
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);
}
//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);
}
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().
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().
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
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
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?
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?
It seems that kill_cur_item() kills the item, but also the script. Switching kill_cur_item(); with unfreeze(1); might work.