Howdy, Stranger!

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

"Once per game" Link

Is there a way to make a link that can get clicked once per game only? As in
"you are the chosen one. I'm offering you to come with me instead of working for the king. If you refuse, I will (link: leave)[same page without this dialogue]

Comments

  • You would use a click-replace macro and also (probably) disable the back button.

    The click-replace removes the link once they click it (I showed you how in your other post) and the disable the back button prevents cheating (but is optional, I would assume. It's your game though.)

    Hope that helps.
  • Sage wrote: »
    You would use a click-replace macro and also (probably) disable the back button.
    Yes about that... lets go back once so I can understand it better.
    My text will add|here>[...]
    (click-replace: ?here)[(display: "New Passage")]
    
    It would be, first...
    the link I want to use once|then the page I want the link to take the player>[I do not know what to put here]
    (click-replace: ?the page where this is written)[(display: "uhm... what?")]

    I'm sorry, this one surpasses me. Me stupid.
  • Okay so the thing in quotes (where it says "New Passage") is an actual passage you create.

    Ideally you would name it something useful.

    Try that first. And then literally just paste that stuff I gave you.

    You can even put it into a new game just to not mess anything up in your existing one.

    That will give you a total of 2 passages. Right? Home and the new one.

    Type something (anything at all) in the new one.

    Pasty the stuff I gave you in the home passage.

    Then click play.
  • Rafe wrote: »
    Is there a way to make a link that can get clicked once per game only? As in
    "you are the chosen one. I'm offering you to come with me instead of working for the king. If you refuse, I will (link: leave)[same page without this dialogue]
    

    Set a variable in an initialization passage that you won't ever visit again. Then, check that variable before displaying your link. Immediately set the variable to something different after displaying the link so that it won't ever display again.

    Here's an example:

    (if: $foo is false)[You are the chosen one. I'm offering you to come with me instead of working for the king. If you refuse, I will leave.(set: $foo to true)]
    (else:)[I told you, the offer was only good once.]

    I attached an HTML file as well.
  • I added another variable condition to each link. Now I have a lot of text on that page, but if it works, I'm not touching it again.

    That game was great, Sharpe. Is it done with "if" conditions and variables?

  • Rafe wrote: »
    I added another variable condition to each link. Now I have a lot of text on that page, but if it works, I'm not touching it again.

    That game was great, Sharpe. Is it done with "if" conditions and variables?

    I provided the relevant code in my post right after it's description.

    Here it is again:
    (if: $foo is false)[You are the chosen one. I'm offering you to come with me instead of working for the king. If you refuse, I will leave.(set: $foo to true)]
    (else:)
    

    The HTML file was provided so that you could open it in Twine 2 and view the code, though everything necessary is in my first post.
  • I still have troubles with these links. I need to set a link to follow several "if" conditions, but no matter how I reorder these "ifs" it always screw up.
    I need the link to disappear both if the player clicked it before, and if the player clicked 3 links on that page. Let's say it is a special trader that will only sell you one item of each, and 3 different items max (these are rare items)

    It sells golden cherries, a full health potion, a "call eagles" spell, and a familiar. You can buy each item once, and only 3 of the 4. After that, the item you did not buy dissapears and a new "continue" link shows up.
    First link works fine:
    (if: $items is 3)[(link: "continue")[(goto: "town")]]
    

    In this order, 4º item is not hidden when 3º item is clicked.
    (if: $calleagles is 0)(if: $items < 3)[(link: "Call eagles")[(set: $items to $items + 1, $calleagles to 1)(goto: "buying items")]]
    (if: $cherries is 0)(if: $items < 3)[(link: "Golden cherries")[(set: $items to $items + 1, $cherries to 1)(goto: "buying items")]]
    

    In this order, an item is not hidden after it was clicked once.
    (if: $items < 3)(if: $calleagles is 0)[(link: "Call eagles")[(set: $items to $items + 1, $calleagles to 1)(goto: "buying items")]]
    (if: $items < 3)(if: $cherries is 0)[(link: "Golden cherries")[(set: $items to $items + 1, $cherries to 1)(goto: "buying items")]]
    

    What I'm doing wrong?
  • you are missing some [hook] brackets in your two last examples, immediately after the first (if:) statement, which should close at the end.

    TRY THIS:
    (if: $calleagles is 0)[(if: $items < 3)[(link: "Call eagles")[(set: $items to $items + 1, $calleagles to 1)(goto: "buying items")]]]
    (if: $cherries is 0)[(if: $items < 3)[(link: "Golden cherries")[(set: $items to $items + 1, $cherries to 1)(goto: "buying items")]]]
    

    AND:
    (if: $items < 3)[(if: $calleagles is 0)[(link: "Call eagles")[(set: $items to $items + 1, $calleagles to 1)(goto: "buying items")]]]
    (if: $items < 3)[(if: $cherries is 0)[(link: "Golden cherries")[(set: $items to $items + 1, $cherries to 1)(goto: "buying items")]]]
    

    I haven't actually studied your code to see if the logic is fine, and I am a bit rushed for time right now. I just noticed the missing brackets, so that is something that would need to be fixed, whether or not the logic is correct.

  • Rafe wrote: »
    (if: $calleagles is 0)(if: $items < 3)[(link: "Call eagles")[(set: $items to $items + 1, $calleagles to 1)(goto: "buying items")]]
    (if: $cherries is 0)(if: $items < 3)[(link: "Golden cherries")[(set: $items to $items + 1, $cherries to 1)(goto: "buying items")]]
    

    This is the proper syntax for multiple conditions in order like that:

    (if: $calleagles is 0 and $items < 3)[]
  • Sharpe wrote: »
    Thank you, that actually solved it. I admit this is the first time I try multiple conditions in a link.

  • Hi, i don't know if i understand clearly but you can do it like that.

    you can run 'test' to see.

    and 'testharlowe' is the archive

Sign In or Register to comment.