Game saves and Access Rights?!

Hello, immensely huge forum! I was wondering if there would be someway to implement 'Auto-Saves' in my game? Also, is there a way that when I update my game it'll reappear on the 'Latest Games' section, at the website? In an older post, someone told me it was possible by changing the 'Access Rights' of the game, but I don't know how to.

Thanks.


Also keen to see if there's a way to do auto-saves. If not, is that a possible feature for future Quests?


K.V.

Sorry! I somehow didn't see this thread until the second post!


You can add these to your game in full code view:

<function name="OnlineCheck" type="boolean"><![CDATA[
  s = " " + 0.1
  return (Instr(s, ",") > 0)
]]></function>
<command name="savecmd">
  <pattern>save</pattern>
  <script>
    DoSave
  </script>
</command>
<function name="DoSave"><![CDATA[
  if(OnlineCheck()){
    JS.saveGame()
  }
  else{
    request (RequestSave, "")
  }
]]></function>

Now, every time you want to save, just add DoSave to the script.

Note that it will popup a window prompting the player to enter the save's filename on the first save.


Is it possible to have the regular save command save to one file, and have an autosave feature save to a second file?


K.V.

Is it possible to have the regular save command save to one file, and have an autosave feature save to a second file?

You'd have to change the source code, build your own version of Quest, and be sure the player was using that version of Quest (on their Windows desktop) to play the game.

...or be sure that people can only play the game online and change the way the Javascript saveGame() function works.


I'll get right on it then : )


I'm trying to post a bunch of code here, but there is a problem when I copy and paste from full code view into the post. Two extra spaces are added to each line (because they were copied when I highlighted the code in full code view). Any way to get rid of the extra spaces without having to manually delete them all?


All right, I'm just copying and pasting from the local code view. I created an autosave feature with 3 sections of code...

First, paste this in full code view under the game object (these are game attributes):

<autosave>off</autosave>
<ASTurns type="int">-1</ASTurns>
<ASNthTurn type="int">0</ASNthTurn>

Secondly, create an "autosave" command with the following regular expression:

^(autosave|auto) ((?<text>on|off)|(?<text>\d+)|(?<text>.*))$|^autosave|auto$

and paste this into the script code view of the autosave command:

if (player.currentcommand = "autosave" or player.currentcommand = "auto") {
  if (game.autosave = "off") {
    HandleSingleCommand ("autosave on")
  }
  else {
    HandleSingleCommand ("autosave off")
  }
  msg ("To enable autosave (every 20 turns), type \"autosave on\".  To disable autosave, type \"autosave off\".  To enable autosave every (nth) turn, type \"autosave\" plus the desired number.")
}
else if (LCase(text) = "on") {
  if (game.autosave = "on") {
    msg ("The game is already autosaving every 20 turns.")
  }
  else {
    request (RequestSave, "")
    msg ("<br/>The game will now autosave every 20 turns.")
    game.autosave = "on"
    game.ASTurns = -1
    game.ASNthTurn = 20
    EnableTurnScript (Autosave)
  }
}
else if (LCase(text) = "off") {
  if (game.autosave = "off") {
    msg ("Autosave is already off.")
  }
  else {
    msg ("<br/>Autosave is now off.")
    game.autosave = "off"
    DisableTurnScript (Autosave)
  }
}
else if (IsInt(text)) {
  if (ToInt(text) > 0) {
    game.ASNthTurn = ToInt(text)
    request (RequestSave, "")
    if (game.ASNthTurn > 1) {
      msg ("<br>The game will now autosave every " + game.ASNthTurn + " turns.")
    }
    else {
      msg ("<br/>The game will now autosave every turn.")
    }
    game.autosave = "nth"
    game.ASTurns = -1
    EnableTurnScript (Autosave)
  }
  else {
    msg ("To enable autosave every nth turn, you must use a number greater than 0.")
  }
}
else {
  msg ("To enable autosave (every 20 turns), type \"autosave on\".  To disable autosave, type \"autosave off\".  To enable autosave every (nth) turn, type \"autosave\" plus the desired number.")
}

Thirdly, create a turn script (not enabled) and paste this under its script code view:

game.ASTurns = game.ASTurns + 1
if (game.ASTurns > 0 and game.ASTurns % game.ASNthTurn = 0) {
  request (RequestSave, "")
  if (game.ASNthTurn > 1) {
    msg ("<br>The game is autosaving every " + game.ASNthTurn + " turns.")
  }
  else {
    // Don't need to print message if autosave is running every turn.
  }
}

Now, in-game, if you type "autosave on", it will autosave every 20 turns. "Autosave off" will of course turn it off. Just typing "autosave" will toggle autosave on or off depending on its current status.

Furthermore, you can type "autosave" followed by a number greater than 0 to autosave every X number of turns! If you type "autosave" followed by anything else, it will give you a short help explanation.

You can also type "auto" in place of "autosave". Autosave uses the regular save file.


K.V.

Public Service Announcement

If you just use request (RequestSave, ""), none of the game's text will be on the screen when loading a saved game online. That's why I do that check for the online player, then either use JS or request, depending upon the situation.

I made the DoSave() functions to handle that.


Then KV's 2 functions can be combined with my autosave. Just replace each instance of my request (RequestSave, "") with KV's DoSave ()


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums