Home   Help Search Login Register  

Author Topic: What does ? means in a code?  (Read 1150 times)

0 Members and 2 Guests are viewing this topic.

Offline edgren

  • Members
  • *
What does ? means in a code?
« on: 09 Jun 2008, 03:40:07 »
Hi!

I just wonder what the ? means in this kinda code: ? (fuel (vehicle player) <0.1) : hint "Fuel is running low"
If I just run the script just like that in a trigger, I'll get a error-message "Invalid number in expression" or something like that. If I replace the ? with something else, I'll get "Expecting ;". Kinda enyoing :/

Thanks in advance!

Offline Carroll

  • Members
  • *
  • Mission Designer (MP-"well tryin to capiche"
Re: What does ? means in a code?
« Reply #1 on: 09 Jun 2008, 04:36:19 »
IF

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: What does ? means in a code?
« Reply #2 on: 09 Jun 2008, 04:39:27 »
Indeed, ? in SQS code is short for IF, and precedes a THEN (in SQS represented by a colon : ).

In triggers etc. the Condition field represents the IF portion (no extra question marks etc. needed) and the On Activation portion represents the following THEN code. Basically "if thing X is true, then do Y". With SQF, you can do more complicated things like "if thing X is true, then do Y, else do Z". :)

I suggest taking a peek at some of the newbie tutorials in scripting if you want to get into it - the ones for OFP are equally applicable for ArmA most of the time!

Wolfrug out.

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

Offline edgren

  • Members
  • *
Re: What does ? means in a code?
« Reply #3 on: 09 Jun 2008, 05:33:53 »
Many thanks!