The Dink Network

Reply to Re: Changing dink text sprite location

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
October 28th 2010, 07:25 PM
sob_scorpr.gif
Rilian
Peasant They/Them United States
 
Hm, alright. Here's the scenario:

I have two sprites walking back and forth and making periodic comments. One of the sprites walks left and right, the total distance is randomly determined, and the speak procedure is also random. The procedure is looped in the main of that sprite.

Another sprite is walking up and down, doing the same thing (making random statements).

When you touch a particular sprite, the one that is walking up and down freezes, and talks to you, meanwhile the other is supposed to continue in the back unabated. Instead, what happens is the one that is walking left and right doesn't turn around, it keeps going and ends up on the other side of the screen, at which point it continues merrily along doing what it was originally doing. Here are the appropriate scripts:

[Left and right walker. Basewalk etc. are determined in WDE. The code has been modified so that the character is not walking random distances.]

void main(void)
{
int &sy = 0;
int &wt;
&save_x = sp_x(&current_sprite, -1);
sp_speed(&current_sprite,4);

mov:
&wt = random(1000, 0);
wait(&wt);
&save_x -= 20;
move_stop(&current_sprite, 4, &save_x, 1);
&save_x += 20;
wait(10);

&sy = random(3, 1);
if (&sy == 1)
{
say_stop_npc("`3stuff", &current_sprite);
} else
{
if (&sy == 2)
{
say_stop_npc("`3stuff", &current_sprite);
} else
{
say_stop_npc("`3stuff", &current_sprite);
}
}

&wt = random(1000, 0);
wait(&wt);
move_stop(&current_sprite, 6, &save_x, 1);
wait(10);
&sy = random(3, 1);

if (&sy == 1)
{
say_stop_npc("`3stuff", &current_sprite);
} else
{
if (&sy == 2)
{
say_stop_npc("`3stuff", &current_sprite);
} else
{
say_stop_npc("`3stuff", &current_sprite);
}
}

goto mov;

}

[Script attached to item - touch script]

void main(void)
{
int &whob = sp(22); //Up and down walker. Will be talking.
int &said = 1;
int &ss = sp_seq(&whob, -1);
int &sf = sp_frame(&whob, -1);
int &temp = 0;
int &scrpt;
sp_touch_damage(&current_sprite, -1);

}

void touch(void)
{
sp_touch_damage(&current_sprite, 0);
freeze(1);
freeze(&whob);
sp_speed(&prsna, 0); //&prsna is the left-right walker. I am freezing it
//because it does wierd things if I don't.
sp_script(&whob, "blnk"); //
sp_script(&prsna, "blnk"); // This blank script is being attached because
//... the sprite will walk off the screen without it.

sp_speed(&whob, 0);
wait(10);
&save_x = sp_x(&whob, -1);
wait(10);
&save_y = sp_y(&whob, -1);
wait(10);
sp_speed(&whob, 2);
wait(10);
sp_base_walk(&whob, 350);
wait(10);
if (&save_y < 150)
{
move_stop(&whob, 2, 157, 1);
}
wait(10);
sp_dir(&whob, 4);
wait(10);
say_stop("`0stuff", &whob);
wait(10);
sp_dir(1, 6);

say_stop("stuff!", 1);
wait(100);
say_stop("`0stuff,", &whob);
wait(100);
say_stop("`0stuff.", &whob);
wait(100);
say_stop("`0stuff,", &whob);
wait(100);
say_stop("`0stuff!", &whob);
wait(100);
say_stop("stuff!", 1);
&save_y = sp_y(1, -1);
&save_y += 10;
move(1, 2, &save_y, 1);
wait(100);
&said = 2;
unfreeze(1);
unfreeze(&whob);


sp_script(&whob, "cstl_cook");


wait(10);
sp_speed(&whob, 2);
wait(10);

sp_kill(&prsna, 1); //re-creating the left-and-right walker because I attached
// The blank script.
if (&msc == 1)
{
&prsna = create_sprite(164, 141, 0, 353, 1);
sp_speed(&prsna, 2);
sp_base_walk(&prsna, 350);
sp_speed(&prsna, 2);
sp_script(&prsna, "cstl_cookb2");
} else
{
if (&msc == 2)
{
&prsna = create_sprite(477, 141, 0, 353, 1);
sp_speed(&prsna, 2);
sp_base_walk(&prsna, 350);
sp_speed(&prsna, 2);
sp_script(&prsna, "cstl_cookb1");

} else
{
if (&msc == 3)
{
&prsna = create_sprite(165, 65, 0, 353, 1);
sp_speed(&prsna, 2);
sp_base_walk(&prsna, 350);
sp_speed(&prsna, 2);
sp_script(&prsna, "cstl_cookb4");
} else
{
&prsna = create_sprite(477, 65, 0, 353, 1);
sp_speed(&prsna, 2);
sp_base_walk(&prsna, 350);
sp_speed(&prsna, 2);
sp_script(&prsna, "cstl_cookb3");

}
}
}

sp_touch_damage(&current_sprite, -1);

}

To solve the problem I temporarily attached a blank procedure to it, then after the touch procedure is run, I kill the sprite, recreate it, and attach the appropriate script to it again. This works but I would rather not have to do it at all.