SOLVED: Change ListBox ID after use

Started by steptoe, Tue 10/04/2012 11:40:26

Previous topic - Next topic

steptoe

Hi

I am trying to change a ListBox ID Item.

Player has selected item "Windows"  from a ListBox and once used on a character the Listbox selected Item goes to ID 0 (which is just a "" entry).

I am using variables defined on selected ListBox items as well as Game.DoOnceOnly.

This variable is turned off once events have run.


An example:

Code: ags

function ListBox1_OnSelectionChanged(GUIControl *control)
{ 
  
 String itemname = ListBox1.Items[ListBox1.SelectedIndex];
     
 if (itemname == "Windows")
 {
  Trunks=true;
 }


This is repeated for 6 characters. Any item needs to be selected before you can use it on each character.

What would I need to do?

cheers

steptoe



Khris

I can't make heads or tails of your post I'm afraid.

As far as I understand what you're trying to do (allow the player to use a listbox item on a character), the ListBox's OnSelectionChanged function probably shouldn't change the game's state, as in, set or change variables.

If you want to remove the highlight, set ListBox1.SelectedIndex to -1.

If you want to react to the player selecting a listbox item, then clicking a character, you need the character's interact or anyclick event and check which item is selected in there.

steptoe

Cheers Khris

That does the trick  :)

steptoe

SMF spam blocked by CleanTalk