Checking color on key release.

Ask gaming related questions (AHK v1.1 and older)
Sanbenito
Posts: 4
Joined: 16 Dec 2018, 10:50

Checking color on key release.

17 Feb 2019, 15:22

Hi, i need help with the macro

Code: Select all

$numpad1::
While GetKeyState("numpad1","p"){
  PixelGetColor,buff,18,17
  PixelGetColor,pet,1275,1436
  if (buff != 0xE0C43C) and (pet = 0x000000)
 {
  send {f8}	;target my pet
  sleep 50
  send i	;turn buff on
  sleep 350
 }
   else if (buff = 0xE0C43C) and (pet = 0x000000)
 {
  send {f8}	;target my pet
  sleep 50
  send i	;turn buff off
  sleep 350
  send i	;turn buff on
  sleep 350
 }
 }
 return
What I am trying to do: if the key is pressed down, I spam buff (turn it on if it is turned off and vice versa). If the key is released I need the buff to remain ON. Most of the time it works, but sometimes when I release the key, the buff is OFF. I need it to be always ON when I release the key.
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: Checking color on key release.

17 Feb 2019, 16:07

Sanbenito wrote:
17 Feb 2019, 15:22
I need it to be always ON when I release the key.
Once you release your key (Numpad1) you need to do one last check of your colors to see if you are ending with the state you want.
This needs to happen directly after the closing brace of your While loop.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 58 guests