"First time" or "Once" command?


#1

Hello everyone!

I’m super excited to have joined the ChoiceScript community. I love seeing all the new stories that are being worked on and also how helpful everyone is. I think I’ve mostly got ChoiceScript figured out, but I do have a question regarding if there is a specific command.

I apologise in advance if this has been asked before, but I searched through the game development section and the wiki before posting here. I’m not sure though if the command is possibly under a different name.

I want to know if there is a command which allows you to post say for example a description or a phase once, the first time you enter that page, so that in subsequent visits the description/phase either changes or disappears.

e.g.
First time:
This must be the Jester’s Chamber.
It’s far grander than you imagined it to be…
All other times:
The Jester’s Chamber.
It’s far grander than you imagined it to be…
(The bold text in this case would only appear the first time you enter that page, but is replaced by the italics text on subsequent visits to the same page.)

Thank you very much!


#2

There’s no “set in stone” way/rule for that, but you can work around it using a Boolean variable.

I personally use a determined variable for such scenarios. Here’s an example with a looping choices.

*label choice

*set repeat false
*choice
  #Who are you?
    *if not repeat
      *set repeat true
      "Who are you?" you asked the mysterious person.
    *if repeat
      "You haven't tell me your name," you asks.
    "You shall know it soon," he answered.
    *goto question
  #What are you doing here?
    *if not repeat
      *set repeat true
      "What's happening here? What are you doing?"
    *if repeat
      "And what affairs do you have here?"
    He answered, "isn't it obvious? What do you think I'm doing here?"
    *goto question

The repeat variable is my “determined boolean variable.” Give it a read and you’ll understand what I mean, hopefully. :upside_down:


#3

Hmm… I think the way I would do that would be something like…

*temp hasvisited_jc 0

*label jesterschamber
*if hasvisited_jc = 0
 [b]This must be the Jester's Chamber.[/b]
 *line_break
 It's far grander than you imagined it to be...
 *set hasvisited_jc 1

*if hasvisited_jc = 1
 [i]The Jester's Chamber.[/i]
 *line_break
 It's far grander than you imagined it to be...

#4

Thanks so much for the replies @Szaal and @Carlos.R!

I didn’t think of using other commands in a similar manner. I’ll probably use them both depending on what situations I use them in.


#5

You can use something like this
In startup
*create visit 0

In the document / label

*Set visit +1

*If visit 1

    [B]this must be jester's chamber.[/b]
    *goto visitcommon

*if visit > 1

    [I]This is jester's chamber 
    *goto visitcommon[/I]

*label visit common

It's far grander than you imagined