script riddle
Can someone help me with this script for the riddle.
I want the answer for example to be: duck
I use this script:
//riddle 1
answer must be duck
void main(void)
{
playmidi("203.mid");
int ℞
int &rv;
int &trv;
int &rtext;
int <ext;
int &rcur;
int &rhelp1;
int &rhelp2;
int &rhelp3;
int &rmsg1;
int &rmsg2;
int &rmsg3;
int &rmsg4;
int &rmsg5;
int &rtb;
}
void talk(void)
{
freeze(1);
&rx = -55;
&trv = 0;
&rv = 1;
<ext = 0;
&rhelp1 = say_xy("`4Use UP and DOWN to select a letter.", 10, 20);
&rhelp2 = say_xy("`4Use RIGHT to add letter and LEFT to delete one.", 10, 40);
&rhelp3 = say_xy("`4Use ESC to quit and ENTER to accept.", 10, 60);
&rmsg1 = say_xy("`%I am white,", 10, 90);
&rmsg2 = say_xy("`%and everybody loves me.", 10, 108);
&rmsg3 = say_xy("`%I am sweet,", 10, 126);
&rmsg4 = say_xy("`%and I can fly.", 10, 144);
&rmsg5 = say_xy("`%What am I?", 10, 162);
sp_kill(&rhelp1, 0);
sp_kill(&rhelp2, 0);
sp_kill(&rhelp3, 0);
sp_kill(&rmsg1, 0);
sp_kill(&rmsg2, 0);
sp_kill(&rmsg3, 0);
sp_kill(&rmsg4, 0);
sp_kill(&rmsg5, 0);
&rtb = create_sprite(350, 253, 0, 30, 1);
sp_que(&rtb, 9999);
&rcur = say_xy("_", &rx, 225);
sp_kill(&rcur, 0);
&rtext = say_xy("A", &rx, 225);
sp_kill(&rtext, 0);
sp_gold(&rtext, <ext);
mainloop:
wait_for_button();
if (&result == 12)
{
&rv -= 1;
goto draw;
}
if (&result == 18)
{
&rv += 1;
goto draw;
}
if (&result == 14)
goto prev;
if (&result == 16)
goto next;
if (&result == 4)
goto done;
if (&result == 5)
goto quit;
goto mainloop;
draw:
if (&rv > 26)
&rv -= 26;
if (&rv < 1)
&rv += 26;
sp_active(&rtext, 0);
if (&rv == 1)
&rtext = say_xy("A", &rx, 225);
if (&rv == 2)
&rtext = say_xy("B", &rx, 225);
if (&rv == 3)
&rtext = say_xy("C", &rx, 225);
if (&rv == 4)
&rtext = say_xy("D", &rx, 225);
if (&rv == 5)
&rtext = say_xy("E", &rx, 225);
if (&rv == 6)
&rtext = say_xy("F", &rx, 225);
if (&rv == 7)
&rtext = say_xy("G", &rx, 225);
if (&rv == 8)
&rtext = say_xy("H", &rx, 225);
if (&rv == 9)
&rtext = say_xy("I", &rx, 225);
if (&rv == 10)
&rtext = say_xy("J", &rx, 225);
if (&rv == 11)
&rtext = say_xy("K", &rx, 225);
if (&rv == 12)
&rtext = say_xy("L", &rx, 225);
if (&rv == 13)
&rtext = say_xy("M", &rx, 225);
if (&rv == 14)
&rtext = say_xy("N", &rx, 225);
if (&rv == 15)
&rtext = say_xy("O", &rx, 225);
if (&rv == 16)
&rtext = say_xy("P", &rx, 225);
if (&rv == 17)
&rtext = say_xy("Q", &rx, 225);
if (&rv == 18)
&rtext = say_xy("R", &rx, 225);
if (&rv == 19)
&rtext = say_xy("S", &rx, 225);
if (&rv == 20)
&rtext = say_xy("T", &rx, 225);
if (&rv == 21)
&rtext = say_xy("U", &rx, 225);
if (&rv == 22)
&rtext = say_xy("V", &rx, 225);
if (&rv == 23)
&rtext = say_xy("W", &rx, 225);
if (&rv == 24)
&rtext = say_xy("X", &rx, 225);
if (&rv == 25)
&rtext = say_xy("Y", &rx, 225);
if (&rv == 26)
&rtext = say_xy("Z", &rx, 225);
sp_kill(&rtext, 0);
sp_gold(&rtext, <ext);
goto mainloop;
next:
if (&rx == 80)
{
Playsound(19, 22050, 0, 0, 0);
goto mainloop;
}
sp_strength(&rtext, &rv);
&trv *= 26;
&trv += &rv;
&rv = 1;
&rx += 15;
sp_x(&rcur, &rx);
<ext = &rtext;
&rtext = say_xy("A", &rx, 225);
sp_kill(&rtext, 0);
sp_gold(&rtext, <ext);
goto mainloop;
prev:
if (<ext == 0)
{
Playsound(19, 22050, 0, 0, 0);
goto mainloop;
}
&rx -= 15;
sp_x(&rcur, &rx);
sp_active(&rtext, 0);
&rtext = <ext;
<ext = sp_gold(&rtext, -1);
&rv = sp_strength(&rtext, -1);
&trv -= &rv;
&trv / 26;
goto mainloop;
done:
&trv *= 26;
&trv += &rv;
//say("&trv", 1);
// Uncomment to see the numeric value of an answer.
cleanup:
if (<ext != 0)
{
sp_active(&rtext, 0);
&rtext = <ext;
<ext = sp_gold(&rtext, -1);
goto cleanup;
}
sp_active(&rtext, 0);
sp_active(&rcur, 0);
sp_active(&rhelp1, 0);
sp_active(&rhelp2, 0);
sp_active(&rhelp3, 0);
sp_active(&rmsg1, 0);
sp_active(&rmsg2, 0);
sp_active(&rmsg3, 0);
sp_active(&rmsg4, 0);
sp_active(&rmsg5, 0);
sp_active(&rtb, 0);
if (&trv == 244648606)
{
say_stop("`%Correct.", ¤t_sprite);
playsound(43, 22050,0,0,0);
sp_hard(¤t_sprite, 1);
draw_hard_map(¤t_sprite);
int &hold = sp_editor_num(¤t_sprite);
editor_type(&hold, 1);
&hold = create_sprite(269,380,0,36,10);
sp_nodraw(¤t_sprite,1);
wait(75);
sp_pframe(&hold,11);
wait(75);
sp_pframe(&hold,12);
wait(75);
sp_pframe(&hold,13);
wait(75);
sp_pframe(&hold,14);
wait(75);
sp_pframe(&hold,15);
wait(75);
sp_pframe(&hold,16);
wait(75);
sp_pframe(&hold,17);
wait(75);
sp_active(&hold, 0);
destroy:
unfreeze(1);
spawn("screenlk");
sp_active(¤t_sprite, 0);
return;
}
say_stop("`%Error!", ¤t_sprite);
quit:
if (<ext != 0)
{
sp_active(&rtext, 0);
&rtext = <ext;
<ext = sp_gold(&rtext, -1);
goto quit;
}
sp_active(&rtext, 0);
sp_active(&rcur, 0);
sp_active(&rhelp1, 0);
sp_active(&rhelp2, 0);
sp_active(&rhelp3, 0);
sp_active(&rmsg1, 0);
sp_active(&rmsg2, 0);
sp_active(&rmsg3, 0);
sp_active(&rmsg4, 0);
sp_active(&rmsg5, 0);
sp_active(&rtb, 0);
unfreeze(1);
return;
}
void hit(void)
{
//Bomb Detection
int &temp = compare_sprite_script(&missle_source, "dam-bomn");
if (&temp == 1)
{
sp_hard(¤t_sprite, 1);
draw_hard_map(¤t_sprite);
int &hold = sp_editor_num(¤t_sprite);
editor_type(&hold, 1);
goto destroy;
}
}
Can someone help me (paul pliska, redink1). Just send me an email or put it on this board.
I have everything working now only this script I can not make it work. I tried for more then three hours last night.
Please help?
I want the answer for example to be: duck
I use this script:
//riddle 1
answer must be duck
void main(void)
{
playmidi("203.mid");
int ℞
int &rv;
int &trv;
int &rtext;
int <ext;
int &rcur;
int &rhelp1;
int &rhelp2;
int &rhelp3;
int &rmsg1;
int &rmsg2;
int &rmsg3;
int &rmsg4;
int &rmsg5;
int &rtb;
}
void talk(void)
{
freeze(1);
&rx = -55;
&trv = 0;
&rv = 1;
<ext = 0;
&rhelp1 = say_xy("`4Use UP and DOWN to select a letter.", 10, 20);
&rhelp2 = say_xy("`4Use RIGHT to add letter and LEFT to delete one.", 10, 40);
&rhelp3 = say_xy("`4Use ESC to quit and ENTER to accept.", 10, 60);
&rmsg1 = say_xy("`%I am white,", 10, 90);
&rmsg2 = say_xy("`%and everybody loves me.", 10, 108);
&rmsg3 = say_xy("`%I am sweet,", 10, 126);
&rmsg4 = say_xy("`%and I can fly.", 10, 144);
&rmsg5 = say_xy("`%What am I?", 10, 162);
sp_kill(&rhelp1, 0);
sp_kill(&rhelp2, 0);
sp_kill(&rhelp3, 0);
sp_kill(&rmsg1, 0);
sp_kill(&rmsg2, 0);
sp_kill(&rmsg3, 0);
sp_kill(&rmsg4, 0);
sp_kill(&rmsg5, 0);
&rtb = create_sprite(350, 253, 0, 30, 1);
sp_que(&rtb, 9999);
&rcur = say_xy("_", &rx, 225);
sp_kill(&rcur, 0);
&rtext = say_xy("A", &rx, 225);
sp_kill(&rtext, 0);
sp_gold(&rtext, <ext);
mainloop:
wait_for_button();
if (&result == 12)
{
&rv -= 1;
goto draw;
}
if (&result == 18)
{
&rv += 1;
goto draw;
}
if (&result == 14)
goto prev;
if (&result == 16)
goto next;
if (&result == 4)
goto done;
if (&result == 5)
goto quit;
goto mainloop;
draw:
if (&rv > 26)
&rv -= 26;
if (&rv < 1)
&rv += 26;
sp_active(&rtext, 0);
if (&rv == 1)
&rtext = say_xy("A", &rx, 225);
if (&rv == 2)
&rtext = say_xy("B", &rx, 225);
if (&rv == 3)
&rtext = say_xy("C", &rx, 225);
if (&rv == 4)
&rtext = say_xy("D", &rx, 225);
if (&rv == 5)
&rtext = say_xy("E", &rx, 225);
if (&rv == 6)
&rtext = say_xy("F", &rx, 225);
if (&rv == 7)
&rtext = say_xy("G", &rx, 225);
if (&rv == 8)
&rtext = say_xy("H", &rx, 225);
if (&rv == 9)
&rtext = say_xy("I", &rx, 225);
if (&rv == 10)
&rtext = say_xy("J", &rx, 225);
if (&rv == 11)
&rtext = say_xy("K", &rx, 225);
if (&rv == 12)
&rtext = say_xy("L", &rx, 225);
if (&rv == 13)
&rtext = say_xy("M", &rx, 225);
if (&rv == 14)
&rtext = say_xy("N", &rx, 225);
if (&rv == 15)
&rtext = say_xy("O", &rx, 225);
if (&rv == 16)
&rtext = say_xy("P", &rx, 225);
if (&rv == 17)
&rtext = say_xy("Q", &rx, 225);
if (&rv == 18)
&rtext = say_xy("R", &rx, 225);
if (&rv == 19)
&rtext = say_xy("S", &rx, 225);
if (&rv == 20)
&rtext = say_xy("T", &rx, 225);
if (&rv == 21)
&rtext = say_xy("U", &rx, 225);
if (&rv == 22)
&rtext = say_xy("V", &rx, 225);
if (&rv == 23)
&rtext = say_xy("W", &rx, 225);
if (&rv == 24)
&rtext = say_xy("X", &rx, 225);
if (&rv == 25)
&rtext = say_xy("Y", &rx, 225);
if (&rv == 26)
&rtext = say_xy("Z", &rx, 225);
sp_kill(&rtext, 0);
sp_gold(&rtext, <ext);
goto mainloop;
next:
if (&rx == 80)
{
Playsound(19, 22050, 0, 0, 0);
goto mainloop;
}
sp_strength(&rtext, &rv);
&trv *= 26;
&trv += &rv;
&rv = 1;
&rx += 15;
sp_x(&rcur, &rx);
<ext = &rtext;
&rtext = say_xy("A", &rx, 225);
sp_kill(&rtext, 0);
sp_gold(&rtext, <ext);
goto mainloop;
prev:
if (<ext == 0)
{
Playsound(19, 22050, 0, 0, 0);
goto mainloop;
}
&rx -= 15;
sp_x(&rcur, &rx);
sp_active(&rtext, 0);
&rtext = <ext;
<ext = sp_gold(&rtext, -1);
&rv = sp_strength(&rtext, -1);
&trv -= &rv;
&trv / 26;
goto mainloop;
done:
&trv *= 26;
&trv += &rv;
//say("&trv", 1);
// Uncomment to see the numeric value of an answer.
cleanup:
if (<ext != 0)
{
sp_active(&rtext, 0);
&rtext = <ext;
<ext = sp_gold(&rtext, -1);
goto cleanup;
}
sp_active(&rtext, 0);
sp_active(&rcur, 0);
sp_active(&rhelp1, 0);
sp_active(&rhelp2, 0);
sp_active(&rhelp3, 0);
sp_active(&rmsg1, 0);
sp_active(&rmsg2, 0);
sp_active(&rmsg3, 0);
sp_active(&rmsg4, 0);
sp_active(&rmsg5, 0);
sp_active(&rtb, 0);
if (&trv == 244648606)
{
say_stop("`%Correct.", ¤t_sprite);
playsound(43, 22050,0,0,0);
sp_hard(¤t_sprite, 1);
draw_hard_map(¤t_sprite);
int &hold = sp_editor_num(¤t_sprite);
editor_type(&hold, 1);
&hold = create_sprite(269,380,0,36,10);
sp_nodraw(¤t_sprite,1);
wait(75);
sp_pframe(&hold,11);
wait(75);
sp_pframe(&hold,12);
wait(75);
sp_pframe(&hold,13);
wait(75);
sp_pframe(&hold,14);
wait(75);
sp_pframe(&hold,15);
wait(75);
sp_pframe(&hold,16);
wait(75);
sp_pframe(&hold,17);
wait(75);
sp_active(&hold, 0);
destroy:
unfreeze(1);
spawn("screenlk");
sp_active(¤t_sprite, 0);
return;
}
say_stop("`%Error!", ¤t_sprite);
quit:
if (<ext != 0)
{
sp_active(&rtext, 0);
&rtext = <ext;
<ext = sp_gold(&rtext, -1);
goto quit;
}
sp_active(&rtext, 0);
sp_active(&rcur, 0);
sp_active(&rhelp1, 0);
sp_active(&rhelp2, 0);
sp_active(&rhelp3, 0);
sp_active(&rmsg1, 0);
sp_active(&rmsg2, 0);
sp_active(&rmsg3, 0);
sp_active(&rmsg4, 0);
sp_active(&rmsg5, 0);
sp_active(&rtb, 0);
unfreeze(1);
return;
}
void hit(void)
{
//Bomb Detection
int &temp = compare_sprite_script(&missle_source, "dam-bomn");
if (&temp == 1)
{
sp_hard(¤t_sprite, 1);
draw_hard_map(¤t_sprite);
int &hold = sp_editor_num(¤t_sprite);
editor_type(&hold, 1);
goto destroy;
}
}
Can someone help me (paul pliska, redink1). Just send me an email or put it on this board.
I have everything working now only this script I can not make it work. I tried for more then three hours last night.
Please help?

I'm not sure what other changes you made, but...
//say("&trv", 1);
// Uncomment to see the numeric value of an answer.
Uncomment the say command, then run through the riddle. Write down the number Dink says.
Then, modify the number on this line to the number you wrote down:
if (&trv == 244648606)
//say("&trv", 1);
// Uncomment to see the numeric value of an answer.
Uncomment the say command, then run through the riddle. Write down the number Dink says.
Then, modify the number on this line to the number you wrote down:
if (&trv == 244648606)
That's the riddle script from Lyna's Story. Rather cleaver if I do say so myself.
It does have a bug in it though... Not major, but since it seems to be a popular script to reuse I guess I should point it out.
If you enter more than six(? I forget) or so letters the number "wraps" to negative. Most of the script still works fine after that but not the delete command (LEFT ARROW). If you want to fix this, replace the "next" and "prev" sections with the code below:
next:
sp_strength(&rtext, &rv);
sp_defense(&rtext, &trv);
&trv *= 26;
&trv += &rv;
&rv = 1;
&rx += 15;
sp_x(&rcur, &rx);
<ext = &rtext;
&rtext = say_xy("A", &rx, 225);
sp_kill(&rtext, 0);
sp_gold(&rtext, <ext);
goto mainloop;
prev:
if (<ext == 0)
{
Playsound(19, 22050, 0, 0, 0);
goto mainloop;
}
&rx -= 15;
sp_x(&rcur, &rx);
sp_active(&rtext, 0);
&rtext = <ext;
<ext = sp_gold(&rtext, -1);
&rv = sp_strength(&rtext, -1);
&trv = sp_defense(&rtext, -1);
goto mainloop;

If you enter more than six(? I forget) or so letters the number "wraps" to negative. Most of the script still works fine after that but not the delete command (LEFT ARROW). If you want to fix this, replace the "next" and "prev" sections with the code below:
next:
sp_strength(&rtext, &rv);
sp_defense(&rtext, &trv);
&trv *= 26;
&trv += &rv;
&rv = 1;
&rx += 15;
sp_x(&rcur, &rx);
<ext = &rtext;
&rtext = say_xy("A", &rx, 225);
sp_kill(&rtext, 0);
sp_gold(&rtext, <ext);
goto mainloop;
prev:
if (<ext == 0)
{
Playsound(19, 22050, 0, 0, 0);
goto mainloop;
}
&rx -= 15;
sp_x(&rcur, &rx);
sp_active(&rtext, 0);
&rtext = <ext;
<ext = sp_gold(&rtext, -1);
&rv = sp_strength(&rtext, -1);
&trv = sp_defense(&rtext, -1);
goto mainloop;
wow i didn't know you could assign say commands to variables!
Actually, it ain't a command but you can use the -1 parameter to retrieve a value.. which you can then place in a variable

I think igloo15 means this part:
&rmsg1 = say_xy("`%I am white,", 10, 90);
What you're actually assigning to the variable is the sprite number of the text created by the say_xy function. Then you can refer to that text by the variable and make it stay on the screen, get rid of it or maybe move it around.
It probably works with other say commands buy say_xy is the only one it really makes sense with.
&rmsg1 = say_xy("`%I am white,", 10, 90);
What you're actually assigning to the variable is the sprite number of the text created by the say_xy function. Then you can refer to that text by the variable and make it stay on the screen, get rid of it or maybe move it around.
It probably works with other say commands buy say_xy is the only one it really makes sense with.