Need help with a Piano Tiles ish script

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Grubas
Posts: 2
Joined: 30 Aug 2018, 09:30

Need help with a Piano Tiles ish script

23 Oct 2018, 08:27

Hi, I've never understood coding really and have been sitting with this for almost 3, 4 hours now so decided to ask for help

Basically I have an app on my phone I'm trying to create a script for, by doing this I've connected my phone to my pc so I can view the phone screen on my pc (Bluestacks isn't working with this app sadly so can't use that).

What I have to do in the game is press the falling objects in the order they fall before they reach the bottom of the screen.

https://imgur.com/a/BMZU4hm

The white dots are the falling objects that I want my mouse to locate and click on.

Currently this is how far I've gotten

Code: Select all

^P::

MouseClick, left, 356, 939 ; The start button for the game
return

Loop, 210
$location = PixelSearch (3, 321, 529, 789, FEFFFE, 5, fast RGB)

If IsArray ($location) = True Then
MouseClick, left, $location[0], $location[1], 1, 0
}

^L::Pause
I want it to loop 210 times, meaning clicking the falling objects 210 times and then stopping so I'll "die". Then I want the first code to start up the game again and this will continue in an infinite loop

Right now my problem is that the pixel search is not locating the falling objects nor clicking them

I'd really appreciate help with this and please ask further questions if I didn't explain well enough cause I'm really awful at explaining
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Need help with a Piano Tiles ish script

24 Oct 2018, 07:04

fixed syntax:

Code: Select all

CoordMode Pixel
CoordMode Mouse

^p::
	clickCounter := 0
	Loop 
	{
		Click 356, 939

		Loop
		{
			PixelSearch x, y, 3, 321, 529, 789, 0xFEFFFE, 5, Fast RGB
			if (ErrorLevel == 0)
			{
				Click %x%, %y%
				++clickCounter
			}
		} Until (clickCounter <= 210)
	}
Return
the only thing left up to u is making sure the coordinates make sense wrt the type of CoordMode being used. see the docs to gain an understanding how this directive affects mouse and pixel functions, and select a mode appropriate for ur use case

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: NinjoOnline and 223 guests