Howdy, Stranger!

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

How to put a variable in, as part of a link?

Is there a method for putting a variable in the link to another passage?

For instance, what I have currently does not seem to work.

<<set $subject = "filing cabinet">>

Room

I'll be doing this a lot, so it'll be very tedious to just constantly change every passage link. Instead, I want to be able to change them all by adjusting the variable.

Any help is appreciated.

Comments

  • Try:
    [["Engage the " + $subject + "!"|Room]]
    
  • Try:
    [["Engage the " + $subject + "!"|Room]]
    

    I don't understand the syntax involved in making this work or why it's necessary, but if it looks stupid and it works, it isn't stupid. This solved my problem, thank you very much!
  • edited August 2015
    I don't understand the syntax involved in making this work
    You can join two or more text values together using the plus symbol, in the following the output of printing the new $result variable should be: Engage the filing cabinet!
    <<set $subject = "filing cabinet">>
    <<set $result = "Engage the " + $subject + "!">>
    <<print $result>>
    
    This is what the "Engage the " + $subject + "!" part of TheMadExile's answer is doing, it is joining the three pieces of text together and then using the result as the link's text.
  • Alternatively:
    <<set $subject = "filing cabinet">>
    <<set $result = "Engage the " + $subject + "!" + 
    "With science.">>
    <<print $result>>
    
Sign In or Register to comment.