Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Rui 'Trovatore' Pires on Sat 14/06/2003 10:28:13

Title: Suggestion - ListBox go upwards instead
Post by: Rui 'Trovatore' Pires on Sat 14/06/2003 10:28:13
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.
Title: Re:Suggestion - ListBox go upwards instead
Post by: Scorpiorus on Sat 14/06/2003 13:54:51
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
Title: Re:Suggestion - ListBox go upwards instead
Post by: Pumaman on Sat 14/06/2003 15:56:36
DeleteSaveSlot(savegameindex[ListBoxGetSelected(5,0)]);
Title: Re:Suggestion - ListBox go upwards instead
Post by: Rui 'Trovatore' Pires on Sat 14/06/2003 15:58:50
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?

Title: Re:Suggestion - ListBox go upwards instead
Post by: Pumaman on Sat 14/06/2003 16:05:37
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.
Title: Re:Suggestion - ListBox go upwards instead
Post by: Rui 'Trovatore' Pires on Sat 14/06/2003 16:08:47
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!