I figured that I might as well post a note that I've just published a new release of
SugarCube for those of you using it.
Highlights:
- Added dynamic updating to several of the page elements within the UI bar (sidebar) when passages are displayed, which is configured via the config.updatePageElements property (default: true). The affected elements are the story: banner, subtitle, author, caption, and menu. Note: Since SugarCube uses the story's title as the basis for the key used to store and load data used when playing the story and for saves, it is not included in updates and it is strongly recommended that you do not add any kind of dynamic code to it.
- Added a seedable PRNG which integrates with the story history (incl. saves), which is configured via the History.initPRNG() static method.
- Changed the saves menu so that the delete and purge buttons no longer close the menu. This should make it more convenient for players to reuse save slots, since they can now delete and then immediately save without having to reopen the menu.
- Updated the <<if>> macro to emit an error if an expression is supplied to the <<else>> clause. This is primarily to flag improper <<else if>> usage for authors.
- Updated the <<optionbar>> macro's output to reflect the changes to UISystem.
- Updated UISystem:
- Added the new static method UISystem.alert(), which opens a window.alert()-style message box.
- Added the new static method UISystem.show(), which opens the UI dialog window and is now the basic method by which all dialogs are opened.
- Made various improvements to UISystem.
- Updated the UI CSS styles.
- Updated the default CSS @media query for mobile devices.
- Updated the feature detection logic a bit and the feature polyfills.
- Updated the embedded jQuery library (to v2.1.0).
- Embedded the seedrandom.js library.
- Moved the history (un)marshaling code out of SaveSystem and into History. This was spurred on in large part by the integration of the seedable PRNG into History. This also necessitated save format changes.
- Moved several internal utility functions into the Util object for namespacing.
Comments
http://www.motoslave.net/sugarcube/docs/#macros
http://www.motoslave.net/sugarcube/ (Extras section)
Also, you can create test pages that link to proper pages, and tag them; then start your run through from a test page, to mimic the player having visited those places (have an "injured" tag on the test page, then play from there to see how the game responds).
Highlights:
I haven't made the switch yet, but SugarCube's save feature is a big deal for me so I'd like to check it out.
Highlights:
I didn't think you could get Safari without the developer tools (they're generally built in). I had to enable the developer menu from the preferences menu, advanced tab, because it was disabled by default. Maybe it's just disabled in your version as well?
Thanks. Impressed how fast you knock these out.
At first it didn't work in my code, but it turns out that the PRNG expects the init call to be in StoryInit, while I had it in the link used to go from the title page (Start) to the first actual story passage. It would be worth mentioning this in the API docs.
For other programmers, here is some example code for using the PRNG in SugarCube: Thanks for adding and improving this feature! I'm using it in my "23" game, which I'm still working on (despite the deadline being two weeks ago).
The only sticking point I've found is that the saves function does not work in iOS 7 Safari (it didn't work with 3010, either). I get an Apologies dialog mentioning that the saves function is either not supported or disabled, or to try HTTP. I am looking at my story on the Web, not locally. I also tried flipping some settings switches in iOS Safari's prefs, but that didn't help.
But if that's the only thing that doesn't work at this point, I don't mind--I'm thrilled otherwise.
Actually, I intended it to be used in a script passage (probably along with any config settings you might have). Although, calling it in StoryInit works too, just as long as it's done at story initialization.
I'm honestly kind of surprised that needed to be spelled out, but I'll look into clarifying that point. Thanks.
About the only way that could happen is if iOS 7 Safari broke support for localStorage. A quick Google shows that initial versions of iOS 7 Safari are pretty buggy. What's the full version (7.x.x) of yours?
There is also this vague post on the apple forums.
I used the following example code from the Sugarcube docs: When I set the radio button and go to another passage using a link I can see that $pie gets set to "blueberry", "cherry" or "coconut cream" correctly. But while I click around on the three 'radio' buttons they can all be set on or all be set off (the initial state).
Edit: I can't switch radio buttons off again.
That's not what I expect for a set of radio buttons, only one button at a time should be settable, the other radio button should turn off automatically.
Like I said, it's probably me. I'm actually using -3030. Any clues?
I've found the problem with the radio buttons myself:
The code is setting the radio button id, it should be setting the name.
If 'el.id' is replaced with 'el.name', it should work better. I just quickly patched it directly in header.html and tested that it's working.
Is there going to be a way to set the default radio button for a group (and the default states of check boxes)?