Suggestion: allow {if:} inside of page links

Right now, you can put a page link inside of an if check. This allows for having page links conditionally seen based on the check. But you can't put checks inside of pagelinks; pagelinks show all text inside of them.

This is useful for a situation where I want a link to go to a single page, but display different text based on the situation.
For instance, if the link is to leave a room. I want the link to acknowledge whether you have a friend with you, and state that your friend will leave with you. But if you are alone, it shouldn't display the same text.

There are ways to get around this; create two separate links with different text, for instance, or just find ways to word it that make it clear outside of the link that your friend will leave with you. Nonetheless, I think it would be really useful if you could just pop an if check inside a page link.


Okay, this is just to give you ideas. You can pass a string which can be used in the middle of your section link. It would work like this...

    squiffy.set("Reggie",true);
    
    if (squiffy.get("Reggie")){
       squiffy.set("ComradeStr","and Reggie");}
    else{
       squiffy.set("ComradeStr","");}
       
[[You {ComradeStr} depart the room]](depart)

[[depart]]:

And out you go...

Make sure all the squiffy commands are preceded by four or more spaces.

In this case, it's a crude example. You can change the value of Reggie, make it false, and see the link not display his name. When Reggie joins or leaves you, use the squiffy to reset the string. Or you could just set it (if Reggie comes and leaves in a dedicated section) using a set command....

@set ComradeStr=and Reggie

This post really got hashed. What I meant to say is that you can form a string reading either blank or with "and Reggie" and use the {comradeStr} function freely in your links. Just make sure you identify the REAL destination with a fixed location in ( )s.


@Bluevoss I've edited your post to fix the code. If you surround code blocks on the forum with ``` then it will be formatted correctly.


Many thanks. I didn't realize the problem until I'd posted. I'll have to remember this trick in future.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums