It's all mine. The first version of this script was set up on a timer, but it proved to clunky if someone bumped my character. There are a few lines still commented out that I missed when cleaning it up for just a simple macro. I can say that this gives a huge advantage to when competing for land.
Here is the version I trimmed down. This one keeps your character standing near the building ready place the design at the demo time. There are some issues with it that need to be re-worked:
1) The toon just stands there in one place using mouse clicks to anti-afk until demo time (looks like a bot)
2) The toon will continue to click/search for 12 minutes after demo time. (sometimes people are not around to attack and speed up the demo process)
On the upside you can set this up as a failsafe for those 4am demos that you might oversleep for.
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
FormatSeconds(NumberOfSeconds) ; Convert the specified number of seconds to hh:mm:ss format.
{
time = 19990101 ; *Midnight* of an arbitrary date.
time += %NumberOfSeconds%, seconds
FormatTime, mmss, %time%, mm:ss
SetFormat, float, 2.0
return NumberOfSeconds//3600 ":" mmss ; This method is used to support more than 24 hours worth of sections.
}
Start:
#MaxThreadsperHotkey 2
SetNumLockState, on
SetTitleMatchMode, 2
Title = AA Utility (%A_ScreenWidth% x %A_ScreenHeight%)
Run_Minutes = 12 ; # of minutes to click after demolition time
Run_Seconds := Ceil(Run_Minutes * 60)
colorID = 0x8DBFDB
Gosub, GameCheck
Gosub, Resolution
Goto Input
GameCheck:
IfWinExist, - ArcheAge
{
WinActivate
Sleep 500
WinMaximize
Sleep 500
return
}
else
MsgBox, 64, %Title%, %Title% will resume when ArcheAge is started.
WinWait, - ArcheAge
Return
Resolution:
WinActivate - ArcheAge
If (A_ScreenWidth = 1680 && A_ScreenHeight = 1050)
{
Resolution_type = 1
xbuild = 800
ybuild = 750
xbuild_box_1 = 760
ybuild_box_1 = 738
xbuild_box_2 = 838
ybuild_box_2 = 763
;MsgBox, 64, %Title%, 1680 x 1050 Resolution Detected., 1
}
If (A_ScreenWidth = 1920 && A_ScreenHeight = 1080)
{
Resolution_type = 2
xbuild = 919
ybuild = 764
xbuild_box_1 = 880
ybuild_box_1 = 752
xbuild_box_2 = 957
ybuild_box_2 = 778
;MsgBox, 64, %Title%, 1920 x 1080 Resolution Detected., 1
}
If (A_ScreenWidth <> 1680 && A_ScreenWidth <> 1920)
{
MsgBox, 16, %Title%, Resolution not supported!, 2
ExitApp
}
Return
Input:
InputBox, House_Key, %Title%, `n Input design shortcut.,,230,170,,,,300,0
if ErrorLevel
{
WinMaximize
ExitApp
}
WinActivate
MouseMove, 800, 65
Sleep 1000
Send {%House_Key%}
MsgBox, 64, %Title%, You have 15 seconds to position`n`n 0& rotate your structure., 2
Sleep 15000
MouseGetPos, xclick, yclick
MouseClick, left, %xclick%, %yclick%,30, 50
MsgBox, 64, %Title%, Mouse Position Aquired!`n`nDo NOT move or change`n`nthe camera position!, 2
InputBox, Demo_Time, %Title%, What is the Demolition time?`n`n24 Hour Format:(hhmm),,230,170,,,,300,%DefTimeToStart_1%
if ErrorLevel
{
WinMaximize
ExitApp
}
#Persistent
SetTimer, Chronos, 500
Return
Chronos:
FormatTime, TimeToStart,,HHmm
If TimeToStart >= %Demo_Time%
{
StartTime := A_TickCount
Send {%House_Key%}
Sleep 100
Goto Grabber
}
else
{
Gosub, MouseAfk
}
Return
Grabber:
Loop
{
EndTime := A_TickCount
GrabberRunTime := Ceil((EndTime - StartTime)/1000)
if GrabberRunTime >= %Run_Seconds%
ExitApp
PixelSearch, xbuild_find, ybuild_find, %xbuild_box_1%, %ybuild_box_1%, %xbuild_box_2%, %ybuild_box_2%, %colorID%, 5, Fast
if ErrorLevel
MouseClick, left, %xclick%, %yclick%, 10
else
{
Loop 20
{
MouseClick, left, %xbuild%, %ybuild%
Sleep 150
}
}
}
Return
MouseAfk:
Gosub, DisconnectCheck
Random, Afk_Timer2, 1000, 5000
WinActivate - ArcheAge
MouseClick, left, 40, 65
Sleep %Afk_Timer2%
MouseClick, left, 240, 65
Sleep %Afk_Timer2%
Return
DisconnectCheck:
If resolution_type = 1
{
xdisconnect_box_1 = 800
ydisconnect_box_1 = 564
xdisconnect_box_2 = 880
ydisconnect_box_2 = 589
xdisconnect = 841
ydisconnect = 576
}
If resolution_type = 2
{
xdisconnect_box_1 = 789
ydisconnect_box_1 = 477
xdisconnect_box_2 = 1134
ydisconnect_box_2 = 629
xdisconnect = 961
ydisconnect = 593
}
WinActivate - ArcheAge
PixelSearch, xdisconnect_find, ydisconnect_find, %xdisconnect_box_1%, %ydisconnect_box_1%, %xdisconnect_box_2%, %ydisconnect_box_2%, %colorID%, 5, Fast
if ErrorLevel
Return
else
{
Loop 5
{
IfWinExist - ArcheAge
{
Sleep 150
MouseClick, left, %xdisconnect%, %ydisconnect%
Sleep 150
}
else
Goto Text
}
}
Return
^!a:: ; this is just helped me find the correct position and color for seeking/clicking
WinActivate - ArcheAge
MouseGetPos, xtest, ytest
PixelGetColor, color, %xtest%, %ytest%, slow
MsgBox The resolution of the primary monitor is %A_ScreenWidth% x %A_ScreenHeight%`n`nThe Cursor is at X: %xtest% Y: %ytest% with a color of: %color%
Return
^!p::Pause, Toggle
Return
Pause::
Send ^!p
Return
Text:
; this is where I had the script email/text me if the the game got disconnected
Return
Esc::
ExitApp
Return