Page 1 of 1

some help with some code

PostPosted: Fri Jun 04, 2010 7:12 pm
by draxido
Hello everyone.

I have a little problem with this If statement, and i cant figure out why its giving my an error message.

The message is "error line 7: expected ;"
this leads me to believe the "else" is missing a semicolon~ but in other if statements i have seen it is not needed, and even when i put one in, i get the same error.


Here is the line of code
Code: Select all
if(energyNum >= 1);
{
CreateActor("energyshot", "energy ball", "(none)", "(none)", 0, 0, false);
energyammo.textNumber = energyammo.textNumber -= 1;
}
else
{
PlaySound2("C:\\Users\\Rage\\Desktop\\FMP work\\My work\\Armored Retribution\\data\\Error.wav", 1.000000, 1, 0.000000);
}


Any help would be very very appreciated.
Thank you

Re: some help with some code

PostPosted: Fri Jun 04, 2010 7:36 pm
by Rux
Well, try this. (Delete in Red, add in green.)

if(energyNum >= 1); <- NO SEMICOLON NEEDED HERE
{
CreateActor("energyshot", "energy ball", "(none)", "(none)", 0, 0, false);
energyammo.textNumber = energyammo.textNumber -= 1;
}
else if(energyNum <= 0) < - Add this
{
PlaySound2("C:\\Users\\Rage\\Desktop\\FMP work\\My work\\Armored Retribution\\data\\Error.wav", 1.000000, 1, 0.000000);
}

Copy and paste the code here.
Code: Select all
if(energyNum >= 1)
{
CreateActor("energyshot", "energy ball", "(none)", "(none)", 0, 0, false);
energyammo.textNumber = energyammo.textNumber -= 1;
}
else if(energyNum <= 0)
{
PlaySound2("C:\\Users\\Rage\\Desktop\\FMP work\\My work\\Armored Retribution\\data\\Error.wav", 1.000000, 1, 0.000000);
}


Sometimes I have a problem with the Else statement too. Go try it out. If it doesn't work, Idk what could be wrong.

Re: some help with some code

PostPosted: Fri Jun 04, 2010 8:00 pm
by draxido
oh my god i love you :P

thanks so much, you just solved my 2 hour long problem.
:D

Re: some help with some code

PostPosted: Sat Jun 05, 2010 1:45 am
by Rux
draxido wrote:oh my god i love you :P

thanks so much, you just solved my 2 hour long problem.
:D


You're welcome. :) (lol 2 hours?)