Amusing bug?
July 27th 2004, 10:26 PM

MiloBones


Has anyone else experienced that using the hurt command on a sprite causes emake to run? This might have been due to the circumstances I called it under, but is extremely funny in any case... I'm trying to poison a bonca, and everytime the poison does damage, the bonca makes me some gold, or a big heart...
Where in the script are you calling the hurt command?
July 28th 2004, 08:51 AM

MiloBones


In a poison() proc, called from another script via is_script_attached and run_script_by_number. The proc looks something like this:
void poison( void )
{
loop_here:
wait(500);
&random = random(2,1);
if (&random == 2)
{
hurt(¤t_sprite, 5);
goto loop_here;
}
}
It'll probably work if I make it return at the end, but there are two things which are weird about this.
1. It only ran emake when hurt was actually called. If &random was 1 the first time through, it did nothing.
2. It JUST ran emake. No corspe...
void poison( void )
{
loop_here:
wait(500);
&random = random(2,1);
if (&random == 2)
{
hurt(¤t_sprite, 5);
goto loop_here;
}
}
It'll probably work if I make it return at the end, but there are two things which are weird about this.
1. It only ran emake when hurt was actually called. If &random was 1 the first time through, it did nothing.
2. It JUST ran emake. No corspe...
I'm stumped. Probably just an another stupid bug with the DinkC.
BTW, try what happens if you switch the die and poison procedures' places. I.e. if you had poison before die, switch places that die is before poison.
BTW, try what happens if you switch the die and poison procedures' places. I.e. if you had poison before die, switch places that die is before poison.
That most surely happens because it runs the die procedure after hurting the sprite... I've had similar odd problems (several times) and I've in fact encountered the very same problem as you. (except that I tried to do something else than hurt the enemy) MadStalker's way should fix it, but if not I recall that putting a return; in the end of the procedure should do the trick.
July 28th 2004, 10:39 AM

MiloBones


Neither worked. I'll figure something out, though. I could always just have die() check if the thing is really dead...
void poison( void )
{
loop_here:
wait(500);
&random = random(2,1);
if (&random == 2)
{
hurt(¤t_sprite, 5);
}
goto loop_here;
}
i fixed it so that it doesn't just do nothing when the random number is 2.
{
loop_here:
wait(500);
&random = random(2,1);
if (&random == 2)
{
hurt(¤t_sprite, 5);
}
goto loop_here;
}
i fixed it so that it doesn't just do nothing when the random number is 2.
July 28th 2004, 05:24 PM

MiloBones


That kinda misses the point, since it would last forever. How dare you not be telepathic... Thanks, though.