_SCAR 139 Posted September 17, 2017 Is there any way to retrieve the side from string? I mean something like: sideFromString "WEST"; ==> returns west (side, not string) Share this post Link to post Share on other sites
_SCAR 139 Posted September 17, 2017 Answering myself, but not sure if this is "clean": _side = [] call compile "WEST"; Share this post Link to post Share on other sites
torndeco 128 Posted September 17, 2017 I would just use a switch statement and return the particular side. Using call compile is abit unnecessary and i avoid using it so can make more secure BE Filters. Espeically if you are allowing the player is allowed to type in the side. 1 Share this post Link to post Share on other sites
Grumpy Old Man 3540 Posted September 17, 2017 Since sides are finite and can't be created dynamically, why not just use the good ole keys n values routine? _input = "WEST"; _keys = ["WEST","EAST","INDEPENDENT","CIVILIAN"]; _values = [west,east,independent,civilian]; _output = _values select (_keys find _input); Cheers 4 Share this post Link to post Share on other sites
_SCAR 139 Posted September 18, 2017 Thank you, I'll need to add a few (blufor, opfor, resistance) but I think you're right. Share this post Link to post Share on other sites
Grumpy Old Man 3540 Posted May 10, 2018 (edited) On 9/18/2017 at 4:11 AM, _SCAR said: Thank you, I'll need to add a few (blufor, opfor, resistance) but I think you're right. west/blufor are the same and interchangeable. Same goes for east/opfor and resistance/independent. Edit: just saw the date, added additional info anyway due to a "like". Cheers Edited May 10, 2018 by Grumpy Old Man Share this post Link to post Share on other sites
HazJ 1288 Posted May 10, 2018 Why not just use SIDE then use str to make it string? You can also use "call compile" to do the same but vice versa. Or did I misunderstand completely? Share this post Link to post Share on other sites
Grumpy Old Man 3540 Posted May 11, 2018 17 hours ago, HazJ said: Why not just use SIDE then use str to make it string? You can also use "call compile" to do the same but vice versa. Or did I misunderstand completely? Agreed, there's probably a more convenient way to begin with. Having the requirement of getting a side from an input string there's only a few solutions, heh. Cheers 1 Share this post Link to post Share on other sites