Author Topic: A function to release all key  (Read 2170 times)

Ciryan

  • Newbie
  • *
  • Posts: 14
A function to release all key
« on: November 27, 2018, 07:00:01 AM »
Hello there !

Is that possible to have a function which would release all key down at once ?

I'm currently using variables to press keys. But the token {STATE_KEYSTATE} doesn't work with all keys using brackets like [SHIFT] for instance. So, if I want to detect if this key is pressed, I have to check {STATE_KEYSTATE:SHIFT} instead of {STATE_KEYSTATE:{TXT:myVariable}} (with myVariable = [SHIFT]). And if a user changes the key in myVariable, it won't be detected anymore.

With a function which releases any key, I will just have to check if any key is pressed with {STATE_ANYKEYDOWN} and use the function if the result is 1.

I don't know if I'm clear enough.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: A function to release all key
« Reply #1 on: November 27, 2018, 07:18:16 AM »
As an aside, while it won't work in all situations, you can strip the brackets to check that variable value:

Code: [Select]
{STATE_KEYSTATE:{TXTREPLACEVAR:"{TXTREPLACEVAR:myVariable:"[":""}":"]":""}}

Ciryan

  • Newbie
  • *
  • Posts: 14
Re: A function to release all key
« Reply #2 on: November 27, 2018, 07:27:34 AM »
Well, it works even with a variable without brackets, so it should do. Thank you.