Skip to content

Instantly share code, notes, and snippets.

Created July 30, 2013 01:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/c2366cafb6c987488466 to your computer and use it in GitHub Desktop.
Save anonymous/c2366cafb6c987488466 to your computer and use it in GitHub Desktop.
;Thanks to tic (Tariq Porter) for his GDI+ Library
;http://www.autohotkey.com/forum/viewtopic.php?t=32238
FileCreateDir, %A_MyDocuments%\AutoHotkey\Lib
FileInstall, ON Button.png, ON Button.png, 1
FileInstall, Off Button.png, Off Button.png, 1
FileInstall, Diablo-III-CM-Wizard-Script.png, diabloiiicmwizardscript.png, 1
FileInstall, Gdip_All.ahk, %A_MyDocuments%\AutoHotkey\Lib\Gdip_All.ahk
FileInstall, GDIpHelper.ahk, %A_MyDocuments%\AutoHotkey\Lib\GDIpHelper.ahk
#NoEnv
#Include <Gdip_All>
#Include <GDIpHelper>
#SingleInstance force
#MaxThreadsPerHotkey 2
SendMode Input
SetWorkingDir %A_ScriptDir%
SetBatchLines, -1
xCenter := A_ScreenWidth/2-(565/2)
yCenter := A_ScreenHeight/2-(374/2)
SetUpGDIP()
StartDrawGDIP()
ClearDrawGDIP()
Gdip_SetSmoothingMode(G, 4)
pBitmap := Gdip_CreateBitmapFromFile("diabloiiicmwizardscript.png")
Gdip_DrawImage(G, pBitmap, xCenter, yCenter, 565, 374)
Gdip_DisposeImage(pBitmap)
EndDrawGDIP()
Sleep 2000
StartDrawGDIP()
ClearDrawGDIP()
EndDrawGDIP()
GUI_Enabled = False
1_count := 0
2_count := 0
3_count := 0
latest_key = 0
Screen_x := A_ScreenWidth/4.5
Screen_y := A_ScreenHeight-50
;Awsome On/Off system from Wickster below!
CustomColor = 000000
Gui 3: +Disabled
Gui 3: +LastFound +AlwaysOnTop -Caption +ToolWindow
Gui 3: Color, %CustomColor%
Gui 3: add, Picture, x0 y0 w50 h50 vOgre, %A_ScriptDir%\Off Button.png
WinSet, TransColor, %CustomColor% 230
;End of the setup for the On/Off system by Wickster
Gui 2: Add, Text, x10 y10 w150 h30 , Script Toggle Key
Gui 2: Add, Hotkey, x180 y10 w120 h30 vToggle, XButton1
Gui 2: Add, Text, x10 y50 w150 h30 , Ingame key for 1st spell
Gui 2: Add, Edit, x180 y50 w120 h30 vKey1, 1
Gui 2: Add, Text, x10 y90 w150 h30 , Ingame key for 2nd spell
Gui 2: Add, Edit, x180 y90 w120 h30 vKey2, 2
Gui 2: Add, Text, x10 y130 w150 h30 , Ingame key for 3rd spell
Gui 2: Add, Edit, x180 y130 w120 h30 vKey3, 3
Gui 2: Add, Text, x10 y170 w150 h30 , Ingame key for Armor ability
Gui 2: Add, Edit, x180 y170 w120 h30 vDK,
Gui 2: Add, Text, x10 y220 w150 h40 , Min Time between keypresses in ms
Gui 2: Add, Edit, x180 y220 w120 h30 vMinDelay, 10
Gui 2: Add, Text, x10 y270 w150 h40 , Max Time between keypresses in ms
Gui 2: Add, Edit, x180 y270 w120 h30 vMaxDelay, 30
Gui 2: Add, Text, x10 y320 w150 h30 , Script Exit Hotkey
Gui 2: Add, Hotkey, x180 y320 w120 h30 vExitKey, ^!Esc
Gui 2: Add, CheckBox, vStats , Show stats on exit?
Gui 2: Add, Button, x110 w100 h30 gButtonDone , Done
Gui 2: +AlwaysOnTop
SetTimer, Gui, 100
IfNotExist, CM.config
{
Gui 2: Show,, Config
}else {
FileReadLine, Toggle, CM.config, 1
FileReadLine, Key1, CM.config, 2
FileReadLine, Key2, CM.config, 3
FileReadLine, Key3, CM.config, 4
FileReadLine, MinDelay, CM.config, 5
FileReadLine, MaxDelay, CM.config, 6
FileReadLine, ExitKey, CM.config, 7
FileReadLine, Stats, CM.config, 8
FileReadLine, DK, CM.config, 9
if ErrorLevel {
FileDelete, CM.config
MsgBox, please choose your configuration agian
Gui 2: Show,, Config
}
Hotkey, %Toggle%, Main
Hotkey, %ExitKey%, ExitSub
}
SetTimer, DS, 10000
return
3GuiClose:
2GuiClose:
ExitApp
return
Main:
{
t:=!t
;On/Off System by Wickster
if (t) {
GuiControl 3:,Ogre, %A_ScriptDir%\On Button.png
}else{
GuiControl 3:,Ogre, %A_ScriptDir%\Off Button.png
}
;End of On/Off System by Wickster
loop:
while t {
IfWinActive, Diablo III
{
Random, X, 1, 3
if (X == 1) and (latest_key != 1) {
RandSleep(MinDelay,MaxDelay)
Send, {%Key1% Down}
RandSleep(MinDelay,MaxDelay)
Send, {%Key1% Up}
EnvAdd, 1_count, 1
latest_key = 1
}else if (X == 2) and (latest_key != 2) {
RandSleep(MinDelay,MaxDelay)
Send, {%Key2% Down}
RandSleep(MinDelay,MaxDelay)
Send, {%Key2% Up}
EnvAdd, 2_count, 1
latest_key = 2
}else if (X == 3) and (latest_key != 3) {
RandSleep(MinDelay,MaxDelay)
Send, {%Key3% Down}
RandSleep(MinDelay,MaxDelay)
Send, {%Key3% Up}
EnvAdd, 3_count, 1
latest_key = 3
}else{
goto, loop
}
}
}
}
return
RandSleep(x,y) {
Random, rand, %x%, %y%
Sleep %rand%
}
return
DS:
IfWinActive, Diablo III
{
SetTimer, DS, Off
send, %DK%
Random, DT, 95000, 119000
SetTimer, DS, %DT%
}
return
ButtonDone:
Gui 2: submit
Hotkey, %Toggle%, Main
Hotkey, %ExitKey%, ExitSub
if (MinDelay <= 0) {
MinDelay = 10
MsgBox, Min delay was too low, set to default (10ms)
}
if (MaxDelay <= MinDelay) {
MaxDelay := MinDelay + 10
MsgBox, Max delay was too low, set to %MaxDelay%ms
}
FileAppend, %Toggle%`n, CM.config
FileAppend, %Key1%`n, CM.config
FileAppend, %Key2%`n, CM.config
FileAppend, %Key3%`n, CM.config
FileAppend, %MinDelay%`n, CM.config
FileAppend, %MaxDelay%`n, CM.config
FileAppend, %ExitKey%`n, CM.config
FileAppend, %Stats%`n, CM.config
FileAppend, %DK%, CM.config
return
Gui:
if (GUI_Enabled="False")
{
IfWinActive, Diablo III
{
Gui 3: Show, w50 h50 x%Screen_x% y%Screen_y%
WinActivate, Diablo III
GUI_Enabled = True
Hotkey, %Toggle%, Main, On
}
} else {
IfWinNotActive, Diablo III
{
Gui 3: Hide
GUI_Enabled = False
Hotkey, %Toggle%, Off
}
}
return
ExitSub:
if (Stats)
{
if A_ExitReason not in Logoff,Shutdown
{
MsgBox, 64, Results, %1_count% %Key1%'s`n%2_count% %Key2%'s`n%3_count% %Key3%'s
}
ExitApp
} else {
ExitApp
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment