Problem With Code Pixel Color

Ask gaming related questions (AHK v1.1 and older)
michelxd15
Posts: 132
Joined: 08 Aug 2019, 02:02

Problem With Code Pixel Color

08 Aug 2019, 04:08

I am trying to use a code that I found here in the forum but I have the same problem of many users and without any help so far

this is a code:

Code: Select all

#SingleInstance, Force
SetKeyDelay,0
x40 := 1050
x75 := 1075
HealthY := 163
Loop,
{

   If WinActive("Tibia")
   {

      PixelGetColor, Check75, %x75%, %HealthY%
      PixelGetColor, Check40, %x40%, %HealthY%

      If (Check75 != 0x7D7DFF And Check40 != 0x7D7DFF)
         Send, {End}

      Else If (Check75 != 0x7D7DFF)
         Send, {PageDown}

   }
   Sleep, 1000
}
Return

The problem is that the code would be to press a key with a certain percentage of life.
but it ends up spamming the key even with a full life.
I've done several tests and I can't imagine why

this image shows the tibia life bar could someone help me?
https://imgur.com/a/0jdWLuV
User avatar
Blackholyman
Posts: 1293
Joined: 29 Sep 2013, 22:57
Location: Denmark
Contact:

Re: Problem With Code Pixel Color

08 Aug 2019, 05:13

know that pixelgetcolor store the color ID in hexadecimal blue-green-red (BGR) format

your color id 0x7D7DFF
Spoiler
so you need to make sure that your hex color is in the same format (BGR or RGB)
Also check out:
Courses on AutoHotkey

My Autohotkey Blog
:dance:
michelxd15
Posts: 132
Joined: 08 Aug 2019, 02:02

Re: Problem With Code Pixel Color

08 Aug 2019, 06:14

in case this script below is working perfectly, I managed to fix the pixelcolor
but I would like a script with option for 2 healers like this script above, could you help me? I tried to use the information from my script based on 1 healer, the problem is that the advanced script with 2 healers ends up spamming the key even with full life
Can you help me ?

@Blackholyman


#IfWinActive, Tibia
CoordMode, Pixel, Screen
while(1){
color:= 0
myszkaX:= 1281
myszkaY:= 143
PixelGetColor, color, %myszkaX%, %myszkaY%, RGB

if(color != 0xDB4F4F){
Send {F2}
Sleep, 200
continue
}
}
return

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 58 guests