Howdy, Stranger!

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

Putting a macro inside a link

Hi everybody. How can I put a macro, or anything useful, inside a link? I mean, a basic link is [[Text|Passage]]. But I also want a macro executed when that link is clicked. For example, a variable set. How do I do that?

Comments

  • You need to state which Story Format you are using as answers can very for each one.

    a. built-in story formats: (Sugarcane, Jonah, Responsive)

    The link documentation includes a setter-links which is a link that assigns a value to one or more variables when the link is clicked:

    [[click here if you choose blue|Next Passage][$colour = "blue"]]

    b. SugarCube

    This story format supports setter-links as can be seen in it's links documentation, it also has a <<click>> macro which can be used to do other things besides assigning values to variables:

    <<click "click here if you choose blue">>
    <<set $colour = "blue">>
    <<cacheaudio "bgm_space" "space_quest.mp3">>
    <<audio "bgm_space" play>>
    <<goto "Next Passage">>
    <</click>>
  • Right. I'm using the default format, Sugarcane. Now I see what I've been doing wrong with these links - I don't need to put "set" inside that extra pair of brackets. Thanks.
Sign In or Register to comment.