Code:
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=E:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\VCWizards\AppWiz\MFC\Control\templates\1046\root.ico
#AutoIt3Wrapper_Outfile=mykeys.exe
#AutoIt3Wrapper_Outfile_x64=refine_array.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs
AutoIt Version: 3.0
Language: English
Platform: Win xx
Author: Rotten
Ver. 1.0
Need:
Included:
.exe and .Au3 -source
Tested:
Worked, refines.. LOOK images folder
Problems:
Script Function:
HOTKEYS,
Shift+P, PAUSE/Break, pause
Alt+LShift+T, Terminata script
Alt+LShift+D, shows just pop up.
#ce
; Press Esc to terminate script, Pause/Break to "pause"
#include-once
#include <MsgBoxConstants.au3>
#include <File.au3>
#include <Array.au3>
#include <ImageSearch.au3>
#include <winApiProc.au3>
Global $Paused, $aquaM, $perid, $resonance1, $resonance2, $white_pearl
$aquaM = "aquamarine.png"
$perid = "peridot.png"
$resonance1 = "minor_resonance_stone.png"
$resonance2 = "lesser_resonance_stone.png"
$white_pearl = "white_pearl.png"
$trash1 = "trash1.png"
$trash2 = "trash2.png"
$trash3 = "trash3.png"
$trash4 = "trash4.png"
$trash5 = "trash5.png"
$trash6 = "trash6.png"
$refine_win = "item_refinement.png"
$refine_button = "refine_gray.png"
$fill_all = "fill_all_empty_slots.png"
$ward_cancel = "ward_upgrade.png"
$done = "done.png"
$buttons_warnings = "\buttons_warnings\"
$refine_images = "\refine_images\"
$warning_opal = "warning_opal.png"
$warning_opal_OK = "warning_opal_OK_button.png"
HotKeySet("+p", "TogglePause")
HotKeySet("+!t", "Terminate") ; shift alt t, termina
HotKeySet("+!d", "ShowMessage") ;Shift-Alt-d vvv
Opt("WinTitleMatchMode", "2") ; Helps With Getting The Window Information...
;;;; Body of program would go here ;;;;
;start_refinery()
TogglePause()
WinActivate("Neverwinter")
Local $xfill = 0, $yfill = 0, $xrefine = 0, $yrefine = 0
$var = _FileListToArray(@ScriptDir & $refine_images, "*.png") ;this makes list for active windows by name
_ImageSearch(@ScriptDir & $buttons_warnings & $fill_all, 1, $xfill, $yfill, 10)
_ImageSearch(@ScriptDir & $buttons_warnings & $refine_button, 1, $xrefine, $yrefine, 10)
;$xrefine = $xfill + 370
;$yrefine = $yfill - 50
While 1 ; all parts are in "loop" so scriipt looks allways if new stuff drops in
While 1
If Not WinExists("Neverwinter") Then
TogglePause()
EndIf
;MsgBox(0, "ogma", $xrefine & "/" & $yrefine)
MouseMove($xfill, $yfill, 1)
Sleep(50)
MouseClick("LEFT")
Sleep(250)
For $i = 1 To $var[0] ; we run until list is end
$Refine = ($var[$i])
If _checkForImage1($Refine) = 1 Then
_checkForImage($Refine)
Local $x = 0, $y = 0
If _ImageSearch(@ScriptDir & $buttons_warnings & $warning_opal, 1, $x, $y, 10) = 1 Then
Local $x = 0, $y = 0
_ImageSearch(@ScriptDir & $buttons_warnings & $warning_opal_OK, 1, $x, $y, 10)
MouseMove($x, $y, 1)
Sleep(50)
MouseClick("LEFT", $x, $y, 2, 5)
Sleep(50)
ExitLoop ; is this needed
EndIf
ExitLoop
Else
ContinueLoop
EndIf
Next
Sleep(5)
MouseMove($xrefine, $yrefine, 1)
Sleep(30)
MouseClick("LEFT")
Sleep(Random(2200, 2300))
;Else
;TogglePause()
;EndIf
WEnd
Sleep(100)
WEnd
Func _checkForImage1($iRefine)
Local $y = 0, $x = 0
Local $search = _ImageSearchArea(@ScriptDir & $refine_images & $iRefine, 1, 12, 35, 533, 822, $x, $y, 10)
If $search = 1 Then
Return 1
Else
Return 0
EndIf
EndFunc ;==>_checkForImage1
Func _checkForImage($iRefine)
Local $y = 0, $x = 0
Local $search = _ImageSearchArea(@ScriptDir & $refine_images & $iRefine, 1, 12, 35, 533, 822, $x, $y, 10)
If $search = 1 Then
MouseMove($x, $y, 1)
Sleep(50)
MouseClick("LEFT", $x, $y, 2, 5)
Sleep(50)
Else
Sleep(50)
EndIf
EndFunc ;==>_checkForImage
Func actMouze()
$xrefine = $xfill + 324
$yrefine = $yfill - 63
MouseMove($xrefine, $yrefine)
Sleep(500)
MouseClick("LEFT")
Sleep(50)
EndFunc ;==>actMouze
Func start_refinery()
Local $y = 0, $x = 0
Local $search = _ImageSearch(@ScriptDir & "\" & $refine_win, 1, $x, $y, 10)
TogglePause()
If $search = 1 Then
Sleep(5000)
Else
Exit
EndIf
EndFunc ;==>start_refinery
Func IsVisible($handle)
If BitAND(WinGetState($handle), 2) Then
Return 1
Else
Return 0
EndIf
EndFunc ;==>IsVisible
;;;;;;;;
Func TogglePause()
$Paused = Not $Paused
While $Paused
Sleep(100)
ToolTip('Script is "Paused"', 5, 5)
WEnd
ToolTip("")
EndFunc ;==>TogglePause
Func Terminate()
#Region --- CodeWizard generated code Start ---
;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=Critical, Timeout=5 ss, Miscellaneous=Top-most attribute
If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
$iMsgBoxAnswer = MsgBox(262160, "Note", "Script is about to Terminate.", 5)
Select
Case $iMsgBoxAnswer = -1 ;Timeout
Case Else ;OK
EndSelect
#EndRegion --- CodeWizard generated code Start ---
Exit 0
EndFunc ;==>Terminate
Func ShowMessage()
MsgBox(4096, "", "This is a message.")
EndFunc ;==>ShowMessage