[SOLVED] Can't get SetRestartPoint to work properly

Started by Cassiebsg, Sat 30/08/2014 23:24:40

Previous topic - Next topic

Cassiebsg

Me again.

Sorry about posting once again, but I can't get the SetRestartPoint to do what I need it to do. Been at this all day, so I cast the towel in the ring now, and try to get the experts to explain...

Explaining: I have created a room 300 as my start menu, from then it loads room 301 which is a "cut scene" currently consisting of a dialog, and then it moves to room 1.
Now, when using the restart option in game, it defaults to room 300, but I want it to restart at room 301! So I added the SetRestartPoint, problem then occurs, cause the dialog does not start and thus it's impossible to continue and play the game. :(
I have tried adding it to the first load, room load, before fadein, after fade in, rep_exec, inside the dialog right at the start, creating a room 400 with just SetRestartPoint and player change room... nothing seems to work. :/
Any ideias? Or do I really need to impose the start menu on the player, if he/she wants to restart the game? Seems kind of annoying...

Is it me, that am missing something here? Can I do a "if restorepoint=true, then run dialog" type of thing? I'm kinda out of ideas atm...
There are those who believe that life here began out there...

Khris

When you call SetRestartPoint(), AGS waits until all blocking events have stopped, then saves the game to slot 999. Restarting the game restores that slot.

If you call SetRestartPoint(), then run the dialog immediately after, SetRestartPoint() will not get called until after the dialog; possibly only in room 1. From what you describe, it sounds like it is never called at all though.

Try this in room 301 (including of course linking the events to their functions):
Code: ags
function room_Load() {
  SetRestartPoint();
  SetTimer(1, 2);
}

function room_RepExec() {
  if (IsTimerExpired(1)) dCutscene.Start();
}

This should store to 999 in the first loop, then call the dialog afterwards.

Cassiebsg

#2
Cool, that did the trick, thanks again Khris. :)
Hadn't thought about using a timer.

EDIT: Just for future reference for those that maybe having the same problem. I found out that Khris code doesn't quite work as intended. It does in fact restar where I wanted, but somehow I found out that it was messing up the next room. Once I was done with the dialog and moved to the next room, I was faced with a blocking event and couldn't do anything else but look at the screen and background events. :sad:

I've just solved this problem today! (I've know about it for about 1,5 months, but hadn't had the time to look at the code)
Remembering what Khris said: "AGS waits until all blocking events have stopped"... I did the following:

Code: ags

function room_FirstLoad()
{
  SetRestartPoint();
}

function room_Load()
{
  SetTimer(1, 2); 
}


It's now working as intended and I'm happy.
Thanks again for the help Khris! ;-D
There are those who believe that life here began out there...

SMF spam blocked by CleanTalk