Sign in to follow this  
Followers 0
Izzeh

Help with GUI/Pixel Scanning

1 post in this topic

Ok so basically this is an autotraining script for a 2D game I play, However I tried to add GUI and it just WON'T work. Basically the GUI opens and asks you to into the pixel colour of the monster under the mouse (And this is found by pressing Alt+A and copy and pasting into top box), and also what you want it to say every 15 minutes... The problem being that I'm pretty sure I haven't used the variables in the right way - What should happen is when you click start, it takes the $pixel variable and then sets it as the pixel to find when it scans every 3 seconds.. This is where it stops working... it works fine without the GUI and just having a predefined pixel colour. Also the send command doesn't seem to work either - any help with that would be great!

#include <GUIConstants.au3>

Dim $start, $var, $pos, $say, $pixel, $pixelcolor, $btn

HotKeySet("!x","QuitLoop")

Func QuitLoop()

$start=0

EndFunc

GUICreate("Choose your options", 400, 250)

GUICtrlCreateLabel("Colour of Pixel:", 30, 10)

$pixel = GUICtrlcreateinput("", 30, 31, 200, 20)

GUICtrlCreateLabel("What to say:", 30, 68)

$say = GUICtrlcreateinput("Hi just watching movie so not really paying attention", 30, 88, 350, 20)

GUICtrlCreateLabel("Colour under mouse: (Press Alt+A to update)", 30, 170)

hotkeyset("!a","change")

Func change()

$pos=mousegetpos()

$var=PixelGetColor ( $pos[0] , $pos[1] )

GUIctrlcreateinput($var, 30, 190, 150, 20)

EndFunc

$btn = GUICtrlCreateButton("Start", 350, 200, 40)

GUISetState(@SW_SHOW)

$msg = 0

While $msg <> $GUI_EVENT_CLOSE

$msg = GUIGetMsg()

Select

Case $msg = $btn

$pixelcolor = $pixel

GUISetState(@SW_HIDE)

$start = 1

EndSelect

Wend

While $start=1

$coord = Pixelsearch(8, 33, 519, 416, $pixelcolor)

If @error <> 1 then

MouseClick("left", $coord[0], $coord[1] )

Endif

sleep(3000)

WEnd

While $start=1

Send($say)

Send("{ENTER}")

sleep(900000)

WEnd

Share this post


Link to post
Share on other sites



Sign in to follow this  
Followers 0