JestersDead 2 Posted July 28, 2014 I'm working on a GUI control that will allow map click teleport of any connected players. I have script that creates a listbox containing the unit names of each player: disableSerialization; _listboxB = 3100; _display = _this select 0; { _index = lbAdd [_listboxB, str(_x)]; } forEach allUnits; // <---- this will be changed to only be for playable units once it's working. (_display displayCtrl _listboxB) ctrlAddEventHandler ["LBDblClick","_this execVM 's\GUI\gui_teleport.sqf'"]; The ctrlAddEventHandler then fires a script when the desired unit is doubleclicked: //Get the passed ctrl _ctrl = _this select 0; //Get passed selected index _index = _this select 1; picked = (_ctrl lbText _index); //This creates the text that was displayed in the listbox index that was selected onMapSingleClick "picked setPos _pos; true; onMapSingleClick '';"; Here's the problem... the variable, picked, is injected into the teleport code as a string, wrapped in quotes, and I get a script error that it's expecting an object, but got a string. I've been going crazy trying to find a way to remove the quotes so the script will take it, but I've gotten nowhere, and I'm out of ideas. Anyone have any ideas? Share this post Link to post Share on other sites
IndeedPete 1038 Posted July 28, 2014 Try (untested): picked = call(compile(_ctrl lbText _index)); Share this post Link to post Share on other sites
cz_bpk 1 Posted July 28, 2014 I use this: http://forums.bistudio.com/showthread.php?170867-lbData-gt-String-to-Object&p=2589349&viewfull=1#post2589349 Share this post Link to post Share on other sites
JestersDead 2 Posted July 28, 2014 Ahhhh, so simple. Thanks for the help guys! Share this post Link to post Share on other sites