*if and *hide_reuse


#1

Okay, this is what I am trying to achieve:

I am attempting to create a menu of options the player will select an option from several times. I want to hide some of the choices after they have been selected once, some if they have been selected under certain circumstances (like twice with certain variables in place), and some not at all.

I’ll attempt to give an example but it may be confusing because my scripting is going to be off and that’s what I need help on: how to correctly script this menu.

*choice
      *hide_reuse
       #Listen to X and Y's conversation.
       *if variableZ = 1 hide_reuse
       #Try talking to Z a while. (which sets variable Z to 1 on success)
       #Watch out the window for a while.
       *hide_reuse
       #See if M would like to talk for a while.
       *hide_reuse
       #Sing a song.
       *if variable S = 2 hide_reuse
       #Grab a snack. (first time may set variable S to 1, or 2, second time will set to 2)

What I want to know is how to properly code and align the (*if variable, hide_reuse) choices alongside normal *hide_reuse and choices that don’t hide however many times you select them.


#2

hey, a few quick questions.

1, do you mean that sing a song can be chosen twice before disapparing?
2. how did you plan on getting succes with talking to Z? (random generator or something?)


#3
  1. Actually, that’s for grabbing a snack. You might know you just ate everything and not have a reason to ask again… or you might not and ask again, and find out that there isn’t any more.
  2. It’s time-based. There’s actually a progression- each choice goes to a different *label… and each of those labels has different things that could happen based on -when- you select the choice. Then they take you to another label that adds to a variable used for time, then take you back to the menu. So in gaining success talking to Z, it happens if enough time has passed, and doesn’t happen if not enough time has passed.

#4

ALSO! While I’m here- does anyone know if there’s a way to basically fake_choice *if variables? Nested story that splits based on a certain stat being at a certain level, per se, and then going back to a non-nested point, without using a *goto? It would save me a heckalot of time and shorten my scripting considerably…


#5

Well, hope it’s clearer like this.

*label begin (0)
*choice (0)
  *hide_reuse  #Listen to X and Y's conversation. 
    text text text
    *goto begin (can only use choice once) 

  *if (variableZ = 1) 
    *hide_reuse #Try talking to Z a while.
      text text text
      *set variableZ +1 
      *goto begin (only available if variableZ =1, and then only once) 

  #Watch out the window for a while. 
    text text text
    *goto begin (always available ) 

  *hide_reuse #See if M would like to talk for a while. 
    text text text 
    *goto begin (only once) 

  *hide_reuse #Sing a song.
    text text text
    *goto begin (always) 

  *if (variable S <= 2) 
    #grab a snack 
      text text text
      *set variable S +1 
      *got begin 

  *if (variable S = 2) 
    *hide_reuse #Grab a snack. 
      text text text
      *goto begin 

hope it isn’t to unclear. And what you ment. Also, I have no ending in it, but i assume you know how to leave with the goto / label.


#6

Uhhh… well, I thank you, but no, that really isn’t actually clear to me… I need to understand the indentation to understand it, unfortunately. But if someone who does know how to box it were to format it properly, I’d find it more understandable. :\


#7

yeah, I found out how to make one of those grey boxes (use the preformatted text option) :smile:

Eddited my post, hope it’s clearer now


#8

OHhhhhHHHHhHhHh! Yes, that helps a whole lot! I’ll need to actually format it that way and try running quicktest to make sure. I’ll let you know if I run into any problems with it in quicktest.


#9

Just out of curiosity, did it work? And if it did, did it work the way you wanted?


#10

The simple answer is no - for your purposes the only way to jump to a different point rather than continue down the page line-by-line is to use a *goto / *label combination (in which case I’d recommend using *choice instead of *fake_choice, to be on the safe side, as the latter will not catch any ‘redirection’ scripting errors).


#11

@mrwolf2 No, but I did get it working by removing *hide_reuse entirely and instead using *if (variable), #choice below it, and then putting variables within the nest to make the option no longer appear when the conditions are met. Well, the short of it is that I worked my way around the problem.

@Vendetta You’re maybe going to be surprised, but I discovered that *if AUTOMATICALLY nests like a fake choice!

So let’s say we have
"Blah blah blah story"
*if awesome = “True”
(indent) Super awesome story part.
Blah blah blah.

And that WORKS! So if you’re not awesome, you don’t get the super awesome story part, it just continues to read down and skip that part.


#12

Ah, I totally misunderstood your actual query. What it seems you’re talking about is just ordinary conditional text, but from this bit - “…going back to a non-nested point…” (emphasis is my own) I thought you meant returning to an earlier section elsewhere in the scene file, which is of course only possible with *goto / *label.

My bad, but I’m glad you’ve resolved the issue anyway. :slight_smile:

On the subject of conditional text, you may find some useful howto tips in this Wiki article -