1
SCI Syntax Help / Trying to sidestep the Restore Menu (SCI0)
« on: March 26, 2024, 08:42:47 AM »
I'm trying to add a "Retry" button on the death dialog that will automatically restore the most recent save.
Here's what I have tried to no effect:
Here's what I have tried to no effect:
Code: [Select]
(repeat
(= mbResult
(Print
{Remember:\nsave early, save often!}
#title
{Words to the wise:}
#font
gDeadFont
#button
{Restore}
1
#button
{Retry}
2
#button
{Restart}
3
#button
{__Quit__}
4
)
)
(switch mbResult
(1
(if (!= (gGame restore:) -1) (return))
)
(2
(gCast eachElementDo: #dispose)
(gCast eachElementDo: #delete)
(RestoreGame objectName 0 gVersion)
(return)
)
(3 (gGame restart:) (return))
(4 (= gQuitGame TRUE) (return))
)
)
I simply added a new button called retry, and when it is clicked I copy/pasted some code from the restore method in the game script, but I am clearly missing something. Here is the code from the game script. I'm a bit out of my element when it comes to deciphering the base code, so any help would be appreciated.Code: [Select]
(method (restore &tmp gameNum oldCursor hSound)
(= gameNum -1)
(Load rsFONT gSaveRestoreFont)
(Load rsCURSOR gNormalCursor)
(Load rsCURSOR gLoadingCursor)
(= oldCursor (self setCursor: gNormalCursor))
(= hSound (Sound pause: 1))
(if (GetSaveDisk TRUE)
(if gPrintDlg (gPrintDlg dispose:))
(= gameNum (Restore doit: &rest))
(if (!= gameNum -1)
(self setCursor: gLoadingCursor)
(if (CheckSaveGame objectName gameNum gVersion)
(gCast eachElementDo: #dispose)
(gCast eachElementDo: #delete)
(RestoreGame objectName gameNum gVersion)
else
(Print
{That game was saved under a different interpreter. It cannot be restored.}
#font
0
#button
{OK}
1
)
(self setCursor: oldCursor (HaveMouse))
(= gameNum -1)
)
)
(GetSaveDisk FALSE)
)
(Sound pause: hSound)
(return gameNum)
)