How to save/load your game in "novella" theme?

I am trying to make a game without using the command bar. Most stuff works like a charm, but for the life of me, I can't figure out how to make the game save if you can't type in "save". Does anyone have a good solution for save/load mechanic in "novella" theme?


Game progress saves automatically online and there’s a bar at the top of offline games with a save button on it (or there used to be).
Otherwise you’d need to devise a way of incorporating the save function in link form into your game using the command function with the text processor.


I understand that and I apologize for being unprecise. You see, I am aiming for a bit of immersion, so I would like to be able to save only when using a typwriter. I have an idea how to sidestep the issue by summoning the command bar when using the typewriter, waiting for input so that the player can write "save", and then removing the command bar after that. But, I would really like to skip the whole command bar interface. So please, any help would be appreciated.

While we are at it, I also have a puzzle where you need to put some items into a big suitcase in order to be able to carry those things from location A to location B. I made it work, but the problem I am having is that any player can open the suitcase while it is in the inventory. I would like to make the suitcase unopenable while in my inventory, and then openable again when dropping it on the ground. I wonder if you might know those two commands for making objects openable/unopenable on request? I know you can tick it on/ff in the UI, but I need to be able to do it through a script.


The first issue can be resolved using the text processor - I’m afk atm so cant give an example presently. I’ll get back to you later though if nobody else does.

The second issue you use the code I showed you earlier where the game checks if the object is carried first before performing the action. I’ll give an example of that too later if nobody else answers.


One of the problems is though (as I wanted to do something similar with one of my games) you can’t get rid of the existing save systems. Unless that’s changed, I couldn’t work out how to do it a couple of years back though.


The thing is, I am pretty good with IF statements and I really don't see how you can make it work through an IF script. I already have a very complicated IF script upon picking up the suitcase, so I am worried that doing it through a script would cause more headaches down the line. But I ll wait.

All I really need is just the command to make the suitcase unopenable for the duration of being inside my inventory. Something like:

Add_to_inventory object suitcase
Make_suitcase_unopenable

The same could be probably achieved if anyone just knew the "save" command. I could just use the computer and then call on "save" command.

Unfortunately, I don't understand the programming language, so I am just stuck at this point. It's probably something like JS.SaveGame or something. I really wish there was a dictionary or a list with these commands somewhere where you can go check it.


You need to place the If command within the function to open the suitcase. I’m still afk but I can imagine the problem - it’s a core function which can’t be edited in that way.
Well it can, you just need to know how to edit the core functions but that also alters the core function for the entire game. It’s doable though.
Alternatively you’d need to build your own suitcase from scratch (rather than using the core container function). Someone like the pixie or hk are better placed than me to tackle that hurdle though.


Unfortunately, I don't understand the programming language, so I am just stuck at this point. It's probably something like JS.SaveGame or something. I really wish there was a dictionary or a list with these commands somewhere where you can go check it.

There’s something you can do which opens up the core commands including save. I forget what it is atm and I’m afk.


Well, until I was waiting for the answer I came up with my own script for saving upon using the typewriter. Like I said, I would still like to avoid using the commandbar, but if anyone else is interested, this might be a temporary solution. It's not perfect since I cant figure out how to get input and then save and then immediately remove the command bar, but I made it so that the command bar pretty much disappears on the very next action. Any other ideas would be appreciated.

msg ("It occurs to you that it would probably be a good idea to <b>save</b> your memories on a sheet of paper in case you ever want to revisit them for whatever reason.")
request (Show, "Command")
SetTurnTimeoutID (2, "") {
  request (Hide, "Command")
}

2 seconds to type something? XD


Are you working online or offline?

In days of yore I think you got to the core commands by clicking something at the bottom left of the offline Quest program.


Its 2 turns, not 2 seconds. And I am using offline version.


Yes you can type in save. No, I have not played novella before.


Jmnevil54, I understand that you can type "save" in the command bar. I want to avoid using the command bar and create a game that operates only through links. So how can one save without the command bar? There must be some way to call the save command without actually having to type it.

Also, I was wondering how to make an item switch from being openable to unopenable? I know that you can tick it on/off in UI, but how would one do it with a script command?


You can run the 'save' command as if the player typed it by doing:

do (save, "script")

which runs the script associated with the save command.


You could also use a command link, I think. Something like this:

msg ("Would you like to {command:save} your game?")

In this case, the player can click the word "save" and Quest automatically types it into the command bar and submits it. This works even if the command bar is hidden.


A third option would be to use the parser directly:

HandleSingleCommand ("save")

That one causes Quest to deal with the command exactly as if the player had typed "save".


These same three methods can be used to automate just about any command the player could enter. This is quite a useful trick to learn.
For example, if you wanted to have the player automatically use a spanner on an engine, running its normal "use" verb, you could use any of the following:

  1. do (useon, "script", QuickParams ("object1", spanner, "object2", engine))
  2. msg ("You probably want to {command:use spanner on engine}.")
  3. HandleSingleCommand ("use spanner on engine")

Thanks Mrangel! You are a master at this craft! Also, I was wondering how to make an item switch from being openable to unopenable? I know that you can tick it on/off in UI, but how would one do it with a script command?


You swap the openable object for an unopenable one with the same name.


I should probably expand on that. As always there’s a few ways to do it but what I always do is have a room that isn’t connected to the game that is used to store objects. So if I want to change the properties of an object I simply move the current one to the room and the one in the room into the game.
So in your situation you could have an object that’s a suitcase in the game and a container suitcase in the object room. Using a key on the object in the game ‘unlocks’ the case and you simply run a script moving the suitcase to the room and the container suitcase into the game with the message ‘it has unlocked’.


I know that you can tick it on/off in UI, but how would one do it with a script command?

That tickbox is for the open attribute. mSo to tick or untick it during play, you would use:

object.open = false

or

object.open = true

(One mistake I've seen a few times is someone using if (someobject.open) { to check if an object is open. This checks if it's openable, and the attribute to check if it's currently open is isopen)

If you want a suitcase to be only openable when it's on the ground, one method would be adding this to the script that runs when you take it:

if (suitcase.isopen) {
  msg ("You close it and pick it up")
  suitcase.isopen = false
}
suitcase.open = false
AddToInventory (suitcase)

That way it guards against someone opening it and then picking it up. However, setting suitcase.open = true in the drop script would be a bit more complicated. Because the "drop" script is also run when you put it inside a container, even a container that you're still holding. So you'd probably need to check that.

A simpler method might be to create a changedparent attribute for the suitcase; this will automatically run whenever it is taken, dropped, or moved - so you can avoid adding extra complexity to existing take/drop scripts. This would be a script attribute; I believe in the desktop version of Quest you can create these in the attributes tab; in the web version you'd need to use an initialise script.

The changedparent could be:

this.hasbeenmoved = true
if (Contains (game.pov, this) or GetBoolean (this.parent, "open")) {
  if (GetBoolean (this, "isopen")) {
    msg ("The suitcase is too unwieldy when it's open, so you have to close it.")
    this.isopen = false
  }
  this.open = false
}
else {
  this.open = true
}

That would disable opening the suitcase if it's in the inventory or inside an openable container; and would display a message and close it if the player tries to pick it up while it's open.

Under Quest 5.8, this could be simplified a little:

this.hasbeenmoved = true
this.open = GetBoolean (this.parent, "isroom")
if (this.isopen and not this.open) {
  msg ("You have to close it.")
  this.isopen = false
}

(object can be opened only if the object it's inside of is a room ... though the previous version would also allow it to be opened on a table or other surface)

I always recommend using the change script attributes where possible, because they make it easier to respond to the results of the player's action, rather than the action itself.
The drop script is a good example. A lot of people have a script for when an object is dropped, which they use to mean "when a player stops carrying it". But if you put an object in a container, the drop script runs. If you give an object to an NPC and they put it on the ground, the drop script is not run. If you have a "sprint" command which has a chance of objects randomly falling out of the player's pockets, the drop script is not run. But the changedparent script is run every time an object is moved.


Thanks Mrangel! You hit the nail on the head again. This was extremely helpful. I just have one more question. When I try opening the suitcase in the inventory, I get the default message: "You can't open it". Is there any way to change that message into: "You can't open the suitcase while you are carrying it."

Have in mind that I will have to open the case later, so I will need to have two variations of what happens when you try opening the case. One when the suitcase is openable and one for when the case is not openable. Thanks in advance! Oh, how I wish I had your knowledge!


I don't think the message can be changed. However, you could decide to use an openscript instead.

You can give a container a script attribute named "openscript" that will be run instead of setting the isopen attribute to true.

So if you have the container always openable, but make its openscript:

if (Contains (game.pov, this)) {
  msg ("You can't open the suitcase while carrying it.")
}
else {
  OpenObject (this)
}

(the script will run only if the suitcase is reachable, openable, and unlocked, so you wouldn't want to set open to false if you were using this. However, you'd probably still want to use either the changedparent or open scripts to close the case when picking it up)

(the openscript attribute is probably somewhere on the container tab, but I don't have the editor in front of me right now)


Mrangel, I just wanted to come back and say thank you! Your knowledge and expertise is a credit to this site, which cannot be repaid with an ordinary thank you. Since you saved me so much time, I would like to repay my gratitude with this:

For days I've been bashing my head against a rock,
Only frustration and anger preventing me to stop!
As I listen to the endless ticking of the clock,
Bloody veins in my eyes remind me of my block!
How much longer can I endure this shock,
Will I ever solve this problem like a doc?
Then comes this dude with a name like a croc,
Out of nowhere and with an avatar of a frog.
He barely acknowledges me by picking up the rock
And then breaking it with but a gentle knock!

:)


Log in to post a reply.

Support

Forums