Howdy, Stranger!

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

How to hide links if a variable = 2

I know that i should use an if statement (macro), but i'm confused because i'm new to Twine and the programming language, i'm used to some C# and PHP so here's my code:

The main(The Shortcut) passage:
[[Hogtie him and leave him|Hogtie]]
[[snap his neck|Snap 2]]
[[Check his Pockets|Get Keys 2]]
(if: $sctimes is 2)[Open The Vent]

Hogtie passage:
[[Back|The Shortcut]]
(if: $sctimes is 1)[(set: $sctimes to 2)]

Snap 2 passage:
[[Back|The Shortcut]]
(if: $sctimes is 1)[(set: $sctimes to 2)]

Get Keys 2 passage:
[[Back|The Shortcut]]
(set: $sctimes to 1)

So, what i want is to hide all the links(Hogtie, Snap 2, Get Keys 2) in the main(The Shortcut) passage if the $sctimes = 2 and create a new passage called "Open The Vent"

Comments

  • It's actually easy, i should've looked at the manual first:

    i had to use the If macro and then the Replace macro and for the link that's called "Open The Vent" i used the Link-goto macro, when this is combined it look like this:
    (if: $sctimes is 2)[(replace: "Check his Pockets")[](link-goto: "Open The Vent")]
    

    Thanks
  • The following code shows the three markup links if $sctimes is not equal to 2, otherwise it shows the "Open The Vent" text.
    (if: $sctimes is not 2)[
    [[Hogtie him and leave him|Hogtie]]
    [[snap his neck|Snap 2]]
    [[Check his Pockets|Get Keys 2]]
    ](else:)[Open The Vent]
    
  • Great, this is more understandable!, thank you
Sign In or Register to comment.