OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Surdus Priest on 23 Oct 2007, 23:01:49

Title: while the player is and isnt in a vehicle (in sqf)
Post by: Surdus Priest on 23 Oct 2007, 23:01:49
in sqs, the condition for when the player is in a vehicle is: !(vehicle player != player);   and (vehicle player = player) for when the player isnt.

but in sqf whats the condition to determine whether or not the player is in a vehicle?

surdus
Title: Re: while the player is and isnt in a vehicle (in sqf)
Post by: LCD on 23 Oct 2007, 23:33:57
same thing


if (vehicle player == player) then {};

if (vehicle player != player) then {};

LCD OUT
Title: Re: while the player is and isnt in a vehicle (in sqf)
Post by: Spooner on 23 Oct 2007, 23:40:32
You beat me to that one, but I'll just clarify by pointing out that:
Code: [Select]
!(vehicle player != player)

is exactly the same as:
Code: [Select]
(vehicle player == player)

Logic thankfully hasn't changed at all between SQS and SQF, just the programming structures that use them (so you would use "? condition : stuff" in the archaic SQS, where you'd use "if (condition) then { stuff };" in shiny new SQF).
Title: Re: while the player is and isnt in a vehicle (in sqf)
Post by: Surdus Priest on 24 Oct 2007, 00:03:34
im beginning to wonder just how closely related sqf is to VB or javascript :P