MV Need help Eventing! XD

I have a keypad that opens a door in game. It has a 3 digit code. I have everything working except I can't figure out how to get it where you have to enter 276 in that order. Right now, if you enter the numbers 276 in any order it opens the door. Each number is connected to a control switch and I've tried to have use conditional branches to make sure buttons are pushed in the correct order but no luck. I have it setup where after 3 buttons are pushed it resets. that works fine but I'm having no luck. Any suggestions?
you'll need a stage counter that only goes up if the correct button for the sequence is called.
so the fgirst test is if button 2 is pressed, give +1 to the counter or nothing if not.
if counter is 1 check if button 7 is pressed, if counter is 2 then check if button 6 is pressed.

for better help, we would need to see screenshots of the event code and properties, not how the event looks in game
I would use a variable.

If we give each button a value:
Button 1 =pressed: variable +1
Button 2 =pressed: variable +2
Etc etc

After each press, check if the variable is 276. If so, door opens.

If it is not 276, check if it is bigger than 100.

If it is smaller than 100, multiply it by 10 and go back to pressing buttons.

If it is bigger than 100, set it to 0 first and than go back to pressing buttons.

So... now if we press 3, it will be multiplied by 10, become 30. Then we press 7, which is added, now it is 37 multiplied by 10 is 370. We press 9 and we get 379. Now it is the wrong code, and larger than 100, and it is the wrong code, so it starts all over.

Hope that helps.
l have a similar puzzle that you read the slabs in 12345 order. Once you read a slab, the number is added to a string.
And the lock event runs in parellel check if the string has a 12345 in it.
Here, this is how I did it.

Just replace "input number" with whatever you do to have the player choose a number:

Code:
◆Control Variables:#0020 Door Code = 0
◆Loop
  ◆Input Number:Door Code (Input), 1 digit
  ◆Play SE:Computer (90, 150, 0)
  ◆Control Variables:#0020 Door Code *= 10
  ◆Control Variables:#0020 Door Code += Door Code (Input)
  ◆If:Door Code = 276
    ◆Text:None, Window, Bottom
    :    :Correct! Door is now open!
    ◆Control Switches:#0020 Door Open = ON
    ◆Break Loop
    ◆
  :Else
    ◆If:Door Code ≥ 100
      ◆Play SE:Buzzer3 (90, 100, 0)
      ◆Text:None, Window, Bottom
      :    :\v[20] is not the right code. Please try again.
      ◆Show Choices:Try again, Give up (Window, Right, #1, #2)
      :When Try again
        ◆
      :When Give up
        ◆Break Loop
        ◆
      :End
      ◆Control Variables:#0020 Door Code = 0
      ◆
    :End
    ◆
  :End
  ◆
:Repeat Above

Tested with both correct and incorrect codes,
Simply put you need an over all variable containing the code (container).
You have the simple case where 0 is not a number, so you can:

For each switch it is enough to add the given numeric (1-9) to the container.
And multiply the container by 10.
And if the container is > 1000 (for 3 digits) then validate & reset the container.

For example if user inputs 553,
the container will have 50, 550 and 5530.
where 5530 is > 1000 so full code.

Advantage is that since container is a number here, It can be easily set even with the limitted event processing in event editor.
Simply put you need an over all variable containing the code (container).
You have the simple case where 0 is not a number, so you can:

For each switch it is enough to add the given numeric (1-9) to the container.
And multiply the container by 10.
And if the container is > 1000 (for 3 digits) then validate & reset the container.

For example if user inputs 553,
the container will have 50, 550 and 5530.
where 5530 is > 1000 so full code.

Advantage is that since container is a number here, It can be easily set even with the limitted event processing in event editor.
Wait, so you repeat my solution, and then take the correct condition out and replace it with the wrong one? 😛 (you changed 100 into 1000, which should really be 100)

It's not just like my solution, it is my solution. Like every single detail comes from my reply above. That would make sense if it was a default method, but it isn't. I came up with that all by myself.
Wait, so you repeat my solution, and then take the correct condition out and replace it with the wrong one? 😛 (you changed 100 into 1000, which should really be 100)

It's not just like my solution, it is my solution. Like every single detail comes from my reply above. That would make sense if it was a default method, but it isn't. I came up with that all by myself.
Sorry,

That was not what I did and definitly not what I intended... I didn't understand your solution since it was in code and I was lazy. I offer simple solution in words, that was my goal. Also since you think my solution is wrong and I am quite sure it is not then you maybe also didn't read mine very carefully. :LZScheeze:
you changed 100 into 1000, which should really be 100
If you multiply it by 10 after each input, it should indeed be 1000, not 100.

And I don't think this necessarily has to be based on your solution; probably just another person also coming up with the most sensible way of doing it 😉
Well, when that happens to me, people will scold me about having to read replies better.
but then the door code won't be 276, but 2760
It will still be exactly 276. To put in another way, 100 is the correct value to compare with in your solution (where you multiply first, then add), but 1000 is correct in @darai's (where you add first, then multiply).
It will still be exactly 276. To put in another way, 100 is the correct value to compare with in your solution (where you multiply first, then add), but 1000 is correct in @darai's (where you add first, then multiply).
Yeah, I actually removed the reply just before you replied to it, because I don't want to cause a whole side track here. I said what I said and I should better keep it at that.

You were probably already typing when I removed it, but yeah... I wasn't going to reply, but I also didn't want to pretend I didn't say it, and make it seem like you reply to a ghost-post.
I just used a window for it as plugin which works nicely with * * * * number.
it takes the variable number input which is also set to 0 and don't remember
the input last time which is default.

eventing can be on many ways, but if you want it in order.
I think you can be best go with.

1st digit * 100
2nd digit * 10
3rd digit * 1

than check the number to compare to see it's correct.
but while there are multiple ways short and long way, a mini snippet
on those is maybe the quickest way, but the way you want it to be
is up to you.

the way JohnDoeNews do is simple add a 0 on the end or -0 for the desire effect.
as I made a special plugin for the keypad that require images, I just need to draw
the frame for it.
Hm. Would it work by using 3 variables and a conditional? Like first button press is a variable, and so on. The number you hit becomes the variable's value. Then just conditionals to make sure each number matches what it's supposed to?

All the math and adding above made my head crazy right now, but I'm on my phone instead of my computer. (A little downtimes at work) That could be my mental issue right now.

But I'm curious myself for potential future use.
Hm. Would it work by using 3 variables and a conditional? Like first button press is a variable, and so on. The number you hit becomes the variable's value. Then just conditionals to make sure each number matches what it's supposed to?

All the math and adding above made my head crazy right now, but I'm on my phone instead of my computer. (A little downtimes at work) That could be my mental issue right now.

But I'm curious myself for potential future use.
This would probably be the easiest way. 😛 We make it complicated, because we're too lazy to do the same thing 3 times. 😛 Hahaha. You're right, though. Simple and effective.

Original thread: https://forums.rpgmakerweb.com/threads/need-help-eventing-xd.169930/