Jump to content

Help with checkbox


 Share

Recommended Posts

When i start my program the box is unchecked like it is suposed to be and it isnt running... like its suposed to be. But once i check the box and uncheck it, it wont stop running. Please help me B)

Heres my code

;Theivery Bot V0.2
;By jackyyll
;11.5.05


;Stuff
Global $yaxis = 0
Global $xaxis = 0

$ErrorTitle = "Instruction"
AdlibEnable ( "_WinCheck", 10 )

HotKeySet("{PAUSE}", "EndScript")
;End Stuff


;Functions
;Close error
Func _WinCheck()
   If WinExists ( $ErrorTitle ) Then
      WinActivate ( $ErrorTitle )
      Send ( "o" )
   EndIf
EndFunc
;End Close Eror

;Steal
Func Steal()

Opt( "MouseCoordMode", 0)

Send('{F9}')
_MouseClickPlus( "Monster&Me - MythOfOrient", "left",  396 - $yaxis, 328 - $xaxis, 1) 
Sleep(300)
EndFunc
;End Steal

;Exit Bot
Func EndScript()
   $exit = MsgBox(4+16+0+4096+0, "Theivery Bot", "End Theivery Bot?")
      If $exit = 6 Then
        Exit
      EndIf
  EndFunc
;End Exit Bot

;SilentMouse
Func _MouseClickPlus($Window, $Button = "left", $X = "", $Y = "", $Clicks = 1)
  Local $MK_LBUTTON    =  0x0001
  Local $WM_LBUTTONDOWN   =  0x0201
  Local $WM_LBUTTONUP    =  0x0202
 
  Local $MK_RBUTTON    =  0x0002  
  Local $WM_RBUTTONDOWN   =  0x0204
  Local $WM_RBUTTONUP    =  0x0205

  Local $WM_MOUSEMOVE    =  0x0200
 
  Local $i              = 0
 
  Select
  Case $Button = "left"
     $Button     =  $MK_LBUTTON
     $ButtonDown =  $WM_LBUTTONDOWN
     $ButtonUp   =  $WM_LBUTTONUP
  Case $Button = "right"
     $Button     =  $MK_RBUTTON
     $ButtonDown =  $WM_RBUTTONDOWN
     $ButtonUp   =  $WM_RBUTTONUP
  EndSelect
 
  If $X = "" OR $Y = "" Then
     $MouseCoord = MouseGetPos()
     $X = $MouseCoord[0]
     $Y = $MouseCoord[1]
  EndIf
 
  For $i = 1 to $Clicks
     DllCall("user32.dll", "int", "SendMessage", _
        "hwnd",  WinGetHandle( $Window ), _
        "int",   $WM_MOUSEMOVE, _
        "int",   0, _
        "long",  _MakeLong($X, $Y))
       
     DllCall("user32.dll", "int", "SendMessage", _
        "hwnd",  WinGetHandle( $Window ), _
        "int",   $ButtonDown, _
        "int",   $Button, _
        "long",  _MakeLong($X, $Y))
       
     DllCall("user32.dll", "int", "SendMessage", _
        "hwnd",  WinGetHandle( $Window ), _
        "int",   $ButtonUp, _
        "int",   $Button, _
        "long",  _MakeLong($X, $Y))
  Next
EndFunc

Func _MakeLong($LoWord,$HiWord)
  Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF))
EndFunc
;End SilentMouse


;GUI
#include <GUIConstants.au3>

GuiCreate("Theivery Bot", 250, 250)
GuiCtrlCreateTab(1, 1, 250, 250)
GuiCtrlCreateTabItem("About")
GuiCtrlCreateLabel("Theivery bot By jackyyll", 5, 40)
GuiCtrlCreateTabItem("Theivery")
$start = GuiCtrlCreateCheckbox("Run", 150, 150, 80, 20)
GuiCtrlSetState(0, $GUI_CHECKED)

GuiSetState()

While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
        Case $msg = $start
        While 1
          Steal()
        WEnd
    EndSelect
WEnd

GUIDelete()

Exit
Link to comment
Share on other sites

Maybe you need something like that:

(warning: not working example)

While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $start
        If $z = 0 Then
            Steal()
            $z = 1
        EndIf
        
        If $z = 1 Then
            StopStealing()
            $z = 0
        EndIf
    EndSelect
WEnd
Link to comment
Share on other sites

No the idea is simple:

a) You run a while/wend loop to get tge gui control clicked.

B) once a control is clicked (in your case the 'run' control) the while/wend loop ends and AU3 STOPS listening to other user's choices.

So you either have to use the Adlib functionality (see the helpfile) or to call the while/wend loop again to listen to more user's choices.

Link to comment
Share on other sites

I tried doing:

AdlibEnable ( "_Check", 10 )

Func _Check()
   If $check = $GUI_UNCHECKED Then
      $c = 1
   EndIf
EndFunc

GuiCreate("Theivery Bot", 250, 250)
GuiCtrlCreateTab(1, 1, 250, 250)
GuiCtrlCreateTabItem("About")
GuiCtrlCreateLabel("Theivery bot By jackyyll", 5, 40)
GuiCtrlCreateTabItem("Theivery")
$start = GuiCtrlCreateCheckbox("Run", 150, 150, 80, 20)
$check = GuiCtrlSetState(-1, $GUI_UNCHECKED)

While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
        Case $msg = $start
        While $c = 0
        Steal()
        WEnd
       EndSelect
WEnd

And it still wont work -.- I get an error saying that $check wasnt define...

Edited by jackyyll
Link to comment
Share on other sites

  • Moderators

;Theivery Bot V0.2
;By jackyyll
;11.5.05


;Stuff
Global $yaxis = 0
Global $xaxis = 0

$ErrorTitle = "Instruction"
AdlibEnable ( "_WinCheck", 10 )

HotKeySet("{PAUSE}", "EndScript")
;End Stuff



;GUI
#include <GUIConstants.au3>

$MyGUI = GuiCreate("Theivery Bot", 250, 250)
GuiCtrlCreateTab(1, 1, 250, 250)
GuiCtrlCreateTabItem("About")
GuiCtrlCreateLabel("Theivery bot By jackyyll", 5, 40)
GuiCtrlCreateTabItem("Theivery")
$start = GuiCtrlCreateCheckbox("Run", 150, 150, 80, 20)

GuiSetState()

While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
        Case GUICtrlRead($start) <> 1
        While GUICtrlRead($start) <> 1
          Steal()
        WEnd
    Case GUICtrlRead($start) = 1
        MsgBox(0, "", "Checked Test")
    EndSelect
WEnd

GUIDelete()

Exit

;Functions
;Close error
Func _WinCheck()
   If WinExists ( $ErrorTitle ) Then
      WinActivate ( $ErrorTitle )
      Send ( "o" )
   EndIf
EndFunc
;End Close Eror

;Steal
Func Steal()
Opt( "MouseCoordMode", 0)

Send('{F9}')
_MouseClickPlus( "Monster&Me - MythOfOrient", "left",  396 - $yaxis, 328 - $xaxis, 1) 
Sleep(300)
EndFunc
;End Steal

;Exit Bot
Func EndScript()
   $exit = MsgBox(4+16+0+4096+0, "Theivery Bot", "End Theivery Bot?")
      If $exit = 6 Then
        Exit
      EndIf
  EndFunc
;End Exit Bot

;SilentMouse
Func _MouseClickPlus($Window, $Button = "left", $X = "", $Y = "", $Clicks = 1)
  Local $MK_LBUTTON    =  0x0001
  Local $WM_LBUTTONDOWN   =  0x0201
  Local $WM_LBUTTONUP    =  0x0202

  Local $MK_RBUTTON    =  0x0002  
  Local $WM_RBUTTONDOWN   =  0x0204
  Local $WM_RBUTTONUP    =  0x0205

  Local $WM_MOUSEMOVE    =  0x0200

  Local $i              = 0

  Select
  Case $Button = "left"
     $Button     =  $MK_LBUTTON
     $ButtonDown =  $WM_LBUTTONDOWN
     $ButtonUp   =  $WM_LBUTTONUP
  Case $Button = "right"
     $Button     =  $MK_RBUTTON
     $ButtonDown =  $WM_RBUTTONDOWN
     $ButtonUp   =  $WM_RBUTTONUP
  EndSelect

  If $X = "" OR $Y = "" Then
     $MouseCoord = MouseGetPos()
     $X = $MouseCoord[0]
     $Y = $MouseCoord[1]
  EndIf

  For $i = 1 to $Clicks
     DllCall("user32.dll", "int", "SendMessage", _
        "hwnd",  WinGetHandle( $Window ), _
        "int",   $WM_MOUSEMOVE, _
        "int",   0, _
        "long",  _MakeLong($X, $Y))
       
     DllCall("user32.dll", "int", "SendMessage", _
        "hwnd",  WinGetHandle( $Window ), _
        "int",   $ButtonDown, _
        "int",   $Button, _
        "long",  _MakeLong($X, $Y))
       
     DllCall("user32.dll", "int", "SendMessage", _
        "hwnd",  WinGetHandle( $Window ), _
        "int",   $ButtonUp, _
        "int",   $Button, _
        "long",  _MakeLong($X, $Y))
  Next
EndFunc

Func _MakeLong($LoWord,$HiWord)
  Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF))
EndFunc
;End SilentMouse

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Did you not try to play around with it?

$MyGUI = GuiCreate("Theivery Bot", 250, 250)
GuiCtrlCreateTab(1, 1, 250, 250)
GuiCtrlCreateTabItem("About")
GuiCtrlCreateLabel("Theivery bot By jackyyll", 5, 40)
GuiCtrlCreateTabItem("Theivery")
$start = GuiCtrlCreateCheckbox("Run", 150, 150, 80, 20)
GuiSetState()

While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case GUICtrlRead($start) = 1
        While GUICtrlRead($start) = 1
          MsgBox(0, "", "Checked")
        WEnd
    Case GUICtrlRead($start) = 4
        MsgBox(0, "", "Not Checked")
    EndSelect
WEnd

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Well what I gave you will do the trick.

Example:

$MyGUI = GuiCreate("Theivery Bot", 250, 250)
GuiCtrlCreateTab(1, 1, 250, 250)
GuiCtrlCreateTabItem("About")
GuiCtrlCreateLabel("Theivery bot By jackyyll", 5, 40)
GuiCtrlCreateTabItem("Theivery")
$start = GuiCtrlCreateCheckbox("Run", 150, 150, 80, 20)
GuiSetState()

While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case GUICtrlRead($start) = 1
        While GUICtrlRead($start) = 1
          Steal()
        WEnd
    Case GUICtrlRead($start) = 4
        Sleep(100)
    EndSelect
WEnd

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

That didnt work, i did this:

;GUI
#include <GUIConstants.au3>

$MyGUI = GuiCreate("Theivery Bot", 250, 250)
GuiCtrlCreateTab(1, 1, 250, 250)
GuiCtrlCreateTabItem("About")
GuiCtrlCreateLabel("Theivery bot By jackyyll", 5, 40)
GuiCtrlCreateTabItem("Theivery")
$start = GuiCtrlCreateCheckbox("Run", 150, 150, 80, 20)
GuiCtrlSetState(-1, $GUI_UNCHECKED)

GuiSetState()

While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
        Case GUICtrlRead($start) <> 4
        While GUICtrlRead($start) <> 4
          Steal()
        WEnd
    Case GUICtrlRead($start) = -1
        ExitLoop
    EndSelect
WEnd
Link to comment
Share on other sites

  • Moderators

= -1 works for you for checking if the box is unchecked?

I can't seem to replicate that myself. And I don't see that as an option in the GuiConstants.au3 for "unchecked".

But whatever floats your boat.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...