Difference between revisions of "SCI Kernel Documentation/Save-Restore Game Functions"

From SCI Wiki
Jump to navigationJump to search
 
(4 intermediate revisions by the same user not shown)
Line 29: Line 29:
 
 
 
 
  
xxxxxxx body xxxxxxxx
+
==<br /> Save/Restore Game Functions ==
 +
 
 +
<blockquote>
 +
Saves the whole heap, including scripts loaded and all global, local, and temporary variables. Name is a string of the current game (ie. King's Quest#1 = KQ1), num is the number of the save game, comment is a pointer to a string that will be saved for later lookup, and version is the current version of the SCI interpreter. The game is saved under &lt;name&gt;SG.&lt;num&gt; and the file &lt;name&gt;SG.DIR contains the comment and the number for the given save game.
 +
</blockquote>
 +
 
 +
===<br /> (SaveGame name num @comment version) ===
 +
 
 +
<blockquote>
 +
Saves the whole heap, including scripts loaded and all global, local, and temporary variables. Name is a string of the current game (ie. King's Quest#1 = KQ1), num is the number of the save game, comment is a pointer to a string that will be saved for later lookup, and version is the current version of the SCI interpreter. The game is saved under &lt;name&gt;SG.&lt;num&gt; and the file &lt;name&gt;SG.DIR contains the comment and the number for the given save game.
 +
</blockquote>
 +
 
 +
===<br /> (RestoreGame name num version) ===
 +
 
 +
<blockquote>
 +
RestoreGame restores the heap in the saved game, and then starts the game from where it had been saved. If the current running SCI version does not match the restored game's one, then a message will be printed and the game will not be restored.
 +
</blockquote>
 +
 
 +
===<br /> (RestartGame) ===
 +
 
 +
<blockquote>
 +
This function resets the system to the state it had at the beginning of the game, allowing the user to restart the game without rebooting it.
 +
</blockquote>
 +
 
 +
===<br /> (GameIsRestarting [flag]) ===
 +
 
 +
<blockquote>
 +
If flag is present will set the GameIsRestarting internal flag to the given value, TRUE or FALSE. With no arguments, the function returns the value of the internal flag. The internal flag is set by RestartGame, and reset every time in the doit: of theGame.
 +
</blockquote>
 +
 
 +
===<br /> (GetSaveDir) ===
 +
 
 +
<blockquote>
 +
Return a string pointing to the current save directory.
 +
</blockquote>
 +
 
 +
===<br /> (CheckSaveGame gameName fileNum version) ===
 +
 
 +
<blockquote>
 +
Check the save game file "&lt;gameName&gt;SG.&lt;fileNum&gt;" to see if the versions match and so it can be restored.
 +
</blockquote>
  
 
&nbsp;
 
&nbsp;
Line 42: Line 82:
 
&nbsp;
 
&nbsp;
  
<span style="float: left">[[SCI Kernel Documentation/|&lt; Previous: ]]</span><span style="float: right">[[SCI Kernel Documentation/|Next: &gt;]]</span>
+
<span style="float: left">[[SCI Kernel Documentation/Picture Functions|&lt; Previous: Picture Functions]]</span>
 +
<span style="float: right">[[SCI Kernel Documentation/Animation Functions|Next: Animation Functions &gt;]]</span>
  
 
&nbsp;
 
&nbsp;
  
 
[[Category:SCI Documentation]]
 
[[Category:SCI Documentation]]
[[Category:Scripting]]
 
 
[[Category:Kernel Functions]]
 
[[Category:Kernel Functions]]
 +
[[Category:Save/Restore Game Functions]]

Latest revision as of 19:06, 3 December 2015

Official SCI Documentation

Chapter: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Index


Save/Restore Game Functions

Author: Jeff Stephenson

Revision by: David Slayback

 


Save/Restore Game Functions

Saves the whole heap, including scripts loaded and all global, local, and temporary variables. Name is a string of the current game (ie. King's Quest#1 = KQ1), num is the number of the save game, comment is a pointer to a string that will be saved for later lookup, and version is the current version of the SCI interpreter. The game is saved under <name>SG.<num> and the file <name>SG.DIR contains the comment and the number for the given save game.


(SaveGame name num @comment version)

Saves the whole heap, including scripts loaded and all global, local, and temporary variables. Name is a string of the current game (ie. King's Quest#1 = KQ1), num is the number of the save game, comment is a pointer to a string that will be saved for later lookup, and version is the current version of the SCI interpreter. The game is saved under <name>SG.<num> and the file <name>SG.DIR contains the comment and the number for the given save game.


(RestoreGame name num version)

RestoreGame restores the heap in the saved game, and then starts the game from where it had been saved. If the current running SCI version does not match the restored game's one, then a message will be printed and the game will not be restored.


(RestartGame)

This function resets the system to the state it had at the beginning of the game, allowing the user to restart the game without rebooting it.


(GameIsRestarting [flag])

If flag is present will set the GameIsRestarting internal flag to the given value, TRUE or FALSE. With no arguments, the function returns the value of the internal flag. The internal flag is set by RestartGame, and reset every time in the doit: of theGame.


(GetSaveDir)

Return a string pointing to the current save directory.


(CheckSaveGame gameName fileNum version)

Check the save game file "<gameName>SG.<fileNum>" to see if the versions match and so it can be restored.

 

Notes


 

Table of Contents

 

< Previous: Picture Functions Next: Animation Functions >