Yuval
If the target control is a controls' group, all the child controls of that group will be moved automatically (as their position is relative to the control group rather than the display).
Results appear below as you type; use the arrow keys to move through them.
Command · Markdown · JSON · original wiki page
Sets wanted position and size for 2D control animation. Width and height are optional. ctrlCommit is required to complete the operation.
For 3D control, param is relative [x, z, y] and no ctrlCommit is required as it cannot be animated. If target control is inside a CT_CONTROLS_GROUP, the position needs to be relative to it.
Important
This command doesn't work well with CT_MAP control. Use ctrlMapSetPosition instead.
controlName ctrlSetPosition [x, y]
Parameters:
Returns: Nothing
controlName ctrlSetPosition [x, y, w, h]
Parameters:
controlName: Control - 2D controlx: Number - position in xy: Number - position in yw: Number - width of the controlh: Number - height of the controlReturns: Nothing
controlName ctrlSetPosition [x, z, y]
Parameters:
controlName: Control - 3D controlx: Number - screen xz: Number - distance from the screen (depth). If object is too far, it cannot be dragged by the mouse.y: Number - screen yReturns: Nothing
Move control:
_control2D ctrlSetPosition [0, 0];
_control2D ctrlCommit 0;
Move control and resize:
_control2D ctrlSetPosition [0, 0, 1, 1];
_control2D ctrlCommit 0;
_control3D ctrlSetPosition [0.5, 1, 0.5]; //centered and 1m away from screen
Typewriter effect:
with uiNamespace do
{
0 spawn
{
_text1 = "This is a simple demo of typewriter text effect with various speed.";
_text2 = "This took 10 seconds.";
_text3 = "This is a fast one, set for 2 seconds.";
ctrl = findDisplay 46 ctrlCreate ["RscStructuredText", -1];
ctrl ctrlSetPosition [0, 0, 0, 0.1];
ctrl ctrlCommit 0;
ctrl ctrlSetStructuredText parseText format ["<t color='#ff0000' size='2.1'>%1</t>", _text1 splitString " " joinString " "];
ctrl ctrlSetPosition [0, 0, ctrlTextWidth ctrl, 0.1];
ctrl ctrlCommit 8;
waitUntil { ctrlCommitted ctrl };
sleep 0.5;
ctrl ctrlSetPosition [0,0,0,0.1];
ctrl ctrlCommit 0;
ctrl ctrlSetStructuredText parseText format ["<t color='#ff0000' size='2.1'>%1</t>", _text2 splitString " " joinString " "];
ctrl ctrlSetPosition [0, 0, ctrlTextWidth ctrl, 0.1];
ctrl ctrlCommit 2;
waitUntil { ctrlCommitted ctrl };
sleep 2;
ctrl ctrlSetPosition [0,0,0,0.1];
ctrl ctrlCommit 0;
ctrl ctrlSetStructuredText parseText format ["<t color='#00ff00' size='2.1'>%1</t>", _text3 splitString " " joinString " "];
ctrl ctrlSetPosition [0,0,ctrlTextWidth ctrl,0.1];
ctrl ctrlCommit 2;
waitUntil { ctrlCommitted ctrl };
sleep 2;
ctrlDelete ctrl;
};
};
ctrlMapSetPosition · ctrlCommit · ctrlCreate · ctrlDelete · ctrlModel · ctrlSetModel · ctrlPosition · ctrlClassName · displayCtrl · ctrlModelScale · ctrlSetModelScale · ctrlModelDirAndUp · ctrlSetModelDirAndUp
If the target control is a controls' group, all the child controls of that group will be moved automatically (as their position is relative to the control group rather than the display).