+1 vote
by (130 points)

I'm a complete fledgling to Twine2 and I can't seem to make an "if -> then" statement for my rudimentary health system.

< !-- header -->

(if: $_player_health is 0) (goto: "death scene")

Can someone tell me if there's a template for "if -> then" with a command for the "then" part?

1 Answer

+3 votes
by (62.7k points)

As explained in the documentation, you have to attach (if:) macros to hooks. Hooks are like JavaScript blocks, except that they use square brackets ( [] ) instead of curly braces. To attach a macro to a hook, just place the hook right after the macro: 

(if: some condition)[(goto: "some passage")]


Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.