Forum Jump :

Author Message

Posts: 1

Level: Member

Country: se
Occupation: ServiceTech.
Age: 51
In-game name: Brother_B

#1 Posted at 2020-06-16 08:52        

This is my first scripting question, i usually search for the answer, with great success, but now i'm stuck.

What i have now, works with one DataTerminal:

I have two DataTerminals called DT1 and DT2 in the variablename. They both have an init call line to a script:
0=[this,"DT1","1"] execVM "DataTerminal\Intelposition.sqf";

The script (IntelPosition.sqf):
Private _Box = _this select 0; // The name of the DataTerminal (VariableName)
Private _IntelPosition = _this select 1; // DT1 or DT2 etc.
Private _IntelMarker = _this select 2; // The name of the markers you have, except the number you get when you copy paste the marker.

_IntelPosition = [[_IntelMarker,0],[_IntelMarker+"_1",0],[_IntelMarker+"_2",0],[_IntelMarker+"_3",0],[_IntelMarker+"_4",0],[_IntelMarker+"_5",0],[_IntelMarker+"_6",0],[_IntelMarker+"_7",0],[_IntelMarker+"_8",0],[_IntelMarker+"_9",0]] call BIS_fnc_selectRandom; //Selecting random markername for the position of the DataTerminal.
_Box setPos [getMarkerPos (_IntelPosition select 0) select 0, getMarkerPos (_IntelPosition select 0) select 1, (getMarkerPos (_IntelPosition select 0) select 2) + (_IntelPosition select 1)]; //Positioning of the DataTerminal

The question:

How do i code so i can use this single script for multiple DataTerminals?
Can i use something like "forEach"?

Thanks in advance. Bengt.