Variables in Question

Discussion in 'Site Feedback' started by robyna, Apr 12, 2021.

Tags:
  1. robyna

    robyna Virgin

    I tried to use a variable in the end-of-chapter question but it didn't work. Is it possible to use variables in this way (specifically, I was trying to ask about a character, using her name if MC had talked to her earlier and her job title (clerk) if he hadn't. Here's the code:

    Did you want to talk to {if Lupe > 0}Lupe {else}the clerk{endif} before you leave?
     
  2. Almax

    Almax Really Experienced

    Unfortunately, no, that's not possible -- you can use the immersion variables (the things that have custom names that people can type an entry into), but not actual code. I'd recommend just putting what you wanted to say as a line at the bottom of the chapter.

    (Also! Not that it matters much, but the code you've got right there would have two spaces between "Lupe" and "before" if Lupe > 0! Hope this helped!)
     
    gene.sis and insertnamehere like this.
  3. robyna

    robyna Virgin

    Thanks. I'll try the suggestion of adding it to the main text.

     
  4. DeviantChalice

    DeviantChalice Really Experienced

    I just had an idea for this one. You could create an extra chapter gated behind the "Lupe" variable and have that one linked to the clerk chapter, and make the clerk chapter not visible if you do have the variable. So which the chapter title wouldn't vary, which chapter title you saw would.

    If that makes sense...
     
    Last edited: Apr 14, 2021
    gene.sis and Almax like this.
  5. Almax

    Almax Really Experienced

    That definitely works! I think robyna was asking about having code in the end-of-chapter question, though, rather than the next chapter's title -- but you're totally right, and if robyna doesn't like having the question as a line in the main chapter text, they could for sure have the question be something like "What do you do?" and then two of the chapters be "Talk to the Clerk" and "Talk to Lupe".

    And if the difference is just supposed to be in what name displays, rather than what the chapter contents are, one of the chapters could just link to the other -- bam, same chapter, different titles. Good call, DeviantChap!
     
    Last edited: Apr 13, 2021
    gene.sis and DeviantChalice like this.