Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Keep A_PriorKey unchanged after pressing 8 or 9


  • Please log in to reply
No replies to this topic
Tito
  • Members
  • 13 posts
  • Last active: Dec 14 2015 12:03 PM
  • Joined: 10 Nov 2012

Hi, 

 

Is there some easy way to keep A_PriorKey unchanged after pressing 8 or 9?

e.g. if A_PriorKey = 1 and I press 8 or 9, it should stay as 1. 

       if A_PriorKey = z and I press 8 or 9, it should stay as z. 

       etc

 

Thanks in advance

 

Edit: testing out some stuff, so basically this could work.

It uses a function that sets a variable whenever a key is not pressed anymore. The variable can be used globally inside the script if needed. 

The loop was not needed, but this was just for some quick testing.

 

If anyone has a better implementation, pls post ;)

Also, im not sure about making a global variable. I just want my variable to be used inside of other functions aswell. Not sure if this is the way to do it :/

myfunc(key)
{
global myprevkey = key
}
;------------------------------------------------------------
~$1::
Loop
{
	if not GetKeyState("1", "P")
	{
	myfunc(1)
	break
	}
	else
	{
    	Send, {1 down}
    	Sleep 20
    	Send, {1 up}
    	Sleep 20
	}
}
Return