I dont know if Im doing something wrong, but I dont want to bother Ghost with it anymore ;D so I post it here:
I want to have a listbox where I can add and remove items (well I already have this). If I click on some of the items, a script will run (for example a msg will display). I know how to do this (barely) and it works. For example if I click on one a message will display saying "one", and if i click on two a msg will display saying "two" of course, but when I remove item one, item two takes its place and when i click on item two, its says "one" :f ) So... What I need is some "manual for a simple" that will tell me step by step what to do. Pleeeeeeease! Pretty please.
Thank you!
From what you describe it appears that you are displaying item's index number (i.e. it's location in the list) something like this:
Display("You clicked on item number %d",MyList.SelectedIndex);
Perhaps what you want to do instead is to display the item's text like this
Display("You clicked on item %s",MyList.Items[MyList.SelectedIndex]);
Yes, but I dont want just a display message after I click on the item, that was just an example. I want a script to run (for example a player to go to a different room or so). Basically Im looking for the complete script for: function listboxname_SelectionChanged(GUIControl *control)
Ok, so if you have a listbox named MyList and put 2 items in it, "one" and "two" you could just so something like the following
if (MyList.Items[MyList.SelectedIndex]=="two") {
TwoFunction();
}
else if (MyList.Items[MyList.SelectedIndex]=="one") {
OneFunction();
}
Thank you thank you thank you! It works perfectly!