Jump to content
Sign in to follow this  
Lynxgtr

Display loadouts in RscListBox

Recommended Posts

Howdy

 

Well, I started making a dialog with the task to shorten the time it takes for players to equip for a mission. So basically I created alot of loadouts via the inbuilt virtual arsenal, but now I my knowledge of scripting reaches it's limit. How do I get the loadouts to be shown in the RscListbox? 

 

10c11e424e.jpg

Share this post


Link to post
Share on other sites

lbAdd and lbData might help. Have a look at the other related commands on that page too.

 

This might help to get you started:

private [ "_ctrl", "_loadouts","_index"];
_ctrl = YOUR LISTBOX CONTROL;

_loadouts = [["Basic Rifleman","brifleman"],["Automatic Rifleman","arifleman"]]; // Multi-dimensional Array of Loadouts. Format [[DISPLAYNAME,CLASSNAME],[DISPLAYNAME,CLASSNAME]]

{
	_index = _ctrl lbAdd (_x select 0);
	_ctrl lbSetData [_index, _x select 1];
} forEach _loadouts;

_ctrl lbSetCurSel 0; // Selects the first item in the listbox.

You can access the classname assigned to an index of the listbox, maybe after a button is pressed, by using lbData.

 

For example, following from the above example:

_sIndex = lbCurSel _ctrl; // returns selected index
_data = _ctrl lbData _sIndex; // returns the "classname" of the selected loadout

_data call MyLoadoutFunc // Or something like this 

Haven't tested the above but it should set you on the road to achieving what you asked.

  • Like 1

Share this post


Link to post
Share on other sites

Thank you, it works like a charm. :)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×