set priorities Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Green Astronaut
Posts: 84
Joined: 13 Dec 2020, 08:35

set priorities

Post by Green Astronaut » 23 Jun 2021, 13:52

I'm having a problem with the priorities of a code, I don't know if I'm using the correct expressions when setting priorities

this is the code:

Code: Select all

#SingleInstance, Force
CoordMode, Pixel, Screen ; need this since you are using screen coordinates
Loop
{
	If WinActive("Pokemon Red")
	{
		PixelGetColor, HealarIco, 1282, 143, RGB
		PixelGetColor, HealarGreatPot, 1261, 143, RGB
		PixelGetColor, HealarUltimatePot, 1255, 143, RGB
		PixelGetColor, ManaRuim, 1255, 157, RGB
		If (HealarUltimatePot <= 0x434F6A) ; first priority
                        ControlSend,, {numpadmult}, Pokemon Red
		Else If (HealarGreatPot <= 0x434F6A) ; second priority
                        ControlSend,, {-}, Pokemon Red
		Else If (ManaRuim <= 0x555A65) ; third priority
                        ControlSend,, {f3}, Pokemon Red
		Else If (HealarIco != 0xDB4F4F) ; fourth priority
                        ControlSend,, {=}, Pokemon Red
		}
	Sleep, 280
}
Return
the problem I'm having is organizing the keystroke priorities of this code.

Can someone help me ?

these two lines seem to me to be ignored

Code: Select all

		If (HealarUltimatePot <= 0x434F6A) ;first priority
                        ControlSend,, {numpadmult}, Pokemon Red
		Else If (HealarGreatPot <= 0x434F6A) ; second priority
                        ControlSend,, {-}, Pokemon Red
these lines below are working perfectly:

Code: Select all

		Else If (ManaRuim <= 0x555A65) ; third priority
                        ControlSend,, {f3}, Pokemon Red
		Else If (HealarIco != 0xDB4F4F) ; fourth priority
                        ControlSend,, {=}, Pokemon Red

I think I'm putting wrong expressions on the highest priority lines
and I need a lot of help to adjust this

User avatar
boiler
Posts: 16925
Joined: 21 Dec 2014, 02:44

Re: set priorities

Post by boiler » 23 Jun 2021, 14:06

What are you trying to accomplish when you use <= to compare a color’s value? Generally, comparing RGB color values as being greater than or less than each other doesn’t make much sense since the “value” is dominated by the highest order byte, or the amount of red. I suppose it works if it helps you sort between a handful of known color values.

Green Astronaut
Posts: 84
Joined: 13 Dec 2020, 08:35

Re: set priorities  Topic is solved

Post by Green Astronaut » 23 Jun 2021, 15:01

@boiler
I adjusted it to the following way and everything worked out, thank you for your attention

Code: Select all

#SingleInstance, Force
CoordMode, Pixel, Screen ; need this since you are using screen coordinates
Loop
{
	If WinActive("Pokemon Red")
	{
		PixelGetColor, HealarSupreme, 1255, 143, RGB
		PixelGetColor, HealarUltimate, 1261, 143, RGB
		PixelGetColor, HealarIco, 1282, 143, RGB
		PixelGetColor, ManaRuim, 1255, 157, RGB
		If (HealarSupreme != 0xDB4F4F) ; 
                        ControlSend,, {numpadmult}, Pokemon Red
		Else If (ManaRuim != 0x6562F0) ; 
                        ControlSend,, {f3}, Pokemon Red
		Else If (HealarIco != 0xDB4F4F And HealarUltimate != 0xDB4F4F) ;
                        ControlSend,, {-}, Pokemon Red			
		Else If (HealarIco != 0xDB4F4F) ; 
                        ControlSend,, {=}, Pokemon Red
		}
	Sleep, 300
}
Return

Post Reply

Return to “Ask for Help (v1)”