Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: foz on Thu 07/08/2003 19:07:38

Title: save game...gui
Post by: foz on Thu 07/08/2003 19:07:38
I`m having trouble with my custom save gui.....
can any one help.....
i want it to save a file......but only if there is text in the textbox....
at the moment if you click save it save it with a blank title.....
heres the script:-
if (interface==4) {
// if save interface

if (button==1) {
index=ListBoxGetNumItems(4,1);
// Count saved games  
if (index<20) {
// if less than 20
ListBoxGetItemText(4,1,ListBoxGetSelected(4,1),text);

// Get the typed text

InterfaceOff(4);
// Close interface
Wait (2);
SaveGameSlot(savegameindex[index],text);}
// Save game (text as description)

if (index>19) {
// if saved games are 20

index=ListBoxGetSelected(4,1);
// Get the selected save game

GetTextBoxText(4,0,text);
// Get the typed text
Wait(10);
InterfaceOff(4);
// Close the interface
InterfaceOff(7);
SaveGameSlot(savegameindex[index],text);}
}
if (button==2) {
index=ListBoxGetNumItems(4,1);
// Count saved games  
if (index<20) {
// if less than 20

GetTextBoxText(4,0,text);
// Get the typed text

InterfaceOff(4);
// Close interface
Wait (10);
SaveGameSlot(index+1,text); }
// Save game (text as description)

if (index>19) {
// if saved games are 20

index=ListBoxGetSelected(4,1);
// Get the selected save game

GetTextBoxText(4,0,text);
// Get the typed text
Wait(10);
InterfaceOff(4);
// Close the interface
InterfaceOff(7);
SaveGameSlot(savegameindex[index],text);}
}
if (button==3) {
InterfaceOff(4);
InterfaceOff(7);
// if cancel is pressed close interface
}
Title: Re:save game...gui
Post by: AGA on Thu 07/08/2003 21:04:36
If you use http://atticwindow.adventuredevelopers.com/tutorials.php?id=1 it should work perfectly, it always has so me in the past... If you're already using that, I dunno what could be the matter...
Title: Re:save game...gui
Post by: Spyros on Thu 07/08/2003 22:42:26
After the
GetTextBoxText(4,0,text);
You can check if the text is empty
You can check it with
if (StrComp(text,"")==1) Display("You must type a text");
Title: Re:save game...gui
Post by: foz on Thu 07/08/2003 23:38:57
Cheers  spyros.....ive still some tweaking to do but your help has pushed me in the right direction.....
thanks again..