Home   Help Search Login Register  

Author Topic: Missing semicolon  (Read 1768 times)

0 Members and 1 Guest are viewing this topic.

Offline Jack48271

  • Members
  • *
Missing semicolon
« 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?? ???
« Last Edit: 08 Jun 2012, 22:31:37 by h- »

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: ;
« Reply #1 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.

"When 900 years YOU reach, look as good you will not!"

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: ;
« Reply #2 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:
« Last Edit: 08 Jun 2012, 22:32:06 by h- »
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.