OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Lacota on 20 Jan 2008, 05:26:07
-
Hi, I am confused as to which is the correct way to declare private variables in scripts. I have seen many examples with PRIVATE ["_somevar","_someothervar"]; but I get an "Unknown Operator" error whn I try to run them. PRIVATE = [] works for me in that I don't get an error but not sure if the scope is being set correctly.
I am running OFP Res 1.96
Thanks
-
Use private for functions (sqf code) you will execute with call command.
private["_var1", "_unit", "_whatever"];
To declare local variables in sqs code, just initialize them assigning a value.
_inrange = false
-
Thanks Mondoble but if I enter "private[];" without "=" I get the Unknown Operator error I mentioned. It even indicates that the error is between the private keyword and the square brackets.
-
Are trying that in SQS or SQF?
If SQS, you dont need private at all.
private = [whatever here] will define a global variable named private.
private command (http://www.ofpec.com/COMREF/index.php?action=list&game=All&letter=p#254)