Custom restore gui

Started by piraatlife4me, Fri 06/02/2004 22:23:09

Previous topic - Next topic

meowy

Giving it a shot.. will post more after I fight with it some more hehe.  Thank you!

I had the f5/f7 working okay using what you posted, but the UI link still wasn't working.  So I tried to just erase the bit from the UI and now none works hahaha argh!!

I think I'll get it back working f5/f7 again and attempt removing the clickable link from the GUI screen and just write a little text note on how to save and restore.  Nice and simple.. I hope haha

I've since broke my quit UI too ahaha.. sheesh.  But hey, at least I know why that one doesn't work now!  Go me! =)
- meowy

Scorpiorus

#21
QuoteI had the f5/f7 working okay using what you posted, but the UI link still wasn't working. So I tried to just erase the bit from the UI and now none works hahaha argh!!
What is the GUI link btw? Do you mean you turn on your save/load GUI from another GUI (like what I mentioned) or is it a SAVE GUI button to save the game that doesn't work?

meowy

#22
Oh my gosh!! It works! =)  Woohoo thank you so much!  It all seems so simple now sheesh.

Obviously I should not post when I'm sleepy hehe.. I know what I meant to post a couple days ago but reading that, it makes no sense up there.  Hrm.  I'll try to explain, just in case anyone stumbles across this later on haha.

I couldn't get the ICONBAR clicky bit.. the little "load" and "save" click spots..  ?  Not sure what to call them.. but the images linked up to LOAD and SAVE GUI's.  They were loading up the wrong thing.

Just 20 minutes ago it clicked in my brain where I am supposed to put the GUIOn like from on_mouse_function, to make them work *laughs*  Gah.. I get it now at least haha

So now both F5/F7 and then clicking the ICONBAR link.. thingies.. bring up the proper screens.   It restored my game just fine too =)


I think I have a new problem.. I changed rooms during the test run, once I did that the script seemed to stop for the LOAD/SAVE buttons on the GUI and by F5/F7.  The ICONBAR gui works otherwise though.  (The look/walk/paw and quit all work fine)

Even returning back to the room I started in, it didn't start working again.  It's just with the save/load.

This time I'm fully awake, and I'm not sure if what I've said makes sense haha.  Going to do a search of the forum and see if anyoen else has had this problem though, figured i"d mention it before I hit post though =) (Edit, not sure what to search for.. so far not finding anything though.)

Thank you again for the help :)


EDIT:   If I change rooms, the F5/F7 actually DO work.  It's the Save/Restore buttons that are on the ICONBAR ui that pops up at the top of the screen that are breaking.  They act as if there's no script connected (But there is, since it works in the starting room before I change rooms.)


Here's what I have for the ICONBAR:



 if (interface == ICONBAR) {
   if (button == 4) {  // show inventory
     show_inventory_window();
   }
   else if (button == 5) {   // use selected inventory
     if (character[ GetPlayerCharacter() ].activeinv >= 0)
       SetCursorMode(4);
   }
   else if (button == 6)   { // save game
   SetTextBoxText(SAVE,1,""); // Clear Text box
   ListBoxSaveGameList(SAVE,3); // Fill List Box with saved games
   index=ListBoxGetNumItems(SAVE,3); // Count how many saved games there are
   if (index>19) { // If saved games 20 (maximum)
   Display("You must overwrite a previous saved game"); // Display warning
   }
   GUIOn(SAVE); // Bring Save interface on
   }
   else if (button == 7) {  // load game
        ListBoxSaveGameList(LOAD,0); // Fill List box with saved games
   GUIOn(LOAD); // Bring restore Interface on
   }
   else if (button == 8)   // quit
     GUIOn(6);
     
   else if (button == 9)    // about
     Display("JammieGirl and Cat (Spring 2004)[[Adventure Game Studio v2 run-time engine[[Copyright (c) 1999-2003 Chris Jones");
 }  // end if interface ICONBAR
- meowy

Scorpiorus

#23
QuoteEDIT: If I change rooms, the F5/F7 actually DO work. It's the Save/Restore buttons that are on the ICONBAR ui that pops up at the top of the screen that are breaking. They act as if there's no script connected (But there is, since it works in the starting room before I change rooms.)
That's strange, but I remember it happend to me too but it's gone when I reboot the system. Try putting the following script into the on_interface_click() function:

if (interface == ICONBAR) {

Ã, Ã, Ã, if (button >= 0) Display("button %d is pressed!", button);

if (button == 4) { // show inventory
show_inventory_window();
}

...
...
...

This should display the button number once you clicked it on with the mouse. :P Does it work with buttons 6 and 7 at all? ...and after changing rooms?

piraatlife4me

Hey guys,
Sorry Meowy to butt in here but now I'm having troubles again!arrgggghh I was wondering if you guys might know of a solution here. I have been reading your problem and mine is kinda similar. My save/gui works ok accept it will only let me save and load only two games at a time. What I mean is in the save list box and the restore list box it only lets me have two games available and if two games are already saved it just overwrites one of them and only displays two. Any thoughts on why this might happen? Here is my source code in the
interface_click function

if (interface==SAVEGAME) {
SetMouseCursor(8);
if (button==2) {// if save is pressed Count saved games
index=ListBoxGetNumItems(7,4); // Count saved games
GetTextBoxText(7,1,text); // Get the typed text
SetCursorMode(0);
 SetMouseCursor(0);
 StopChannel(5);
 SetChannelVolume(5,255);
 PlaySoundEx(70,5);
  game.text_shadow_color = 4;
    InterfaceOff(7); // Close the interface
  SaveGameSlot(index,text); // Save game (text as description)
game.text_shadow_color = 4;
}

else {
index = ListBoxGetSelected(7,4); // Get the selected save game
SetCursorMode(0);
 SetMouseCursor(0);
 StopChannel(5);
 SetChannelVolume(5,255);
 PlaySoundEx(70,5);
  game.text_shadow_color = 4;
  InterfaceOff(7); // Close the interface
  SaveGameSlot(savegameindex[index],text); // Overwrite the selected game
game.text_shadow_color = 4;
}
if (button==3) {
 SetCursorMode(0);
 SetMouseCursor(0);
 StopChannel(5);
 SetChannelVolume(5,255);
 PlaySoundEx(70,5);
  game.text_shadow_color = 4;
InterfaceOff(7);
}
}
if (interface == RESTOREGAME) {
 if (button == 2) {
   index=ListBoxGetSelected(8,0);
   SetCursorMode(0);
SetMouseCursor(0);
game.text_shadow_color = 4;
GUIOff(8);
RestoreGameSlot(savegameindex[index]);

   }
 else if (button == 3) {
   SetCursorMode(0);
 SetMouseCursor(0);
 StopChannel(5);
 SetChannelVolume(5,255);
      PlaySoundEx(70,5);
         game.text_shadow_color = 4;
    GUIOff(8);

   }
 }
I have tried lots of different things here and still end up with some kinda problem. Am I ordering these things wrong?
Daniel
Winebarger

Scorpiorus

#25
Quote from: piraatlife4me on Mon 08/03/2004 16:49:26I have tried lots of different things here and still end up with some kinda problem. Am I ordering these things wrong?
Currently the save script saves a game whatever GUI element you clicked  (including button 3), because of:

...
else {
index = ListBoxGetSelected(7,4); // Get the selected save game
SetCursorMode(0);
SetMouseCursor(0);
StopChannel(5);
SetChannelVolume(5,255);
PlaySoundEx(70,5);
game.text_shadow_color = 4;
InterfaceOff(7); // Close the interface
SaveGameSlot(savegameindex[index],text); // Overwrite the selected game
game.text_shadow_color = 4;
}
...

it's even worse if there is no slot selected at that time because then ListBoxGetSelected(7,4) returns -1 (i.e. index=-1) and we have SaveGameSlot(savegameindex[ -1 ],text)!!
Therefore, replace else with else if (button==XXX)

Delete all the saved games from compiled folder and see if it helps to solve the problem.

piraatlife4me

Hey Scorpiorus! It's been a while.
It's Dan here, so I understand what you mean but the problem I am still having is if I just click in the list box on the save I want. It just automatically saves over the game and if nothing is in the list box above it just overwrites it without a name. So I just get a gui full of blank saved game files. I need the name of the save game file to appear in the text box when you click on each game in the listbox. I also don't want it to automatically overwrite the game just because the player clicks is there an easy way to do that? I think that would solve my problem.

Daniel
Winebarger

meowy

Rebooting fixed my problem :)

Guess I can't run EverQuest and AGS together haha

All works great now, thank you kindly!
- meowy

Scorpiorus

#28
Quote from: piraatlife4me on Mon 08/03/2004 21:31:31
Hey Scorpiorus! It's been a while.
It's Dan here, so I understand what you mean but the problem I am still having is if I just click in the list box on the save I want. It just automatically saves over the game and if nothing is in the list box above it just overwrites it without a name. So I just get a gui full of blank saved game files. I need the name of the save game file to appear in the text box when you click on each game in the listbox. I also don't want it to automatically overwrite the game just because the player clicks is there an easy way to do that? I think that would solve my problem.

Daniel
Winebarger
Sorry for such a late reply Dan. I see what you mean here. Unfortunately, the save/load part is one of those things that incorporate both scripting and making of GUI forms. Therefore instead of posting a raw script code I'll try to come with a save/load template that includes the features we are discussing. :)


Quote from: meowy on Mon 08/03/2004 22:47:02
Rebooting fixed my problem :)

Guess I can't run EverQuest and AGS together haha

All works great now, thank you kindly!
Glad it works now :)

~Cheers

piraatlife4me

Oh scorpiorous it's totally cool I figured out some kind of way around the problem. (sort of...ok you got me...not really)  BTW thanks for letting me know about that template. What a great idea.  I'm sure many other people would find that very useful in ags creation especialy people like me who are new to ags and it's compatibility. I definitely will look forward to that becoming available :)

Thanks again buddy

Daniel
Winebarger

SMF spam blocked by CleanTalk