Ranwer135 308 Posted July 21, 2015 (edited) Hey guys, I want to be able to store data such as a classname (e.g. magazine) in a selection. Once the button is clicked, it will detect if a data name matches the selected and then it will remove the stored classname off a player. :confused: Here is my code for adding the selection: _config = configfile >> "CfgMagazines" >> _item >> "displayName"; If ("DSS_CanisterFuel_Filled_F" in magazines player) then { _item = "DSS_CanisterFuel_Filled_F"; _selName = lbAdd [1500, getText _config]; lbSetData [1500,_selName, "isUse"]; }; If ("DSS_CanisterFuel_Empty_F" in magazines player) then { _item = "DSS_CanisterFuel_Empty_F"; _selName = lbAdd [1500, getText _config]; lbSetData [1500,_selName, "isUse"]; }; Here is the code for checking if the data matches: _index = lbCurSel 1500; _data = lbData [1500,_index]; if (_data isEqualTo "isUse") then { hint format ["%1", _data]; player removeMagazine _item; }; They may not work, but you can see what I am trying to do. (Since it's going to add multiple selections, I want the button to perform one check, not multiple checks. Therefore avoiding performance lag) Thanks, Rawner135 Edited July 22, 2015 by Ranwer Share this post Link to post Share on other sites
x39 101 Posted July 21, 2015 whats your question now? Share this post Link to post Share on other sites
Ranwer135 308 Posted July 21, 2015 whats your question now? Darn, didnt realise I had the icon up there.. I'll contact moderator to remove thread icon. Share this post Link to post Share on other sites
Ranwer135 308 Posted July 22, 2015 Any ideas?!? :confused: Share this post Link to post Share on other sites
ianbanks 30 Posted July 22, 2015 Hi Ranwer, Why are you storing "isUse" in the list box? You could put each of the class names into the list box data instead: lbSetData [1500, _selName, _item]; Share this post Link to post Share on other sites
Ranwer135 308 Posted July 22, 2015 Basically, I want data to match either "isFood", "isWater" or "isUse". Once the data matches, it does the specific action. (Again, this is to avoid script lag) The problem is, the 2 scripts can't pass over the classname to remove magazine because its local. (If I use global, it won't look pretty..) I also cant seem to get the index of lbAdd as well. :confused: (thought about "isEqualTo" and "lbCurSel", they obviously don't work for adding items) Share this post Link to post Share on other sites
ianbanks 30 Posted July 22, 2015 So you need to add both "inUse" and the class name to the list box? Share this post Link to post Share on other sites
Ranwer135 308 Posted July 23, 2015 Well I want to be able to have my items belong in a data known as "isUse", and have the selected item that matches the data, to remove the selected item's magazine. (DayZ mod has done this technique before, i.e. "ui_SelectSlot.sqf"), but they used gearSlotdata to get the magazine in order to remove it. Share this post Link to post Share on other sites
nimrod_z 8 Posted July 23, 2015 Well I want to be able to have my items belong in a data known as "isUse", and have the selected item that matches the data, to remove the selected item's magazine. (DayZ mod has done this technique before, i.e. "ui_SelectSlot.sqf"), but they used gearSlotdata to get the magazine in order to remove it. hmm, sounds like your taking a more difficult route then may be needed. using the "configName" command will return the classname and if you need to save it there is always "setVariable" command. thats what i did anyway. not sure if thats what you're looking for or if it helps bud. _idc = ctrlIDC (_this select 0); _selectedIndex = _this select 1; _data = lbData[_idc,lbCurSel _idc]; _type = ""; _conf = configFile >> "cfgMagazines" >> _data; _type = "cfgMagazines"; if (!isClass _conf) then {_conf = configFile >> "cfgWeapons" >> _data; _type = "cfgWeapons"}; _name = configName (_conf); player setVariable ["inventorySelected",_name]; Share this post Link to post Share on other sites