Reply to Script suddenly not working.
If you don't have an account, just leave the password field blank.
Hey peoples. I've had this script for over 3 years, and it always worked fine, but now, suddenly, it doesn't work correctly anymore. I didn't change anything in it, so maybe I was just lucky that the script ran in the first place, but it just has a bug. Here is the script:
void main(void)
{
int &guard;
if (&story == 1)
{
if (&player_map == 500)
{
move_stop(1, 2, 270, 1);
&guard = create_sprite(310, 0, 0, 281, 1);
sp_base_walk(&guard, 280);
sp_speed(&guard, 1);
move(&guard, 2, 270, 1);
wait(100);
say("`9You can't escape!", &guard);
move_stop(1, 4, -10, 1);
}
if (&player_map == 499)
{
move_stop(1, 4, 320, 1);
&guard = create_sprite(600, 270, 0, 281, 1);
sp_base_walk(&guard, 280);
sp_speed(&guard, 1);
move(&guard, 4, 200, 1);
wait(100);
say("`9Give it up!", &guard);
move_stop(1, 4, 200, 1);
move_stop(1, 2, 420, 1);
}
if (&player_map == 531)
{
move_stop(1, 2, 170, 1);
&guard = create_sprite(200, 0, 0, 281, 1);
sp_base_walk(&guard, 280);
sp_speed(&guard, 1);
move(&guard, 2, 170, 1);
wait(100);
say("`9There's no way to go!", &guard);
move_stop(1, 6, 620, 1);
}
if (&player_map == 532)
{
freeze(1);
move_stop(1, 6, 320, 1);
&guard = create_sprite(0, 170, 0, 281, 1);
sp_base_walk(&guard, 280);
sp_speed(&guard, 1);
int &guard2 = create_sprite(320, 0, 0, 281, 1);
sp_base_walk(&guard2, 280);
sp_speed(&guard2, 1);
move(&guard, 6, 220, 1);
move_stop(1, 2, 260, 1);
wait(1000);
move_stop(1, 8, 252, 1);
move_stop(&guard2, 2, 200, 1);
move(&guard, 2, 260, 1);
say_stop("`9We've got you now, spy!", &guard2);
say_stop("This looks bad...", 1);
wait(1750);
turn_midi_on();
script_attach(1000);
fade_down();
&player_map = 65;
sp_x(1, 300);
sp_y(1, 210);
load_screen();
draw_screen();
fade_up();
&update_status = 1;
draw_status()
return;
}
}
}
void talk(void)
{
if (&story == 0)
{
if (&player_map != 161)
return;
freeze(1);
say_stop("What's this?", 1);
say_stop("It looks like some important stuff...", 1);
wait(500);
choice_start();
set_y 240
set_title_color 7
title_start();
Some paperwork lies on the table.
title_end();
"Take a look"
"Leave"
choice_end()
if (&result == 2)
{
unfreeze(1);
return;
}
if (&result == 1)
{
&story = 1;
say_stop("Let's see...", 1);
say_stop("`9'It's absolutely necessary to get rid of these...'", 1);
wait(70);
turn_midi_off();
playmidi("4.mid");
&guard = create_sprite(490, 10, 0, 281, 1);
sp_base_walk(&guard, 280);
sp_speed(&guard, 1);
wait(500);
move_stop(&guard, 2, 200, 1);
wait(100);
say_stop("`9Hey, you there, freeze!", &guard);
say_stop("`9 That's classified information!", &guard);
say_stop("dang!", 1);
fade_down();
script_attach(1000);
&player_map = 468;
load_screen();
draw_screen();
freeze(1);
sp_x(1, 310);
sp_y(1, 120);
sp_dir(1, 2);
fade_up();
move_stop(1, 2, 200, 1);
&guard = create_sprite(310, 120, 0, 281, 1);
sp_base_walk(&guard, 280);
sp_speed(&guard, 1);
move(&guard, 2, 410, 1);
wait(100);
say("`9Get over here!", &guard);
move_stop(1, 2, 410, 1);
script_attach(0);
}
}
}
Now, this is what happens: the talk procedure works. Then, A chase follows, which starts in screen 500. Everything goes fine. Then, Dink and the guard walks in screen 499. That part is in italics, and there where it all goes wrong: Dink won't walk the first coordinates (move_stop(1, 4, 320, 1)) and the guard isn't created! I also have no idea why it won't create the guard, because in all other instances, it worked fine. Does anyone have any ideas about this? Much thanks in advance and beyond!
void main(void)
{
int &guard;
if (&story == 1)
{
if (&player_map == 500)
{
move_stop(1, 2, 270, 1);
&guard = create_sprite(310, 0, 0, 281, 1);
sp_base_walk(&guard, 280);
sp_speed(&guard, 1);
move(&guard, 2, 270, 1);
wait(100);
say("`9You can't escape!", &guard);
move_stop(1, 4, -10, 1);
}
if (&player_map == 499)
{
move_stop(1, 4, 320, 1);
&guard = create_sprite(600, 270, 0, 281, 1);
sp_base_walk(&guard, 280);
sp_speed(&guard, 1);
move(&guard, 4, 200, 1);
wait(100);
say("`9Give it up!", &guard);
move_stop(1, 4, 200, 1);
move_stop(1, 2, 420, 1);
}
if (&player_map == 531)
{
move_stop(1, 2, 170, 1);
&guard = create_sprite(200, 0, 0, 281, 1);
sp_base_walk(&guard, 280);
sp_speed(&guard, 1);
move(&guard, 2, 170, 1);
wait(100);
say("`9There's no way to go!", &guard);
move_stop(1, 6, 620, 1);
}
if (&player_map == 532)
{
freeze(1);
move_stop(1, 6, 320, 1);
&guard = create_sprite(0, 170, 0, 281, 1);
sp_base_walk(&guard, 280);
sp_speed(&guard, 1);
int &guard2 = create_sprite(320, 0, 0, 281, 1);
sp_base_walk(&guard2, 280);
sp_speed(&guard2, 1);
move(&guard, 6, 220, 1);
move_stop(1, 2, 260, 1);
wait(1000);
move_stop(1, 8, 252, 1);
move_stop(&guard2, 2, 200, 1);
move(&guard, 2, 260, 1);
say_stop("`9We've got you now, spy!", &guard2);
say_stop("This looks bad...", 1);
wait(1750);
turn_midi_on();
script_attach(1000);
fade_down();
&player_map = 65;
sp_x(1, 300);
sp_y(1, 210);
load_screen();
draw_screen();
fade_up();
&update_status = 1;
draw_status()
return;
}
}
}
void talk(void)
{
if (&story == 0)
{
if (&player_map != 161)
return;
freeze(1);
say_stop("What's this?", 1);
say_stop("It looks like some important stuff...", 1);
wait(500);
choice_start();
set_y 240
set_title_color 7
title_start();
Some paperwork lies on the table.
title_end();
"Take a look"
"Leave"
choice_end()
if (&result == 2)
{
unfreeze(1);
return;
}
if (&result == 1)
{
&story = 1;
say_stop("Let's see...", 1);
say_stop("`9'It's absolutely necessary to get rid of these...'", 1);
wait(70);
turn_midi_off();
playmidi("4.mid");
&guard = create_sprite(490, 10, 0, 281, 1);
sp_base_walk(&guard, 280);
sp_speed(&guard, 1);
wait(500);
move_stop(&guard, 2, 200, 1);
wait(100);
say_stop("`9Hey, you there, freeze!", &guard);
say_stop("`9 That's classified information!", &guard);
say_stop("dang!", 1);
fade_down();
script_attach(1000);
&player_map = 468;
load_screen();
draw_screen();
freeze(1);
sp_x(1, 310);
sp_y(1, 120);
sp_dir(1, 2);
fade_up();
move_stop(1, 2, 200, 1);
&guard = create_sprite(310, 120, 0, 281, 1);
sp_base_walk(&guard, 280);
sp_speed(&guard, 1);
move(&guard, 2, 410, 1);
wait(100);
say("`9Get over here!", &guard);
move_stop(1, 2, 410, 1);
script_attach(0);
}
}
}
Now, this is what happens: the talk procedure works. Then, A chase follows, which starts in screen 500. Everything goes fine. Then, Dink and the guard walks in screen 499. That part is in italics, and there where it all goes wrong: Dink won't walk the first coordinates (move_stop(1, 4, 320, 1)) and the guard isn't created! I also have no idea why it won't create the guard, because in all other instances, it worked fine. Does anyone have any ideas about this? Much thanks in advance and beyond!