lawman_actual 24 Posted May 26, 2015 Fairly newbie question but bear with me - I'm only just starting to get the hang of this scripting business. I want to be able to check throughout a mission I'm making that a variable is being altered correctly, so I made a radio trigger to display to me the value of the trigger. Only problem is I can't figure out how to get the variable to be "called" as part of the text... In my init.sqf file I define a global variable - the number of units available on standby: standbyUnits = 0; Now I call a radio trigger so that my unit (dag1a1) can check this value at any time... dag1a1 groupChat standbyUnits; I figured that by placing the variable name where the text is usually typed, the engine would type the value of the variable as the chat. Apparently not... How can I achieve this? I've checked the radio trigger with some text and it works fine. Many thanks. Share this post Link to post Share on other sites
jshock 513 Posted May 26, 2015 _unit groupChat (format ["%1",_myVariableName]); Share this post Link to post Share on other sites
lawman_actual 24 Posted May 26, 2015 _unit groupChat (format ["%1",_myVariableName]); Thanks very much, worked a charm! Not that I understand why... Can you explain what the format ["1%" is doing? Share this post Link to post Share on other sites
Jona33 51 Posted May 26, 2015 Format is just a command that takes a variable and converts it into a string for you, the %1 (make sure it is %1 not 1%) refers to the first argument that you give to it (in the square brackets), basically _argument1=16; _argument2=randomUnit; hint format ["number=%1 and unit=%2",_argument1,_argument2]; would give you a box saying number=16 and unit=randomUnit Share this post Link to post Share on other sites
lawman_actual 24 Posted May 26, 2015 Understood. Thanks again both of you Share this post Link to post Share on other sites
killzone_kid 1331 Posted May 26, 2015 you can just simply dag1a1 groupChat str standbyUnits; str converts anything to string. Share this post Link to post Share on other sites