I`m trying to get it so you have to say hello to somebody and then another option becomes open but not until you’ve said hello first and the chap has answered. I’ve set a variable to false and when you ask him it turns to true but I can’t get any further.
You are in another damp cell there is an old man sat on a bunk.
Leave [[cell ->Hallway]]
(link:“Hello old man”) [
“The old man smiles and says watca.”
(set:$speakbill to true)
]
(if:$speakbill is true)[
(link: “Can I ask you a couple of questions ?”) [
“Of course you can”]
]
Cheers Max Frog that works perfect. Is there any resource so you can look at commands to work out what they do to help solve problems, like gamemaker has.
Using one of the “timer” family of macros like (event:) to trigger the displaying of the Can I ask you a couple of questions ? link is very inefficient, because those macros check their conditions roughly every 17 milliseconds on a machine/device with a 60MHz display.
A better solution would be to get the Hello old man link to directly reveal the other link. And this action can be achieved using a Hidden Hook combined with the (show:) macro…
Leave [[cell->Hallway]]
(link: "Hello old man")[
“The old man smiles and says watca.”
(set: $speakbill to true)
(show: ?bill)
]
|bill)[
(if: $speakbill)[
(link: "Can I ask you a couple of questions ?")[
“Of course you can”
]
]
]
notes:
1: It is unclear from your code example if the $speakbill variable is only being used to display the other link, or if it will be used later in the project. If its purpose is only to control the displaying of the 2nd link then it can be removed like so…
Leave [[cell->Hallway]]
(link: "Hello old man")[
“The old man smiles and says watca.”
(show: ?bill)
]
|bill)[
(link: "Can I ask you a couple of questions ?")[
“Of course you can”
]
]
2: The is comparison operator shouldn’t be used when evaluating the current true / false state of a Boolean variable. The correct syntax for doing that is…
<!-- Checking if a Boolean variable is true -->
(if: $hasLamp)[...the lamp lights up the area...]
<!-- Checking if a Boolean variable is false -->
(if: not $hasLamp)[...it is too dark to see...]
or
(unless: $hasLamp)[...it is too dark to see...]
<!-- Reacting to both potential states of a Boolean variable -->
(if: $hasLamp)[...the lamp lights up the area...]
(else:)[...it is too dark to see...]
3: Please use the forum’s comment field’s </> option when supplying a code example, as it stops the forum’s software automatically converting standard quotes into typographical ones, which helps those trying to debug your code.
Cheers Greyelf, all works well. These commands are all new at the moment so it will be a while before I can do much. One last question is it possible to refresh the screen so it list from the beginning as in the old CLS in MSbasic.
Cheers.
Are you trying to implement a “Stretch Text” or “Endless Page” type interface like those used by some social media apps?
If so then be aware that the main Twine Story Formats are designed around a Passage Transition/Navigation based Progress History system. Which means that changes made to the value of a Story variable while visiting a Passage are only persisted to History when the next Passage Transition/Navigation occurs.
But to answer your question, the (replace:) macro can be used to replace the existing content of a Named Hook. And as explained in the documentation I linked to, the “passage” area of the page can be targeted using the special ?Passage hook-name.
The quick brown fox jumps over the lazy dog.
|target>[The content of the target named hook.]
(link: "Clear the Target area")[
(replace: ?target)[]
]
(link: "Clear the Passage area")[
(replace: ?Passage)[]
]