Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Format shortcuts and complex saving in Sugarcube

edited April 2015 in Help! with 1.x
I suspect my use of Sugarcane shortcuts is biting me in the rear whenever I try to use Sugarcube, but I decided I probably need Sugarcube's save capability, unless there's a relatively simple way of saving some specified variables to browser storage. So I have two questions for anyone who knows Sugarcube well enough to answer.

1. Is the <<$variable/passage>> shortcut syntax that Sugarcane allows for replacing <<display passage>> or <<print $variable>> not supported in Sugarcube? I switched over and immediately practically everything broke because I've been using that syntax all over the place. (Do I really have to go back through and insert "display" or "print" into each individual link, in other words?)

2. Does Sugarcube saving allow for saving the content of specified variables too? For my project, it's not sufficient to simply save the passage that the player has reached because it's an RPG gamebook, so I need to save stats, experience, inventory, that sort of thing. It looks like there's a metadata property, but does that only hold one variable, or several? Can I stuff multiple arrays' worth of data into it? And can I intercept that information on load and distribute it back into the places it needs to be in order to restore the user's progress? I don't see much information on actually using the metadata property.

Thanks!

Comments

  • The answer to the second question is yes, SugarCube saves the status of variables. It happens automatically. The only save system setup I've done is specify SugarCube to disable browser history controls, and full variable saving works for me.

    I'll let someone more knowledgeable answer your first question since I'm not familiar with SugarCane and have not much idea of what you're talking about there. I just use <<print $variable>> whenever I want to display a variable.
  • telyni wrote:

    1. Is the <<$variable/passage>> shortcut syntax that Sugarcane allows for replacing <<display passage>> or <<print $variable>> not supported in Sugarcube?


    No, neither shorthand syntax is supported. 

    For the shorthand &lt;&lt;print&gt;&gt; syntax, you'd have to add the macro name (print) back in.

    For pseudo macros (which is the purpose of the shorthand &lt;&lt;display&gt;&gt; syntax), you'd either need to add the macro name (display) back in, if you weren't actually using it as a pseudo macro, or convert it over to a widget macro (via &lt;&lt;widget&gt;&gt;), if you were using it as a pseudo macro.


    telyni wrote:

    2. Does Sugarcube saving allow for saving the content of specified variables too?


    Yes.  All history up to the point where the save is made, including the story's $variable store, is saved.  Conversely, the entire saved history, including the story's $variable store, is restored when a save is loaded.  The whole point of SugarCube's save system is to be as transparent as possible and just work.  You don't have to do anything special, it just works, right out of the box.

    You may want to check out the completely optional configuration properties for saves (config.saves.*).  They offer several ways to change how the saves system behaves.

    You probably will not want, nor need, to use the SaveSystem API directly.  As to the metadata property, specifically, it's just what it says on the tin (i.e. it's for metadata).  You definitely do not want to be stuffing raw story data into it.
  • Awesome, thanks for the expert response! Guess I'm going to do whatever it takes to get Sugarcube running now, as that's exactly what I need for the saving. I will have to look into the widget stuff, as I have quite a number of pseudo macros.
  • Thanks for this. Exactly what I was looking for when my story broke upon switching to SugarCube. I did a Replace Across Story from <<$ to <<print $ and all was well with my world once again.
Sign In or Register to comment.