d0n Posted June 17, 2009 Posted June 17, 2009 Hi, i have a bot here that works fairly well, however i was wondering what is the best way to pause the script during one of the searches? i tried to do it with the guistat func but it doesn't seem to be working. expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Opt("Sendkeydelay", 1000) Global $mob $FV_1 = "C:\Documents and Settings\Admin\Desktop\Rev bot\FV_1.bmp" $FV_2 = "C:\Documents and Settings\Admin\Desktop\Rev bot\FV_2.bmp" $Title = "(Tank)" $1 = 1 $2 = 3 #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 127, 263, 395, 258) $Label1 = GUICtrlCreateLabel("", 8, 40, 127, 17) $Combo1 = GUICtrlCreateCombo("", 0, 8, 121, 25) GUICtrlSetData(-1, "FV_1|FV_2", "") $Button1 = GUICtrlCreateButton("Start", 0, 224, 57, 33, $WS_GROUP) $Button2 = GUICtrlCreateButton("Stop", 64, 224, 57, 33, $WS_GROUP) $Pic1 = GUICtrlCreatePic("", 8, 112, 108, 100, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Gui() Func Gui() While 1 $Msg = GUIGetMsg() Select Case $Msg = $Combo1 $Selection = GUICtrlRead($Combo1) IF $Selection = "FV_1" Then GUICtrlSetImage($Pic1,$FV_1) GUICtrlSetData($Label1,"Bear") ElseIf $Selection = "FV_2" Then GUICtrlSetImage($Pic1,$FV_2) GUICtrlSetData($Label1,"Dragon") EndIf Case $Msg = $Button1 IF $Selection = "FV_1" Then $mob = "Bear" Search1() FV_1() ElseIf $Selection = "FV_2" Then $mob = "Dragon" Search1() FV_2() EndIf Case $Msg = $Button2 Exit Case $Msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd EndFunc Func FV_1() While 1 MoveLEFT() MoveDOWN() MoveLEFT() MoveRIGHT() MoveDOWN() MoveRIGHT() MoveUP() MoveUP() WEnd EndFunc Func FV_2() While 1 MoveRIGHT() MoveRIGHT() MoveDOWN() MoveLEFT() MoveUP() MoveLEFT() WEnd EndFunc Func GuiStat() $Msg = GUIGetMsg() Select Case $Msg = $Button2 Exit EndSelect EndFunc Func Search1() Sleep(1000) $Text1 = ControlGetText($Title,"","[CLASS:RichEdit20A; INSTANCE:2]") $Trim1 = StringRight($Text1, 300) $a = StringInStr($Trim1, $mob & " is here.") If $a NOT= 0 Then ControlClick($Title,"","[CLASS:Button; INSTANCE:31]") ControlClick($Title,"","[CLASS:Button; INSTANCE:29]","Left",2) Sleep(3000) ControlClick($Title,"","[CLASS:Button; INSTANCE:28]","Left",2) $1 = 1 Search2() GuiStat() Else EndIf Sleep(100) EndFunc Func Search2() While $1 > 0 $Text2 = ControlGetText($Title,"","[CLASS:RichEdit20A; INSTANCE:2]") $Trim2 = StringRight($Text2, 200) $b = StringInStr($Trim2, "You gain") $Trim4 = StringRight($Text2, 2000) $d = StringInStr($Trim4, "slain by") If $b NOT= 0 Then $1 = 0 EndIf If $d NOT= 0 Then MsgBox("","","Dead") Exit EndIf WEnd EndFunc Func Chat() $Text3 = ControlGetText($Title,"","[CLASS:RichEdit20A; INSTANCE:2]") $Trim3 = StringRight($Text3, 1000) $Trim4 = StringRight($Text3, 2000) $c = StringInStr($Trim3, "tells") $d = StringInStr($Trim4, "You are dead") If $c OR $d NOT= 0 Then MsgBox("","","Bot Stopped") Exit EndIf EndFunc Func MoveUP() Chat() ControlClick($Title,"",1023) Search1() EndFunc Func MoveDOWN() Chat() ControlClick($Title,"",1024) Search1() EndFunc Func MoveLEFT() Chat() ControlClick($Title,"",1026) Search1() EndFunc Func MoveRight() Chat() ControlClick($Title,"",1025) Search1() EndFunc
dantay9 Posted June 17, 2009 Posted June 17, 2009 Put the contents of guistat into a while loop. When the criteria is met, exit the loop and continue the script.
d0n Posted June 17, 2009 Author Posted June 17, 2009 i did this, but it didn't seem to work Func GuiStat() While 1 $Msg = GUIGetMsg() Select Case $Msg = $Button2 Exit EndSelect WEnd EndFunc
koekje Posted June 17, 2009 Posted June 17, 2009 (edited) i did this, but it didn't seem to work Func GuiStat() While 1 $Msg = GUIGetMsg() Select Case $Msg = $Button2 Exit EndSelect WEnd EndFunc Haven't read through your script, but could be it replacing Exit with ExitLoop? Because Exit will _always_ exit your script, and the title says pausing, so i think this may be it Edited June 17, 2009 by koekje
d0n Posted June 17, 2009 Author Posted June 17, 2009 na, i just want to either pause or exit mid script inside a loop
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