syron Posted June 20, 2008 Share Posted June 20, 2008 Hello everybody, Im pretty new to this GUI stuff in Autoit and especially with stuff like ObjCreate() which I didnt use before! This is a script which WORKS for a little game which can be played on a forum and I don't know why the STOP button doesn't work. Maybe one of you can tell me. The function StartBot() searches for a monster which is on a level, the user defined and then it attacks until the image to attack isnt existing anymore. I am really thankful for every hint you can give me. Best regards expandcollapse popup#include <GUIConstants.au3> #include <IE.au3> #include <File.au3> $oIE = ObjCreate("Shell.Explorer.2") $GUI_PetEden = GUICreate ("Pet eden", 720, 560,193, 125) $GUIActiveX = GUICtrlCreateObj ( $oIE, 10, 10 , 700 , 500 ) $GUI_Button_Setup = GuiCtrlCreateButton ("Setup", 10, 520, 100, 30) $GUI_Button_MyPet = GuiCtrlCreateButton ("My Pet", 120, 520, 100, 30) $GUI_Button_Adventure = GuiCtrlCreateButton ("Adventure", 230, 520, 100, 30) $GUI_Button_Warehouse = GuiCtrlCreateButton ("Warehouse", 340, 520, 100, 30) $GUI_Button_Start = GuiCtrlCreateButton ("Start", 500, 520, 100, 30) $GUI_Button_Stop = GuiCtrlCreateButton ("Stop", 610, 520, 100, 30) GUISetState () ;Show GUI $oIE.navigate("http://www.l2021.com/bbs/pet.php?index=mypet") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $GUI_Button_Setup Setup() Case $msg = $GUI_Button_MyPet $oIE.navigate("http://www.l2021.com/bbs/pet.php?index=mypet") Case $msg = $GUI_Button_Adventure $mapid_get = IniRead("data.ini", "Pet Eden", "mapid", "") $oIE.navigate("http://www.l2021.com/bbs/pet.php?index=petpknpc&mapid=" & $mapid_get) Case $msg = $GUI_Button_Warehouse $oIE.navigate("http://www.l2021.com/bbs/pet.php?index=usershop") Case $msg = $GUI_Button_Start $mapid = IniRead("data.ini", "Pet Eden", "mapid", "") $monsterlevel = IniRead("data.ini", "Pet Eden", "monsterlevel", "") GUICtrlSetState($GUI_Button_Setup, $GUI_DISABLE) GUICtrlSetState($GUI_Button_MyPet, $GUI_DISABLE) GUICtrlSetState($GUI_Button_Adventure, $GUI_DISABLE) GUICtrlSetState($GUI_Button_Warehouse, $GUI_DISABLE) GUICtrlSetState($GUI_Button_Start, $GUI_DISABLE) StartBot($mapid, $monsterlevel) EndSelect Wend GUIDelete () Exit Func StartBot($id, $max) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $GUI_Button_Stop GUICtrlSetState($GUI_Button_Setup, $GUI_ENABLE) GUICtrlSetState($GUI_Button_MyPet, $GUI_ENABLE) GUICtrlSetState($GUI_Button_Adventure, $GUI_ENABLE) GUICtrlSetState($GUI_Button_Warehouse, $GUI_ENABLE) GUICtrlSetState($GUI_Button_Start, $GUI_ENABLE) Return EndSelect $oIE.navigate("http://www.l2021.com/bbs/pet.php?index=petpknpc&mapid=" & $id) _IELoadWait($oIE) $body = _IEBodyReadText($oIE) If StringInStr($body, "Your pet is dead, can it still fight?") Then $oIE.navigate("http://www.l2021.com/bbs/pet.php?index=usershop&action=list&itemtype=7") _IELoadWait($oIE) $oIE.navigate("http://www.l2021.com/bbs/pet.php?index=itemuse&storageid=436560") _IELoadWait($oIE) $oIE.navigate("http://www.l2021.com/bbs/pet.php?index=petpknpc&mapid=" & $id) _IELoadWait($oIE) EndIf $fopen = FileOpen("log.txt", 2) FileWrite($fopen, $body) FileClose($fopen) $fread = FileOpen("log.txt", 0) $readmonsterline = FileReadLine($fread, 9) $splitmonsterlevel = StringSplit($readmonsterline, " ") ; $splitmonsterlevel[2] = Level $readhpline = FileReadLine($fread, 12) $splithp = StringSplit($readhpline, " ") If $splitmonsterlevel[2] = $max OR $splitmonsterlevel[2] < $max Then While $splithp[2] > 0 _IEImgClick($oIE, "http://www.l2021.com/bbs/images/pet/skill/commonf.jpg") If @error Then ExitLoop ;~ The monster is dead, search another one EndIf _IELoadWait($oIE) WEnd EndIf ;~ MsgBox(0, "",) ; read level WEnd EndFunc Func Setup() $inifile = "data.ini" $getmonsterlevel = IniRead($inifile, "Pet Eden", "monsterlevel", "") $getmapid = IniRead($inifile, "Pet Eden", "mapid", "") $setup = GUICreate("p.e. setup", 175, 263, 302, 174) $Label1 = GUICtrlCreateLabel("Max. Monster Level: ", 8, 10, 103, 17) $Label2 = GUICtrlCreateLabel("Map ID: (max 12)", 8, 50, 90, 17) $mapid = GUICtrlCreateInput($getmapid, 112, 48, 57, 21) $maxmonsterlvl = GUICtrlCreateInput($getmonsterlevel, 112, 8, 57, 21) $mapidlist = GUICtrlCreateList("", 8, 72, 161, 162) GUICtrlSetData(-1, "1: Borbon Lv 1~10|2: Sunset Canyon Lv10~50|3: Hungriness Lv50~90|4: Oblivion Lv90~130|5: Dust Lane Lv130~170|6: Babylon Lv170~220|7: Flaming Desert ?|8: Desert Fortess ?|9: Underground ?") GUICtrlSetState(-1, $GUI_DISABLE) $savesetup = GUICtrlCreateButton("save", 96, 240, 75, 17, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete($setup) ExitLoop Case $savesetup IniWrite($inifile, "Pet Eden", "monsterlevel", GUICtrlRead($maxmonsterlvl)) IniWrite($inifile, "Pet Eden", "mapid", GUICtrlRead($mapid)) GUIDelete($setup) ExitLoop EndSwitch WEnd EndFunc Link to comment Share on other sites More sharing options...
Anonymouse Posted June 20, 2008 Share Posted June 20, 2008 (edited) Hello everybody, Im pretty new to this GUI stuff in Autoit and especially with stuff like ObjCreate() which I didnt use before! This is a script which WORKS for a little game which can be played on a forum and I don't know why the STOP button doesn't work. Maybe one of you can tell me. The function StartBot() searches for a monster which is on a level, the user defined and then it attacks until the image to attack isnt existing anymore. I am really thankful for every hint you can give me. Best regards CODE#include <GUIConstants.au3> #include <IE.au3> #include <File.au3> $oIE = ObjCreate("Shell.Explorer.2") $GUI_PetEden = GUICreate ("Pet eden", 720, 560,193, 125) $GUIActiveX = GUICtrlCreateObj ( $oIE, 10, 10 , 700 , 500 ) $GUI_Button_Setup = GuiCtrlCreateButton ("Setup", 10, 520, 100, 30) $GUI_Button_MyPet = GuiCtrlCreateButton ("My Pet", 120, 520, 100, 30) $GUI_Button_Adventure = GuiCtrlCreateButton ("Adventure", 230, 520, 100, 30) $GUI_Button_Warehouse = GuiCtrlCreateButton ("Warehouse", 340, 520, 100, 30) $GUI_Button_Start = GuiCtrlCreateButton ("Start", 500, 520, 100, 30) $GUI_Button_Stop = GuiCtrlCreateButton ("Stop", 610, 520, 100, 30) GUISetState () ;Show GUI $oIE.navigate("http://www.l2021.com/bbs/pet.php?index=mypet") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $GUI_Button_Setup Setup() Case $msg = $GUI_Button_MyPet $oIE.navigate("http://www.l2021.com/bbs/pet.php?index=mypet") Case $msg = $GUI_Button_Adventure $mapid_get = IniRead("data.ini", "Pet Eden", "mapid", "") $oIE.navigate("http://www.l2021.com/bbs/pet.php?index=petpknpc&mapid=" & $mapid_get) Case $msg = $GUI_Button_Warehouse $oIE.navigate("http://www.l2021.com/bbs/pet.php?index=usershop") Case $msg = $GUI_Button_Start $mapid = IniRead("data.ini", "Pet Eden", "mapid", "") $monsterlevel = IniRead("data.ini", "Pet Eden", "monsterlevel", "") GUICtrlSetState($GUI_Button_Setup, $GUI_DISABLE) GUICtrlSetState($GUI_Button_MyPet, $GUI_DISABLE) GUICtrlSetState($GUI_Button_Adventure, $GUI_DISABLE) GUICtrlSetState($GUI_Button_Warehouse, $GUI_DISABLE) GUICtrlSetState($GUI_Button_Start, $GUI_DISABLE) StartBot($mapid, $monsterlevel) EndSelect Wend GUIDelete () Exit Func StartBot($id, $max) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $GUI_Button_Stop GUICtrlSetState($GUI_Button_Setup, $GUI_ENABLE) GUICtrlSetState($GUI_Button_MyPet, $GUI_ENABLE) GUICtrlSetState($GUI_Button_Adventure, $GUI_ENABLE) GUICtrlSetState($GUI_Button_Warehouse, $GUI_ENABLE) GUICtrlSetState($GUI_Button_Start, $GUI_ENABLE) Return EndSelect $oIE.navigate("http://www.l2021.com/bbs/pet.php?index=petpknpc&mapid=" & $id) _IELoadWait($oIE) $body = _IEBodyReadText($oIE) If StringInStr($body, "Your pet is dead, can it still fight?") Then $oIE.navigate("http://www.l2021.com/bbs/pet.php?index=usershop&action=list&itemtype=7") _IELoadWait($oIE) $oIE.navigate("http://www.l2021.com/bbs/pet.php?index=itemuse&storageid=436560") _IELoadWait($oIE) $oIE.navigate("http://www.l2021.com/bbs/pet.php?index=petpknpc&mapid=" & $id) _IELoadWait($oIE) EndIf $fopen = FileOpen("log.txt", 2) FileWrite($fopen, $body) FileClose($fopen) $fread = FileOpen("log.txt", 0) $readmonsterline = FileReadLine($fread, 9) $splitmonsterlevel = StringSplit($readmonsterline, " ") ; $splitmonsterlevel[2] = Level $readhpline = FileReadLine($fread, 12) $splithp = StringSplit($readhpline, " ") If $splitmonsterlevel[2] = $max OR $splitmonsterlevel[2] < $max Then While $splithp[2] > 0 _IEImgClick($oIE, "http://www.l2021.com/bbs/images/pet/skill/commonf.jpg") If @error Then ExitLoop ;~ The monster is dead, search another one EndIf _IELoadWait($oIE) WEnd EndIf ;~ MsgBox(0, "",) ; read level WEnd EndFunc Func Setup() $inifile = "data.ini" $getmonsterlevel = IniRead($inifile, "Pet Eden", "monsterlevel", "") $getmapid = IniRead($inifile, "Pet Eden", "mapid", "") $setup = GUICreate("p.e. setup", 175, 263, 302, 174) $Label1 = GUICtrlCreateLabel("Max. Monster Level: ", 8, 10, 103, 17) $Label2 = GUICtrlCreateLabel("Map ID: (max 12)", 8, 50, 90, 17) $mapid = GUICtrlCreateInput($getmapid, 112, 48, 57, 21) $maxmonsterlvl = GUICtrlCreateInput($getmonsterlevel, 112, 8, 57, 21) $mapidlist = GUICtrlCreateList("", 8, 72, 161, 162) GUICtrlSetData(-1, "1: Borbon Lv 1~10|2: Sunset Canyon Lv10~50|3: Hungriness Lv50~90|4: Oblivion Lv90~130|5: Dust Lane Lv130~170|6: Babylon Lv170~220|7: Flaming Desert ?|8: Desert Fortess ?|9: Underground ?") GUICtrlSetState(-1, $GUI_DISABLE) $savesetup = GUICtrlCreateButton("save", 96, 240, 75, 17, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete($setup) ExitLoop Case $savesetup IniWrite($inifile, "Pet Eden", "monsterlevel", GUICtrlRead($maxmonsterlvl)) IniWrite($inifile, "Pet Eden", "mapid", GUICtrlRead($mapid)) GUIDelete($setup) ExitLoop EndSwitch WEnd EndFunc Maybe a Do...Until function would help? Case $Pause Do Sleep(100) Until $Unpause ; create another button or hotkey for unpause, or use the same one, so it pauses until you hit pause again just throwing it out there as something to try while you're waiting for an answer P.S. I do believe this would create a loop, I may be wrong though. Helpfile says "Loop based on an expression." Good Luck P.S.S. I didn't read all of the code, btw [Edit] I have a problem with writing english properly when high on caffeine[/edit] Edited June 20, 2008 by Anonymouse children may smile; the wise ponder- Dr. Holmes of Hardvard Medical School on an Ether BingeLove Makes The World Go Round?So does five shots of tequila. What's your point?[quote name='Valik' date='Jun 5 2008, 05:13 PM']wraithdu, 24 hours. Said I have a bad attitude, just driving the point home with a ban.[/quote]This is classic. :) Link to comment Share on other sites More sharing options...
lolifox Posted August 7, 2008 Share Posted August 7, 2008 well i would be very gratefull, if that script would work better, it atacks first monster, then it just refreshes or somethin and doesnt proceed to second monster, and yes stop button doesnt work but thanks for this hard work, i cant wait for updates Link to comment Share on other sites More sharing options...
mezor Posted November 27, 2008 Share Posted November 27, 2008 Just asking, where to get the IE bot? And how to operate it with pet eden... Link to comment Share on other sites More sharing options...
syron Posted December 25, 2008 Author Share Posted December 25, 2008 fixing a new version... since I started playing again... and lolifox you gotta set up iexplore that it is creating new cache every time you visit a website. Late answers... I know Link to comment Share on other sites More sharing options...
KapitanTutan Posted January 14, 2009 Share Posted January 14, 2009 fixing a new version... since I started playing again...and lolifox you gotta set up iexplore that it is creating new cache every time you visit a website.Late answers... I knowhi im trying to make codes for Pet Eden too and i was wondering if got any solutions for the new Security Code?im kinda noob in these codes so i don't have any idea how to bypass the Security Popup. any suggestions how to solve it would be appreciatted thanks Link to comment Share on other sites More sharing options...
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