Howdy, Stranger!

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

How to use L's sound macros in Sugarcube

edited June 2014 in Workshop
Hi folks. I've registered an account here ages ago, and never posted anything, so I guess it's time.

I'm currently working on a game using Sugarcube, and I've noticed that Leon Arnott's sound macro isn't compatible. Basically, you just need to change two characters to make it work: replace storeArea at line 86 by store-area. I've written a small blog post with more details here. I hope someone will find this useful.

Comments

  • What a coincidence! Just yesterday, I started exploring what all it would take to make the switch to SugarCube for the save feature, and the only two macros I use are Leon's Replace and sound. I'll have to try this.

    Thanks for posting!
  • In case you didn't know already, Sharpe, there's a fully functioning Sugarcube version of L's revision macro set (including replace) at the Sugarcube site. IIRC the only syntax you'll need to change in your story is <<replace>> to <<replacelink>>.
  • I've tampered with a few other macros from L, and as stated in Sugarcube's documentation, most incompatibility problems can be solved by replacing "state.history[0]" by "state.active". I rather suck at Javascript, but so far I've also managed to make the timed goto macro and the typewriter transition work, if someone needs them.
  • Thanks, MU. :)

    Cool blog, Lectronice. Now, get to work on that game! ;)

    Did you ever finish your TwineCodex? I agree that the Twine community is scattered. I hope this forum will become the first place everyone goes to discuss and share games, but Twitter seems to currently be the Twine mainstream. Just my take on things.

    It's been a long time since I heard TwineQuest mentioned, too.

    My change to SugarCube, should I choose to do so, is going to involve a lot of initializing variables and changing <<PassageName>> to <<display "PassageName">>. I think that should be about it. I hope.
  • That was about it for me. I'm sure there's a big advantage to not initialising variables, but that's the only big pain for me, not just for switching but also having to remember to go and set each one to 0 in StoryInit every time I add a new one. I wonder if a macro could be written to run whenever a variable is checked and set it to 0 if it isn't initialised?
  • mostly wrote:

    That was about it for me. I'm sure there's a big advantage to not initialising variables, but that's the only big pain for me, not just for switching but also having to remember to go and set each one to 0 in StoryInit every time I add a new one. I wonder if a macro could be written to run whenever a variable is checked and set it to 0 if it isn't initialised?

    I believe that it is not 100% true that all variable have to be initialised in StoryInit.

    What is true is that you have to assign a variable a value BEFORE you use it in a comparison or as a parameter to a macro. That assignment could be earlier in the same passage, or in a passage that the user has visited earlier.

    A good reason to initialise all variables in one place is that it is easier to keep track of the variables you are using within your story/game. You can even add comments to explain the purpose of the variable because over time even the Author can misremember what a variable is actually for. lol

    :: StoryInit
    /% Track how much health player has as a percentage of total health. note: value should not go below zero. %/
    <<set $health = 100>>

    /% relationship states. 0 = never meet; 1 = friends; 2 = lovers; 4 = married %/
    <<set $relationship = 0>>
  • @Sharpe Thanks! My deadline is getting closer... :) Sadly, it seems to be the only way for me to actually finish a game.

    About my TwineCodex project: I suppose the idea of an offline cookbook still makes sense, but it was more than one year ago, before this forum (so much better than Google Groups!) and before the official wiki. I think twinery.org is a great initiative for the community. It answers well to the need of gathering all Twine-related things, even if it lacks its own games database, in my opinion. Choosing to pull data from the IFDB totally makes sense, because it kind of legitimates Twine games as interactive fiction (there's still some hypertext haters out there), yet I wish there was a kind of official Twine games repository.

    Maybe the scattered nature of the community comes from the scattered nature of Twine itself. I mean, it's basically a tool for (dis)playing a wiki as a story. It's all about creating something meaningful by linking meaningless fragments together. And Twitter, well, isn't it a kind of multi-user, vertical Twine ? I guess Twine and Twitter get along pretty well because they are similar.

    But let me go back to the Codex: it was a mix of Twine/Twee documentation, L's macros and a few others, and various articles, mostly by Emmanuel Turner. I asked peope if they were OK with that. Chris liked the idea. L liked it too, but told me his macros were updated very often, so it would kind of defeat the purpose putting them in an offline file. And Turner refused for copyright reasons. So it left me with a TiddlyWiki filled with links to online resources, which was precisely what I didn't want. Maybe I'll try again with TiddlyWiki5, someday...

    About initializing variables, I've noticed yesterday that Sugarcube has two useful operators : def and ndef (see Control Macros here) which can evaluate if a variable is defined or not.
  • lectronice wrote:
    @Sharpe Thanks! My deadline is getting closer... :) Sadly, it seems to be the only way for me to actually finish a game.


    Me too. I was once a newspaper reporter. I learned to write under deadline and only under deadline.

    I invite you to participate in our sporadic challenges such as Super Sudden Surprise Challenge: Flash (Interactive) Ficton. The main purpose of each is to set a deadline and guidelines that will encourage people like you and I to actually finish a game. :)

    lectronice wrote:
    Choosing to pull data from the IFDB totally makes sense, because it kind of legitimates Twine games as interactive fiction (there's still some hypertext haters out there), yet I wish there was a kind of official Twine games repository.


    I'd say there are way, way more games on Philome.la than IFDB. Twine users have gravitated away from IFDB at this point, it seems to me. Not saying that's a good (or bad) thing. It's just how it is.

    However, in my opinion, Philome.la further separates an already diffuse community rather than draws it together like IFDB would help do. But, that's the thing, I don't think one out of ten Twine users care about any sort of "Twine community" outside of a community of which they are already a part. In other words, it seems to me that Twine users are members of other non-Twine specific communities and thus only use the Twine community on this forum for tech support. That's the center of the issue for those seeking or desiring a large, diverse, centralized Twine community: there isn't one because Twine users don't want or need onethey already have their own online community.

    Again, I'm not saying there is anything is wrong or right about any of that; it's just how it is, in my view. :)
  • lectronice wrote:

    I rather suck at Javascript, but so far I've also managed to make the timed goto macro and the typewriter transition work, if someone needs them.
    I'd love to be able to use <<timedgoto>>, that would be awesome! Only thing is I'd be paranoid that your so-called sucky Javascript (which is clearly a zillion times better than mine) might break my game in certain browsers or something. Is that a possibility? Either way, please do post the code or pm me. Thanks!
  • Hi, I've posted my <<timedgoto>> SugarCube version here. I did this a few months ago and I don't exactly remember what I've changed, except this state.history[0] / state.active thing at the end of the script, but it works for me, at least in SugarCube -2850.
  • Thanks!

    Hmm, it's not working for me. To be honest I'm not sure which Sugarcube version I'm using, do you know how I can check? I don't like the idea of updating Sugarcube partway through a WIP in case I break stuff, but I'm probably just being paranoid. I've added your revised macro to a script passage, but when I actually use the syntax in my story, i.e.:

    <<timedgoto "wherever" 3s >>

    The writing that should be coloured purple shows up as blue. This also happened with the original L macro when I tried to use it before.

    Any ideas?
  • D'oh! I realised what happened; I named the script passage timedgoto. Surprised I haven't fallen foul of that before. Sorry about that, it seems to be working great! Thanks!
  • No problem, I'm glad it helped :)

    About the SugarCube version, it is usually displayed at the bottom of the  sidebar. Thus I'm using a tweaked SugarCube with a modified sidebar I can toggle on or off by clicking at the top of the screen. I'm not 100% sure the original SugarCube displays the version number at the same place, I still need to upgrade to the latest version.
  • mostly wrote:
    To be honest I'm not sure which Sugarcube version I'm using, do you know how I can check?


    Open the header.html or a story compiled with it (or View Source on a story open in a browser) and check right at the top, there will be a comment along the lines of:

    SugarCube (build: ####):
    The #### will be the build.  It's also displayed at the bottom of the ui-bar, if you'd prefer to check there.
  • I'm sorry if I'm necroing this post, but it has pretty much exactly what I need. I've been trying to get the timed goto macro to work in Sugarcube. Your blog appears to be down, but could you post it elsewhere? It would be really helpful.
  • Hello there, no problem at all. I am currently upgrading/fixing/breaking stuff on my website, it may take a couple of days. I'll update the link ASAP.
  • Thank you! I really appreciate it. I'll check back in a few days then.
  • It's updated and apparently working (I love to mess with my website, I'ts quite the bad habit). Please let me know if you encounter any problem.
  • Thank you! I really appreciate it.
Sign In or Register to comment.