Hullo. Sorry for posting twice in the same day.
I've sorted out a list box GUI at the bottom of the screen that displays everything the player's done, such as looking at something or "You picked up X item." and such.
Anyway, I don't want it to display everything since they began playing, so I'm trying to find a way to delete the items at the top of the list box (the ones less recent) if the number of things registered reaches 25, for example. Here's the code I've come up with:
if (ListBox.ItemCount <25) {
ListBox.RemoveItem(0);
}
I've bunged this under game_start like I do with most things. When I run the game, the yellow box thing comes up and points at the second line - which I've highlighted in blue - and says 'ListBoxRemove: invalid listindex specified.' I have a feeling I have to create a global variable, but what's wrong?
Thanks in advance.
I've sorted out a list box GUI at the bottom of the screen that displays everything the player's done, such as looking at something or "You picked up X item." and such.
Anyway, I don't want it to display everything since they began playing, so I'm trying to find a way to delete the items at the top of the list box (the ones less recent) if the number of things registered reaches 25, for example. Here's the code I've come up with:
if (ListBox.ItemCount <25) {
ListBox.RemoveItem(0);
}
I've bunged this under game_start like I do with most things. When I run the game, the yellow box thing comes up and points at the second line - which I've highlighted in blue - and says 'ListBoxRemove: invalid listindex specified.' I have a feeling I have to create a global variable, but what's wrong?
Thanks in advance.