some help with some code

Non-platform specific questions.

some help with some code

Postby draxido » Fri Jun 04, 2010 7:12 pm

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
draxido
 
Posts: 18
Joined: Mon Feb 01, 2010 7:36 pm
Score: 0 Give a positive score

Re: some help with some code

Postby Rux » Fri Jun 04, 2010 7:36 pm

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.
I'm not good at coming up with signatures...
User avatar
Rux
 
Posts: 645
Joined: Sun Apr 29, 2007 9:26 pm
Location: Sitting on your moniter invisable.
Score: 35 Give a positive score

Re: some help with some code

Postby draxido » Fri Jun 04, 2010 8:00 pm

oh my god i love you :P

thanks so much, you just solved my 2 hour long problem.
:D
draxido
 
Posts: 18
Joined: Mon Feb 01, 2010 7:36 pm
Score: 0 Give a positive score

Re: some help with some code

Postby Rux » Sat Jun 05, 2010 1:45 am

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?)
I'm not good at coming up with signatures...
User avatar
Rux
 
Posts: 645
Joined: Sun Apr 29, 2007 9:26 pm
Location: Sitting on your moniter invisable.
Score: 35 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron