conditional branch not calling else

Discussion in 'RPG Maker MV' started by Seth-Rah, Oct 30, 2017.

  1. Seth-Rah

    Seth-Rah professional amateur Member

    Messages:
    22
    Likes Received:
    7
    Location:
    South Africa
    First Language:
    English
    Primarily Uses:
    RMMV
    I have been fooling around with this one for a while now, however I cannot really see where the logic is going wrong

    So all I can do is explain my logic and see if anyone might have some information.
    Using YEP_ButtonCommonEvents I am checking for the A input, using the A input will call the following common event.
    The logic is that if the variable is == 0, then the key should switch me to move mode, by updating the variable.
    Then updating the variable again when pressed again. This part is working fine.
    [​IMG]

    However, now I have an event that is using HIME_EventTriggerLabels
    With this, I have
    If we are in Inspect mode (If the variable is 0), when left is pressed, give me a text window, and then recall the variable "0Inspect / 1Move" (variable names to be changed at a later time)
    But right now, regardless of the value the variable being in, it won't seem to stop using the information inside if, instead of going to else.

    [​IMG]

    This is what it does at the moment. This is an MP4 so it will require you to view the footage below on imgur.


    buttons used in footage, as follows.

    left -> z -> z
    a -> z
    left -> z -> z
    left -> z -> z
    a -> z
    left -> z -> z

    Any suggestions?
     
    Last edited: Oct 30, 2017
    #1
  2. Tai_MT

    Tai_MT Veteran Veteran

    Messages:
    5,194
    Likes Received:
    4,365
    First Language:
    English
    Primarily Uses:
    RMMV
    Does it work without the plugins?

    It'd be easy enough to code something similar without the plugins to make sure it's working without them. If it does work without them, you may have to consider that it's a bug with your plugins and that they're incompatible with each other.

    Beyond that, I'm not really sure I follow the logic in the screenshots.

    Your common event will prompt constantly (because it's Parallel Process) because the variable changes. At least, as long as the Switch that activates it there is on. You'll have to turn that switch off every single time it's done doing what you want it to do. Every time it checks to see if the variable is 1, it changes to 0. Every time it is 0, it changes it to 1. That switch for the Parallel process event should only come on once you push the left button, and should be turned off in both the "If" lines and the "Else" lines at the bottom, to prevent multiple firings.

    As for the event itself... It looks strange to me and I'm not really sure what I'm looking at. I'm not familiar with the script, so I have no idea what you're meant to be doing with the labels. However, if the labels work like the Conditional Events (which is what it looks like they do), then your "else" case isn't prompting because you aren't pushing "Right" as the button trigger, you just keep pushing Left. Which, will only display the text and the variable so long as the above criteria are met (Variable = Zero, Left Button is pressed).

    I'm not really sure how it's set up entirely. This is kind of a very limited amount of information. Especially since I don't see anything that actually activates the events or anything.

    Presumably, you press the left key, then it changes between movement mode and search mode. But, it should only do this upon pressing the Left Key. So, pressing that Key should activate the switch which activates the Common Event. Each branch of the Common Event should then turn the switch off at the end, after changing the variable. This gives you a "reset" to change the variable each time the button is pressed.

    Then, you simply have a regular event on the map that only checks to see what the variable is. This would be easy enough by just clicking the event. Just put the Conditional Branch in there like you have it. If Variable equals 0, display Search Text. If it doesn't equal 0, transfer player to coordinates.

    Also, you can just put the "view variable" text in the same box as the first text box. May as well instead of adding a second text box. While you're at it, you can also see where the error is, by putting that same "view variable" text in your common event, just to be sure it's actually changing the variable. Which, it doesn't look like it's doing (likely because the common event doesn't turn the switch off).
     
    #2
  3. Seth-Rah

    Seth-Rah professional amateur Member

    Messages:
    22
    Likes Received:
    7
    Location:
    South Africa
    First Language:
    English
    Primarily Uses:
    RMMV
    Thanks for the response

    I will be checking this without the plugins as well shortly.

    I have tried pressing right before in different instances not shown, however it still won't seem to reach else.

    The reason I am showing the footage is because it seems to still be calling the left function, that is not part of the else. Which means that the function should not be working at all, as the conditions for it are not met. The value that is being recalled after the left dialog is the condition for the if. When it shows 1, it means that the left action should not have been invoked at all because the condition specifies that it has to be 0.

    The common event is invoked by the "a" key on the keyboard, which then shows the value updating text of "inspect" or "move". Being able to interchange between these two shows that the value is being stored correctly, instead of it just constantly calling inspect that switches to move.

    The logic I have is that I want the common event to be able to be called from anywhere on the map, to switch me from an inspect mode, to a move mode and vice versa. Character movement has been disabled with the arrow keys and mouse button. The only way to transition between areas would be if move mode is enabled, and that would allow me to do map transitions.

    Regarding the labels, I am using a plugin called HIME_EventTriggerLabels, that will allow me to call events when the button specified in the label gets pressed, instead of it requiring me to interact with the "ok" key.
     
    #3
  4. Llareian

    Llareian Jack of All Trades, Master of None Veteran

    Messages:
    603
    Likes Received:
    1,400
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    The problem appears to be how you're thinking about HIME's Event Trigger Labels. Every time you push the button, it will call everything below that trigger, REGARDLESS of what's above it. So you need to rewrite the event as such:

    Label button_trigger_left
    ....If 0Inspect/1Move = 0
    ....,,,,Text: you pressed the left key
    ....End
    ....Text \v[1]
    Label button_trigger_right
    ....If 0Inspect/1Move = 1
    ....,,,,Transfer Player
    ....End

    EDIT: Or put the text \v[1] box inside the conditional, depending if you want to see it every time or not.
     
    #4
    Seth-Rah likes this.
  5. Seth-Rah

    Seth-Rah professional amateur Member

    Messages:
    22
    Likes Received:
    7
    Location:
    South Africa
    First Language:
    English
    Primarily Uses:
    RMMV
    That actually makes a lot of sense, I will give that a look. Thanks
     
    #5
    Llareian likes this.
  6. Seth-Rah

    Seth-Rah professional amateur Member

    Messages:
    22
    Likes Received:
    7
    Location:
    South Africa
    First Language:
    English
    Primarily Uses:
    RMMV
    Turns out Llareian is correct.

    Thanks a lot for the assistance, this will help with future inquiries too probably, because I now know to check the event call order.

    Although this does make it a bit more tedious to work with for the future because I will need an if branch for every possible input instead of one for the modes, but that's not really RPG makers fault.

    --edit--
    Reading the documentation on Himeworks, I found the following lines.

    It's either a bug or the way labels are handled might have been changed in different versions of MV.
     
    Last edited: Oct 30, 2017
    #6
  7. Llareian

    Llareian Jack of All Trades, Master of None Veteran

    Messages:
    603
    Likes Received:
    1,400
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    @Seth-Rah , you could try having two different event pages. Set the condition on one page to be if the variable is 0 and the other page if the variable is 1, then add your button triggers on the appropriate page. I'd be interested to know if this works.
     
    #7
  8. Seth-Rah

    Seth-Rah professional amateur Member

    Messages:
    22
    Likes Received:
    7
    Location:
    South Africa
    First Language:
    English
    Primarily Uses:
    RMMV
    Looking into it quickly, because I am not using switches, but using a variable instead (In the likely case that I start adding more states) I am not really able to create pages. The variable option in MV for page conditioning only allows me to use > or = to.

    [​IMG]

    In my case I would be needing it to be = to a value.

    At least that's how I think this is supposed to be used right?
    Sorry, I am really new to RPG Maker.
     
    Last edited: Oct 30, 2017
    #8

Share This Page