Jump to content
Sign in to follow this  
TemichSablin

Dialog problems

Recommended Posts

So the problem is:

My goal is to get info from one ListBox, get info from a ComboBox and when i press OK do the following.

[info1] exec info2

Info1 is ListBox info - it is a name of a soldier

for example "mtemichsablin"

then Info2 is the full path to the SQS

for example "temich\kill.sqs"

What script do I have?

I use Dr. Eyeball's Dialog Framework - http://forums.bistudio.com/showthread.php?t=57825

I reconfigured the combobox to show other values - not the ListBox ones, but custom.

And here are some lines I tried

File - MyTestDialog.sqf from Dr. Eyeball's Framework

LOC3_OkButton =
{
 _selectedIndex = lbCurSel LOC3_IDC_ListBox;
 [color="Red"]_selectedData = LOC3_IDC_ListBox lbData lbCurSel LOC3_IDC_ListBox;[/color]

 player globalChat format["%1'", lbData [LOC3_IDC_ListBox, _selectedIndex] ];
 [color="Red"][ _selectedData] exec "temich\kill.sqs";[/color]
};

Coloured lines are those i entered.

Error in the first one.

If more files are needed i will post em too.

---------------------------------------------------------------

And, how can i transform a string data type to object type?

Edited by TemichSablin

Share this post


Link to post
Share on other sites

You are using the "control" syntax.

_selectedData = control lbData index;

You need to use the "IDC" syntax.

_selectedData = lbData [iDC, index];

Try:

_selectedData = lbData [LOC3_IDC_ListBox, lbCurSel LOC3_IDC_ListBox];

or

_selectedData = lbData [LOC3_IDC_ListBox, selectedIndex];

and ensure LOC3_IDC_ListBox is defined with an IDC value.

The safest way of mapping a string type to an object type is to already maintain an array of objects in a global variable, then find the relevant object in that array using any method (by index, nested array using named param's, str compare the string and object, etc).

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  

×