jackyyll Posted November 5, 2005 Posted November 5, 2005 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 Heres my code expandcollapse popup;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
erebus Posted November 5, 2005 Posted November 5, 2005 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
jackyyll Posted November 5, 2005 Author Posted November 5, 2005 No i mean... shouldnt it end the Steal() once you uncheck the box? How do i get it working?
erebus Posted November 5, 2005 Posted November 5, 2005 No the idea is simple: a) You run a while/wend loop to get tge gui control clicked. 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.
jackyyll Posted November 5, 2005 Author Posted November 5, 2005 (edited) 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 November 5, 2005 by jackyyll
jackyyll Posted November 5, 2005 Author Posted November 5, 2005 Nothing i do is helping :/ Someone please helpppp
Moderators SmOke_N Posted November 6, 2005 Moderators Posted November 6, 2005 expandcollapse popup;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.
jackyyll Posted November 6, 2005 Author Posted November 6, 2005 I tried your code, now when i start the program, it is already doing Steal() and when i check the checkbox it gives me the msg box over and over and over.
Moderators SmOke_N Posted November 6, 2005 Moderators Posted November 6, 2005 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.
jackyyll Posted November 6, 2005 Author Posted November 6, 2005 (edited) Yeah im playing around with it right now. I can get it to shut off when i check it ... but when i keep it unchecked it just runs Steal() Edited November 6, 2005 by jackyyll
jackyyll Posted November 6, 2005 Author Posted November 6, 2005 YAY! I got it, thanks alot ronsrules PS Srry for dbl post...
Moderators SmOke_N Posted November 6, 2005 Moderators Posted November 6, 2005 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.
jackyyll Posted November 6, 2005 Author Posted November 6, 2005 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
Moderators SmOke_N Posted November 6, 2005 Moderators Posted November 6, 2005 = -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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now