Code review

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
benzynowy tato
Posts: 1
Joined: 27 Mar 2024, 06:26

Code review

Post by benzynowy tato » 27 Mar 2024, 06:37

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.]

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

Re: Code review

Post by boiler » 27 Mar 2024, 06:47

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.


Post Reply

Return to “Ask for Help (v1)”