MODULE: Saves List with Screens GUI v1.2/v2.0

Started by SupSuper, Thu 25/05/2006 23:45:22

Previous topic - Next topic

SupSuper

Quote from: SSH on Tue 20/09/2005 10:44:42
A savegame with screenshots module/GUE that has a list of game titles and a single screenshot displayed, rather than my one that shows multiple screenshots at a time
Well since my game uses one of those, I decided to convert it into a module. I had a look at the guidelines for modules and tried to follow what I understood, hope I didn't do anything wrong. Instructions and more detailed info included inside.



v2.0 (Only for AGS v3.0 and later)
- New version for AGS v3.0
Download here

v1.2 (Only for AGS v2.72 and earlier)
- Added support for AGS v2.72 (v2.71 should still work)
Download here

v1.11
- Now you can also show/hide the GUI by changing the gSavelist.Visible, though I don't condone this :P
Download here
Mirror (Thanks Candle!)

v1.1
- Now you can overwrite existing saved games by selecting them
- The game now checks for the 20-savegame-limit
- No more problems with forgetting to turn on "Save screenshots in savegames"
Download here

v1.0
Download here
Mirror (Thanks Neole!)
Programmer looking for work

jasonjkay

#1
Sounds great, I'll add it to my site tomorrow.
http://www.americangirlscouts.org/agsresources/ - Mods, plugins and templates.

SSH

12

Play_Pretend

I don't know if I'm doing something wrong here...I plugged in the module and GUI, changed key and top menu responses to SaveList.Show();, they work beautifully except when I attempt to select a game off the saved list.  Then I get the following error:

Error: run_text_script1: error -6 running function "lstGames_Selection_Changed":
Error: Null pointer referenced
in Saves List with Screens GUI (line 72)
from Global script (line 158)

Line 158 is just:
#sectionstart lstGames_SelectionChanged  // DO NOT EDIT OR REMOVE THIS LINE
function lstGames_SelectionChanged(GUIControl *control) {

   SaveList.Select();  // This line is 158
 
}
#sectionend lstGames_SelectionChanged  // DO NOT EDIT OR REMOVE THIS LINE

Did I screw something up? :)

SupSuper

Did you turn on "Save screenshots in save games" in the game's General Settings?
Programmer looking for work

Play_Pretend

#5
*smacks palm into face*

I can't believe I'd even forget that... :)  No, I didn't, and I'll be trying it just as soon as I get home.  I'll let you know how it turns out, and try to get the egg off my face now. :)

EDIT:  Ha!  Yep, that did the trick.  It works fine now, thanks a bunch! :)

SSH

Mayeb the module should turn this on in its game_start function?
12

SupSuper

#7
Quote from: SSH on Wed 12/07/2006 14:04:23
Mayeb the module should turn this on in its game_start function?
Umm, I don't know how to do that.

Ok, new version. This one should display an error if you try to exceed the savegame limit, and it also allows you to overwrite existing games by selecting them (you'll create a new savegame if none are selected). To unselect, just close and reopen the dialog.
Programmer looking for work

strazer

#8
Quote from: SupSuper on Wed 19/07/2006 16:35:56Umm, I don't know how to do that.

Check out the SetGameOption function.

Shade

#9
i am using the newest version of ags and i imported the module and the gui and wanted to test it but if i click on the "save" or "cancel" button i get these errors:

QuoteAn internal error has occured. Please not down the following information.
If the problem persists, contact Chris Jones.
(ACI version 2.72.920)

Error: run_text_script1: error -6 running function 'btnSave_Click':
Error: Null pointer referenced
in Saves List with Screens GUI (line 74)
from Save List with Screens GUI (line 100)
from Global script (line 168)

QuoteAn internal error has occured. Please not down the following information.
If the problem persists, contact Chris Jones.
(ACI version 2.72.920)

Error: run_text_script1: error -6 running function 'btnCancel_Click':
Error: Null pointer referenced
in Saves List with Screens GUI (line 74)
from Global script (line 176)

screenie.Delete(); (line 74)
SaveList.Hide();   (line 100)
SaveList.Save();   (line 168)
SaveList.Hide();   (line 176)

Actually all i did was to import the module. when i hit the "save" or "cancel" button the game immediately crashes so that i can't see whether there is a screenshot or not.
here are the functions:
Code: ags
function btnSave_Click(GUIControl *control, MouseButton button) {
  
	SaveList.Save();
}
Code: ags
function btnCancel_Click(GUIControl *control, MouseButton button) {
  
	SaveList.Hide();
}

Alynn

I had somewhat the same error... I believe it came from me calling the GUI like

gSaveGui.Visible = true;

When I changed that to SaveList.Show() it worked correctly...

I also double clicked each button to make sure the script was there... that fixed any sort of problems...

so try both of those and see if it fixes it for you.

Shade

i called the GUI with gSaveGui.Visible = true; too and SaveList.Show() did the trick.  :D
works for me now. thanks!

SSH

Perhaps SupSuper coudl add to the module:

Code: ags

bool guistatus;

function repeatedly_execute() {
  if (gSaveGui.Visible && !guistatus) {
    // Do whatever extra stuff Savelist.Show does, or maybe just call it
  }
  guistatus=gSaveGui.Visible ;
}


So that either way works...?
12

SupSuper

#13
So you're telling me I went to the trouble of writing instructions so in the end I have to do more work for people that don't read them? ::)

Anyways, I don't really understand how the above would work. Wouldn't it keep running said function while the GUI is/isn't visible?
Programmer looking for work

monkey0506

No...it wouldn't keep running.

That's why he put the bool "guistatus" in there.

The first loop that gSaveGui is visible, guistatus is set to false (it is initialized to false (0)), so the function would be run. After that, guistatus is set to true because gSaveGui.Visible still equals true. When the user turns gSaveGui off (gSaveGui.Visible = false) then the function won't be run, and guistatus will be set to false.

SupSuper

Well that still creates another problem. See, if you bring up the GUI "manually", you'll end up with the GUI splattered over the screenshot, since everything else has to be done AFTERwards.
The built-in Show() function does all that BEFORE showing the GUI, to prevent this problem.

So you'll just have to learn to read the instructions. :P
Programmer looking for work

SSH

Maybe the special code coudl turn the GUI off again, wait 1 cycle for the screen to update, then call Show()  :P


The customer is always right!
12

monkey0506

You could just put:

Code: ags
if (gSaveGui.Visible && !guistatus) {
  gSaveGui.Visible = false;
  SaveList.Show();
  }


That would solve the problem.

[EDIT:]

SHUT UP SSH! I WAS POSTING FIRST!

:=  :D Just kidding. ;) You beat me fair and square. :)

SupSuper

Oh come on people, I like being lazy, let me live my dream. :'(

Fine fine, it's done, though at the price of a 1-gameloop-delay. If something bad comes out of this, I'll blame you guys. :P

Oh, and I couldn't change the version in the module info because I screwed up and ended up locking myself out of it.
Programmer looking for work

strazer

Quote from: SupSuper on Wed 02/08/2006 17:27:11Oh, and I couldn't change the version in the module info because I screwed up and ended up locking myself out of it.

You could just create a new module and copy the whole code in there.

SMF spam blocked by CleanTalk