Unfreezing after say_stop
Why won't Dink unfreeze after choosing "yes" in this script? If I change the last say_stop(); to just say(); then it works.
void talk (void)
{
freeze(1);
say_stop("Ooh, a mushroom!", 1);
choice_start()
set_y 240
set_title_color 15
title_start()
Eat it?
title_end()
"Yes"
"No"
choice_end()
if (&result == 1)
{
//playsound
sp_brain_parm(¤t_sprite, 10);
sp_brain(¤t_sprite, 12);
sp_timing(¤t_sprite, 0);
int &hold = sp_editor_num(¤t_sprite);
if (&hold != 0)
editor_type(&hold, 1);
say_stop("Word", 1);
}
unfreeze(1);
}
void talk (void)
{
freeze(1);
say_stop("Ooh, a mushroom!", 1);
choice_start()
set_y 240
set_title_color 15
title_start()
Eat it?
title_end()
"Yes"
"No"
choice_end()
if (&result == 1)
{
//playsound
sp_brain_parm(¤t_sprite, 10);
sp_brain(¤t_sprite, 12);
sp_timing(¤t_sprite, 0);
int &hold = sp_editor_num(¤t_sprite);
if (&hold != 0)
editor_type(&hold, 1);
say_stop("Word", 1);
}
unfreeze(1);
}
You are essentially killing the sprite when you change its brain to 10. When the sprite dies, the script stops executing. This only occurs at the end of a script function, or when there is a pause in script execution (i.e. in a 'wait' or a 'say_stop' command).
Is there any way I can carry on the script for longer after shrinking it, or will I just have to make it disappear when picked, without shrinking?
You may be able to use script_attach(0); like this:
if (&result == 1)
{
//playsound
sp_brain_parm(¤t_sprite, 10);
sp_brain(¤t_sprite, 12);
sp_timing(¤t_sprite, 0);
int &hold = sp_editor_num(¤t_sprite);
if (&hold != 0)
editor_type(&hold, 1);
//the script will die unless we attach it to the screen
script_attach(0);
say_stop("Word", 1);
}
unfreeze(1);
if (&result == 1)
{
//playsound
sp_brain_parm(¤t_sprite, 10);
sp_brain(¤t_sprite, 12);
sp_timing(¤t_sprite, 0);
int &hold = sp_editor_num(¤t_sprite);
if (&hold != 0)
editor_type(&hold, 1);
//the script will die unless we attach it to the screen
script_attach(0);
say_stop("Word", 1);
}
unfreeze(1);