BANDWIDTH Posted November 17, 2006 Share Posted November 17, 2006 (edited) Oké, Im making a Diablo II Bot which goes kinda well since well now. expandcollapse popup;=============================== ; Autoit Set Options ;=============================== Opt("WinTitleMatchMode", 4) Opt("MouseCoordMode", 2) Opt("SendKeyDelay", 35) ;=============================== ; Load setup.ini user's Globals ; Processes ;=============================== $D2_EXE = IniRead("Config\setup.ini", "Processes", "D2_EXE", "Diablo II.exe") $D2_CMD = IniRead("Config\setup.ini", "Processes", "D2_CMD", '-window -lowquality -nosound -res800 -title "Diablo II"') $D2_WIN = IniRead("Config\setup.ini", "Processes", "D2_WIN", "Diablo II") $D2_PATH = IniRead("Config\setup.ini", "Processes", "D2_PATH", "C:\Program Files\Diablo II") $D2_REALM = IniRead("Config\setup.ini", "Processes", "D2_REALM", "Europe") ;=============================== ; Load setup.ini user's Globals ; Character ;=============================== $Acc = IniRead("Config\setup.ini", "Character", "Accountname", "") $Pass = IniRead("Config\setup.ini", "Character", "Password", "") $Slot = IniRead("Config\setup.ini", "Character", "Charslot", "") ;=============================== ; Load setup.ini user's Globals ; Channel ;=============================== $Channel = IniRead("Config\setup.ini", "Channel", "Channel", "") ;=============================== ; Set Path to the Path where ; D2 is installed ;=============================== If $D2_PATH = "Auto" Then $D2_PATH = RegRead("HKEY_LOCAL_MACHINE\Software\Blizzard Entertainment\Diablo II", "InstallPath") If $D2_PATH < 0 Then MsgBox (0+16, "INCORRECT PATH", "Path was not found in your registry, Please specify the Diablo II Path in Config\setup.ini") Exit Endif EndIf ;=============================== ; Run Diablo II ;=============================== Run($D2_PATH & "\" & $D2_EXE & " " & $D2_CMD) If ProcessExists($D2_EXE) Then WinActivate($D2_WIN) WinWaitActive($D2_WIN) If Not @error Then WinMove("Diablo II", "", 0, 0) WinWaitActive($D2_WIN) ;WinSetState($D2_WIN, "", @SW_MINIMIZE) Else MsgBox(0+16, "ERROR", "Could not find correct window") Exit EndIf EndIf $handle = WinGetHandle("classname=Diablo II", "") ControlSend($handle, "", "", "{ENTER}") If Not @error Then _MouseClick($handle, "left", 405, 380, 1) Else MsgBox(0+16, "ERROR", "We got an error please check your setup.ini, Then try again. :)") Exit EndIf ;############################################################################################################################### ; ; LOGIN PROCESS ; ;############################################################################################################################### Realm() Sleep(5000) Login() Sleep(2500) Slots() Sleep(2500) Channel() ;MouseClick("left", 595, 460, 1, 0) ;create game button ;############################################################################################################################### ; ; ALL-NEEDED-FUCTIONS ; ;############################################################################################################################### Func Realm() If $D2_REALM = "Europe" Then _MouseClick($handle, "left", 400, 425, 2) _MouseClick($handle, "left", 395, 350, 1) ElseIf $D2_REALM = "Asia" Then _MouseClick($handle, "left", 400, 400, 2) _MouseClick($handle, "left", 395, 350, 1) ElseIf $D2_REALM = "U.S East" Then _MouseClick($handle, "left", 400, 375, 2) _MouseClick($handle, "left", 395, 350, 1) ElseIf $D2_REALM = "U.S West" Then _MouseClick($handle, "left", 400, 350, 2) _MouseClick($handle, "left", 395, 350, 1) EndIf EndFunc Func Login() ControlSend($handle, "", "", "{TAB}") ControlSend($handle, "", "", $Acc) _MouseClick($handle, "left", 400, 390, 1) ControlSend($handle, "", "", $Pass) _MouseClick($handle, "left", 405, 470, 1) EndFunc Func Slots() If $Slot = "1" Then _MouseClick($handle, "left", 180, 135, 1) _MouseClick($handle, "left", 695, 555, 1) ElseIf $Slot = "2" Then _MouseClick($handle, "left", 450, 135, 1) _MouseClick($handle, "left", 695, 555, 1) ElseIf $Slot = "3" Then _MouseClick($handle, "left", 180, 225, 1) _MouseClick($handle, "left", 695, 555, 1) ElseIf $Slot = "4" Then _MouseClick($handle, "left", 450, 225, 1) _MouseClick($handle, "left", 695, 555, 1) ElseIf $Slot = "5" Then _MouseClick($handle, "left", 180, 315, 1) _MouseClick($handle, "left", 695, 555, 1) ElseIf $Slot = "6" Then _MouseClick($handle, "left", 450, 315, 1) _MouseClick($handle, "left", 695, 555, 1) ElseIf $Slot = "7" Then _MouseClick($handle, "left", 180, 405, 1) _MouseClick($handle, "left", 695, 555, 1) ElseIf $Slot = "8" Then _MouseClick($handle, "left", 450, 405, 1) _MouseClick($handle, "left", 695, 555, 1) EndIf EndFunc Func Channel() If $Channel = "" Then Sleep(25) Else _MouseClick($handle, "left", 90, 475, 1) _MouseClick($handle, "left", 575, 480, 1) ControlSend($handle, "", "", $Channel) _MouseClick($handle, "left", 720, 420, 1) EndIf EndFunc ;=======================MOUSEMOVEEEE=========================================== Func _MouseClick($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)) EndFuncThe first part Run Diablo is just a quick made thing to test it.Anyways if i run it Maximized, Nothing's wrong then till i remove the " ; " before WinSetStateThe first few things are right he's doing it absolutly fine there.Then i get at the part "When i already logged in" and instead he is choosing a character, he press at the "Create A New Character".Any ideas? (If i run it normal, Then it works fine though).For people who want to know more about whats all going on heres the .iniexpandcollapse popup[Processes] ;#################################################################################### ; ; ; !!!SOMETHING HERE!!! ; ; ; ;#################################################################################### ;Path to Diablo II.exe :) D2_PATH = C:\Program Files\Diablo II ;Name of the executable. D2_EXE = Diablo II.exe ;What you want to add in the parameters. D2_CMD = -direct -txt -w -lq -ns -res800 -title "Diablo II" ;Name of the Diablo II window. D2_WIN = Diablo II ;The realm where you play. D2_REALM = Europe ;#################################################################################### [Character] ;#################################################################################### ; ; ; !!!SOMETHING HERE!!! ; ; ; ;#################################################################################### ;Accountname of your account. Accountname = MYACCOUNTNAME ;The password of your account. Password = MYPASSWORD ;The slot number of your character. Charslot = 2 ;#################################################################################### [Channel] ;#################################################################################### ; ; ; !!!SOMETHING HERE!!! ; ; ; ;#################################################################################### ;The channel you want to join. Channel = OP BANDWIDTH ;#################################################################################### Thanks already! Edited November 17, 2006 by BANDWIDTH Link to comment Share on other sites More sharing options...
jvanegmond Posted November 17, 2006 Share Posted November 17, 2006 I noticed that when the registry value for Diablo II is missing, a back up kicks in, but the back up is flawed too. The check is checking for "Auto" while IniRead returns "C:\... more". github.com/jvanegmond 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