how do i something like this
if (listbox.hasitem("blank"){
}
cause I need an action to fire with a code to something like this and i cant use selected index cause the the item that is added might not get to be added to be called index 0 or 4 it might change if you put/register something before it.
How about give the player an inventory item, or give another character an inventory item and checking if they have it?
if (player.HasInventory(iBlank))
{
DoStuff();
}
To give characters inventory items:
player.AddInventory(iBlank);
Just replace player with another characters script name to use them as a "list".
You may use a loop to check the entries of the listbox until a match is found.
For convenience, you may write a function like this (untested):
function FindInListbox(String text){
int ii=0;
int index=-1;
while(ii<listbox.ItemCount){
if (listbox.Items[ii]==text) {
index=ii;
ii=listbox.ItemCount;
}
ii++;
}
return index;
}
This function will return the entry with the first occurrence of the "text" parameter and return -1 if it is not found.
So, your code could be like:
if (FindInListbox("blank")>=0) {
}
bool hasitem(this ListBox*, String list_item) {
int count;
while (count < this.ItemCount) {
if (this.Items[count] == list_item) return true;
count++;
}
}
Not tested, but that's the basic principle at least.
Edit: Curse you Gilbet! ;) I might as well post this anyway.
thanx you guys.one of these should work but i don't think i can use inventory as i left that alone and progressed into the list boxes
oh and btw the whole meaning of this that this box is used for cego active quest that he has to do and when you talk to the AI you will need "magic circles quest 1" to be in questbox(listbox name) then if it is the AI will say something but if you don't have this then she will say something opposite to the other response and nothing will happen important unless u do have the item.