-I can't manage to make him go back to the door, and then leave, so it saves time, instead the char goes to the door, but doesnt enter, just leaves the game
PHP Code:
HotKeySet("x","endbot")
HotKeySet("s","toggle")
Global $toggle = True
Global $mode = 0
Global $wpos = WinGetPos("Diablo III")
;Lets make sure user have made Diablo window as small as possible.
WinMove("Diablo III","",$wpos[0],$wpos[1],816, 638)
ConsoleWrite("Starting j-BastionBot by j0achim @ www.ownedcore.com"&@CRLF)
ConsoleWrite("Version: 1.1 - 08.06.2012"&@CRLF)
ConsoleWrite("Greetings to all of the ownedcore community!"&@CRLF&@CRLF)
$q = MsgBox(48+4,"j-BastionBot","You're difficulty set to Hell?")
If $q = 6 Then
$mode = 1
EndIf
WinActivate("Diablo III")
Sleep(500)
$r = 1
$t = TimerInit()
while 1
While $toggle = True
Check()
$wpos = WinGetPos("Diablo III")
If PixelChecksum($wpos[0]+385,$wpos[1]+382,$wpos[0]+389,$wpos[1]+86) = 3014526114 Then ;Error message.
Click(385,382)
MouseMove(Random(10,45),Random(30,40),0)
Sleep(50)
ElseIf PixelChecksum($wpos[0]+76,$wpos[1]+258,$wpos[0]+80,$wpos[1]+262) = 2572354573 Then ;Were in character menu.
Click(76,258)
MouseMove(Random(10,45),Random(30,40),0)
Sleep(50)
ElseIf PixelChecksum($wpos[0]+116,$wpos[1]+608,$wpos[0]+120,$wpos[1]+612) = 3853584318 Then ;Were ingame.
ConsoleWrite("=== STARTING NEW GAME ===" & @CRLF)
ConsoleWrite("Run #: " & $r & @crlf)
$rt = TimerInit()
Sleep(Random(120,130))
ControlSend("Diablo III","","","{SPACE}")
Sleep(Random(550,600))
Click(757,519,"Left",2)
Sleep(Random(1900,1950))
Click(736,521)
Sleep(Random(1500,1550))
Click(592,181)
Sleep(Random(1200,1250))
Click(144,66)
Sleep(Random(1200,1250))
Click(589,521)
Sleep(Random(1200,1250))
Click(397,527)
Sleep(Random(1200,1250))
;Mode 1 means we should do some AOE dmg over the guard. This is absolutely needed in Hell mode.
If $mode = 1 Then
ControlSend("Diablo III","","","{SHIFTDOWN}")
Sleep(25)
For $x = 0 to 1
Click(705,410,"Right",10)
Sleep(Random(250,275))
Next
ControlSend("Diablo III","","","{SHIFTUP}")
Sleep(25)
EndIf
;Back to Camp.
Sleep(Random(200,250))
Click(36,125)
Sleep(Random(1500,1550))
Click(77,50)
Sleep(Random(2700,2750))
Click(111,103)
Sleep(Random(320,325))
;Back to game menu.
ControlSend("Diablo III","","","{ESC}")
Sleep(Random(15,25))
Click(352,349)
$c = 0
Do
Sleep(100)
$c +=1
;Make sure we never get stuck here for infinity.
If $c > 120 Then
ExitLoop
EndIf
Until PixelChecksum($wpos[0]+76,$wpos[1]+258,$wpos[0]+80,$wpos[1]+262) = 2570191885
$srt = TimerDiff($rt)
ConsoleWrite("Runtime: " & Round($srt/1000,2) & " seconds." & @CRLF)
$trt = TimerDiff($t)
$total = Round((($trt/1000)/60)/60,4)
$rph = Round($r/$total)
;Total runtiume calculation.
$hours = Floor((($trt/1000)/60)/60)
$minutes = (($trt/1000)/60)
;trim minutes if runtime is more then 1 hour.
If $minutes > 60 Then
While $minutes > 60
$minutes -=60
WEnd
EndIf
ConsoleWrite("Total runtime: " & $hours & " hours, "& Ceiling($minutes) &" minutes."& @CRLF)
ConsoleWrite("Runs per hour: " & $rph & @CRLF)
ConsoleWrite("=== RUN #: " & $r & " HAS ENDED ===" & @CRLF & @CRLF)
$r +=1
MouseMove(Random(10,45),Random(30,40),0)
EndIf
Sleep(300)
WEnd
Sleep(300)
WEnd
Func Click($x, $y, $button = "Left", $offset = 5)
Check()
$wpos = WinGetPos("Diablo III")
MouseClick($button,Random(($wpos[0]+$x)-$offset,($wpos[0]+$x)+$offset), Random(($wpos[1]+$y)-$offset,($wpos[1]+$y)+$offset), 1, 3)
Sleep(50)
EndFunc
Func Check()
If Not WinExists("Diablo III","") Then
MsgBox(64,"j-BastionBot","Unable to detect if Diablo III window exists, if this is incorrect please replay in thread about this issue and include as much details as possible."&@CRLF&@CRLF&"Closing!")
Exit
EndIf
If Not WinActive("Diablo III","") Then
WinActivate("Diablo III")
EndIf
$p = WinGetPos("Diablo III","")
If $p[2] <> 816 Or $p[3] <> 638 Then
WinMove("Diablo III", "", $p[0],$p[1], 816, 638)
EndIf
EndFunc
Func toggle()
If $toggle = True Then
ConsoleWrite("Toggle bot OFF."&@CRLF)
$toggle = False
Sleep(100)
Else
ConsoleWrite("Toggle bot ON."&@CRLF)
$toggle = True
Sleep(100)
EndIf
EndFunc
Func endbot()
MsgBox(64,"j-BastionBot", "j-BastionBot stopped.",5)
Exit
EndFunc