Save / Load library not working [Moved to the Quest Forum]
M4u
16 Jul 2024, 14:07Hi guys, I tried to use the new library to save a game but it is not working:
https://github.com/ThePix/quest/wiki/Library:-Save-and-Load
It gets stuck in: "About to do clones"
Any advise or a different way to save when playing online?
Thank you,

daeun
16 Jul 2024, 14:20Just double confirming, pixie's save-and-load might indeed be not working
as I had tried before in
https://textadventures.co.uk/forum/quest/topic/kx6xtevrhug7dvspfkdz9q/running-start-script-on-every-play-even-on-saves
PsychoVyse
22 Jul 2024, 08:54I'm also interested to know as I heavily rely on object clones and will need to reload them in the same state as they were when they were saved.
PsychoVyse
23 Jul 2024, 20:09I noticed you posted a Quest 5.8 guide to saving yet this is the QuestJS forum, this is the guide to saving on QuestJS https://github.com/ThePix/QuestJS/wiki/Save-Load
NOTE FROM MODERATOR: This thread was moved to the Quest Forum after this was posted.
M4u
27 Aug 2024, 22:18Thank you PsychoVyse, where can i get QuestJS? is that Quest 6 as mentioned in the article? Is it the version online?
K.V.
28 Aug 2024, 04:51Hello.
where can i get QuestJS? is that Quest 6 as mentioned in the article? Is it the version online?
https://github.com/ThePix/QuestJS
K.V.
30 Sept 2024, 03:09If you are still checking this thread, the normal online saving feature has recently been fixed.

TextMisadventures
23 Nov 2024, 04:09For anyone reading this who is having this issue, I believe this might be what happens when the game includes a |
in the code somewhere.
https://github.com/ThePix/quest/wiki/Library:-Save-and-Load
Clones
It can handle clones, but you do need to set them up. When a save-game is loaded, all existing clones in the game world are destroyed, and then all the clones from the save-game are re-created. Note that they will be cloned from the saved prototypes, so if your prototype has changed, it will be a clone of the prototype as it was when the game was saved.
To ensure a clone gets its attributes set properly, you need to give the prototype a "saveloadatts" attribute - and Quest will refuse to clone anything without it. The attribute should be a string list of attributes to save. Unlike the "saveloadatts" attribute of the
game
object, Quest will attempt to guess the attribute type, and is restricted toint
,string
andboolean
Limitations
Your game name must not include a vertical bar,
|
.This cannot cope with attributes that are scripts, dictionaries or lists, except for string lists and dictionaries of string lists (if the latter seems somewhat obscure, it is because it is required internally). You certainly can use these other attributes in your game, they just will not be saved, so you cannot have them change during game play.
It cannot cope with objects that are created during game time, as you will not know their names or types. It can handle cloned objects, so you can work around that limitation.
It assumes the player object is called "player", and does not allow for changing POV.
The
firsttime/otherwise
script command saves deep in the underlying code, inaccessible to Quest, and therefore cannot be saved. It is probably best avoided altogether. You can use theonce
text processor directive.
<function name="GetCloneData" type="string"> ol = FilterByNotAttribute(AllObjects(), "prototype", null) sl = NewStringList() msg("About to do clones") foreach (o, ol) { s = o.name + "/" + o.prototype.name if (HasAttribute(o, "saveloadatts")) { foreach (att, o.saveloadatts) { s = s + "/" + GetAttribute(o, att) } list add (sl, s) } else { error("Clone prototype, " + o.prototype.name + ", has no 'saveloadatts' attribute.") } } return (Join(sl, "|")) </function>
To test this theory, one could replace this line:
return (Join(sl, "|"))
... with these 2 lines:
msg("About to return GetCloneData...")
return (Join(sl, "|"))