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

  • #1, z constantinFriday, 07. July 2017, 17:59 hodinky 7 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


    Fanoušek fóra

    167 Posts


  • #2, z sebastianFriday, 07. July 2017, 18:08 hodinky 7 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... 

    Kapitán

    2346 Posts

  • #3, z constantinFriday, 07. July 2017, 18:14 hodinky 7 years ago
    great! thank you!

    Fanoušek fóra

    167 Posts

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

    Kapitán

    1097 Posts

  • #5, z sebastianFriday, 07. July 2017, 18:55 hodinky 7 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.

    Kapitán

    2346 Posts

  • #6, z MachtnixFriday, 07. July 2017, 22:16 hodinky 7 years ago
    Ah, correct. 

    Kapitán

    1097 Posts