Update: This macro is now built into Twine 1.4! It is no longer necessary to install it.
This is not strictly a new macro, but a replacement version of the <<if>>
macro. You might have noticed that nesting the <<if>>
macro can get a bit messy:
<<if $fire eq "warm">> The fire isn't hot yet. <<else>> <<if $medal eq "water">> You medal protects you. <<else>> <<if $dead gt 0>> Not again! <<else>> You died! <<endif>> <<endif>> <<endif>>
The <<else if>>
macro allows you to essentially have multiple <<if>>
macros chained together, without needing to nest each of them within the <<else>> / <<endif>>
tag pair of the other:
<<if $fire eq "warm">> The fire isn't hot yet. <<else if $medal eq "water">> You medal protects you. <<else if $dead gt 0>> Not again! <<else>> You died! <<endif>>
The macro code is here:
Obsolete script removed: use Twine 1.4
You might wonder why I chose "else if" instead of "elseif"... I guess my mind flipped a coin and the 'natural language' side shone upward.
If someone else has already developed a similar macro, as I suspect they might, then do tell.
Feel free to report any bugs to @webbedspace.
Comments
Super helpful!
This is actually a really nice macro to have on hand. Lovely work :D