Start script

Get help with using AutoHotkey and its commands and hotkeys
derpybaits
Posts: 9
Joined: 22 Dec 2018, 03:14

Start script

22 Dec 2018, 12:04

Hello, I was wondering if it is possible to have a script run like the one below exept instead of it clicking when it sees a color instead have it click when a number comes up on the screen. the number could be lets say random between 100-200.




`::SetTimer F5,% (F5 := !F5) ? 1 : "Off"
F5::
PixelSearch, Px, Py, 90, 190, 1062, 621, 0x374D52, 0, Fast
if ErrorLevel
return
{
Click, 737 324
Sleep 20
Click, 777 359
sleep 20
Click, 777 394
}
Return
User avatar
Scr1pter
Posts: 1072
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: Start script

22 Dec 2018, 14:56

Hi,

Remember to use the code tags when posting code.

Code: Select all

This is some code
Ok, if I understood correctly:
Instead of pressing F5 to activate the PixelSearch, you want that the PixelSearch gets activated automatically,
once a specific condition is true.

In this case the condition is a number, which is visible on the screen.
First question:
Is the number a copyable text, or is it an Image?
If it's an Image (e.g. like Captcha), you might have to work with ImageSearch or OCR.

Since you want the script to persistently check for numbers, you will have to add an (endless) loop.

Lets's clarify the question first.

Regards
Please use code tags when posting code!
Keyboard: Logitech G15 FE - Mice: Logitech G9 FE, G502 FE, G602 - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.29.00
derpybaits
Posts: 9
Joined: 22 Dec 2018, 03:14

Re: Start script

22 Dec 2018, 18:50

Scr1pter wrote:
22 Dec 2018, 14:56
Hi,

Remember to use the code tags when posting code.

Code: Select all

This is some code
Ok, if I understood correctly:
Instead of pressing F5 to activate the PixelSearch, you want that the PixelSearch gets activated automatically,
once a specific condition is true.

In this case the condition is a number, which is visible on the screen.
First question:
Is the number a copyable text, or is it an Image?
If it's an Image (e.g. like Captcha), you might have to work with ImageSearch or OCR.

Since you want the script to persistently check for numbers, you will have to add an (endless) loop.

Lets's clarify the question first.

Regards
First it is a image not text it is a image of a number.
Second what im hoping to do is instead of have it pixelsearch the color i want the script to search for any numbers on the screen within 100 to 200 to trigger the script as it is now when it sees a color it clicks where i want it to. I need to change the trigger of the script from color to any number between 100 and 200 and the number that shows up will be randomly between 1 and 200
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Start script

22 Dec 2018, 19:13

I'd like to see what a screenshot of say the number 123 looks like, how big is it, what background ... ?
OCR might be able to detect scores on pong like games or similar, so let's see what you have in mind.
derpybaits
Posts: 9
Joined: 22 Dec 2018, 03:14

Re: Start script

22 Dec 2018, 19:33

wolf_II wrote:
22 Dec 2018, 19:13
I'd like to see what a screenshot of say the number 123 looks like, how big is it, what background ... ?
OCR might be able to detect scores on pong like games or similar, so let's see what you have in mind.
https://gyazo.com/4ec8d789d35966826fef9f32423f3e08

The number that pops up on the right side of the screen would be what i need to trigger it. As it like a xp counter it can be random number i need the script to trigger only if it is over 100
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Start script

22 Dec 2018, 20:04

I'm no expert, but I think with AHK, you can probably get what you need, given a static screen. so try that first.

You may be looking for a ready-made solution, I have not seen any, that would solve your problem, sorry, maybe someone else knows.
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Start script

23 Dec 2018, 03:44

I would take this approach: Paint a vertical line (using MS Paint or similar) into the screenshot, lining up with the top of the blue cloud thing.
figure out where exactly that line appears on-screen in-game. Let that be our "SCAN_LINE".

(1) each frame (start with frozen screen first) we scan for the point of change from Background to Cloudy_Blue.
Don't scan anything else yet, make it fast by scanning as little as possible, maybe only check every forth pixel.

(2) as soon as location of cloud is known, check for number, here it gets a little hazy ...
If the number starts within (untested, say 10 pixels) of the "SCAN-LINE" it has enough digits, so it is greater than 100.
Smaller numbers start further to the right than that. Maybe this approach will work, maybe not.

Good Luck!

Return to “Ask For Help”

Who is online

Users browsing this forum: flyingDman and 256 guests