_JB 0 Posted November 19, 2018 I am making a storage system that will take items from a crate and store them in an array. Where im having some trouble is when I convert the classname to displayname to display in the listbox, When the player selects the listbox displayname I have to convert the displayname back to classname and end up getting a different classname then what goes in. If I input "U_BG_Guerilla2_2" whos displayname is "Guerilla Outfit (Pattern)" into private _classname = "getText (_x >> 'displayName') == _this" configClasses (configFile >> "cfgWeapons"); if (count _classname > 0) exitWith {configName (_classname select 0)}; _classname = "getText (_x >> 'displayName') == _this" configClasses (configFile >> "cfgMagazines"); if (count _classname > 0) exitWith {configName (_classname select 0)}; _classname = "getText (_x >> 'displayName') == _this" configClasses (configFile >> "cfgVehicles"); if (count _classname > 0) exitWith {configName (_classname select 0)}; _classname It will return "U_IG_Guerilla2_2" instead of "U_BG_Guerilla2_2". I have tried using [configFile >> "cfgWeapons" >> _classname, true] call BIS_fnc_returnParents; but returns ["U_IG_Guerilla2_2","Uniform_Base","ItemCore","Default"]. This seems to be a problem with vanilla arma gear because any RHS gear I use it on returns the same classname. If anyone has any ideas I appreciate the help. Share this post Link to post Share on other sites
Harzach 2517 Posted November 19, 2018 Display names aren't unique, unfortunately. And since this is originally an Independent outfit, it is defaulting to the Independent variant. Share this post Link to post Share on other sites
pedeathtrian 99 Posted November 19, 2018 Just now, _JB said: I have to convert the displayname back to It's generally a bad idea to rely on displayed text in listbox (and other controls). Collection display controls have special mechanisms to associate data with elements. Check out this example as well as commands lbSetData and lbData. Adding items with smth like this: // adding _idxLastAdded = _listBox lbAdd "<displayname here>"; _listBox lbSetData [_idxLastAdded, "<classname here>"]; Later, using: // using _idxSelected = lbCurSel _listBox; _className = _listBox lbData _idxSelected; UPD. Data is limited to a string type, but you can always make it a key for associative array, where value is of any type. 2 Share this post Link to post Share on other sites
_JB 0 Posted November 20, 2018 18 hours ago, pedeathtrian said: It's generally a bad idea to rely on displayed text in listbox (and other controls). Collection display controls have special mechanisms to associate data with elements. Check out this example as well as commands lbSetData and lbData. Adding items with smth like this: // adding _idxLastAdded = _listBox lbAdd "<displayname here>"; _listBox lbSetData [_idxLastAdded, "<classname here>"]; Later, using: // using _idxSelected = lbCurSel _listBox; _className = _listBox lbData _idxSelected; UPD. Data is limited to a string type, but you can always make it a key for associative array, where value is of any type. Ah I see now, Never thought of using lbSetData. Thanks for pointing this out kind sir! Share this post Link to post Share on other sites