Turning back in passages sugarcube2

Hello, I want to make a one-time viewing passage in sugarcube2. For example, a man looked from outside and we made a passage out of it as [[look man->looking man]]. We entered this passage and typed [[back->back]] to exit. I don’t want to see the [[look man->looking man]] passage again when I come back. What code should I write? Thank you.

<<if not hasVisited("looking man")>>[[look man->looking man]]<</if>> should do it

1 Like
<<if $hasSleeep is false>>
	[[go Sleeep->ruya]] 
<<set $hasSleeep to true>>


<<elseif $hasSleeep is true and not $hasDaddyy>>
 [[Daddyy here->baba burda]]
<<set $hasDaddyy to true>>
<</if>>`

ok solved by chatgpt

thank you

Your code will set those variables even if you didn’t click on the links (which isn’t something you want).

You can set variables inside links two ways:

  • [[Text|PassageName][$var to value]]
  • <<link [[Text|Passage]]>><<set $var to value>><</link>>

Also:
<<if $var is true>> = <<if $var>>

and finally:

ChatGPT is notorious for giving people incorrect code.

2 Likes