Jump to content

Problem's with bot


lolifox
 Share

Recommended Posts

Hi. I took this bot LINK and with huge terarin help edited it to this, but since i learn slowly i bumped in some problems >.< , so was willing that some one would help there. Mkey here goes edited one:

#RequireAdmin
#include <IE.au3>
#include <GUIConstants.au3>
#include <IE.au3>
#include <array.au3>
#include <File.au3>

Opt("MouseClickDelay", 500)

$oIE = _IECreateEmbedded()

$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_Storage = GuiCtrlCreateButton   ("Storage", 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=fight&mapid=" & $mapid_get)
        Case $msg = $GUI_Button_Storage
            $oIE.navigate("http://www.l2021.com/bbs/pet.php?index=storage")
        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_Storage, $GUI_DISABLE)
            GUICtrlSetState($GUI_Button_Start, $GUI_DISABLE)
            StartBot($mapid)
    EndSelect
    
Wend

GUIDelete ()

Exit

Func StartBot($iId)
    $bRunningBot = True
    $oIE.navigate("http://www.l2021.com/bbs/pet.php?index=fight&mapid=" & $iId)
    _IELoadWait($oIE)
    
    While 1
        $oTable = _IETableGetCollection ($oIE, 1)
        $aTableData = _IETableWriteToArray($oTable)
        
        Switch $aTableData[0][0]
            Case "Good luck with your leveling! - Windows Internet Explorer"
                $oIE.navigate("http://www.l2021.com/bbs/pet.php?index=fight&mapid=" & $iId)
                _IELoadWait($oIE)
            Case "Monster Info"
                $aArrayData = StringRegExp($aTableData[0][2], "(?s)(?i)(?:Monster Name:)", 1)
                If $aArrayData[4] And StringCompare($aArrayData[0], "Avakara", 2) Then 
                    While 1     
                        $oTable = _IETableGetCollection ($oIE, 0)
                        $aTableData = _IETableWriteToArray($oTable)
                        _IEImgClick($oIE, "http://www.l2021.com/bbs/wxpet/images/skill/commonf.jpg")
                        If @error Then
                            _IELinkClickByText($oIE, "New Monster")
                            _IELoadWait($oIE)
                            ExitLoop
                        Else; below bot stops after there security appears, but i doubt that i can stop bot with GUI_DISABLE :/
                            If StringInStr($aTableData[0][1], "Please enter the security code") Then
                                GUICtrlSetState(-1, $GUI_DISABLE)
                                SoundPlay("C:\Program Files\noname\sounds\alert.mp3")
                            EndIf
                        EndIf
                        _IELoadWait($oIE)
                    WEnd
                Else
                    _IELinkClickByText($oIE, "New Monster")
                    _IELoadWait($oIE)
                EndIf
            Case Else
                $oIE.navigate("http://www.l2021.com/bbs/pet.php?index=fight&mapid=" & $iId)
                _IELoadWait($oIE)
        EndSwitch
    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 30)", 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   Above 220|8: Desert Fortess   Above 270|9: Underground   Above 300")
    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

but... it just loops on first bot stage, and the security block isn't working too (gives error), and i think there's more bad things :/ , so anyone can point some light

Link to comment
Share on other sites

... really ? :)

Do you think that if a script has a GUI part, no matter what doesn't work on that script it has to be posted under this section?

This being said, the bot help is not a highly regarded subject on this forum; if you're lucky enough, some1 might help you..

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

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...