Jump to content

Recommended Posts

Posted

While 1

Hi again

Wend

^^

This script worked today :angry

#include-once

Opt("MouseCoordMode", 2)
Opt("PixelCoordMode", 2)
Opt("WinTitleMatchMode", 2)
Opt("SendKeyDelay", 20)
Opt("SendAttachMode", 1)
Opt("GUIOnEventMode", 1)
Opt("TrayAutoPause", 0)
Opt("WinTitleMatchMode", 2)

HotKeySet("{F8}", "start")
HotKeySet("{F9}", "quit")
HotKeySet("{F10}", "hideshow")

$INI = @ScriptDir & "\Settings.ini"
$title = IniRead($INI, "Nvm", "D2Window", "")
$D2WHERE = IniRead($INI, "Nvm", "D2 Path", "")
$BWKey = IniRead($INI, "Nvm", "Bonewall Key", "")
$TeleKey = IniRead($INI, "Nvm", "Tele Key", "")
$hwnd = WinGetHandle($title)
$coord = PixelSearch( 0, 0, 800, 600, 0xFC2C00)
$coord1 = PixelSearch( 0, 0, 800, 600, 0x080404) 
$coord2 = PixelSearch( 0, 0, 800, 600, 0x080808)
$coord3 = PixelSearch( 0, 0, 800, 600, 0x040404)
$coord4 = PixelSearch( 0, 0, 800, 600, 0x141C08) ; back to town
$coord5 = PixelSearch( 0, 0, 800, 600, 0x101408)
$state = "show"
$window = GUICreate("")
GUISetState()

While 1
    Sleep(100)
WEnd

Func hideshow()
    If $state = "show" Then
        WinSetState($window, "", @SW_HIDE)
        $state = "hide"
    Else
        WinSetState($window, "", @SW_SHOW)
        $state = "show"
    EndIf
EndFunc

Func start()
While 1

ControlSend("", "", $hwnd, "{Enter}")
Sleep(100)
ControlSend("", "", $hwnd, "30 seconds to go")
Sleep(100)
ControlSend("", "", $hwnd, "{Enter}")
Sleep(2000)
ControlSend("", "", $hwnd, "{Enter}")
Sleep(100)
ControlSend("", "", $hwnd, "10 seconds to go")
Sleep(100)
ControlSend("", "", $hwnd, "{Enter}")
Sleep(100)
ControlSend("", "", $hwnd, $TeleKey)        
Sleep(2000)
    _MouseClickPlus($hwnd, "left", $coord[0], $coord[1], 1)
Sleep(2500)
    _MouseClickPlus($hwnd, "right", $coord1[0], $coord1[1], 1)
Sleep(2500)
    _MouseClickPlus($hwnd, "right", $coord2[0], $coord2[1], 1)
Sleep(2500)
    _MouseClickPlus($hwnd, "right", $coord3[0], $coord3[1], 1)
Sleep(1500)

Error msg is:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\Administrator\Moje dokumenty\Nvm\Y.au3"

C:\Documents and Settings\Administrator\Moje dokumenty\Nvm\Y.au3 (62) : ==> Subscript used with non-Array variable.:

_MouseClickPlus($hwnd, "left", $coord[0], $coord[1], 1)

_MouseClickPlus($hwnd, "left", $coord^ ERROR

>Exit code: 1 Time: 9.865

Sometimes this working but not always :D

This world is crazy

Posted

Check @error after the pixelsearch, I'm guessing it's not finding a pixel, and so doesn't return an array.

The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

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
×
×
  • Create New...