All pastes #435958 Raw Edit

WildRob's Return from Act 1 New

public text v1 · immutable
·published 2007-04-12 08:25 UTC
rendered paste body
; Return from Rogue Camp WP to Harrogath Start
; v 0.61 by WildRob

#include "Includes.TownMove.au3"
#include "Includes.Init.au3"
#include "Includes.Click.au3"
opt ("PixelCoordMode", 2) 
opt ("MouseCoordMode", 2) 
opt ("ColorMode", 1) 

$CurrentDir = StringSplit(@ScriptDir, "\") 
_ArrayPop($CurrentDir) 
$BotDir = $CurrentDir[1] 
For $Rebuild = 2 to ($CurrentDir[0] - 1) 
   $BotDir = $BotDir & "\" & $CurrentDir[$Rebuild] 
Next 

; check if in act 1
$Act_PCS = PixelChecksum(242,132, 246,136)
If $Act_PCS <> 1115492022 Then 
        ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        $file = FileOpen($BotDir & "\Logs\Act1_Town.txt" , 1)
        If $file = -1 Then
           MsgBox(0, "Error", "Unable to open file.")
           Exit
        EndIf
        FileWriteLine($file, _NowDate() & "  " &_NowTime() & " We are not in Act 1!  Act PCS = " & $Act_PCS)
		FileWriteLine($file, " ")
        FileClose($file)
        ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
	Exit 1
EndIf

$PCS_Act1_Start = PixelChecksum(242,132, 246,136)
        ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        $file = FileOpen($BotDir & "\Logs\Act1_Town.txt" , 1)
        If $file = -1 Then
           MsgBox(0, "Error", "Unable to open file.")
           Exit
        EndIf
        FileWriteLine($file, _NowDate() & "  " &_NowTime() & " Barrel PCS = " & $PCS_Act1_Start)
        FileClose($file)
        ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

; read variables
$Char_CheckMoveDelay = IniRead($BotDir & "\Config\mm.BOT.ini", "Advanced Settings", "Char_CheckMoveDelay", "")
$D2_SendKeyDownDelay = IniRead($BotDir & "\Config\mm.BOT.ini", "Advanced Settings", "D2_SendKeyDownDelay", "")
$Walk_Delay = IniRead($BotDir & "\Config\mm.BOT.sequences.ini", "Vars", "@Walk_Delay", "")

; check location of WP
$GreenBlock = 65304
$MidBlock = PixelSearch( 640, 280, 760, 330, $GreenBlock)
If Not @error Then
    $WpLoc = "down"
Else 
	$WpLoc = "up"
EndIf
        ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        $file = FileOpen($BotDir & "\Logs\Act1_Town.txt" , 1)
        If $file = -1 Then
           MsgBox(0, "Error", "Unable to open file.")
           Exit
        EndIf
        FileWriteLine($file, _NowDate() & "  " &_NowTime() & " WP location is " & $WPLoc)
        FileClose($file)
        ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

; Go near WP 
Opt("MouseClickDownDelay", 100)
If $WpLoc = "down" Then
	MouseClick("left", 792, 370, 1, 1)
	CheckMove($Char_CheckMoveDelay)
	Sleep($Walk_Delay)
	MouseClick("left", 654, 335, 1, 1) ; 654, 305, 1, 1
	CheckMove($Char_CheckMoveDelay)
	Sleep($Walk_Delay)
ElseIf $WpLoc = "up" Then
	MouseClick("left", 610, 103, 1, 1) ; 620
	CheckMove($Char_CheckMoveDelay)
	Sleep($Walk_Delay)
EndIf

; Open WP menu
If NOT IsWaypointOpen() Then
	$X_PS = 5
	$X_PS_max = 650
	$begin = TimerInit()
	Do
		$pixel = PixelSearch($X_PS, 5, $X_PS_max, 457, 15176291, 0, 1)
		If NOT @error Then
			Feedback("Clicking on Harrogath WP.", 8)
			;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
			$file = FileOpen($BotDir & "\Logs\Act1_Town.txt" , 1)
			If $file = -1 Then
				MsgBox(0, "Error", "Unable to open file.")
				Exit
			EndIf
			FileWriteLine($file, _NowDate() & "  " &_NowTime() & " PixelSearch for Act 1 WP successful at: " & $pixel[0] & ", " & $pixel[1])
			FileClose($file)
			;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
			MouseClick("left", $pixel[0], $pixel[1], 1, 1)
			Sleep(1500)
		EndIf
		If ValidateWP() Then ExitLoop
		If IsArray($pixel) Then 
			$X_PS = $pixel[0]
			If $X_PS > $X_PS_max Then $X_PS = 5
		EndIf		
		$dif = TimerDiff($begin)
	Until $dif >= 10000	
EndIf
Opt("MouseClickDownDelay", $D2_SendKeyDownDelay)

; Error check
If NOT ValidateWP() Then
	Feedback("Error opening Act1 WP : ABORTING !", 4)
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    $file = FileOpen($BotDir & "\Logs\Act1_Town.txt" , 1)
    If $file = -1 Then
        MsgBox(0, "Error", "Unable to open file.")
        Exit
    EndIf
    FileWriteLine($file, _NowDate() & "  " &_NowTime() & " Error opening Act 1 WP : ABORTING !")
	FileWriteLine($file, " ")
	FileClose($file)
	;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
	Exit 0
Endif

If NOT UseWP(5, 1, 10000) Then
	Feedback("Timeout using WP : ABORTING !", 4)
	;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
	$file = FileOpen($BotDir & "\Logs\Act1_Town.txt" , 1)
	If $file = -1 Then
		MsgBox(0, "Error", "Unable to open file.")
		Exit
	EndIf
	FileWriteLine($file, _NowDate() & "  " &_NowTime() & " Timeout using WP : ABORTING !")
	FileWriteLine($file, " ")
	FileClose($file)
	;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
   Exit 0
Endif

;If we got to here assume everything worked.
$PCS_Act5_WP = PixelChecksum(700, 60, 704, 64)
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
$file = FileOpen($BotDir & "\Logs\Act1_Town.txt" , 1)
If $file = -1 Then
	MsgBox(0, "Error", "Unable to open file.")
	Exit
EndIf
FileWriteLine($file, _NowDate() & "  " &_NowTime() & " Act 5 WP entered. PCS = " & $PCS_Act5_WP)
FileClose($file)
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<


;A5 WP To Start
Sleep(1000)
MouseClick("left", 479, 189, 1, 1)
CheckMove($Char_CheckMoveDelay)
Sleep($Walk_Delay)
SetupActContext(5)
If FromBlockClickTo(100, 250, 350, 500, 393, -276, 2, 0) == 0 Then Return 0
CheckMove($Char_CheckMoveDelay)
Sleep($Walk_Delay)
If FromBlockClickTo(400, 400, 650, 570, -10, -210, 2, 0) == 0 Then Return 0
CheckMove($Char_CheckMoveDelay)
Sleep($Walk_Delay)
If FromBlockClickTo(300, 450, 550, 570, 147, -390, 2, -1) == 0 Then Return 0
CheckMove($Char_CheckMoveDelay)
Sleep($Walk_Delay)
$PCS_Start_Act5 = PixelChecksum(70, 70, 74, 74)
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
$file = FileOpen($BotDir & "\Logs\Act1_Town.txt" , 1)
If $file = -1 Then
	MsgBox(0, "Error", "Unable to open file.")
	Exit
EndIf
FileWriteLine($file, _NowDate() & "  " &_NowTime() & " Reached Start position Act 5.  PCS = " & $PCS_Start_Act5)
FileWriteLine($file, " ")		
FileClose($file)
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Exit