Sign in to follow this  
Followers 0
crazycrash

bringing my gui and my script together, make it one

8 posts in this topic

Hey guys, after studying the auto3help files and tutorials i made those two scripts. One is the gui, one is whats actually happening. They both seem to be working fine individually. Now i am trying to bring them together but i just dont understand how. I want it so the inputs from the gui are used in the script after the button is pressed, otherwise it should use the preset value from the gui. Plus the script only starts if the start button is pressed. Plus the start button should then become a stop button so it can be pressed to stop the script afterwards. If i understand that, then i think ill be able to take it on =)

It would be great if you could help me out here, so i can actually write scripts that have gui's =)

Thanks...

Here's my GUI

#include <GuiConstants.au3>


HotKeySet("{F1}", "About_GUI")


GuiCreate("Auto", 400, 400) 
;squaredefinition
GuiCtrlCreateLabel("Please define the variable x that is defined as the lenth of the perpendicular going from the center of the square to one of its sides", 10, 10, 200, 60)
GuiCtrlCreateInput( "5", 10, 70, 100, 20);this should be used as the $searcharea variable in the script, if the button is pressed, otherwise default should be used
GuiCtrlCreateButton("Set  the Squaresize", 120, 70, 100, 20)
;colordefinition
GuiCtrlCreateLabel("Please define the color to search for in hex format", 10, 110, 200, 30)
GuiCtrlCreateInput( "0xFFFFFF", 10, 145, 100, 20);this should be used as the $color variable in the script, if the button is pressed, otherwise default should be used
GuiCtrlCreateButton("Set the Color", 120, 145, 100, 20)

GuiCtrlCreateButton("Start", 70, 200, 100, 20)



;Display the GUI
GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE; loop until the message recieved is equal to event close.
WEnd


Func About_GUI()
    MsgBox(64, "Welcome!", " search")
EndFunc

Here's my Script

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")


$xmid = @DesktopWidth/2
$ymid = @DesktopHeight/2
$lookingfor = 0xFFFFFF
$searcharea = InputBox("Areainput", "Pixel area to search for in the middle of the screen (2*$searcharea)^2 is the area. Please specify $searcharea", "", " M2") 

MsgBox(0, "hunt", "the program is about to start, to pause press pause key, to end it press esc key, enjoy")
;;;; Body of program would go here;;;;
    ToolTip('Script is "Running"',0,0)
While 1
    $go = PixelSearch( $xmid-$searcharea, $ymid-$searcharea, $xmid+$searcharea, $ymid+$searcharea, $lookingfor)
    If IsArray($go) Then
    MsgBox(0, "yay", "the color you where looking for was found") 
    EndIf
WEnd
;;;;;;;;

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip('Script is "Running"',0,0)
EndFunc

Func Terminate()
    Exit 0
EndFunc

Share this post


Link to post
Share on other sites



OK here's what you do. Your GUI waits for the close event with this line:

While GuiGetMsg() <> $GUI_EVENT_CLOSEoÝ÷ Ù»­Ê«IÊâ¦Ö¥²ÞyÛ-¡Ú,¶çß²¨º·¦¢÷­«p)^)jwZuÖj×!~ôß¡ ED509!"Ø^±Êâ¦Ýý²Z(¤×±·*.ëޮǭºÚ®&ë-¢­rí®HÇè¯*.­Ê'¶º%²Ê0zÇ­¶­ºá·py§]q«ë-¢Ç­¶¯j[§¶ºÛh+)­ë,yÖ(º·â©¡×°Ye¢%G­+ºÚ"µÍÚ[ÛYH ÑÝZPÛÛÝ[Ë]LÉÝÂÝÙ^]
    ][ÝÞÑ_I][ÝË    ][ÝÐXÝ]ÑÕRI][ÝÊBÝÙ^]
    ][ÝÞÔUTÑ_I][ÝË    ][ÝÕÙÙÛT]ÙI][ÝÊBÝÙ^]
    ][ÝÞÑTÐßI][ÝË    ][ÝÕZ[]I][ÝÊBÝZPÜX]][ÝÐ]]É][ÝË


HÝZPÝÜX]SX[
    ][ÝÔXÙHY[HHXXH]ÈY[YÈH[ÙH[[ÛÚ[ÈÛHHÙ[ÙHÜ]XHÈÛHÙ]ÈÚYÉ][ÝËLL

BÌÍÜÙXÚXXÝHÝZPÝÜX]R[]
    ][ÝÍI][ÝËL
ÌL
NÝÈÚÝ[HÙYÈH   ÌÍÜÙXÚXHXXH[HØÜYH]ÛÈÜÙYÝÚÙHY][ÚÝ[HÙYÌÍÜÙXÚXXHÝZPÝÜX]P]Û   ][ÝÔÙ]]^I][ÝËL
ÌL
BÝZPÝÜX]SX[
    ][ÝÔXÙHY[HHÛÛÜÈÙXÚÜ[^ÜX] ][ÝËLLLÌ
BÌÍØÛÛÜÝHÝZPÝÜX]R[]
    ][ÝÌ][ÝËLM
KL
NÝÈÚÝ[HÙYÈH   ÌÍØÛÛÜXXH[HØÜYH]ÛÈÜÙYÝÚÙHY][ÚÝ[HÙYÌÍØÛÛÜHÝZPÝÜX]P]Û ][ÝÔÙ]HÛÛÜ][ÝËLM
KL
BÌÍÜÝHÝZPÝÜX]P]Û    ][ÝÔÝ    ][ÝË
ÌL
BÝZTÙ]Ý]J
B[ÈXÝ]ÑÕRJ
BSÙÐÞ
    ][ÝÕÙ[ÛÛYIÌÌÎÉ][ÝË   ][ÝÈÙXÚ ][ÝÊB[[ÂÛØ[    ÌÍÔ]ÙYÌÍÞZYHÚÝÜÚYÌÌÍÞ[ZYHÚÝÜZYÚÌÌÍÛÛÚÚ[ÙÜHÌÍÜÙXÚXHH[]Þ
    ][ÝÐXZ[]  ][ÝË  ][ÝÔ^[XHÈÙXÚÜ[HZYHÙHØÜY[
ÌÍÜÙXÚXJWÈHXKXÙHÜXÚYH  ÌÍÜÙXÚXI][ÝË ][ÝÉ][ÝË    ][ÝÈL][ÝÊHÌÍÙÝZ[ÙÈHÝZQÙ]ÙÊ
BÚ[H   ÌÍÙÝZ[ÙÈ  ÉÝÈ  ÌÍÜÝIÌÍÙÝZ[ÙÈHÝZQÙ]ÙÊ
BRY ÌÍÙÝZ[ÙÈH ÌÍÜÙXÚXX[BIÌÍÜÙXÚXHHÝZPÝXY
    ÌÍÜÙXÚXXÝ
BQ[YRY  ÌÍÙÝZ[ÙÈH ÌÍØÛÛÜ[BIÌÍÛÛÚÚ[ÙÜHÝZPÝXY
    ÌÍØÛÛÜÝ
BQ[YTÛY
L
BÑ[ÙÐÞ
    ][ÝÚ[ ][ÝË  ][ÝÝHÙÜ[HÈXÝ]ÈÝÈ]ÙHÜÈ]ÙHÙ^[]ÜÈØÈÙ^K[ÞI][ÝÊBÛÛ
    ÌÎNÔØÜÈ   ][ÝÔ[[É][ÝÉÌÎNË
BÚ[HBIÌÍÙÝZ[ÙÈHÝZQÙ]ÙÊ
BRY ÌÍÙÝZ[ÙÈH ÌÍÜÙXÚXX[BIÌÍÜÙXÚXHHÝZPÝXY
    ÌÍÜÙXÚXXÝ
BQ[YRY  ÌÍÙÝZ[ÙÈH ÌÍØÛÛÜ[BIÌÍÛÛÚÚ[ÙÜHÝZPÝXY
    ÌÍØÛÛÜÝ
BQ[YIÌÍÙÛÈH^[ÙXÚ
    ÌÍÞZYIÌÍÜÙXÚXK  ÌÍÞ[ZYIÌÍÜÙXÚXK ÌÍÞZY
ÉÌÍÜÙXÚXK ÌÍÞ[ZY
ÉÌÍÜÙXÚXK ÌÍÛÛÚÚ[ÙÜBRYÐ^J    ÌÍÙÛÊH[BSÙÐÞ
    ][ÝÞX^I][ÝË ][ÝÝHÛÛÜ[ÝHÚHÛÚÚ[ÈÜØÈÝ[  ][ÝÊHQ[YRYÝZQÙ]ÙÊ
HH  ÌÍÑÕRWÑUSÐÓÔÑH[BQ^]Q[[[ÈÙÙÛT]ÙJ
BIÌÍÔ]ÙYHÕ ÌÍÔ]ÙYUÚ[H ÌÍÔ]ÙYBÛY
L
BBUÛÛ
    ÌÎNÔØÜÈ   ][ÝÔ]ÙY  ][ÝÉÌÎNË
BUÑ[UÛÛ
    ÌÎNÔØÜÈ   ][ÝÔ[[É][ÝÉÌÎNË
B[[Â[ÈZ[]J
BQ^][[

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi, This is not a full sample. I have not tested it as I have done it all in the browser on a Linux box. But I think You will catch the drift of it.

Happy coding

#include <GuiConstants.au3>
HotKeySet("{F1}", "About_GUI")
Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
$xmid = @DesktopWidth/2
$ymid = @DesktopHeight/2
$lookingfor = 0xFFFFFF
$searcharea = InputBox("Areainput", "Pixel area to search for in the middle of the screen (2*$searcharea)^2 is the area. Please specify $searcharea", "", " M2") 

MsgBox(0, "hunt", "the program is about to start, to pause press pause key, to end it press esc key, enjoy")
;;;; Body of program would go here;;;;
    ToolTip('Script is "Running"',0,0)

;Display the GUI
Global $gui = MyGuiCreate()
GuiSetState(@SW_SHOW) ;Use the default value as a reminder.
While 1
     Switch GuiGetMsg()
          Case $GUI_EVENT_CLOSE; loop until the message recieved is equal to event close.
              ExitLoop ;Better than using a terminate (Exit) call in the loop?
          Case $ctlBtnStart
          Case $ctlBtnSetColor
     EndSwitch
        ; TODO: Monitro your $pause logic here. Even move this part out in a function 
    $go = PixelSearch( $xmid-$searcharea, $ymid-$searcharea, $xmid+$searcharea, $ymid+$searcharea, $lookingfor)
    If IsArray($go) Then
    MsgBox(0, "yay", "the color you where looking for was found") 
    EndIf

     Sleep(0); For good measure give the rest of your timeslot avay to the system.
WEnd
Exit ;Terminate the application. This will Call OnAutoItExit function if defined.

;;;;;;;;
Func About_GUI()
    MsgBox(64, "Welcome!", " search")
EndFunc

Func MyGuiCreate()
    ;TODO: You might want to move the Global declarations to the top of the file
    ; That is considered "good practice". I'm doing this in the browser, so I have not bothered..:).
    Local $gui = GuiCreate("Auto", 400, 400) 
    ;squaredefinition
    GuiCtrlCreateLabel("Please define the variable x that is defined as the lenth of the perpendicular going from the center of the square to one of its sides", 10, 10, 200, 60)
    Global $ctlInpSearchArea = GuiCtrlCreateInput( "5", 10, 70, 100, 20);this should be used as the $searcharea variable in the script, if the button is pressed, otherwise default should be used
    Global $ctlBtnSquaresize = GuiCtrlCreateButton("Set  the Squaresize", 120, 70, 100, 20)
;colordefinition
    GuiCtrlCreateLabel("Please define the color to search for in hex format", 10, 110, 200, 30)
    Global $ctlInpColor = GuiCtrlCreateInput( "0xFFFFFF", 10, 145, 100, 20);this should be used as the $color variable in the script, if the button is pressed, otherwise default should be used
    Global $ctlBtnSetColor = GuiCtrlCreateButton("Set the Color", 120, 145, 100, 20)

    Global $ctlBtnStart = GuiCtrlCreateButton("Start", 70, 200, 100, 20)
    Return $gui
EndFunc
Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
                ;TODO: You will never get out of this loop
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip('Script is "Running"',0,0)
EndFunc

Func Terminate()
    Exit 0
EndFunc

EDIT: PS: Wrap your code with the autoit tags: [ autoit ]code[ /autoit ] (without the spaces) to get colorcoding..:P

Edited by Uten

Share this post


Link to post
Share on other sites

Thanks a lot you two, i am beginning to understand how this works i think. the script below is where i am at now. How do i make it so the core of the script, well the pixelsearch part, is only called when start was pressed? (basically loop it till infinity except if the start button is pressed again. Do the buttons have any function at all, or could i just use the input fields? (There hasnt got to be a button for the input to be used right?) I dont fully understand yet what this switch/case thing is, what should it do?

Thanks a ton

Global $Paused, $gui, $ctlInpSearchArea, $ctlBtnSquaresize, $ctlInpColor, $ctlBtnSetColor, $ctlBtnStart
#include <GuiConstants.au3>
HotKeySet("{F1}", "About_GUI")
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")

$xmid = @DesktopWidth/2
$ymid = @DesktopHeight/2

MsgBox(0, "hunt", "the program is about to start, to pause press pause key, to end it press esc key, enjoy")

ToolTip('Script is "Running"',0,0)

;Display the GUI
$gui = MyGuiCreate()
GuiSetState(@SW_SHOW) ;Use the default value as a reminder.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

While 1
     Switch GuiGetMsg()
          Case $GUI_EVENT_CLOSE; loop until the message recieved is equal to event close.
              ExitLoop ;Better than using a terminate (Exit) call in the loop?
          Case $ctlBtnStart
          Case $ctlBtnSetColor
     EndSwitch
        ; TODO: Monitro your $pause logic here. Even move this part out in a function 
    $go = PixelSearch( $xmid-$ctlInpSearchArea, $ymid-$ctlInpSearchArea, $xmid+$ctlInpSearchArea, $ymid+$ctlInpSearchArea, $ctlInpColor)
    If IsArray($go) Then
    MsgBox(0, "yay", "the color you where looking for was found") 
    EndIf

     Sleep(10); For good measure give the rest of your timeslot avay to the system.
WEnd
Exit ;Terminate the application. This will Call OnAutoItExit function if defined.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Func MyGuiCreate()
    $gui = GuiCreate("Auto", 400, 400) 
    ;squaredefinition
    GuiCtrlCreateLabel("Please define the variable x that is defined as the lenth of the perpendicular going from the center of the square to one of its sides", 10, 10, 200, 60)
    $ctlInpSearchArea = GuiCtrlCreateInput( "5", 10, 70, 100, 20);this should be used as the $searcharea variable in the script, if the button is pressed, otherwise default should be used
    $ctlBtnSquaresize = GuiCtrlCreateButton("Set  the Squaresize", 120, 70, 100, 20)
    ;colordefinition
    GuiCtrlCreateLabel("Please define the color to search for in hex format", 10, 110, 200, 30)
    $ctlInpColor = GuiCtrlCreateInput( "0xFFFFFF", 10, 145, 100, 20);this should be used as the $color variable in the script, if the button is pressed, otherwise default should be used
    $ctlBtnSetColor = GuiCtrlCreateButton("Set the Color", 120, 145, 100, 20)

    $ctlBtnStart = GuiCtrlCreateButton("Start", 70, 200, 100, 20)
    Return $gui
EndFunc

Func About_GUI()
    MsgBox(64, "Welcome!", " search")
EndFunc

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip('Script is "Running"',0,0)
EndFunc

Func Terminate()
    Exit 0
EndFunc

Share this post


Link to post
Share on other sites

After a few more hours trying, thats where i am at using and mixing the info i got from the two of you. But I dont understand why it wont work lol, it seems the buttons dont change the variables.

Global $Paused
Global $gui, $inpsize, $btnsize, $inpcolor, $btncolor, $btnstart, $btnstop, $go, $guimsg
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("{F1}", "About_GUI")

$xmid = @DesktopWidth/2
$ymid = @DesktopHeight/2
$lookingfor = 0xFFFFFF
$searcharea = 5
$start = 0

#include <GuiConstants.au3>

Opt("GUIOnEventMode", 1)
Opt("MustDeclareVars", 1)

ShowGUI()
MainLoop()

Func MainLoop()
    while 1
        checkgui()
        checking()
        Sleep(100)
    WEnd
EndFunc

Func ShowGUI()
    $gui = GuiCreate("Auto", 400, 400) 
    ;squaredefinition
    GuiCtrlCreateLabel("Please define the variable x that is defined as the lenth of the perpendicular going from the center of the square to one of its sides", 10, 10, 200, 60)
    $inpsize = GuiCtrlCreateInput( "5", 10, 70, 100, 20) ;this should be used as the $searcharea variable in the script, if the button is pressed, otherwise default should be used
    $btnsize = GuiCtrlCreateButton("Set  the Squaresize", 120, 70, 100, 20)
    ;colordefinition
    GuiCtrlCreateLabel("Please define the color to search for in hex format", 10, 110, 200, 30)
    $inpcolor = GuiCtrlCreateInput( "0xFFFFFF", 10, 145, 100, 20) ;this should be used as the $color variable in the script, if the button is pressed, otherwise default should be used
    $btncolor = GuiCtrlCreateButton("Set the Color", 120, 145, 100, 20)
    ;startit
    $btnstart = GuiCtrlCreateButton("Start", 70, 200, 100, 20)
    $btnstop = GuiCtrlCreateButton("Stop", 70, 230, 100, 20)
    GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
    GUISetState(@SW_SHOW)
EndFunc

Func checkgui()
     $guimsg = GuiGetMsg()
    If $guimsg = $btnstart Then
        $start = 1
    EndIf
    If $guimsg = $btnstop Then
        $start = 0
    EndIf
    If $guimsg = $btnsize Then
        $searcharea = GuiCtrlRead($inpsize)
    EndIf
    If $guimsg = $btncolor Then
        $lookingfor = GuiCtrlRead($inpcolor)
    EndIf
EndFunc

Func checking()
    While $start = 1
        $go = PixelSearch( $xmid-$searcharea, $ymid-$searcharea, $xmid+$searcharea, $ymid+$searcharea, $lookingfor)
        If IsArray($go) Then
            MsgBox(0, "", "hey")
            Sleep(1000)
        EndIf
    WEnd
EndFunc

Func Quit()
    MsgBox(32, "Quit", "")
    Exit
EndFunc 

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip('Script is "Running"',0,0)
EndFunc

Func Terminate()
    Exit 0
EndFunc

Func About_GUI()
    MsgBox(64, "Welcome!", " lets hunt")
EndFunc

Share this post


Link to post
Share on other sites

Looks like your doing good progress. Keep it up..:P

You will only get 1 match each time you call this. So it is better (faster) to use ElseIf, Select or Switch structures

Func checkgui()
     $guimsg = GuiGetMsg()
    If $guimsg = $btnstart Then
        $start = 1
    ElseIf $guimsg = $btnstop Then
        $start = 0
    ElseIf $guimsg = $btnsize Then
        $searcharea = GuiCtrlRead($inpsize)
    ElseIf $guimsg = $btncolor Then
        $lookingfor = GuiCtrlRead($inpcolor)
    EndIf
EndFuncoÝ÷ Ù.².Úk¡¶&&^rH§)ò¢êܡ׵éݶ¬zÊ&zØb  bëaÆ®¶­sdgVæ2F&rb33c¶×6rÂb33c¶W&ÃÔ67&DÆæTçVÖ&W"¢6öç6öÆUw&FRgV÷C²gV÷C²fײW&ÂfײgV÷C²£ÒgV÷C²fײb33c¶×6rfײ5$Äb¤VæDgVæ0oÝ÷ Ø*'²^Z¸­z+'Ç­¢ëü¨¹Ú.±ä1)¢µçoz»"¢x¬¥ªí¡ûay«­¢+]Ëk»­âØ^IÈZ%uêÒ£­ØZµû§rب(ºWZuÛ(ëax%GºÚ"µÍ[ÙRY ÌÍÙÝZ[ÙÈH ÌÍØÚ^H[ ÌÍÜÙXÚXHHÝZPÝXY
    ÌÍÚ[Ú^JBÊ  ][ÝÉÌÍÜÙXÚXNI][ÝÈ  [È ÌÍÜÙXÚXJB[ÙRY ÌÍÙÝZ[ÙÈH ÌÍØÛÛÜ[   ÌÍÛÛÚÚ[ÙÜHÝZPÝXY
    ÌÍÚ[ÛÛÜBÊ    ][ÝÉÌÍÛÛÚÚ[ÙÜI][ÝÈ  [È ÌÍÛÛÚÚ[ÙÜB[Y

Share this post


Link to post
Share on other sites

Ic, but that debug thing should only come up if there is a problem right?

I still cant figure out why its not working, It wont start or stop. the messagebox MsgBox(0, "hm", "really am checking", 2) should popup as soon as start is clicked, and repopup all the time but somehow it wont..

Does the elseif really work like that? what if the first IF statement is true, then it wont check the other ones will it?

Thanks a ton!

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.1.1.0
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

Global $Paused
Global $gui, $inpsize, $btnsize, $inpcolor, $btncolor, $btnstart, $btnstop, $go, $guimsg
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("{F1}", "About_GUI")

$xmid = @DesktopWidth/2
$ymid = @DesktopHeight/2
$lookingfor = 0xFFFFFF
$searcharea = 5
$start = 0

#include <GuiConstants.au3>

Opt("GUIOnEventMode", 1)
Opt("MustDeclareVars", 1)

ShowGUI()
MainLoop()

Func MainLoop()
    while 1
        checkgui()
        checking()
        Sleep(100)
    WEnd
EndFunc

Func ShowGUI()
    $gui = GuiCreate("Auto", 400, 400) 
    ;squaredefinition
    GuiCtrlCreateLabel("Please define the variable x that is defined as the lenth of the perpendicular going from the center of the square to one of its sides", 10, 10, 200, 60)
    $inpsize = GuiCtrlCreateInput( "5", 10, 70, 100, 20) ;this should be used as the $searcharea variable in the script, if the button is pressed, otherwise default should be used
    $btnsize = GuiCtrlCreateButton("Set  the Squaresize", 120, 70, 100, 20)
    ;colordefinition
    GuiCtrlCreateLabel("Please define the color to search for in hex format", 10, 110, 200, 30)
    $inpcolor = GuiCtrlCreateInput( "0xFFFFFF", 10, 145, 100, 20) ;this should be used as the $color variable in the script, if the button is pressed, otherwise default should be used
    $btncolor = GuiCtrlCreateButton("Set the Color", 120, 145, 100, 20)
    ;startit
    $btnstart = GuiCtrlCreateButton("Start", 70, 200, 100, 20)
    $btnstop = GuiCtrlCreateButton("Stop", 70, 230, 100, 20)
    GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
    GUISetState(@SW_SHOW)
EndFunc


Func checkgui()
     $guimsg = GuiGetMsg()
    If $guimsg = $btnstart Then
        $start = 1
    ElseIf $guimsg = $btnstop Then
        $start = 0
    ElseIf $guimsg = $btnsize Then
        $searcharea = GuiCtrlRead($inpsize)
        dbg("$searcharea:=" & $searcharea)
    ElseIf $guimsg = $btncolor Then
        $lookingfor = GuiCtrlRead($inpcolor)
        dbg("$lookingfor:=" & $lookingfor)
    EndIf
EndFunc

Func checking()
    While $start = 1
        MsgBox(0, "hm", "really am checking", 2)
        $go = PixelSearch( $xmid-$searcharea, $ymid-$searcharea, $xmid+$searcharea, $ymid+$searcharea, $lookingfor)
        If IsArray($go) Then
            MsgBox(0, "", "hey")
            Sleep(1000)
        EndIf
    WEnd
EndFunc

Func dbg($msg, $erl=@ScriptLineNumber)
    ConsoleWrite("(" & @erl & ") := " & $msg & @CRLF)
EndFunc

Func Quit()
    MsgBox(32, "Quit", "")
    Exit
EndFunc 

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip('Script is "Running"',0,0)
EndFunc

Func Terminate()
    Exit 0
EndFunc

Func About_GUI()
    MsgBox(64, "Welcome!", " lets hunt")
EndFunc

Share this post


Link to post
Share on other sites

Oh and two other questions i have, next to wondering why it doesnt work: Is there a way to tell the script what core to use? for example if you have a duocore, to use the second core, if the first one is used by the game? Second is there a way to speed the script up? even if only a square of 2x2 pixels is searched for, it seems it doesnt recognize the color if its only there for about a third of a second.

Thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0