How to exempt a State Variable from being loaded upon Save.slots.load [Sugarcube 2]

0 votes
asked Oct 12 by puppetz87 (250 points)

Hello everyone,

Following up from my previous post: http://twinery.org/questions/1880/how-to-remember-an-array-of-objects?show=1880#q1880 ,

I would like to know if there's a way to exempt a variable from being loaded when the Save.slots.load method is executed, or alternatively is it possible to execute a script that stores the state variable data externally (i.e. not through the variable store) so that I can retrieve it after executing a save.slots.load?

I want to add that the variable data im trying to store is an array of objects, each with their own individual properties. I apologize if making this second post is unnecessary, but I feel that this is a completely different question from my previous post.

2 Answers

+1 vote
answered Oct 12 by Chapel (33,020 points)

You can make variables that aren't part of the state. It's generally recommended that you use the setup object for things like this. 

<<set setup.var to "blah">>

If that for some reason won't work for you, then you can use the Config.saves.onLoad property to create a single use task object to reset or otherwise change story variables when the game is loaded. I can write you up an example of that if needed, but I think just using the setup object or similar is your best bet, depending on what you're doing. 

commented Oct 15 by puppetz87 (250 points)
Awesome.  Thanks for the help.  I'm going to try your method in addition to TME's and see which one works best.
+1 vote
answered Oct 12 by TheMadExile (20,310 points)

If you want your stashes to be persistent, see my comment on your other thread.  If that's not a requirement, then Chapel's idea will work.

 

commented Oct 15 by puppetz87 (250 points)
Thanks again TME.  I'm going to try both methods and see which one works best for me in the context of my game.  :D
Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...