Is it possible to detect a combo of inputs?

Started by Grimlock on

Topic category: Help with modding (Java Edition)

Last seen on 20:20, 2. Jun 2024
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Is it possible to detect a combo of inputs?

What I mean is like the konami code. If you enter up, up, down, down, left, right, left, right, B, A, it could open like a gui or something. Is this possible with custom code. I know skytils did something like this and I wondered if you could recreate that in mcreator.

Last seen on 15:21, 16. Oct 2023
Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It is possible, only with…
Fri, 08/18/2023 - 05:41

It is possible, only with custom code since I'm pretty sure mcreator doesn't provide global trigger and key enum for this. 

Basically you'd make two lists: 

  1. Konami code list - that has correct sequence. 
  2. Bufer list - that saves last N key presses (10 for konami code). 

On each key stroke, you'd update the buffer and check the buffer against konami code list and do whatever you want if both lists are equal.