If ... and ... if ...?

  • #1, by constantinFriday, 07. July 2017, 17:59 8 years ago
    I have a question, that seems to be easy to answer, but after a lot of tries I just cannot make it.
    Here is the problem:
    I have a lot of different values and want to check, if all of them are true at the same time. If not, something else should happen. Do i really have to write:
    if value1 = x 
        if value 2= y
       else do something else
            if value3=z
               else do something else 
        (and so on ...)

    or is there something to combine values like: if value1=x and value2=y and value3=z then ...

    As you might have guessed, I am more of a writer than a programmer, but I have a lot of fun using visionaire to tell stories and appreciate the help in the forum a lot.

    constantin


    Forum Fan

    167 Posts


  • #2, by sebastianFriday, 07. July 2017, 18:08 8 years ago
    if you are using only action parts then the answer would be yes. 
    But you could use Lua script to combine it like you guessed:

    Execute script :

    if Values["valuename"].Int == 12 and Values["valuename2"].Int == 32 and ... then
     Conditions["alltrue"].ConditionValur = true
    end

    (the value names have to be unique here) 

    and after that actionpart you could just check the "alltrue" condition actionpart if it is true... 

    Thread Captain

    2346 Posts

  • #3, by constantinFriday, 07. July 2017, 18:14 8 years ago
    great! thank you!

    Forum Fan

    167 Posts

  • #4, by MachtnixFriday, 07. July 2017, 18:33 8 years ago
    You can combine two conditions in the editor too, but it's more helpful to use Lua. wink

    Thread Captain

    1097 Posts

  • #5, by sebastianFriday, 07. July 2017, 18:55 8 years ago
    You can combine two conditions in the editor too, but it's more helpful to use Lua. wink

    actually you can only compare two values if they are equal/higher/lower/etc than but not check if two of them are a specific number.
    For condtitions you can only check if it is true or false.

    Thread Captain

    2346 Posts

  • #6, by MachtnixFriday, 07. July 2017, 22:16 8 years ago
    Ah, correct. 

    Thread Captain

    1097 Posts