If statement question

Discussion in 'Site Feedback' started by HaremStarter, Nov 17, 2016.

  1. HaremStarter

    HaremStarter Really Experienced CHYOA Backer

    Is it possible to use to variables in and if statement and if so what would the code look like.
     
  2. gene.sis

    gene.sis CHYOA Guru

    I'm not sure if I understood your question.

    I suppose, you want to know if you could use an if statement within a chapter text where you can compare two variables.
    This is currently not possible.

    I currently work on a feature which would allow this. (Creating a Score Variable with the result of the comparison and using this "helper variable" inside the chapter text)

    Please let me know if this doesn't answer your question.
     
    HaremStarter likes this.
  3. HaremStarter

    HaremStarter Really Experienced CHYOA Backer

    Say I had to variable Fun and Alcohol. Could I write a statement like {if Fun >= 10 ; Alcohol >= 50} where both variable would need be satisfied for the text to be displayed?
     
  4. gene.sis

    gene.sis CHYOA Guru

    This is possible by nested if statements
    {if Fun >= 10}{if Alcohol >= 50}text if both true{endif}{endif}
    or
    {if Fun >= 10}{if Alcohol >= 50}text if both true{else}text if one or none is true{endif}{else}text if one or none is true{endif}


    Unfortunately, there currently isn't a more convenient way to use AND or OR within an if statement.
     
    HaremStarter likes this.
  5. Elros

    Elros Virgin

    Is it planned to implement the And and OR in the future

    The
    {if Fun >= 10}{if Alcohol >= 50}"Case 1"{else}"Case 2"{endif}{else}"Case 2"{endif}
    works, but I have to write the "Case 2" two times. If it's only 2 or three words it's not a real problem, but sometimes I encounter to have many paragraphs in "Case 2" and it becomes a real nightmare for the proofreading.

    The AND and OR are easier to understand too on a second lecture
     
  6. gene.sis

    gene.sis CHYOA Guru

    I thought there was already a suggestion about this but I didn't find one.
    Maybe you want to create that suggestion in the Suggestion Forum.
    The more votes a suggestion gets, the more likely it gets implemented. (If feasible)


    I think one of the main problems for AND and OR in chapter text would be the syntax as CHYOA's naming convention for variables offers a lot of freedom.