Jump to content
Sign in to follow this  
BullyBoii

getting separate strings from an array

Recommended Posts

hi all,

the title says it all really, how would i go about doing this

what i wanted to do was have an array that can hold an infinite number of

strings and then be able to separate out the strings individually.

e.g. a list of waypoint markers in an array

["wp1", "wp2", "wp3", .....];

i then want to be able to extract these waypoint names for use as a position

and create a waypoint for a unit to follow.

if anyone has an idea of how to do this i would very much appreciate them

advising me on how to go about doing this

if i have seemed unclear, please tell me and i will try to rephrase it.

edit: here is my code so far

//////////////////////////////////////////////////////////////////
// Function file for Arma 3
// Created by: =SOF= Sgt.Bull.A - "Bully"
//////////////////////////////////////////////////////////////////

//spawn_group_red.sqf

_markerName = _this select 0; //type string
_side = _this select 1; //type string either "red" or "blue"
_groupName = _this select 2; //type array or string
_wps = _this select 3; //type array of strings -  needs to be with list of marker positions

//sets defualt group type based on side
//opfor deualt group
if (_side = "red") then 
{	
if (isNil _groupName) then {_groupName = (configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfTeam");}; //selects default group
};
//blufor default group
if (_side = "blue") then 
{
if (isNil _groupName) then {_groupName = (configfile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfTeam");}; //selects default group
};

//spawns the group
_spawnpos = getmarkerpos _markername;//gets marker name
_group = [_spawnpos, EAST, _groupName] call BIS_fnc_spawnGroup;//spawn group

//adds the waypoints
//put waypoint params here for each string from _wps array

exit;//ends script

Edited by BullyBoii

Share this post


Link to post
Share on other sites

exit is sqs command does nothing in sqf file you don't need it. to iterate through your wp names use foreach

{

//_x will contain wps name

} forEach _wps;

Share this post


Link to post
Share on other sites
exit is sqs command does nothing in sqf file you don't need it. to iterate through your wp names use foreach

{

//_x will contain wps name

} forEach _wps;

ok thanks, i thought about doing that but then something in my head kept telling me it wouldnt work, thanks for the help, ill try that now :)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×