Using hide_reuse and if together


#1

Hi guys! Recently i got to experiment with choice script and decided to make a little bit test for myself as for how good i understood everything.

I’m having trouble with using two commands together.
I am actually not even sure i can do that…

So let’s say: i have two thing the player can ask an npc.

*label blahblahblah
*hide_reuse *choice

                      # Blah blah blah
                       * set this_is_first_time_selecting_this true
                       *if thisisfirsttimesel... true
                            Oh so it is you!
                            *goto blahblahblah
                       *else 
                             It is you again!
                             *goto anotherscene
                       # Nope Nope Nope
                        * if thisisfirsttime... true
                             I was waiting for you!
                             *goto anotherscene
                        * else
                             Oh so it is you!
                             * goto blahblahblah

Explanation: Basically i want when choosing one ask(1), the npc does something, and the next ask(2) will continue what he does. But if the player choices (2) i want the (1) to continue.

And the error i get is where the *choice is. It says that it has nothing to choose from.

Soorryy, i am on my phone so i can’t send the code like it is. But this is exact how i wrote it.

And also i am writting on note ++, it is a huge help! I am wondering if there is any code format that i can select that could help me even more, something similar to choicescript.


#2

I’m not sure without seeing the exact code for indentation issues etc that might be messing it up. I don’t know, I often seem to run into problems using else and else if’s. (I must be doing something wrong.)

Perhaps try thisisfirsttimesel as a variable and set it to true or false then use it like this and see if it helps:

                   *if (thisisfirsttimesel = "true")
                        Oh so it is you!
                        *goto blahblahblah
                   *if (thisisfirsttimesel != "true") 
                         It is you again!
                         *goto anotherscene

That way you should definitely get one active.

In saying that, if there’s no “choices” per say, it might also be a problem with your #choices rather than the if statements below it (which I would think would create an error due to not having a goto)

Edit: Actually watch the * set this_is_first_time_selecting_this true if you are going to have the player visit this section again. It’s a different variable to the ones underneath, but if you made it the same, it’d mean the player would always see the true text due to where it is. (Might be better put under the if statement).

Edit2: Just a thought, if you’re using hide_reuse, is it working at first, and then saying there’s no options? You might be running out of choices because they’re being hidden.


#3

Hmm ooh right! The first (1) works perfectly, if chosen first, and it continues with the (2) and later with the scene but if (2) is selected then, it shows the text, but if i select the (1) to continue, there is the error. Maybe i should put something like allow_reuse? I remember i created some kind of loop because of that😂

I will try the variable option you suggested at home. And what the ! Does?

What do you mean in first edit? I should put *set under *if? But then how will it pass *if if it was not set??? Sorry i am such a noob…:disappointed_relieved::sweat_smile:


#4

!= means “is not” or “doesn’t equal”, so if you have 1 variable as = and one as != you’re sure to have one or the other selected :slight_smile:

About edit one, what I meant was to put it under the if so it isn’t set for everything.

so for example:

 *if (thisisfirsttimesel = "true")
   *set thisisfirsttimesel "false"
    Oh so it is you!
    *goto blahblahblah

  *if (thisisfirsttimesel != "true") 
      It is you again!
      *goto anotherscene

That way you avoid having it set as true regardless of whether a player has seen the scene before or not, which would happen if it was where it is. (Unless I’m misunderstanding what you’re doing.)

Hmm ooh right! The first (1) works perfectly, if chosen first, and it continues with the (2) and later with the scene but if (2) is selected then, it shows the text, but if i select the (1) to continue, there is the error.

I’m not quit sure I understand that. Is there another choice I’m not seeing? If there’s only the 2 choices and you disable_reuse, you can only go through that section twice without an error occuring. Otherwise you’ll have to allow reuse. If you want to stop people picking the same option more than once, you can have a third option (something like #I’ve already said everything I needed to say). For the original two, create another variable that you can use to stop it from being reselected. Give me a min, I’ll find an example.


#5

Hope this makes sense. You can set up a counting variable that knows when someone has already asked the top two questions and makes them pick the 3rd option to move on (which doesn’t have a variable restriction.) You need to create each variable in the start up as zero if you’re using the counting method I have there. (ie create question1 0).

Anyway, there’s lots of ways to do this. Otherwise, you can use disable_reuse, just make sure that the player can’t visit more times than there are choices.


*label ask


*choice
	*selectable_if (question1 = 0) #Blah blah
		*set question1 +1
		*goto whereever
		
	*selectable (question2 = 0) #Say something else
		*set question2 +1
		*goto whereever	
		
	#I've got nothing else to say
		*goto onwards