Thought I add few more commands that happened to be quite useful in my experiments.

boundingBox and boundingBoxReal

In my experiments with ArmA 2 I came across some inconsistencies between the visual size of an object and its virtual bounding box, supposedly indicating the extreme dimensions of the object. So seeing that Bohemia Interactive added new bounding box command to ArmA 3 and called it “Real” I expected it to return more precise measurements, and it did. For Ka-60 helicopter I spawned in editor to test the command, the results as you can see were quite different:

  • boundingBox Ka_60 : [[-8.09281,-9.60703,-2.9097],[8.09281,9.60703,2.9097]]
  • boundingBoxReal Ka_60 : [[-6.74401,-8.00586,-2.42475],[6.74401,8.00586,2.42475]]


Both commands return nested array with extreme points of the bounding box in model space: [[X1,Y1,Z1],[X2,Y2,Z2]]. Both bounding boxes seem to share the same centre, but are not always aligned with the default centre of the object’s 3D model. So if, for whatever reason, you need to find the offset difference use boundingCenter command. Testing this command on our Ka-60 returned: [-0.0013752,-0.750013,0.582208].

So how is boundingBoxReal command exactly useful? Well for once you can calculate  maxWidth, maxLength and maxHeight of an object knowing its extreme points with ease:

_bbr = boundingBoxReal Ka_60; _p1 = _bbr select 0; _p2 = _bbr select 1; _maxWidth = abs ((_p2 select 0) - (_p1 select 0)); //13.488 _maxLength = abs ((_p2 select 1) - (_p1 select 1)); //16.0117 _maxHeight = abs ((_p2 select 2) - (_p1 select 2)); //4.8495

composeText and formatText

As you probably already know by reading my blog there is a variable type STRING and there is variable type TEXT. The latter one refers to structured text, i.e. HTML like formatted STRING that gives you options to change colour, size, add images, etc. In order to convert normal STRING of text into structured TEXT we use parseText command. The thing is, if you can add strings old fashioned way STRING1 + STRING2 + etc,  you cannot add TEXT the same way. Luckily BIS provided 2 pretty useful commands for this purpose, composeText and formatText.

composeText will take an array of TEXTs or STRINGs and convert it all to TEXT, back to back.

hint composeText [ "Top", lineBreak, parseText "<t color='#ff0000' align='left'>Red Left</t>", parseText "<br />", parseText "<t color='#00ff00' align='right'>Green Right</t>", lineBreak, "Bottom" ];

formatText will do the same with the exception that the first element of the array is a STRING template where you can back reference the rest of the array elements with %1, %2, %3, etc, just like with normal format command.

hint formatText [ "%7%6%5%4%3%2%1", "Bottom", lineBreak, parseText "<t color='#00ff00' align='right'>Green Right</t>", parseText "<br />", parseText "<t color='#ff0000' align='left'>Red Left</t>", lineBreak, "Top" ];


The real treasure found with these commands is that you don’t have to worry about HTML like characters in text strings messing up your structured text. In this post I have demonstrated how to sanitise player name in case it contains <> tags. People do use all sorts of characters for their gamertags and these commands can make life much easier. Compare:

hint formatText ["%1HTMLTags%2","<<<",">>>"]; //<<<HTMLTags>>> hint composeText ["<<<HTMLTags>>>"]; //<<<HTMLTags>>> hint parseText format ["%1HTMLTags%2","<<<",">>>"]; //>> hint parseText "<<<HTMLTags>>>"; //>>

The only thing is if you want your TEXT containing HTML Tags in specific colour, you can do this by changing default text colour of your control inside control class. There is yet another command from the same street worth mentioning – text. This command will simply change STRING to TEXT.

visiblePosition and visiblePositionASL

Surely you’ve heard about position, getPos, getPosATL, getPosASL or even getPosASLW as these are used a lot by ArmA coders. But what about visiblePosition and visiblePositionASL? Even though I have compiled the list of every known ArmA command and these commands have been on that list forever, I overlooked them when I needed them. Now I know exactly why. Wiki page on visiblePosition says:

Returns an object’s rendered 3D position (z value above ground level).

So I naturally assumed the command tells you how much of the target is visible. WRONG! The command should have been named visualPosition instead for less confusion. Both commands give you your normal object position [x,y,z] only it is taken from your screen (ASL variant obviously gives you z Above Sea Level). What you see is what you get so to say. Even if I look away from an object on my screen I can get its visiblePosition. Also I suspect visiblePosition has local effect This is how BIS developer neokika described the reasons for the existence of these commands:

This is because of the interpolation changes in Arma 2.
Back then, new commands [visiblePosition and visiblePositionASL] have been added, please use them instead.

So when would you need these commands? Whenever you want to know exactly what another client sees on screen. Also when you want to attach a tag to a player and see it move with the player without a hitch. This is what happens when you use getPosATL to get player position, even though it is all local and no network is involved:

This is what happens if you use visiblePosition instead:

Here is an example code used in second video clip utilising not yet documented by BIS “Draw3D” event for addMissionEventHandler command, thanks to Xeno from BIS community forums for sharing the info. You can find more info on drawIcon3D command here.

addMissionEventHandler ["Draw3D", { drawIcon3D [ "\A3\ui_f\data\map\vehicleicons\iconManMedic_ca.paa", [0,0,1,1], [ (visiblePosition Bob) select 0, (visiblePosition Bob) select 1, 3 ], 1, 1, 45, name Bob, 1, 0.03, "PuristaLight" ]; }];