OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: edgren on 09 Jun 2008, 03:40:07

Title: What does ? means in a code?
Post by: edgren 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!
Title: Re: What does ? means in a code?
Post by: Carroll on 09 Jun 2008, 04:36:19
IF
Title: Re: What does ? means in a code?
Post by: Wolfrug 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.

Title: Re: What does ? means in a code?
Post by: edgren on 09 Jun 2008, 05:33:53
Many thanks!