Howdy, Stranger!

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

Deactivate two links when clicking on one

I'm very new to Twine! I tried to search for this but wasn't sure exactly what wording to use and didn't find anything in my searches.

I want to have the user take part in a conversation. There would be two clickable links, and the one you pick slightly alters the flow of the conversation. But I want both links to become non-clickable when you click either one of them, because things start to look weird if the user clicks through the conversation normally and then goes back and clicks on everything that's still clickable. If that makes sense. So it would be something like this:
Do you want to do the thing?

[I'd love that!]<Yes|
[Well...]<Maybe|

(Click: ?Yes)[Yay!](Click: ?Maybe)[Pleeeeease?

[Well okay.]<Okay|]

(Click: ?Okay)[Yay!]
Except that when you click ?Yes, ?Maybe also becomes deactivated, and when you click ?Maybe, ?Yes also becomes deactivated. Does this make sense?

Comments

  • Hmm I managed to completely remove the links.
    Do you want to do the thing?

    [I'd love that!]<Yes|
    [Well...]<Maybe|

    (Click: ?Yes)[Yay!(replace: ?Maybe)[]](Click: ?Maybe)[Pleeeeease?

    [Well okay.(replace: ?Yes)[]]<Okay|]

    (Click: ?Okay)[Yay!]
    This is a good enough solution if I can't figure out the other way.
  • I've been playing with a few different solutions for handling a conversation. I started out doing something similar to what you're doing, but it quickly became unreadable for long conversations.

    One option that worked for me was to have a |body>[] hook and a |options>[] hook. You append to the body hook and replace the option hook at every "turn" in the conversation. This is a lot of overhead for a short conversation, but for longer conversations, you can have your conversation span several passages and have each passage be fairly readable:

    Passage 1:
    [Do you want to do the thing?]<body|

    [["I'd love that!"]<yes|
    [Maybe...]<maybe|

    (Click: ?yes)[(display:"dialogue_yes")]
    (Click: ?maybe)[(display:"dialogue_maybe")]
    ]<options|
    Passage 'dialogue_yes':
    (append:?body)[
    "I'd love that," you say.

    Yay!
    ]
    (replace:?options)[
    [[Do the thing]]
    ]
    Passage 'dialogue_maybe':
    (append:?body)[
    "Maybe," you say.

    Pleeeeeeeeease????
    ]
    (replace:?options)[
    [Well, OK.]<ok|(click:?ok)[(display:"dialogue_ok")]
    ]
    Passage 'dialogue_ok':
    (append:?body)[
    "Well, OK," you say.

    Whew. I was worried there.
    ]
    (replace:?options)[
    [[Do the thing]]
    ]
    I'd love to hear other people's solutions.
  • I did have something working in an earlier version of Harlowe, but changes made rendered it useless for now (!).  I've queried it here , and it might be workable yet, but I've been playing around with arrays and come up with another way of conducting a linear/waterfall style dialogue with optional branches, but containing it all in one passage.

      It's a bit tricky to explain as I'm still trying to get my head around it myself but it does work - as mentioned, it uses an array variable to track choices made, tracks the array variable length to show and hide new choices, and makes use  of the goto: macro to send the user back to the same passage after each option has been selected.  It's primarily driven by click macros, which are at the bottom of the code.  One slight bug I did notice is that when the css uses a larger image, every time the user is sent back to the same passage, the images seems to nest itself within the passage which looks a bit odd...  I'm still thinking it might be more work than it's actually worth (and I'd imagine it'd be quite horrid to debug/test if you went wrong somewhere) - particularly as it's just aping functionality that twine already has - the thing is though, for conversations like this I'd rather have it contained in one passage, and have the twine map only reflect game changing branches/choices as opposed to just dialogues with characters (which won't really change anything).  I've tested it with a conversation taken from Dragon Age: Origins (mainly because it was one of the few examples I could find online), which is linked in the example file once you've run through the dialogue.

    A working example can be accessed here.

    Full code is below.  It's not very well noted, and the first four lines are just to track player progress through the dialogue - I'd exclude these lines usually.
    (if: $cullenconv is 0)[(set:$cullenconv to (a:0))]
    convarray: $cullenconv
    convlength: $cullenconvlen
    Cullen: $Cullen

    "Oh, um, h-hello. I...uh, am glad to see your Harrowing went smoothly."<br>
    {
    (if: 0 is in $cullenconv and $cullenconvlen is 0)[
    ["I need to go."]<1|<br>
    ["Hello, Cullen."]<2|<br>
    ["Why are you stuttering?"]<3|<br>
    ["Why do you care"]<4|<br>
    ]

    (if: 1 is in $cullenconv)[(replace: ?a)[$response1<br><br>]]

    (if: 2 is in $cullenconv)[(replace: ?a)[$response1<br><br> "Th-they picked me as the templar to strike the killing blow if...if you became an abomination. I-it's nothing personal, I swear!"<br><br>]]

    (if: 3 is in $cullenconv)[(replace: ?a)[$response1<br><br> "What? I-I'm fine."<br><br>]]

    (if: 4 is in $cullenconv)[(replace: ?a)[$response1<br><br>]]

    []<a|

    (if: 2 is in $cullenconv or 3 is in $cullenconv or 4 is in $cullenconv)[
    "I...uh, I'm just glad you're all right. You know."<br><br>]

    (if: (2 is in $cullenconv or 3 is in $cullenconv or 4 is in $cullenconv) and $cullenconvlen is 2)[
    ["I thought all templars liked killing mages."]<5|<br>
    ["Would you have really struck me down?"]<6|<br>
    ["I knew I would not fail my Harrowing."]<7|<br>
    ]

    (if: 5 is in $cullenconv)[(replace: ?b)[$response2<br><br> "Maybe some, but not me. It's my duty to hunt down apostate mages, but...I do so with a heavy heart." <br><br>]]

    (if: 6 is in $cullenconv)[(replace: ?b)[$response2<br><br> "I would've felt terrible about it...But....but I serve the Chantry and the Maker, and I will do as I am commanded."<br><br>]]

    (if: 7 is in $cullenconv)[(replace: ?b)[$response2<br><br> "You've always been so confident...or so I hear. Um...I've heard of failed Harrowings and the consequences were...unpleasant."<br><br> ]]

    []<b|

    (if: $cullenconvlen is 3)[
    ["I need to go."]<8|<br>
    ["I've no more time to discuss this."]<9|<br>
    ["I shouldn't distract you from your duties."]<10|<br>
    ["Maybe we could go elsewhere end...continue our discussion?"]<11|<br>
    ]

    (if: 8 is in $cullenconv)[(replace: ?c)[$response3<br><br>]]

    (if: 9 is in $cullenconv)[(replace: ?c)[$response3<br><br>]]

    (if: 10 is in $cullenconv)[(replace: ?c)[$response3<br><br>"Oh, you're not distracting. I mean, you are, but...well you're not. I mean, you can talk to me anytime if you want."<br><br>]]

    (if: 11 is in $cullenconv)[(replace: ?c)[$response3<br><br>"Elsewhere? What do you mean?"<br><br>]]

    []<c|

    (if: 11 is in $cullenconv and $cullenconvlen < 5)[
    ["We should get to know each other."]<12|<br>
    ["I've seen the way you look at me..."]<13|<br>
    ["Nothing. I misspoke."]<14|<br>
    ]

    (if: 12 is in $cullenconv)[(replace: ?d)[$response4<br><br>]]

    (if: 13 is in $cullenconv)[(replace: ?d)[$response4<br><br>]]

    (if: 14 is in $cullenconv)[(replace: ?d)[$response4<br><br>]]

    []<d|

    (if: 1 is in $cullenconv or 8 is in $cullenconv or 9 is in $cullenconv or 10 is in $cullenconv or 14 is in $cullenconv)[
    "Uh...uh, yes. Maybe we can talk another time. You can...come talk to me anytime you like."<br><br>[[>>>->Next]]
    ]

    (if: 12 is in $cullenconv or 13 is in $cullenconv)[
    "Oh, my goodness. If you're saying...what I think...that would be really...inappropriate and...I couldn't. I should go." And with that Cullen hastily exits.<br><br>[[>>>->Next]]
    ]

    }


    <!--This part of the code handles any choices made by the player, including any possible variable changes. It tracks choices made, as well as the number of choices.-->

    (Click: ?1)[(set: $cullenconv to it + (a:1))(set: $cullenconvlen to $cullenconv.length) (set: $response1 to ?1) (goto: "Cullen_Conv")]

    (Click: ?2)[(set: $cullenconv to it + (a:2))(set: $cullenconvlen to $cullenconv.length) (set: $response1 to ?2) (goto: "Cullen_Conv")]

    (Click: ?3)[(set: $cullenconv to it + (a:3))(set: $cullenconvlen to $cullenconv.length) (set: $response1 to ?3) (goto: "Cullen_Conv")]

    (Click: ?4)[(set: $cullenconv to it + (a:4))(set: $cullenconvlen to $cullenconv.length) (set: $response1 to ?4) (goto: "Cullen_Conv")]

    (Click: ?5)[(set: $cullenconv to it + (a:5))(set: $cullenconvlen to $cullenconv.length) (set: $response2 to ?5) (goto: "Cullen_Conv")]

    (Click: ?6)[(set: $cullenconv to it + (a:6))(set: $cullenconvlen to $cullenconv.length) (set: $response2 to ?6) (goto: "Cullen_Conv")]

    (Click: ?7)[(set: $cullenconv to it + (a:7))(set: $cullenconvlen to $cullenconv.length) (set: $response2 to ?7) (goto: "Cullen_Conv")]

    (Click: ?8)[(set: $cullenconv to it + (a:8))(set: $cullenconvlen to $cullenconv.length)(set: $response3 to ?8) (goto: "Cullen_Conv")]

    (Click: ?9)[(set: $cullenconv to it + (a:9))(set: $cullenconvlen to $cullenconv.length)(set: $response3 to ?9) (goto: "Cullen_Conv")]

    (Click: ?10)[(set: $cullenconv to it + (a:10))(set: $cullenconvlen to $cullenconv.length)(set: $response3 to ?10) (goto: "Cullen_Conv")]

    (Click: ?11)[(set: $cullenconv to it + (a:11))(set: $cullenconvlen to $cullenconv.length)(set: $response3 to ?11) (goto: "Cullen_Conv")]

    (Click: ?12)[(set: $cullenconv to it + (a:12))(set: $cullenconvlen to $cullenconv.length)(set: $response4 to ?12) (goto: "Cullen_Conv")]

    (Click: ?13)[(set: $cullenconv to it + (a:13))(set: $cullenconvlen to $cullenconv.length)(set: $response4 to ?13) (goto: "Cullen_Conv")]

    (Click: ?14)[(set: $cullenconv to it + (a:14))(set: $cullenconvlen to $cullenconv.length)(set: $response4 to ?14) (goto: "Cullen_Conv")]
    Anyway, like I've said, I'm not convinced this is workable or maintainable in a project, but thought I would share.
  • I am reading on mobile so maybe I missed an example but this was my solution.

    |body>[[Option 1]<Op1|
    [Option 2]<Op2|
    [Option 3]<Op3|
    [Option 4]<Op4|]

    (click: ?Op1)[(set: $choice to 1)(replace: ?body)[The replacement text or whatever]]
    (click: ?Op2)[(set: $choice to 1)(replace: ?body)[The replacement text or whatever]]
    (click: ?Op3)[(set: $choice to 1)(replace: ?body)[The replacement text or whatever]]
    (click: ?Op4)[(set: $choice to 1)(replace: ?body)[The replacement text or whatever]]

    I found it easier to nest hooks. I set my options inside a block to remove them all after the choice is made but still create distinct click/set combos for each.

    I have to wonder if this would be better done with (link:) but I hate to go back and change so much of my own work.

    Oh my god mobile is a pain for this, maybe I'll stick to reading only.
Sign In or Register to comment.