playMaker

Author Topic: Match a key down event to a specific string?  (Read 1140 times)

andymetoo

  • Playmaker Newbie
  • *
  • Posts: 7
Match a key down event to a specific string?
« on: July 25, 2022, 02:24:05 AM »
Hello all. I was wondering whether there was a way to match a key gown event to a specific string. For example, say you have a random letter displayed on the screen that changes every second (you can do this through get random string/set ui text). What I want to do is to be able to tell whether the key that's currently being presses matches the letter on the screen. So if the screen shows H, it can successfully tell when the user presses H, but only for the duration of it being on the screen.

There is a couple of actions on the ecosystem that are something like "Get key down from string", which sounds PERFECT, but I have had no luck with them taking a string variable. I get error messages. I apologize as I'm on mobile now so I can't remember the specific error, but I can update this in the future next time I'm on my computer.

However, if there is another method then that may all be moot.

Thanks in advance.

andymetoo

  • Playmaker Newbie
  • *
  • Posts: 7
Re: Match a key down event to a specific string?
« Reply #1 on: July 25, 2022, 02:44:34 AM »
After a bit of deeper searching I was able to find this.

https://hutonggames.com/playmakerforum/index.php?topic=3801.0

I'll try tomorrow and see if that does it.

andymetoo

  • Playmaker Newbie
  • *
  • Posts: 7
Re: Match a key down event to a specific string?
« Reply #2 on: July 25, 2022, 01:38:49 PM »
For those of you wondering, I did get it to work with the technique mentioned above with a little bit of experimenting...I initially had the FSM that was "picking random letters" (and storing it as a global value, buttonPress) separate from the FSM that was looking for the button down event and this caused all sorts of errors with "Input Button is not setup".

Pulled my hair out with that for a while, but when I finally consolidated it into the same FSM using local variables it worked for me.