Trying to Create a Script to kill monsters.

Ask gaming related questions (AHK v1.1 and older)
Mik02911
Posts: 2
Joined: 03 Jul 2022, 11:10

Trying to Create a Script to kill monsters.

Post by Mik02911 » 03 Jul 2022, 11:17

Hello there,

This is a very simple PixelSearch script im using to simply search for colour and click, over and over. I am in a room full of the same monster. When i click i instant kill one of the monsters.

The problem im having is that this keeps spam clicking the same monster, as it is doing its death animation. I need to quickly move onto the next monster to improve efficiency.

How can i make this script, click the colour its searching for, and search for the next npc(same colour) and repeat. Never clicking the same monster twice.

Im open to any and all suggestions to improve this script.

Thanks
Mik



Code: Select all

F1::
Loop , 1000
{
	CoordMode, Pixel, Window
	PixelSearch, FoundX, FoundY, 8, 34, 522, 367, 0x555B53, 0, Fast RGB
	If (ErrorLevel = 0)
	{
		If ErrorLevel = 0
			Click, %FoundX%, %FoundY% Left, 1 	; Click on it.
		sleep 100
	}
	
}
return


Esc::
Suspend
Pause,, 1
Return

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

Re: Trying to Create a Script to kill monsters.

Post by boiler » 03 Jul 2022, 11:37

You can store the values of the coordinates clicked in new variables such as ClickedX and ClickedY, then check the new FoundX and FoundY to see if they are both within some specified distance of FoundX and FoundY and don’t click again if they are. You would also need to keep track of the time elapsed since the click occurred so you can allow clicking again in that area after the monster has died.

Continuing to search for different monsters while the first one is dying is different. You would have to search a new area (actually multiple areas) that doesn’t include the already found location, and that can get somewhat complicated, although it’s certainly possible.

Mik02911
Posts: 2
Joined: 03 Jul 2022, 11:10

Re: Trying to Create a Script to kill monsters.

Post by Mik02911 » 03 Jul 2022, 12:09

Ahhh i see thanks

Im nowhere near knowledgeable enough to even understand how to impliment any of that. Ive searched everwhere online and nobody seems to have discussed this issue.

What i did try was simpled searching (TOP LEFT) clicking in that area once, then Searching (TOP RIGHT) > (BOTTOM LEFT) > (BOTTOM RIGHT) of game client. it didnt seem to work though.

IF anyone can help me further would be much appreciated. I feel like it should be a common thing(in gaming scripts) to need to click on npc and kill, then click on next npc in the area and kill that one?

Post Reply

Return to “Gaming Help (v1)”