Jump to content

Looping Help


Recommended Posts

I am making an anti-idle bot for Diablo II, and have been working on it for awhile now. Anyways, this program loads Diablo II, logs into your account, then when it gets to the character selection seen, it check for a hex color, which is red to see if that character is about to expire. It then chooses the first character that is about to expire. All of that should be fine, but after is selects that character it goes into a channel in the chat, and posts a message every minute for 15 minutes, to keep it from getting disconnected from the server. After 15 minutes, I want it to go back to the character selection screen, and check and see if it is still going to expire. If it is, then select it again, and do the channel thing again. After all the characters are done, it will exit and kill the script, I have that working. The only problem I have is going back to the character selection, then going back tot he channel. Here is the code:

;Date: April 3, 2007
;Programer: Brandon M. Royer
;Software: Diablo II Mule Bot
;Sofware Name: ZMule

;LICENSE:: This is freeware. You are free to distribute, modify, and do pretty much what
;you want with it. If I didn't allow you, you would just do it anyways :)

;---General Declares----
$D2Path = IniRead("Settings.ini", "General", "D2Path", "")
$D2Exe = IniRead("Settings.ini", "General", "D2Exe", "")
$D2Parameters = IniRead("Settings.ini", "General", "D2Parameters", "")
$Account = IniRead("Settings.ini", "General", "Account", "")
$Password = IniRead("Settings.ini", "General", "Password", "")
$CharOne = IniRead("Settings.ini", "General", "CharOne", "")
$CharTwo = IniRead("Settings.ini", "General", "CharTwo", "")
$CharThree = IniRead("Settings.ini", "General", "CharThree", "")
$CharFour = IniRead("Settings.ini", "General", "CharFour", "")
$CharFive = IniRead("Settings.ini", "General", "CharFive", "")
$CharSix = IniRead("Settings.ini", "General", "CharSix", "")
$CharSeven = IniRead("Settings.ini", "General", "CharSeven", "")
$CharEight = IniRead("Settings.ini", "General", "CharEight", "")

;----Delays----
$D2LoadWait = IniRead("Settings.ini", "Delays", "D2Start", "8000")
$D2ActivateWin = IniRead("Settings.ini", "Delays", "D2ActivateWin", "5000")
$D2Login = IniRead("Settings.ini", "Delays", "D2Login", "5000")
$D2CharSelect = IniRead("Settings.ini", "Delays", "D2CharSelect", "5000")
$D2MouseClick = IniRead("Settings.ini", "Delays", "D2MouseClick", "400")
$D2MoveWindow = IniRead("Settings.ini", "Delays", "D2MoveWindow", "1000")
$D2CreateGame = IniRead("Settings.ini", "Delays", "D2CreateGame", "7500")
$D2ExitGame = IniRead("Settings.ini", "Delays", "D2ExitGame", "4000")


D2Start()
D2Activate()
D2Login()
MuleZone()
D2Idle()
D2Exit()




;----This Loads Diablo II----
Func D2Start()
    TrayTip("ZMule 1.0", "Visit Royersoft.com for Support!", 5, 1)
    Run($D2Path & '\' & $D2Exe & ' ' & $D2Parameters, $D2Path)
    WinWait('Diablo II')
    WinActivate('Diablo II')
    Sleep(5000)
    WinMove('Diablo II', '', 0, 0)
    Sleep($D2LoadWait)
EndFunc  ;==>D2Start

;----Activate the Diablo II Window----
Func D2Activate()
    WinActivate("Diablo II")
    WinMove("Diablo II", "", 0, 0)
EndFunc  ;==>D2Activate

;----This Logs into Your account----
Func D2Login()
    Send("{TAB}")
    Sleep(500)
    Send($Account)
    Sleep(500)
    Send("{TAB}")
    Sleep(500)
    Send($Password)
    Sleep(500)
    Send("{ENTER}")
    Sleep($D2Login)
EndFunc  ;==>D2Login

FUNC MuleZone()
    Opt("MouseCoordMode", 0)
    MouseMove(105, 161)
    $coord = PixelSearch(161, 130, 163, 200, 0xB54531)
    If Not @error Then
        Send("{ENTER}")
        ELSE
        MouseClick("left", 375, 161)
        $coord = PixelSearch(161, 131, 167, 195, 0xB54531)
        If Not @error Then
            Send("{ENTER}")
            ELSE
            MouseClick("left", 103, 255)
            $coord = PixelSearch(255, 222, 263, 291, 0xB54531)
            If Not @error Then
                Send("{ENTER}")
                ELSE
                MouseClick("left", 368, 255)
                $coord = PixelSearch(255, 219, 260, 293, 0xB54531)
                If Not @error Then
                    Send("{ENTER}")
                    ELSE
                MouseClick("left", 98, 352)
                $coord = PixelSearch(352, 316, 353, 384, 0xB54531)
                If Not @error Then
                    Send("{ENTER}")
                    ELSE
                    MouseClick("left", 376, 346)
                    $coord = PixelSearch(346, 314, 350, 382, 0xB54531)
                    If Not @error Then
                        Send("{ENTER}")
                        ELSE
                        MouseClick("left", 98, 444)
                        $coord = PixelSearch(444, 405, 444, 476, 0xB54531)
                        If Not @error Then
                            Send("{ENTER}")
                            ELSE
                            MouseClick("left", 372, 442)
                            $coord = PixelSearch(442, 404, 446, 477, 0xB54531)
                            If Not @error Then
                                Send("{ENTER}")
                            Else
                                D2Quit()
                                Endif
                            EndIf
                        EndIf
                    EndIf
                EndIf
            EndIf
        EndIf
    EndIf
EndFunc
                        
        
    
    

;Anti-Idle's Your Character for Two Hours----
Func D2Idle()
    Opt("SendKeyDownDelay",50)
    MouseMove(88, 504)
    Sleep(3000)
    MouseClick("left", 88, 504)
    Sleep(3000)
    MouseMove(580, 511)
    Sleep(3000)
    MouseClick("left", 580, 511)
    Sleep(3000)
    Send("ZMule")  
    Sleep(3000)
    Send("{ENTER}")
    Sleep(3000)
    Send("Visit Royersoft.com for support")
    Sleep(3000)
    Send("{ENTER}");end
    Sleep(60000);sleep for one minute
    Send("1 Minute is Up...14 to go!")
    Sleep(3000)
    MouseClick("left", 71, 491)
    Sleep(60000);sleep for one minute
    Send("s2 Minutes Up...13 to go!")
    Sleep(6000)
    MouseClick("left", 71, 491)
    Sleep(60000);sleep for one minute
    Send("s3 Minutes Up...12 to go!")
    Sleep(6000)
    MouseClick("left", 71, 491)
    Sleep(60000);sleep for one minute
    Send("s4 Minutes Up...11 to go!")
    Sleep(6000)
    MouseClick("left", 71, 491)
    Sleep(60000);sleep for one minute
    Send("s5 Minutes Up...10 to go!")
    Sleep(6000)
    MouseClick("left", 71, 491)
    Sleep(60000);sleep for one minute
    Send("s6 Minutes Up...9 to go!")
    Sleep(6000)
    MouseClick("left", 71, 491)
    Sleep(60000);sleep for one minute
    Send("s7 Minutes Up...8 to go!")
    Sleep(6000)
    MouseClick("left", 71, 491)
    Sleep(60000);sleep for one minute
    Send("s8 Minutes Up...7 to go!")
    Sleep(6000)
    MouseClick("left", 71, 491)
    Sleep(60000);sleep for one minute
    Send("s9 Minutes Up...6 to go!")
    Sleep(6000)
    MouseClick("left", 71, 491)
    Sleep(60000);sleep for one minute
    Send("s10 Minutes Up...5 to go!")
    Sleep(6000)
    MouseClick("left", 71, 491)
    Sleep(60000);sleep for one minute
    Send("s11 Minutes Up...4 to go!")
    Sleep(6000)
    MouseClick("left", 71, 491)
    Sleep(60000);sleep for one minute
    Send("s12 Minutes Up...3 to go!")
    Sleep(6000)
    MouseClick("left", 71, 491)
    Sleep(60000);sleep for one minute
    Send("s13 Minutes Up...2 to go!")
    Sleep(6000)
    MouseClick("left", 71, 491)
    Sleep(60000);sleep for one minute
    Send("s14 Minutes Up...1 to go!")
    Sleep(6000)
    MouseClick("left", 71, 491)
    Sleep(60000);sleep for one minute
    Send("This is the last minute!")
    Sleep(6000)
    MouseClick("left", 71, 491)
    Sleep(60000)
    D2Exit()
EndFunc

Func D2Exit()
    Send("{ESC}")
    Sleep(1500)
    MuleZone()
EndFunc

;---Kills Diablo II Window----
Func D2Quit()
    Send("{ESC}")
    Sleep(500)
    Send("{ESC}")
    MsgBox(4096, "ZMule 1.0", "Your Mules are Complete!")
    EXIT
EndFunc
Link to comment
Share on other sites

the thing is I don't know how many times I will need to go back in forth. There are 8 characters total, and each one has to be run for 2 hours before the expiration time is erased. I figured I would check and see which ones need done, and check back every 15 minutes, because some character already have 4-20 minutes on them. Why not save time?

Link to comment
Share on other sites

the thing is I don't know how many times I will need to go back in forth. There are 8 characters total, and each one has to be run for 2 hours before the expiration time is erased. I figured I would check and see which ones need done, and check back every 15 minutes, because some character already have 4-20 minutes on them. Why not save time?

Use AdilbeEnable to do a check every 15 mins, or timeInt and Timediff as i said.
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...