Warning: include(/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php): failed to open stream: No such file or directory in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Warning: include(): Failed opening '/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Notice: Undefined index: OFPEC in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152
    Home   Help Login Register  

Author Topic: PRIVATE = [] or PRIVATE []  (Read 1344 times)

0 Members and 1 Guest are viewing this topic.

Offline Lacota

  • Members
  • *
  • I'm a llama!
PRIVATE = [] or PRIVATE []
« 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

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: PRIVATE = [] or PRIVATE []
« Reply #1 on: 20 Jan 2008, 09:37:12 »
Use private for functions (sqf code) you will execute with call command.
Code: [Select]
private["_var1", "_unit", "_whatever"];

To declare local variables in sqs code, just initialize them assigning a value.
Code: [Select]
_inrange = false

Offline Lacota

  • Members
  • *
  • I'm a llama!
Re: PRIVATE = [] or PRIVATE []
« Reply #2 on: 20 Jan 2008, 16:25:20 »
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.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: PRIVATE = [] or PRIVATE []
« Reply #3 on: 20 Jan 2008, 17:43:53 »
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