Skip to content

Instantly share code, notes, and snippets.

@keeganwitt
Last active September 27, 2015 00:58
Show Gist options
  • Save keeganwitt/1186592 to your computer and use it in GitHub Desktop.
Save keeganwitt/1186592 to your computer and use it in GitHub Desktop.
An AutoHotkey bot to maintain the optimum level of drunkenness for the drunkard title in Guild Wars.
; Author: Keegan Witt
; Last Updated: 18 Jan 2011
; Adapted from http://www.autohotkey.com/forum/topic22611-30.html
#NoEnv
#WinActivateForce
SendMode Input
MsgBox, 0, GW Drunkard Bot, You can press Ctrl-Q anytime to quit
if ErrorLevel
{
ExitApp
}
SetTimer, ChangeButtonNames1, 50
MsgBox, 4, GW Drunkard Bot, What kind of alcohol would you like to drink?
IfMsgBox, YES
{
SetTimer, ChangeButtonNames2, 50
MsgBox, 4, GW Drunkard Bot 1 minute, What modus would you like to use?
IfMsgBox, YES
{
InputBox, nAles, GW Drunkard Bot 1 minute, How big is your stack?
if ErrorLevel
{
ExitApp
}
MsgBox, 0, GW Drunkard Bot 1 minute, Click once on your stack, do NOT drink one.
WinActivate, Guild Wars
KeyWait, LButton, D
MouseGetPos, nMouseX, nMouseY
MouseMove, %nMouseX%, %nMouseY%
Sleep, 250
Loop 4
{
random,randTime, 200, 250
Sleep, randTime
Click 1
random,randTime, 125, 175
Sleep, randTime
Click 1
}
nloop:= nAles-4
nTime:= 0
Loop %nloop%
{
random, randTime, 57000, 63000
random, randpixelX, 0, 9
random, randpixelY, 0, 9
If nTime <= -60000
{
MsgBox, 0, Tijdverlies, %nTime%
Sleep, 3000
SendInput, {enter down}
SendInput, {enter up}
Sleep, (3000 - nTime)
nTime:= 0
}
Else
{
Sleep, randTime
Xcoord:= nMouseX - 5 + randpixelX
Ycoord:= nMouseY - 5 + randpixelY
MouseGetPos, Xpos, Ypos, winV
WinActivate, Guild Wars
MouseMove, %Xcoord%, %Ycoord%
Sleep, 250
Click 1
random,randTijd, 125, 175
Sleep, randTijd
Click 1
Sleep, 250
WinGetTitle, title, ahk_id %winV%
WinActivate, %title%
MouseMove, %Xpos%, %Ypos%
nTime:= nTime + randTime - 60000 + 750
If nTime >= 57000
{
MouseGetPos, Xpos, Ypos, winV
WinActivate, Guild Wars
MouseMove, %Xcoord%, %Ycoord%
Sleep, 250
Click 1
random,randTijd, 125, 175
Sleep, randTijd
Click 1
nTime:= 0
Sleep, 250
WinGetTitle, title, ahk_id %winV%
WinActivate, %title%
MouseMove, %Xpos%, %Ypos%
nTime:= 800
}
}
}
Sleep, 120000
Loop 5
{
SoundBeep
}
MsgBox, 4, GW Drunkard Bot, You have consumed your alcohol, would you like to use another stack?
IfMsgBox, YES
{
Run, gw_drunkard_bot.ahk
}
Else
{
ExitApp
}
}
Else
{
InputBox, nAles, GW Drunkard Bot 1 minute, How big is your stack?
if ErrorLevel
{
ExitApp
}
MsgBox, 0, GW Drunkard Bot 1 minute, Click once on your stack, do NOT drink one.
WinActivate, Guild Wars
KeyWait, LButton, D
MouseGetPos, nMouseX, nMouseY
MouseMove, %nMouseX%, %nMouseY%
Sleep, 250
Loop 4
{
random,randTime, 200, 250
Sleep, randTime
Click 1
random,randTime, 125, 175
Sleep, randTime
Click 1
}
nloop:= nAles-4
nTime:= 0
Loop %nloop%
{
randdancetime:= 0
randdance:=0
random, randdance, 0, 79
random, randTime, 57000, 63000
random, randpixelX, 0, 9
random, randpixelY, 0, 9
If ((randdance = 2) or (randdance = 59))
{
MouseGetPos, Xpos, Ypos, winV
WinActivate, Guild Wars
SendInput, {z down}
random, randdancetime, 500, 2000
Sleep, randdancetime
SendInput, {z up}
WinGetTitle, title, ahk_id %winV%
WinActivate, %title%
randdance:=0
}
Else If ((randdance == 3) or (randdance = 58))
{
MouseGetPos, Xpos, Ypos, winV
WinActivate, Guild Wars
SendInput, {d down}
SendInput, {s down}
random, randdancetime, 500, 2000
Sleep, randdancetime
SendInput, {d up}
SendInput, {s up}
WinGetTitle, title, ahk_id %winV%
WinActivate, %title%
randdance:=0
}
Else If ((randdance = 4) or (randdance = 57))
{
MouseGetPos, Xpos, Ypos, winV
WinActivate, Guild Wars
SendInput, {q down}
random, randdancetime, 500, 2000
Sleep, randdancetime
SendInput, {q up}
WinGetTitle, title, ahk_id %winV%
WinActivate, %title%
randdance:=0
}
Else If ((randdance = 5) or (randdance = 56))
{
MouseGetPos, Xpos, Ypos, winV
WinActivate, Guild Wars
SendInput, {d down}
random, randdancetime, 500, 2000
Sleep, randdancetime
SendInput, {d up}
WinGetTitle, title, ahk_id %winV%
WinActivate, %title%
randdance:=0
}
Else If ((randdance = 6) or (randdance = 55))
{
MouseGetPos, Xpos, Ypos, winV
WinActivate, Guild Wars
SendInput, {s down}
random, randdancetime, 500, 2000
Sleep, randdancetime
SendInput, {s up}
WinGetTitle, title, ahk_id %winV%
WinActivate, %title%
randdance:=0
}
Else If ((randdance = 7) or (randdance = 54))
{
MouseGetPos, Xpos, Ypos, winV
WinActivate, Guild Wars
SendInput, {d down}
SendInput, {z down}
random, randdancetime, 500, 2000
Sleep, randdancetime
SendInput, {d up}
SendInput, {z up}
WinGetTitle, title, ahk_id %winV%
WinActivate, %title%
randdance:=0
}
Else If ((randdance = 8) or (randdance = 53))
{
MouseGetPos, Xpos, Ypos, winV
WinActivate, Guild Wars
SendInput, {d down}
SendInput, {q down}
random, randdancetime, 500, 2000
Sleep, randdancetime
SendInput, {d up}
SendInput, {q up}
WinGetTitle, title, ahk_id %winV%
WinActivate, %title%
randdance:=0
}
Else If ((randdance = 9) or (randdance = 52))
{
MouseGetPos, Xpos, Ypos, winV
WinActivate, Guild Wars
SendInput, {q down}
SendInput, {s down}
random, randdancetime, 500, 2000
Sleep, randdancetime
SendInput, {q up}
SendInput, {s up}
WinGetTitle, title, ahk_id %winV%
WinActivate, %title%
randdance:=0
}
Else If ((randdance = 10) or (randdance = 51))
{
MouseGetPos, Xpos, Ypos, winV
WinActivate, Guild Wars
SendInput, {q down}
SendInput, {z down}
random, randdancetime, 500, 2000
Sleep, randdancetime
SendInput, {q up}
SendInput, {z up}
WinGetTitle, title, ahk_id %winV%
WinActivate, %title%
randdance:=0
}
Else If ((randdance = 11) or (randdance = 50))
{
MouseGetPos, Xpos, Ypos, winV
WinActivate, Guild Wars
SendInput, {z down}
SendInput, {s down}
random, randdancetime, 500, 2000
Sleep, randdancetime
SendInput, {z up}
SendInput, {s up}
WinGetTitle, title, ahk_id %winV%
WinActivate, %title%
randdance:=0
}
If nTime <= -60000
{
Sleep, (0-nTime)
nTime:= 0
}
Else
{
Sleep, randTime
Xcoord:= nMouseX - 5 + randpixelX
Ycoord:= nMouseY - 5 + randpixelY
MouseGetPos, Xpos, Ypos, winV
WinActivate, Guild Wars
MouseMove, %Xcoord%, %Ycoord%
Sleep, 250
Click 1
random,randTijd, 125, 175
Sleep, randTijd
Click 1
Sleep, 250
WinGetTitle, title, ahk_id %winV%
WinActivate, %title%
MouseMove, %Xpos%, %Ypos%
nTime:= nTime + randTime - 60000 + 750 + randdancetime
if nTime >= 57000
{
MouseGetPos, Xpos, Ypos, winV
WinActivate, Guild Wars
MouseMove, %Xcoord%, %Ycoord%
Sleep, 250
Click 1
random,randTijd, 125, 175
Sleep, randTijd
Click 1
nTime:= 0
Sleep, 250
WinGetTitle, title, ahk_id %winV%
WinActivate, %title%
MouseMove, %Xpos%, %Ypos%
nTime:= 800
}
}
}
Sleep, 120000
Loop 5
{
SoundBeep
}
MsgBox, 4, GW Drunkard Bot, You have consumed your alcohol, would you like to use another stack?
IfMsgBox, YES
{
Run, gw_drunkard_bot.ahk
}
Else
ExitApp
}
}
Else
{
InputBox, nAles, GW Drunkard Bot 3 minutes, How big is your stack?
if ErrorLevel
{
ExitApp
}
MsgBox, 0, GW Drunkard Bot 3 minutes, Click once on your stack, do NOT drink one.
WinActivate, Guild Wars
KeyWait, LButton, D
MouseGetPos, nMouseX, nMouseY
MouseMove, %nMouseX%, %nMouseY%
Click 3
nloop:= nAles - 1
Loop %nloop%
{
random, randTime, 180000, 183000
random, randpixelX, 0, 9
random, randpixelY, 0, 9
Sleep, randTime
Xcoord:= nMouseX - 5 + randpixelX
Ycoord:= nMouseY - 5 + randpixelY
MouseGetPos, Xpos, Ypos, winV
WinActivate, Guild Wars
MouseMove, %Xcoord%, %Ycoord%
Sleep, 250
click 3
WinGetTitle, title, ahk_id %winV%
WinActivate, %title%
MouseMove, %xpos%, %ypos%
}
Sleep, 180000
Loop 5
{
SoundBeep
}
MsgBox, 4, GW Drunkard Bot, You have consumed your alcohol, would you like to use another stack?
IfMsgBox, YES
{
Run, gw_drunkard_bot.ahk
}
Else {
ExitApp
}
}
ExitApp
^q::ExitApp
ChangeButtonNames1:
IfWinNotExist, GW Drunkard Bot
{
return
}
SetTimer, ChangeButtonNames1, off
WinActivate
ControlSetText, Button1, &1 minute
ControlSetText, Button2, &3 minutes
return
ChangeButtonNames2:
IfWinNotExist, GW Drunkard Bot 1 minute
{
return
}
SetTimer, ChangeButtonNames2, off
WinActivate
ControlSetText, Button1, &Active
ControlSetText, Button2, &AFK
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment