Page 1 of 1

Code review

Posted: 27 Mar 2024, 06:37
by benzynowy tato
Hello, I want to create simple autohotkey scripts with operators else and if. I want to make script which get pixel color from Xpos, and Ypos and then if false take action (send keystroke) or if true go to another function. Please check my code and reviev it. I think it should works but cant test it now. :)

Code: Select all

#Persistent
SetTimer, KolorCheck, 250
return

HealOne:
	PixelGetColor, kolor, Xpos, Ypos
	if (kolor != 0xFF0000) {
		Send, {F5}
	} else {
		HealTwo()
	}
	return
	
	HealTwo()
		PixelGetColor, kolor, Xpos, Ypos
		if (kolor !=0xFF0000) {
			Send, {F7}
		} else {
			ManaHeal
		}
		return
		
	ManaHeal()
		PixelGetColor, kolor, Xpos, Ypos
		if (kolor !=0xFF0000) {
			Send, {F3}
		} else {
			HealOne()
		}
	return

[Mod action: Moved topic to the v1 section since this is v1 code. The main section is for v2.]

Re: Code review

Posted: 27 Mar 2024, 06:47
by boiler
There are a number of basic errors. It would be best if you ran it yourself, got the error messages, and tried fixing those errors rather than asking the forum to take the time to do basic error checking that AHK performs itself.

Re: Code review

Posted: 29 Mar 2024, 01:15
by Chunjee
Xpos and KolorCheck are not defined fyi :think: