The Dink Network

yet another mystery script problem.

September 19th 2004, 02:56 AM
pig.gif
theres another wierd problem that i can't figure out. this script freezes when you choose option 2. here goes;

void main (void)
{
say("`6hello there young man.", &current_sprite);
}

void talk (void)
{
freeze(1);
freeze(&current_sprite);
choice_start();
"be nice."
"be somewhat less nice."
"leave"
choice_end();

if (&result == 1)
{
say_stop("hi, your looking very old today", 1);
say_stop("`6why thank you.", &current_sprite);
say_stop("...", 1);
say_stop("`6hmmm...", &current_sprite);
say_stop("i'll go now.", 1);
unfreeze(1);
unfreeze(&current_sprite);
}

if (&result == 2)
{
say_stop("I HATE YOU!", 1);
say_stop("`6fair enough...", &current_sprite);
wait(700);
say_stop("hmmm.. i wasnt expecting that...", 1);
say_stop("i know!", 1);
wait(500);
hurt(&current_sprite, 500);
playsound(9, 8000,0,0,0);
say_stop("that'l teach him to talk back to me!", 1);
unfreeze(1);
}
}

thanks.
September 19th 2004, 04:01 AM
spike.gif
Weird. Oh well. Make the talk proc look like something like below. Are you sure you weren't talking about choice 3??

void talk (void)
{
freeze(1);
freeze(&current_sprite);
choice_start()
"be nice."
"be somewhat less nice."
"leave"
choice_end()

if (&result == 1)
{
say_stop("hi, your looking very old today", 1);
say_stop("`6why thank you.", &current_sprite);
say_stop("...", 1);
say_stop("`6hmmm...", &current_sprite);
say_stop("i'll go now.", 1);
unfreeze(1);
unfreeze(&current_sprite);
}

if (&result == 2)
{
say_stop("I HATE YOU!", 1);
say_stop("`6fair enough...", &current_sprite);
wait(700);
say_stop("hmmm.. i wasnt expecting that...", 1);
say_stop("i know!", 1);
wait(500);
hurt(&current_sprite, 500);
playsound(9, 8000,0,0,0);
say_stop("that'l teach him to talk back to me!", 1);
unfreeze(1);
}

if (&result == 3)
{
unfreeze(1);
unfreeze(&urrent_sprite);
}
}
September 19th 2004, 05:25 AM
pig.gif
nope. still doesent work. and yes, i had'nt even tryed option 3.
September 19th 2004, 05:29 AM
fairy.gif
GlennGlenn
Peasant He/Him Norway
GlennGlenn doesn't want a custom title. 
Try this:

void main (void)
{
say("`6hello there young man.", &current_sprite);

void talk (void)
{
freeze(1);
freeze(&current_sprite);
choice_start();
"be nice."
"be somewhat less nice."
"leave"
choice_end();

if (&result == 1)
{
say_stop("hi, your looking very old today", 1);
say_stop("`6why thank you.", &current_sprite);
say_stop("...", 1);
say_stop("`6hmmm...", &current_sprite);
say_stop("i'll go now.", 1);
unfreeze(1);
unfreeze(&current_sprite);
}

if (&result == 2)
{
say_stop("I HATE YOU!", 1);
say_stop("`6fair enough...", &current_sprite);
wait(700);
say_stop("hmmm.. i wasnt expecting that...", 1);
say_stop("i know!", 1);
wait(500);
hurt(&current_sprite, 500);
playsound(9, 8000,0,0,0);
say_stop("that'l teach him to talk back to me!", 1);
unfreeze(1);
}
}
)
September 19th 2004, 06:55 AM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
No, don't try that. You must 'close' the main( void ) before 'opening' another void.

Other than that, I don't see a reason why your script can go wrong. Maybe the colorcode + the first character after it can give some problems. It's probably not your problem, but try putting a space after the colorcode
September 19th 2004, 08:45 AM
pig.gif
sjoerdje
Peasant He/Him Netherlands
Lava pig to the rescue! 
and where does the script freezes? At a line? At the end of the conversation? At the beginning of the choice?
September 19th 2004, 08:57 AM
anon.gif
MiloBones
Ghost They/Them
 
Two things which oughtn't be relevant:

1. hurt(); on at least one occasion, has caused freeze-type problems for me. But I think it's a stable command, in general.

2. Why play the sound at speed 8000? 22050 AFAIK is the default... although there's no reason I can see for 8000 causing problems.
September 19th 2004, 09:11 AM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
Oh, wait, I see another thing... You don't need semicolons ";" after the choice_start() and the choice_end()
September 19th 2004, 11:12 AM
spike.gif
That ain't really a problem, they're just useless. And my way fixes that anyway. And he says that the script freezes when you choose option 2, therefore commands such as hurt(); and the playsound command (and 8000 is right, 22050 is too fast for that sound) are irrelevant.

The script modified by me is 100% correct. The problem is somewhere else.

EDIT: spacehoggy, try writing something else than "be somehat less nice." on the second command. It shouldn't help, but try anyway.
September 19th 2004, 12:35 PM
pig.gif
the playsound command is somthing i never used before, and dont understand. i just randomly put in the 2nd number, i used to think it had something to do with how long the sound lasted. anyway, the man dies, the sound is played, and he says the thing. its as if somethings wrong with the unfreeze command, but i dont know what.
September 19th 2004, 12:41 PM
spike.gif
So the man dies and the script is attached to him? Sheesh.... You said it crashes when you choose option 2.

Do script_attach(1000); before hurting him and kill_this_task(); after you unfreeze Dink.

EDIT: Like this:

script_attach(1000);
wait(500);
hurt(&current_sprite, 500);
playsound(9, 8000,0,0,0);
say_stop("that'l teach him to talk back to me!", 1);
unfreeze(1);
kill_this_task();
September 19th 2004, 12:51 PM
pig.gif
ok, theres an improvment to how it works,it doesent freeze, but it doesent hurt him.

EDIT: might as well put this in;

if (&result == 2)
{
say_stop("I HATE YOU!", 1);
say_stop("`6fair enough...", &current_sprite);
wait(700);
say_stop("hmmm.. i wasnt expecting that...", 1);
say_stop("i know!", 1);
wait(500);
script_attach(1000);
wait(500);
hurt(&current_sprite, 500);
playsound(9, 8000,0,0,0);
say_stop("that'l teach him to talk back to me!", 1);
unfreeze(1);
kill_this_task();
}
September 19th 2004, 01:56 PM
anon.gif
MiloBones
Ghost They/Them
 
Would the script_attach change &current_sprite to 1000?
September 19th 2004, 02:05 PM
spike.gif
mm, try putting script_attach(1000); right after hurt(&current_sprite, 500);

The simplest way that should fix all though, is to do the following:

if (&result == 2)
{
say_stop("I HATE YOU!", 1);
say_stop("`6fair enough...", &current_sprite);
wait(700);
say_stop("hmmm.. i wasnt expecting that...", 1);
say_stop("i know!", 1);
wait(500);
playsound(9, 8000,0,0,0);
hurt(&current_sprite, 500);
unfreeze(1);
say_stop("that'l teach him to talk back to me!", 1);
}

If it doesn't matter you that much that Dink unfreezes before saying the last sentence, that is.
September 22nd 2004, 12:04 PM
pig.gif
thanks, it works fine now.