Howdy, Stranger!

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

SugarCube releases



  • Not entirely correct.  Yes the name attribute should be set as well, oversight on my part, but the id should most certainly be getting set as well.  This is not an either-or situation.  And, I fixed the name snafu in the devel repo about thirty minutes ago, so that's no longer an issue.

    There already is, or will be, a way to set them for a group, the $variable used.  The name attribute, along with the id, are set based on the name of the $variable, which means <<radiobutton>>s are grouped by the $variable used (that's what the name attribute is for, grouping).

    The default state is another oversight, which I'll need to fix for both the <<checkbox>> and <<radiobutton>> macros.
  • Thanks for all the fixes. We now have proper groups of radio buttons!

    I know you can't just ignore the id, and it needs to be set too, but in this case all I needed was to set the name to group them. Just a very quick hack!  ;)
  • In a story I have a passage that offers several options for continuing. However, depending on what you did before and on luck, some options might fail to produce the desired effect. In this case, the remaining options will be displayed. I implemented it like this:

    :: Options
    <<if !visited("Option A")>>[[Try A.|Option A]]
    <<if !visited("Option B")>>[[Try B.|Option B]]
    [[Try C.|Option C]]
    However, if I pick option A and then use the browser's back button, the passage returned to will no longer show option A. This means that the "Option A" passage is still considered visited even though I undid the action to go there (I see the browser back button as "undo"). Is this a bug or are my expectations wrong?

    I'm using SugarCube -3030.

    Edit: I get this problem in Firefox. In Konqueror (WebKit renderer) it doesn't occur.
  • You're using Firefox aren't you.  Regardless, I'd call that a bug.
  • Published a new release which should fix the <<checkbox>> & <<radiobutton>> issues (check the docs for the new checked state syntax) and the visited() snafu in Firefox.
  • The problem no longer occurs for me in -3040. Thanks for the quick fix!
  • greyelf, regarding saving in iOS 7: That was not a silly question. Turns out that Private Browsing was on, and it was the culprit. Saves and loads now work just fine. So thanks very much for that suggestion!

    I have to say, though, I don't recall setting it to Private at all. Perhaps it came that way by default when I updated to iOS 7, or maybe I brushed the button accidentally at some point. Rather annoying.
  • Published a new release addressing some additional <<checkbox>> & <<radiobutton>> issues.  Notably, <<checkbox>> gained a required unchecked value argument, so existing uses will require updating.
  • I've encountered some Firefox weirdness in the past day (though I really, really wish I'd found it earlier).

    If I load my story, then go to other websites, and then try to return to my story (by the back button, by a bookmark, or by retyping the URL), it attempts to load but then puts up the "Error: TypeError: window.history.state is undefined" dialog. Quitting Firefox, relaunching it, and then trying my story again loads it just fine. I was able to reproduce this in Firefox on Windows and Mac. I can't reproduce it in Chrome or IE.

    This was happening in 3025. I tried updating to 3050 (since I saw that 3040 addressed some Firefox stuff), but that didn't make a difference.

    EDIT (3/25): Ah, I see. Thanks for your reply, TheMadExile. I won't worry about the problem, then!
  • TEYV wrote:

    I've encountered some Firefox weirdness in the past day (though I really, really wish I'd found it earlier).

    If I load my story, then go to other websites, and then try to return to my story (by the back button, by a bookmark, or by retyping the URL), it attempts to load but then puts up the "Error: TypeError: window.history.state is undefined" dialog. Quitting Firefox, relaunching it, and then trying my story again loads it just fine. I was able to reproduce this in Firefox on Windows and Mac. I can't reproduce it in Chrome or IE.

    That's a bug in Firefox.  It appeared 2-3 releases ago now and it seemed to be fixed in the next point release.  Apparently, it was only partially fixed.
  • Published a new release:
    • Fixed the htmlTag formatter so that it allows empty quoted-strings as attribute values.
    • Updated the htmlTag formatter to ignore line breaks within certain non-void tags (e.g. <ul>, <table>, etc).
    • Updated the either() compatibility shim to allow passing it any type and combination of arguments: scalar values, arrays, whatever.
  • I get an uncaught type error: Cannot read property title of undefined, when I try to use the replace macro set/the cyclinglink macro.
  • Trip wrote:

    I get an uncaught type error: Cannot read property title of undefined, when I try to use the replace macro set/the cyclinglink macro.

    It's been a while since I last tested those.  Let me check.  Okay, found the problem.

    I've published updates for both SugarCube itself as well as the SugarCube versions of the replacelink macro set and cyclinglink macro.  That should fix the problem.  Sorry about the trouble.
  • Another update to allow the <<checkbox>>, <<radiobutton>>, and <<textbox>> macros to set object/array properties (e.g. "$", "$foo['bar']", & "$foo[0]"), which is something I've meant to do for a while but kept forgetting about.
  • Brilliant, thanks :)
  • Need a bit of help here regarding sugarcube.

    This lines of codes does not modify the variable : I can't see what's wrong.

    How Many Zombies do you want to fight?
    <<radiobutton "$battle.enemies" 10 checked>>10
    <<radiobutton "$battle.enemies" 25>>25
    <<radiobutton "$battle.enemies" 50>>50
    <<radiobutton "$battle.enemies" 100>>100
    <<radiobutton "$battle.enemies" 250>>250
    <<radiobutton "$battle.enemies" 500>>500
    <<radiobutton "$battle.enemies" 800>>800

    if i input <<print $battle.enemies>> on any other pages after, I get my initial value of 0.
  • You are using -3065, yes?  If so, how and where are you initializing $battle?
  • Note to self... check for version when learning new things from the reference documents.

    Thanks, i'll update first.

    EDIT: It works.

    Thanks for SugarCube, it made possible to make the game I wanted to make.

    Here is a glimpse of my combat system with about 20% of the real combat system. Witch is about 10% of my game.
  • Published a new release (-3100), which includes a &lt;&lt;textbox&gt;&gt; bugfix and behavior change:
    • Fixed a race condition in the &lt;&lt;textbox&gt;&gt; macro under certain browser engines (WebKit/Blink and Presto). (n.b. the Extras button-toting variant was also updated)
    • Added a polyfill for Math.trunc().
    • Added two more Twine/Twee 1.4+ vanilla header compatibility shims: turns() and passage().
    • Updated the &lt;&lt;textbox&gt;&gt; macro to set the $variable to the default value of the control at initialization.
    • Updated certain error messages (currently, macros and HTML tags) to include tooltips on the error elements which show the source of the item which generated the error.
    • Updated the error messages of the &lt;&lt;print&gt;&gt;, &lt;&lt;if&gt;&gt;, &lt;&lt;set&gt;&gt;, &lt;&lt;unset&gt;&gt;, &lt;&lt;remember&gt;&gt;, and &lt;&lt;forget&gt;&gt; macros.
  • Published a new release (-3125):
    • Updated the htmlTag formatter to apply special processing for <a> and <img> tags which contain the "data-passage" attribute.
    • Updated the macro processing code to allow the options and setup objects to be passed as arguments.
    • Updated the python header support file to return an "unsupported" message within the StorySettings UI and to apply coloring to the titles of both widget tagged passages and the SugarCube-specific special passages. (requires Twine 1.4.2 rc1 or better)
    • Various other minor improvements.
  • Nice! Looking forward to trying this out later. Thanks!
  • Published a new release (-3135):
    • Updated the htmlTag formatter to improve the special processing for tags containing data-* attributes. In particular:
      • The data-passage attribute now supports $variables.
      • Added special processing for the &lt;area&gt; tag (same as for the &lt;a&gt; tag).
      • If an &lt;a&gt; or &lt;area&gt; tag has a data-passage attribute, then it may also include a data-setter attribute, which sets $variables (similar to the setter link wiki-text markup).
    • Various other minor improvements.
  • Published a new release (r3250):
    • Pruned long deprecated code (incl. macros).
    • Changed the wiki link and image formatters so that they accept expressions for their various components (e.g. you can now do this: [["I'll go talk to " + $who|$who + " Talk Scene"]]).
    • Retired windowHistory mode in favor of sessionHistory mode for all browsers (save Interner Explorer when using the file:// scheme), as it is simply much too slow when loading games with both large states and numbers of turns.
    • User functions and RegExp objects are now safe to store in $variables, even being automatically restored from saves.
    • Updated save exports so that they are now compressed and Base64 encoded. Their extension also changed from ".json" to ".save".
    • Updated the store area element to include Twine 1.4.2's data-size attribute.
    • Updated some error messages.
    • Added polyfills for <String>.contains() and <Array>.contains().
    • Updated all polyfills to be non-enumerable.
  • Published a new release (includes r3300 & r3305 combined):
    • Fixed an issue with the rewind menu in sessionHistory mode, which would cause it to fail, and a few other minor issues.
    • Updated the config.saves.autosave property to also accept an array of tag names.
    • Changed the document loader's message from "Loading Resources" to "Initializing. Please wait", since the former could easily be mistaken as an indication that external resources were being loaded.
    • Changed the style of the UI dialog closer so that it looks like a standard UI component and altered its positioning slightly, and decreased the duration of the fade-in animation for it, as it was taking noticeably longer to appear than the dialog in several browser engines.
    • Increased the minimum allowed margin between the viewport and UI dialogs by 60%.
    • Various other minor CSS improvements.
  • Published a new release (r3380):
    • Fixed a serious issue in the Wikifier that could cause an infinite loop in rare cases.
    • Fixed an issue with the Wikifier where unintentional name conflicts with global identifiers were causing hijinks.
    • Fixed an issue with the UI resizing handler ignoring the top position option.
    • Changed technical error messages to be identity agnostic for consistency with the new init screen messages.
    • Changed error alerts caused by uncaught exceptions to include a stack trace, if one is available.
    • Changed the coding style across the entire codebase and performed some cleanup.
    • Updated the loading screen so that it now handles messages for initialization, lack of capabilities, and lack of JavaScript.
    • Added the &lt;&lt;for&gt;&gt;, &lt;&lt;break&gt;&gt;, and &lt;&lt;continue&gt;&gt; macros.
    • Testing out uglifyjs once again, now that Twine/Twee can handle UTF-8.
  • Published a new release (r3400):
    • Fixed a critical bug within the Wikifier name conflict bugfix from r3380.
  • Published a new release (v0.9.5):
    • Fixed the issue where several static Wikifier methods were broken in certain circumstances (bugs introduced in r3250).
    • Fixed the issue with macro evaluation if the last line was an inline comment.
    • Fixed the issue with mobile browsers which have broken window.history.state implementations.
    • Updated the &lt;Array&gt;.contains() method to accept lists, either as multiple arguments or a single array.
    • Added several new polyfills.
    • Added additional tests to a few of the capability checks.
    • Completely overhauled how serialization and deserialization is handled.  In addition to user functions and RegExp objects, Date objects are now properly serialized.
    • Changed the History prototype and its static methods to delta encode all copies of the history stack, including saves.
    • Changed the Hash history mode to encode all state, not simply path information.
    • Changed the version object: added the prerelease property, added the short() and long() methods, and toString() is no longer an alias of the latter.
    • Changed the build system: the build script has been completely rewritten for Node.js and the JavaScript minifier has been changed to UglifyJS 2.
    • Changed build metadata so that releases will now largely follow the Semantic Versioning 2.0.0 format.
    • Other minor improvements.
  • Hmm.  Several releases have passed since I last updated this thread.  I suppose I should rectify that oversight.

    Published a new release (v1.0.0):
    • Majorly overhauled the CSS. Key style changes: reworked how the &lt;body&gt; and #passages elements interact, and reworked the @media queries. Additionally, the CSS has been split into several separate &lt;style&gt; elements (one for each: init screen, fonts, structural, appearance, basic @media queries, narrow viewport @media queries), which will allow entire style groups to be removed or replaced by authors upon initialization.
    • Changed how the MenuStory passage in transformed into the story menu. The StoryMenu passage is, temporarily, unaffected by this change.  Basically, if you're using either passage as a dumping ground for non-menu content, you need to find someplace else for it (StoryCaption might be a nice place).
    • Changed how the Rewind and Share menu dialogs work.
    • Updated the macro processor to unescape string literals used as arguments to macros (e.g. &quot;\&quot;You can&#039;t make me!\&quot;&quot; will now yield &quot;You can&#039;t make me&quot;, just as it would in JavaScript).
    • Updated the visited() function to make it fully compatible with its vanilla counterpart.
    • Updated the previous() function to allow it to take an optional integer offset.
    • Added the lastVisited() function, which returns the number of turns that have passed since the last instance of the given passage occurred within the story history or -1 if it does not exist.
    • Added the state.has() method, which returns whether any states with the given title exist within the story history (e.g. state.has(&quot;Bar&quot;) is equivalent to visited(&quot;Bar&quot;) neq 0, save that state.has() returns immediately upon finding an instance of Bar while visited() traverses the entire history to count all instances of Bar).
    • Added the capability to flag internal passage links as having been visited by adding the class link-visited, which is configured via the config.addVisitedLinkClass property (default: false).
    • Added an additional test to the browser requirements check.
    • Other improvements.
    Note: If you override any of SugarCube's non-trivial styling, then release 1.0.0 probably breaks your CSS.  Seriously, you have been warned.

    You know who to call.
  • That's pretty fantastic. Thank you, TheMadExile. This is flippin' great stuff.
  • Hey, I just installed sugarcube and I want to resize the header that has the title and author and whatnot. How do I do that? Or how do I make the text in the passages scrollable?
Sign In or Register to comment.