Saving

Started by .., Fri 27/08/2004 22:00:53

Previous topic - Next topic

..

Hi

Is there a way to have like a save button that when you click automatically saves the game under a pre determined name for that section of the game?

For example if the player was in a church and they clicked save it would display a message like 'Game Saved' and when they next go to load it would be under - Church *ins Date Here*

??

Edwin Xie

Uh, maybe maing a save GUI and then use GetRoomNumber and GetDate or something similar to that? And then....well look for the source code of the default save dialog.
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Jay

Yeah, basically what Edwinxie said.
You'd use something like,
if (character[EGO].room==whatever) SaveGameSlot (30, "Church");

Inserting the date would be a bit more complicated, but not too hard. You would use the GetTime() function.

SilverWizard_OTF

You can create a variable, whose value will be changed according the room that the player will be in.
     Global script:
int Save_value;

At the end of global script you should type: export save_value, and at script header, import save_value. So to be able the room script to read and edit this value.
At the interaction editor--> before fade in, of each room, you should change its value,  (  Run script:  save_value= //room number) according to the room number, so to be able to keep track of where is the player.

Then, when character clicks SAVE button, run a script like that:
        if(save_value==4) SaveGameSlot(1,"Church", GetTime);
e.g.  if(save_value==5) SaveGameSlot(1,"Graveyard",GetTime);
Where 4 it is the Church's room number.
Where 5 is Graveyard's room number.

I am not sure about if it is right to add a GetTime command where i added it. Try first without it  ( SaveGameSlot(1,"Church");), then try to add the GetTime command where i put it.

I hope i helped a bit.
"All we have to decide is what to do, with the time that is given to us"

Ashen

#4
A similar but slightly different approach would be to use the 'Room Properties' function in the editor, and create a NAME property in each room, which would save you from having to have a different if (save_value == x) ... for each room. Then something like:
Code: ags

string savename;
string savedate;
GetRoomPropertyText("NAME", savename); // passes the rooms name, set in the editor, to the savename string
StrFormat (savedate, " %d/%d", GetTime (4), GetTime(5)); // passes the date to the savedate string
StrCat (savename, savedate); // combines the two
SaveGameSlot (3, savename); // saves to slot 3


Or whatever works for your save GUI. This'll save to slot 3 with a name like 'Church 28/8'
I know what you're thinking ... Don't think that.

Phemar


I think Ashen's got it.

SMF spam blocked by CleanTalk