Home   Help Search Login Register  

Author Topic: Dynamic varibles with format...  (Read 544 times)

0 Members and 1 Guest are viewing this topic.

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Dynamic varibles with format...
« on: 18 Sep 2005, 19:10:33 »
I'm trying to make variables using call, format, and a counter... unfortunately, ofp spits out an unknown operator at me...
here's the code:
Code: [Select]
(call format ["TRG_fakepilot%1",_counter]) = this
and this is done in the init line of createunit:
Code: [Select]
"SoldierWB" createUnit [[0,0,0], group _pilot, {(call format ["TRG_fakepilot%1",_counter]) = this}, 1, "corporal"]
and here is the error message:
Code: [Select]
(call format ["TRG_fakepilot%1",_counter]) |#|= this:error unknown operator
what am i not doing? or doing wrong?

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Dynamic varibles with format...
« Reply #1 on: 18 Sep 2005, 19:51:49 »
Jusr passing so this is quick thought:

Try:

Code: [Select]
"SoldierWB" createUnit [[0,0,0], group _pilot, {(call format ["TRG_fakepilot%1 = this",counter]) }, 1, "corporal"]
Note also that I have made counter a global variable

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Dynamic varibles with format...
« Reply #2 on: 18 Sep 2005, 20:15:26 »
well i need it as a local varible because i use it later on, and the global counter could have been changed if the event happens in close succession. I assume that wouldn't make a difference....