Menu
Login
Language
DE EN FR ES IT CZ
Back

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

  • #1, by constantin Friday, 07. July 2017, 17:59 9 years ago Quote
    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 sebastian Friday, 07. July 2017, 18:08 9 years ago Quote
    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 constantin Friday, 07. July 2017, 18:14 9 years ago Quote
    great! thank you!

    Forum Fan

    167 Posts

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

    Thread Captain

    1098 Posts

  • #5, by sebastian Friday, 07. July 2017, 18:55 9 years ago Quote
    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 Machtnix Friday, 07. July 2017, 22:16 9 years ago Quote
    Ah, correct. 

    Thread Captain

    1098 Posts