Sugarcube help

Felicia Fancybottom

New Member
Jun 15, 2018
2
1
Let me know if I'm not posting this in the right place or if I need to add flair or prefixes or what-have-you. Very new to this and I'm having a bit of difficulty which I simply can't find a solution for online.
Basically I'm trying to make a single choice option in a passage. As in, you will be presented with two choices, for example "Knock Out" or "Kill", but you'll only be able to select one option, which will then open up the result of that action, while greying out the other option.
I was doing this before with, rather simply, linkreplace:

<<linkreplace "-Kill-">>\
<font color="grey"> -Kill- </font>
You kill him.
<<set $isded to true>>
<</linkreplace>>

But I can't now get it to put the link replace inside an if statement, such that, once you've done one action, ("Kill"), the other one ("Knock Out") is no longer possible.
To be clear, I don't want to move to a brand new passage, but rather have the result open up in the current passage, as it does with link replace.
 

Alcahest

Engaged Member
Donor
Game Developer
Jul 28, 2017
3,170
4,069
How about this:
Code:
<span id="knock">
    <<linkreplace "-Knock out-">>\
        <font color="grey"> -Knock out- </font>
        <p>
            You knock him out.
        </p>
        <<remove "#kill">>
        <<set $isknocked to true>>
    <</linkreplace>>
</span>
<span id="kill">
    <<linkreplace "-Kill-">>\
        <font color="grey"> -Kill- </font>
        <p>
            You kill him.
        </p>
        <<remove "#knock">>
        <<set $isded to true>>
    <</linkreplace>>
</span>
 

Felicia Fancybottom

New Member
Jun 15, 2018
2
1
How about this:
Code:
<span id="knock">
    <<linkreplace "-Knock out-">>\
        <font color="grey"> -Knock out- </font>
        <p>
            You knock him out.
        </p>
        <<remove "#kill">>
        <<set $isknocked to true>>
    <</linkreplace>>
</span>
<span id="kill">
    <<linkreplace "-Kill-">>\
        <font color="grey"> -Kill- </font>
        <p>
            You kill him.
        </p>
        <<remove "#knock">>
        <<set $isded to true>>
    <</linkreplace>>
</span>
Thank you! This has been breaking my brain for like 3 hours. Couldn't concentrate on anything else.
 
  • Like
Reactions: Alcahest