Suggestion - ListBox go upwards instead

Started by Rui 'Trovatore' Pires, Sat 14/06/2003 10:28:13

Previous topic - Next topic

Rui 'Trovatore' Pires

Wouldn't it be nice if the listbox could range from 0-whatever, 0 being either the TOP item or the BOTTOM item? Alternatively, if anyone knows how to add a "Delete save game" button, I'd sure like to know about it. You see, I'm using this line -

DeleteSaveSlot(ListBoxGetSelected(5,0)+1);

- but, as you've probably realized, the save slots are numbered upwards from one, and listboxes are numbered downwards from 0.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

Scorpiorus

#1
Do you mean you want a listbox to add a new item ontop of the previous one? The listbox items indexation is the same as the save slots one, excepting that its zero-based (i.e. the first item has index number 0, but the second is 1, next 2, 3, etc...). So you use the right script to access the save slots.

..or is the problem in something else.. maybe?  ::)

-Cheers

Pumaman

DeleteSaveSlot(savegameindex[ListBoxGetSelected(5,0)]);

Rui 'Trovatore' Pires

#3
EDIT - forget what's below, I hadn't seen Chris' post. I'll try it out now.

No, we're not talking about the same thing. I'm using ListBoxSaveGameList to fill up GUI 5, the saving interface, which lists the saved games so -

3
2
1

... and the listbox selection index goes -

0
1
2
3


... so this is what happens:

                     -SAVEGAMES-
agssave.004  |inside the ship  |  listbox index 0
agssave.003  |on the beach    |  listbox index 1
agssave.002  |on the ship       |  listbox index 2
agssave.001  |in danger          |  listbox index 3


see the point? With the code I'm using, which I've specified previously, if I select "on the beach" I select index 1, and so when I push the Delete button I actually erase agssave.002. See where I'm getting at?

Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

Pumaman

The savegameindex array is there for a reason - the save games are listed in the list box ordered by the date/time the game was saved. So once you start overwriting slots, it won't even be in a backwards order, just totally random.

Rui 'Trovatore' Pires

Thanks a lot. I guess I couldn't figure it out because I still didn't really understand the savegame array. Heck, I don't even know what an array IS!
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

SMF spam blocked by CleanTalk