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: variable variable names  (Read 3163 times)

0 Members and 1 Guest are viewing this topic.

Offline tcp

  • Members
  • *
    • Violator Gaming
variable variable names
« on: 29 Aug 2009, 05:06:13 »
Is it possible to use a integer to call a variable name such as IED1tr, IED2tr, etc. so that when _num=2 something like ("IED"_num"tr") could be interpreted as a variable name instead of a string?

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: variable variable names
« Reply #1 on: 29 Aug 2009, 09:38:23 »
Code: [Select]
_left_Ve_1 = 0;

// Following executes _left_ve_1=2
call compile format["_left_ve_%1=%2", 1, 2];

hint str _left_ve_1;

Offline tcp

  • Members
  • *
    • Violator Gaming
Re: variable variable names
« Reply #2 on: 29 Aug 2009, 16:26:08 »
Thank you. I needed a trigger activated variable to be random so my script could be ran on different objects. This should work. However, how would I get the unique ID on the object (vehicle) that executed the script if I already passed this through the init line?
« Last Edit: 29 Aug 2009, 16:37:01 by tcp »