Howdy, Stranger!

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

Two If Visited?

Okay so I'm trying to use two if visited within the same line because I want the conditions to be set up for two visited pages as once. However when I tried to set it up like so 

<<if visited ("first condition") ("second condition") <<endif>>

It doesn't work. It just says bad condition. Does anyone know how to fix this so I can use both conditions, if it's possible?


  • edited May 2015
    Each visited needs to be properly written and you need to use the and operator. You also need to close off the start macro.

    <<if visited ("first condition") and visited ("second condition")>>Your stuff here. <<endif>>

    You can also go

    <<if visited ("first condition")>><<if visited ("second condition")>>Your stuff here. <</if>><</if>>
  • edited May 2015
    Thank you amazing person I don't know! <3

    However I just tried this and it didn't work. I'm gonna test it further to see if I'm doing something else wrong

    I just noticed what I was doing wrong. Thank you for the help. I'm an idiot and code hates me.
  • edited May 2015
    It works fine in my test, though in my test I remove the space in the macros, so it becomes eg:

    <<if visited("first condition") and visited("second condition")>>Your stuff here. <<endif>>

    Also the SugarCube documentation recommends another format:

    <<if visited("Bar", "Café") is 4>>…has been to both the Bar and Café at least four times…<</if>>

    So that could also be for a single visit:

    <<if visited("Bar", "Café")>>…has been to both the Bar and Café<</if>>
  • As noted by Claretta, you may specify multiple passage titles to visited(), in which case the lowest count is returned. So, for the stated goal, I'd certainly recommend simply specifying the additional passage(s) as additional parameters, like so:
    visited("first condition", "second condition")
    That will evaluate to true if the player has been to both passages at least once.
Sign In or Register to comment.