The Dink Network

Reply to Re: wrong

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:
 
 
May 29th 2005, 03:20 PM
fish.gif
Simeon
Peasant He/Him Netherlands
Any fool can use a computer. Many do. 
That's because you shouldn't use the global variable &magic - it's used by the engine to store Dink's stats (Attack = &strength, Defense = &defense and Magic = &magic) so you can't use those. So in your case, if Dink's magic level was anything but 0, your script wouldn't work.

So, change the variablename and after you've done that, you also need to change the order of the two if-statements: if (&hasmagic == 1) should be done before (&hasmagic == 0). Because, now the variable is 0, a conversation follows and the variable is 1. Then immediately there's another if-statement to check if it's 1 (which is now the case) so that conversation runs as well which you likely didn't intent to. If you change the order, it won't do that:

void talk(void)
{
freeze(1);
freeze(&current_sprite);
if (&hasmagic == 1)
{
//code
}
if (&hasmagic == 0)
{
&hasmagic = 1;
}
unfreeze(1);
unfreeze(&current_sprite);
}