OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: Jack48271 on 08 Jun 2012, 21:14:55

Title: Missing semicolon
Post by: Jack48271 on 08 Jun 2012, 21:14:55
I get so confused when to put a semicolon after my statement. Like how do I know if I need one? What kind of statements?
here is a script
unit1 = a if (unit1 = a) then {moveincargo b}
it says missing ; but where?? ???
Title: Re: ;
Post by: Wolfrug on 08 Jun 2012, 21:59:14
Well, what that really means is that it doesn't understand the code; it thinks it ought to shut off somewhere. In your case, after a -> unit1 = a; if (...etc). The code doesn't make a lot of sense anyway (unless it's test code, and you're just making unit1 == a right from the start). Even so, though, you're not using it right.

Code: [Select]
unit1 = a;
if (unit1 == a) then {unit1 moveincargo b};

Would move a, or unit1, into the cargo hold of b. I suggest you avoid using names like 'a' and 'b' though, and instead use things like the aforemention unit1/ab whatever - single-letter names easily get confusing.

Wolfrug out.

Title: Re: ;
Post by: h- on 08 Jun 2012, 22:28:20
Wlcome to OFPEC, Jack48271
:welcome:

I'd like to point out that in the future you might want to use more descriptive thread title.

This is a repository of many many many years worth of knowledge and for example searching it becomes very difficult when thread titles use things like ';' or 'please help..'


I edited the title to make a bit more sense.. :cop: