The Dink Network

Reply to Re: Need help with a spell script

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:
 
 
December 9th 2014, 06:15 AM
spike.gif
It kills random sprites because when you change screens, the text sprite &t1 stops existing. "&t1" (or &crap, or &text, or any variable name) is just a stand-in for the sprite's sprite number, so when you change screens, it kills some sprite that just happens to have the same sprite number that &t1 had.

To fix, you could do something like this:
loop:
if (&crap == &player_map)
sp_kill(&t1, 1);
&t1 = say_xy("&mana / 100", -50,455);
sp_kill(&t1, 0);
int &crap = &player_map
wait(200);
goto loop;

If &crap doesn't equal &player_map, that means they changed screens during the wait(200), &t1 doesn't exist anymore, and so we shouldn't try to kill it.

Alternatively, this might work:
loop:
&t1 = say_xy("&mana / 100", -50,455);
sp_kill(&t1, 200);
wait(200);
goto loop;