mankyle 420 Posted March 28, 2020 I have an scripting problema. I have an RscCombobox in a dialog. It holds the string derived from an array obtained from allunitsUAV scripting command. I can see the different UAVs present in the map and I can select them, but…. I'm having problems referencing the UAV selected in the RscCombobox. _vehicleside = side PLAYER; private _UAVarray = []; { if (side _x == _vehicleside) then { _UAVarray pushBack _x; } } forEach allUnitsUAV; hint format ["UAV(s) on the map: %1", str _UAVarray]; { lbAdd [25502, str (_x)]; lbSetData [25502, _forEachIndex, _x]; } forEach _UAVarray ; while {true} do { _index = lbCurSel 25502; _uav = lbData [25502, _index]; _selectedUAV = _UAVarray select _uav; //select UAV from UAVarray with the Index indicated by field selected in IDD 25502 };[/CODE] When putting hints _selectedUAV doesn't return the UAV, but its index. What I want is to get the UAV from _UAVarray so I can get info like speed, altitude, etc... Share this post Link to post Share on other sites
gc8 978 Posted March 28, 2020 lbSetData can only save strings as data. What you can do is create seperate array and get the UAVs from there. You could just make the _UAVarray global: UAVarray then use that example: UAVarray = []; { if (side _x == _vehicleside) then { UAVarray pushBack _x; } } forEach allUnitsUAV; Then: _index = lbCurSel 25502; _uav = UAVarray select _index; Share this post Link to post Share on other sites
7erra 629 Posted March 28, 2020 Or if you want to avoid global variables: Option 1) Use BIS_fnc_netID and then BIS_fnc_objectFromNetID Option 2) Save the variable to the display: _display setVariable ["UAVArray", _uavArray]; // To access it: _display getVariable ["UAVArray", []]; 1 Share this post Link to post Share on other sites
mankyle 420 Posted March 28, 2020 Mmm Sorry because I'm very noob Regarding scripts... It is strange because I have tried using select inside of the _UAVarray array. I mean... I have the index from the RscCombo (it works because I have used hints to se what the index value returns) so using _UAVarray select _index;[/Code] Should return the correct value for the array... But it gives me an error... I will try storing the variable inside of the display... Thanks... Explanation: I've reengineered BIS UAV console dialog and I want to access it via an action from inside a vehicle. Share this post Link to post Share on other sites
mankyle 420 Posted March 29, 2020 I have separated things in two scripts so one activates when one rscCombobox field is mouseclicked, but... It seems I cannot use _index to retrieve the correct UAV because when nothing has been selected _index returns -1 and -1 doesn't exist within _UAVarray, therefore giving me a error zero divisor could I try modifying the while loop including _index >=0 as a condition? while {_index >= 0} do { _index = lbCurSel 25502; _uav = lbData [25502, _index]; _selectedUAV = _UAVarray select _uav; //select UAV from UAVarray with the Index indicated by field selected in IDD 25502 };[/CODE] Share this post Link to post Share on other sites
Erwin23p 34 Posted March 29, 2020 I had this kind of problem with a listbox, I fixed it by using this after creating the list if (lbSize 1501 > 0) then { lbSetCurSel [1501, 0] }; maybe using lbSetSelected could work. control lbSetSelected [index, selected] Share this post Link to post Share on other sites
killzone_kid 1332 Posted March 29, 2020 you can only store value, which is number, or data, which is string in the combobox. You are trying to store array or object, you can't do that. Share this post Link to post Share on other sites