PDA

View Full Version : Problems with OR/ELSE and ArmA.rpt.



Apocal
Jul 27 2009, 15:40
Ripping off Inspired by one of the FLIR script's features, I've decided to try one of my old personalized attempts another shot, in this case temporarily stripping some vehicle crews of their NVGs in vehicles without image intensifier/thermal imager capability. (Oh yeah, I have very little actual training in coding and instead have relied on poking scripts with a stick and seeing what moved, so I'm sure I have gaping holes in my knowledge somewhere.)

This line, directly taken from the FLIR script, works:

if(!(_caller == gunner _vehicle))exitwith{hint "only gunner can use this function."};

My modified line:

if((! (_caller == gunner _vehicle))OR(! (_caller == commander _vehicle)))exitwith{hint "silly insurgent tank driver, you don't get night vision."};

Error given in ArmA.rpt is:

File C:\Users\Sony AR750EB\Documents\ArmA 2 Other Profiles\Apocal\missions\OPERATION2.Chernarus\scri pt2\FLIR_main.sqf, line 6
Protocol bin\config.bin/RadioProtocolRU/: Missing word AwayGrid

Missing word AwayGrid? In the words of the Virgin Mary, "Come again?"

Other attempts include:

if((! _caller == ((gunner)OR(commander)) _vehicle))exitwith{hint "silly insurgent tank driver, you don't get night vision."};


if((! _caller == ((gunner _vehicle)OR(commander _vehicle))exitwith{hint "silly insurgent tank driver, you don't get night vision."};


if((! _caller == ((gunner _vehicle)ELSE(commander _vehicle))exitwith{hint "silly insurgent tank driver, you don't get night vision."};

Where am I messing this up? Syntax? Or is it a standard limitation of OR/ELSE arguments that I'm trying to force through? Even better if there was some intermediate level tutorial on SQF, I checked out a few on OPEC but they didn't help.

Big Dawg KS
Jul 27 2009, 15:54
if(_caller != gunner _vehicle || _caller != commander _vehicle)exitwith{hint "silly insurgent tank driver, you don't get night vision."};

Apocal
Jul 27 2009, 17:27
if(_caller != gunner _vehicle || _caller != commander _vehicle)exitwith{hint "silly insurgent tank driver, you don't get night vision."};

Thank you very much! So the || serves the same function as OR does outside of?

Big Dawg KS
Jul 27 2009, 17:29
Yes, || is the C-borrowed operator for OR.

Taurus
Jul 27 2009, 17:32
Sorry for sticking my nose into this one.

I think its because you wrote it in capital letters.
http://community.bistudio.com/wiki/Operators#Logical_Operators

"OR" wont work
"or" will.

Same with
"AND" and eeh "and"

Atleast that's how it used to work in OFP and Arma

Big Dawg KS
Jul 27 2009, 17:36
That's interesting. I never noticed since I always use the C-like operators.

Taurus
Jul 27 2009, 17:51
OT here, soz.
Back in my flash point days I was more VB-biased and used
IF ELSE OR AND LOL
Which apparently didn't work hehe!

Nowadays I'm brewing Java and using || && too.

But for those who wants to type the words, they should use lower case. :)

Apocal
Jul 27 2009, 17:56
I suspect a previous program I used has been acting as a crutch in that case; I recall it putting all my operators in lowercase, when I generally wrote uppercase to help a little with legibility.

Edit:
OT here, soz.
Back in my flash point days I was more VB-biased and used
IF ELSE OR AND LOL
Which apparently didn't work hehe!

Nowadays I'm brewing Java and using || && too.

But for those who wants to type the words, they should use lower case. :)

Yeah I came up on VBasic as well. Old habits, hard death, etc.

Worldeater
Jul 27 2009, 22:46
Sorry for sticking my nose into this one.

I think its because you wrote it in capital letters.
http://community.bistudio.com/wiki/Operators#Logical_Operators

"OR" wont work
"or" will.

Same with
"AND" and eeh "and"

Atleast that's how it used to work in OFP and Arma

SQF is not case-sensitive.


iF (true OR TrUE) tHEn {
HInt "yeah, right!";
};