Display Display Text

  • #10, by esmeraldaWednesday, 16. May 2018, 08:41 6 years ago
    In the example in your screenshot is no option what the engine should do, when the value = 1. So the code stops there and none of your texts gets triggered. And you have two option what to do when the value is > 1 or >2. That doesn't work because a value >2 will allways also be >1, so the second if querry (>2) will never get triggerd. You could use = instead of >. 
    Only in the last querry you should use >= (equal or greater). Or just use else.

    If value "Examination" = 0
    display text1
    else if value "Examination" = 1
    display text 2
    else if value "Examination" = 2
    display text 3
    else                                                        (or:   else if value "Examination" >= 3 )
    display text 4
    end if
    set value "Examinateion" +1

    Key Killer

    513 Posts


  • #11, by ice7Wednesday, 16. May 2018, 11:06 6 years ago
    Hi Esmeralda

    I copied your code example, but there appears to be one small issue.

    When I click the scene object, it will show text 1 and then text 3 right after. (without clicking a second time)

    Screenshot attached:

    Thank you again.

    Newbie

    14 Posts

  • #12, by esmeraldaWednesday, 16. May 2018, 11:44 6 years ago
    You are right, I can reproduce this behavior. I can't see a mistake in the code. So either there is a bug in the engine or my knoledge of the "else if" command must be incomplete. (I never used it and tend to forget it is implemented since version 5, so it is quite possible that I made a mistake)

    My first example in the screenshot should work though (tested it). It is the same in principle, just instead of the "else if" there is a "else" with enclosed  if .... else... querries which you have to close with an end if.

    Key Killer

    513 Posts

  • #13, by afrlmeWednesday, 16. May 2018, 12:28 6 years ago
    elseif works like leap frog, if the current if query is false then it skips to the next one, if that's true then it executes whatever is inside of that part of the query & then it should end the query. I don't know if that's the case in VS as it might not be implemented correctly, but the behaviour I described is how it works in Lua script & other programming/scripting languages.

    Imperator

    7278 Posts

  • #14, by ice7Friday, 18. May 2018, 03:06 6 years ago
    Hi, thank you for looking into this issue. Esmeralda, your original code works perfectly.

    Kind Regards smile

    Newbie

    14 Posts

  • #15, by afrlmeFriday, 18. May 2018, 04:23 6 years ago
    There was an issue with the else if system in the engine. Simon has fixed it for the next update.

    Imperator

    7278 Posts

  • #16, by ice7Friday, 18. May 2018, 04:38 6 years ago
    There was an issue with the else if system in the engine. Simon has fixed it for the next update.

    Sounds good. thanks

    Newbie

    14 Posts