Howdy, Stranger!

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

using old macros in 2.0

Hi everyone,
I was just wondering if there's any way at the moment to port old macros into 2. I like 2 especially since I just set my laptop to linux, so I want to keep using it, but I don't really know if it's possible to do anything like replace and cycle in the new system.

Edit: revised title for better specificity, forum etiquette lapse.

Comments

  • No, at least not at the moment.

    The Story Format you select controls the format of a macro and what built-in macros exist, currently none of the 1.4.2 story formats have been converted to work with the alpha version of Twine 2.
  • The general thrust of most of the new features of 2.0 is to supplant most of the macros I'd written for 1.4.

    Consider this:

    It can only be him! <<replace "Goldstein!">>The villain from Vienna, back at last to undo your fine work!<<endreplace>> You're beside yourself with shock.
    This can be written in Twine 2 as:

    It can only be him! [Goldstein!]<name| You're beside yourself with shock.

    (click-replace: ?name)[The villain from Vienna, back at last to undo your fine work!]
    The intended advantage of the second form is that the initial state of the sentence ("Goldstein! You're beside yourself with shock.") is more easily visible in Twine 2. The passage code thus reads more like how the reader will perceive it. (You may note, however, that the first form still seems a little easier to dash off from an authorly perspective. I'm still considering how to approach this.)

    Although, some macros don't quite have fitting equivalents yet:

    You can't accept second place! You're no <<cycle>>short-nosed horse!<<becomes>>silver athlete!<<becomes>>partner to greatness!<<endcycle>> It's back to training for you!
    This can sort-of be done using this:

    You can't accept second place! You're no |phrase>[short-nosed horse!] It's back to training for you!
    (click-replace: ?phrase)[(set: $cycle to (it + 1) % 3) (if: $cycle is 0)[short-nosed horse!](else-if: $cycle is 1)[silver athlete!](else-if: $cycle is 2)[partner to greatness!]]
    but this is unsightly code which I do not recommend.
    The main issue with implementing <<cycle>> and <<cyclinglink>> is determining how the 'state' would be stored. In the above, the author must manage the state manually, regrettably.
    I might in future versions implement this as a possibility:

    You can't accept second place! You're no |phrase>[short-nosed horse!][silver athlete!][partner to greatness!] It's back to training for you!
    (click: ?phrase)[(cycle-left: ?phrase)]
    ...but maybe not exactly like this. (The gist is expanding hooks to have "multiple forms" that can be toggled on and off, or something.)
  • Ok, cool. Thanks for the help, all. I'll see if playing with that code is worth fiddling with in my piece or maybe drop it. Thanks!
Sign In or Register to comment.