Kyran
07-17-2005, 10:32 AM
I am going to make a trading system for a game that I am working on and would like to know the best way to do it.
I'm guess that a listbox would be the way to go. There will be a listbox for every location and every character, when a character pick up an object from a location that object is moved from the location's listbox to the character's listbox.
I'm having problems with how to use listboxes.
Say I have a listbox called myData.
myData.addItem("Flower");
myData.addItem("Pen");
myData.addItem("Herb");
myData.addItem("Herb");
myData.addItem("Herb");
I'll add five items, three herbs, a flower and a pen. That works fine, the five items show up great.
Yet now say I want to remove one Herb from the listbox.
myData.removeItem("Herb")
That doesn't work.
if (notData = hasa”herb”) {
myData.removeItem("Herb")
myData.addItem("Herb")
}
Also I'll need to know how to use IF THEN statements and how to swap objects.
I know about removeItemAt and how to use it, but I don't want to be forced to use numbers.
The listbox is not going to be shown. Is it able to do this, or is there something that would work better?
I'm guess that a listbox would be the way to go. There will be a listbox for every location and every character, when a character pick up an object from a location that object is moved from the location's listbox to the character's listbox.
I'm having problems with how to use listboxes.
Say I have a listbox called myData.
myData.addItem("Flower");
myData.addItem("Pen");
myData.addItem("Herb");
myData.addItem("Herb");
myData.addItem("Herb");
I'll add five items, three herbs, a flower and a pen. That works fine, the five items show up great.
Yet now say I want to remove one Herb from the listbox.
myData.removeItem("Herb")
That doesn't work.
if (notData = hasa”herb”) {
myData.removeItem("Herb")
myData.addItem("Herb")
}
Also I'll need to know how to use IF THEN statements and how to swap objects.
I know about removeItemAt and how to use it, but I don't want to be forced to use numbers.
The listbox is not going to be shown. Is it able to do this, or is there something that would work better?