hi, i'm currently working on a halo side scroller and i'm having trouble with a parse error. If you could explain why i'm getting this error or a different method to achieve my goal i would be greatfull.
Code:
function repeatedly_execute()
{
if (cShield => 101) fixshield();
if (cHealth => 101) fixhealth();
}
Error:
GlobalScript.asc(11): Error (line 11): Parse error in expr near 'cShield'
cShield is a global variable and if it goes over 100 i want the function fixshield to run.
same problem applies to cHealth but any answer should fix both.
Thanks
Use 'if (blah >= 101)' or 'if (blah > 100)', not 'if (blah => 101)'.
lol thankyou very much
hi all,
im having another error could someone pls help.
Code:
// new module script
function pistolshot() {
object[1].SetPosition(cCharacter.x + 35, cCharacter.y + 58;
object[1].Move(object[1].X + Room[1].Width, object[1].Y, 10, eNoBlock, eAnywhere);
}
error:
pistol.asc(-10): Runtime error: unexpected eof
code to use function(in global script:
function on_key_press(eKeyCode keycode)
{
if (IsGamePaused()) keycode = 0; // game paused, so don't react to keypresses
if (keycode == eKeyF) pistolshot();
}
fixed
Don't double post in a short time. You can just edit the last post for it. Also, when you manage to fix a problem, it would be a good idea to write how you fix your problems. This would be helpful to other people in case they encounter similar problems. I suppose it's the missing close ) in the 'object[1].SetPosition(cCharacter.x + 35, cCharacter.y + 58;' line, right?
Just a helpful hint, you can use the 'match-brace' feature of the script editor (press Ctrl-B when the cursor is next to an open/close bracket) to help you fix these kinds of problems.