AutoHotKey Script (v0.1) : spell casting with one key press
Posted: Sat Jul 21, 2012 4:17 pm
Hello all, this is my first post here.
While waiting for the editor to come out, I roamed the web reading articles and reviews about Grimrock to finally find the great script by D32, techzen and Adakos that you can find on the following post : viewtopic.php?f=14&t=589
I found it quite cool to be able to enhanced the game bindings system with a free and open third party tool such as Autohotkey.
But while this was great and easy to use it lacked what all mage fans wants... Spell Bindings.
Looking for a way to make a spell cast feature with AutoHotKey, I carefully to look at D32, techzen and Adakos script and started digging.
After a few hours of trials and errors, I finaly found a way to automate rune clicking in a customizable way. The following script is the result.
Be aware that my work is heavily inspired by D32, techzen and Adakos's work, the two scripts shares some variables and functions and could even be merged to add all the features in a single script.
I'd like to thanks D32, techzen and Adakos for the initial script and for the original idea of using AutoHotKey and automate actions, without their script this would have not been possible.
Script Features
To change the bindings, you should first refer to the AutoHotKey Manual in order to learn how to declare keys for AutoHotKey.
You can find the AutoHotKey Documentation Online at the following adress : http://www.autohotkey.com/docs/
You can also find a complete key list at the following page : http://www.autohotkey.com/docs/KeyList.htm
If you want to be quick and use the script as it is the following keys have been set in the .ini file :
The .Ini Configuration File
Possibles Enhancements / Debug / Tweaking
Changelog
You can report any bug, send feedback, rage for problems, or anything else in this post. Enjoy ![Wink ;)](./images/smilies/icon_e_wink.gif)
While waiting for the editor to come out, I roamed the web reading articles and reviews about Grimrock to finally find the great script by D32, techzen and Adakos that you can find on the following post : viewtopic.php?f=14&t=589
I found it quite cool to be able to enhanced the game bindings system with a free and open third party tool such as Autohotkey.
But while this was great and easy to use it lacked what all mage fans wants... Spell Bindings.
Looking for a way to make a spell cast feature with AutoHotKey, I carefully to look at D32, techzen and Adakos script and started digging.
After a few hours of trials and errors, I finaly found a way to automate rune clicking in a customizable way. The following script is the result.
Be aware that my work is heavily inspired by D32, techzen and Adakos's work, the two scripts shares some variables and functions and could even be merged to add all the features in a single script.
I'd like to thanks D32, techzen and Adakos for the initial script and for the original idea of using AutoHotKey and automate actions, without their script this would have not been possible.
Script Features
- Automatic spell cast system for all four characters.
- Support for all four elemental schools of magic. Spellcraft spells are currently out of the scope.
- Works as follows : Activate the spell runes panel, select runes and validate the spell casting.
- Only support attack spells, utility and shields spells are currently out of the scope.
- Customizable bindings based on a .Ini file and AutoHotKey bindings.
- Download Autohotkey and install it.
- Download the script file from mediafire: Link
- Extract the archive content.
- Change the bindings as you like in 'grimrock-spells-bindings.ini'.
- Doubleclick the file.
- Enjoy the script features.
- Create file named 'grimrock-spells.ahk' on your desktop (or anywhere else on your computer).
- Paste the code found below at The Script section of this post into the file.
- Save the file.
- Create file named 'grimrock-spells-bindings.ini' in the same location as the previous file.
- Paste the code found below at The .Ini Configuration File section of this post into the file.
- Save the file.
- Change the bindings as you like in 'grimrock-spells-bindings.ini'.
- Doubleclick the file.
- Enjoy the script features.
To change the bindings, you should first refer to the AutoHotKey Manual in order to learn how to declare keys for AutoHotKey.
You can find the AutoHotKey Documentation Online at the following adress : http://www.autohotkey.com/docs/
You can also find a complete key list at the following page : http://www.autohotkey.com/docs/KeyList.htm
If you want to be quick and use the script as it is the following keys have been set in the .ini file :
- è : Fire Burst from back left character
- Alt + è : Fire Ball from back left character
- _ : Ice Shards from back left character
- Alt + _ : Frost Bolt from back left character
- ) : Shock from back right character
- Alt + ) : Lightning Bolt from back right character
- = : Ice Shards from back right character
- Alt + = : Frost Bolt from back right character
- Does not work if the spell rune panel is already activated / opened.
Well... It could work in theory, but it is better to keep it closed. - Does not work if some of the spell runes are already activated.
- Does not work while the target character available actions are on cooldown.
- Does not detect that the character is out of Energy.
If this happens you will have to cast the selected spell yourself or to deselect the runes manually. - While the script is active, your binded keys will be desactivated in other programs.
If you are an heavy Alt-Tab user like me, this can be annoying.
I haven't found a workaround yet.
SpoilerShow
Code: Select all
; ---------- ---------- ---------- ---------- ---------- ;
; Legend of Grimrock
; ---------- ---------- ---------- ---------- ---------- ;
;
; AutoHotKey Script
; Spell Keys by LordYig
; v 0.1 21/07/2012
;
; Based on original Attack keys v 0.2
; Created by d32
; Character swapping by techzen, Adakos
; Download AutoHotKey at: http://www.autohotkey.com/
;
; ---------- ---------- ---------- ---------- ---------- ;
#SingleInstance force
SetTitleMatchMode, 2
SetDefaultMouseSpeed, 0
CoordMode, Mouse,
titleOfGrimrockWindow=Legend of Grimrock
; ---------- ---------- ---------- ---------- ---------- ;
; Global Variables
; ---------- ---------- ---------- ---------- ---------- ;
xAdjust := 1 ; Accuracy adjustment for the X axis
yAdjust := 1 ; Accuracy adjustment for the Y axis
; ---------- ---------- ---------- ---------- ---------- ;
; relative positions of weapon slots and character bars
; ---------- ---------- ---------- ---------- ---------- ;
; dx1l := 0.14 ; X position of 1st and 3rd char left hand
; dx2l := 0.62 ; X position of 2nd and 4th char left hand
dx1r := 0.34 ; X position of 1st and 3rd char right hand
dx2r := 0.81 ; X position of 2nd and 4th char right hand
dy1 := 0.32 ; Y position of 1st and 2nd char hands
dy2 := 0.79 ; Y position of 3rd and 4th char hands
; ---------- ---------- ---------- ---------- ---------- ;
; SPELLS MATRIX - COORDINATES
; ---------- ---------- ---------- ---------- ---------- ;
; (1) - FIRE - First Row - Left Column
; (2) - LIFE - First Row - Middle Column
; (3) - AIR - First Row - Right Column
; (4) - SPIRITUALITY - Second Row - Left Column
; (5) - BALANCE - Second Row - Middle Column
; (6) - PHYSICALITY - Second Row - Right Column
; (7) - EARTH - Third Row - Left Column
; (8) - DEATH - Third Row - Middle Column
; (9) - ICE - Third Row - Right Column
; ---------- ---------- ---------- ---------- ---------- ;
; ---------- ---------- ---------- ---------- ---------- ;
; Runes Columns
; ---------- ---------- ---------- ---------- ---------- ;
xLcLrC := 0.10 ; position of 1st and 3rd char left rune column
xLcMrC := 0.20 ; position of 1st and 3rd char middle rune column
xLcRrC := 0.30 ; position of 1st and 3rd char right rune column
xRcLrC := 0.58 ; position of 2nd and 4th char left rune column
xRcMrC := 0.68 ; position of 2nd and 4th char middle rune column
xRcRrC := 0.78 ; position of 2nd and 4th char right rune column
; ---------- ---------- ---------- ---------- ---------- ;
; Runes Rows
; ---------- ---------- ---------- ---------- ---------- ;
yTcTrR := 0.14 ; position of 1st and 2nd char top rune row
yTcMrR := 0.26 ; position of 1st and 2nd char middle rune row
yTcBrR := 0.38 ; position of 1st and 2nd char bottom rune row
yBcTrR := 0.63 ; position of 3rd and 4th char top rune row
yBcMrR := 0.75 ; position of 3rd and 4th char middle rune row
yBcBrR := 0.87 ; position of 3rd and 4th char bottom rune row
; ---------- ---------- ---------- ---------- ---------- ;
; Cast Spell Button
; ---------- ---------- ---------- ---------- ---------- ;
xLcCsC := 0.40 ; position of 1st and 3rd char cast spell column
xRcCsC := 0.85 ; position of 2nd and 4th char cast spell column
yTcCsR := 0.38 ; position of 1st and 2nd char cast spell row
yBcCsR := 0.87 ; position of 3rd and 4th char cast spell row
; ---------- ---------- ---------- ---------- ---------- ;
; ---------- ---------- ---------- ---------- ---------- ;
; reads the resolution, determins the corner of characters' rectangle
; ---------- ---------- ---------- ---------- ---------- ;
init()
{
global
sysget, resX, 0
sysget, resY, 1
chHei := resY * 0.32
if (chHei > 345) chHei := 345 ; this seems to be maximum height of the characters' bar
chWid := chHei / 0.76
chWid := chWid * xAdjust
chHei := chHei * yAdjust
chX := resX-chWid
chY := resY-chHei
initBindings()
}
; ---------- ---------- ---------- ---------- ---------- ;
; reads the bindings in grimrock-spells-bindings.ini
; associates the hotkeys to the selected spell label
; ---------- ---------- ---------- ---------- ---------- ;
initBindings()
{
; ---------- ---------- ---------- ---------- ---------- ;
; Top Left Character Bindings
; ---------- ---------- ---------- ---------- ---------- ;
IniRead, tlcFireBurst, grimrock-spells-bindings.ini, TopLeftCharacterMageSpells,FIREBURST
IniRead, tlcFireBall, grimrock-spells-bindings.ini, TopLeftCharacterMageSpells,FIREBALL
IniRead, tlcIceShards, grimrock-spells-bindings.ini, TopLeftCharacterMageSpells,ICESHARDS
IniRead, tlcIceBolt, grimrock-spells-bindings.ini, TopLeftCharacterMageSpells,ICEBOLT
IniRead, tlcPoisonCloud, grimrock-spells-bindings.ini, TopLeftCharacterMageSpells,POISONCLOUD
IniRead, tlcPoisonBolt, grimrock-spells-bindings.ini, TopLeftCharacterMageSpells,POISONBOLT
IniRead, tlcShock, grimrock-spells-bindings.ini, TopLeftCharacterMageSpells,SHOCK
IniRead, tlcLightningBolt, grimrock-spells-bindings.ini, TopLeftCharacterMageSpells,LIGHTNINGBOLT
if tlcFireBurst
Hotkey, %tlcFireBurst%, TopLeftCharFireBurst
if tlcFireBall
Hotkey, %tlcFireBall%, TopLeftCharFireBall
if tlcIceShards
Hotkey, %tlcIceShards%, TopLeftCharIceShards
if tlcIceBolt
Hotkey, %tlcIceBolt%, TopLeftCharFrostBolt
if tlcPoisonCloud
Hotkey, %tlcPoisonCloud%, TopLeftCharPoisonCloud
if tlcPoisonBolt
Hotkey, %tlcPoisonBolt%, TopLeftCharPoisonBolt
if tlcShock
Hotkey, %tlcShock%, TopLeftCharShock
if tlcLightningBolt
Hotkey, %tlcLightningBolt%, TopLeftCharLightningBolt
; ---------- ---------- ---------- ---------- ---------- ;
; Top Right Character Bindings
; ---------- ---------- ---------- ---------- ---------- ;
IniRead, trcFireBurst, grimrock-spells-bindings.ini, TopRightCharacterMageSpells,FIREBURST
IniRead, trcFireBall, grimrock-spells-bindings.ini, TopRightCharacterMageSpells,FIREBALL
IniRead, trcIceShards, grimrock-spells-bindings.ini, TopRightCharacterMageSpells,ICESHARDS
IniRead, trcIceBolt, grimrock-spells-bindings.ini, TopRightCharacterMageSpells,ICEBOLT
IniRead, trcPoisonCloud, grimrock-spells-bindings.ini, TopRightCharacterMageSpells,POISONCLOUD
IniRead, trcPoisonBolt, grimrock-spells-bindings.ini, TopRightCharacterMageSpells,POISONBOLT
IniRead, trcShock, grimrock-spells-bindings.ini, TopRightCharacterMageSpells,SHOCK
IniRead, trcLightningBolt, grimrock-spells-bindings.ini, TopRightCharacterMageSpells,LIGHTNINGBOLT
if trcFireBurst
Hotkey, %trcFireBurst%, TopRightCharFireBurst
if trcFireBall
Hotkey, %trcFireBall%, TopRightCharFireBall
if trcIceShards
Hotkey, %trcIceShards%, TopRightCharIceShards
if trcIceBolt
Hotkey, %trcIceBolt%, TopRightCharFrostBolt
if trcPoisonCloud
Hotkey, %trcPoisonCloud%, TopRightCharPoisonCloud
if trcPoisonBolt
Hotkey, %trcPoisonBolt%, TopRightCharPoisonBolt
if trcShock
Hotkey, %trcShock%, TopRightCharShock
if trcLightningBolt
Hotkey, %trcLightningBolt%, TopRightCharLightningBolt
; ---------- ---------- ---------- ---------- ---------- ;
; Bottom Left Character Bindings
; ---------- ---------- ---------- ---------- ---------- ;
IniRead, blcFireBurst, grimrock-spells-bindings.ini, BottomLeftCharacterMageSpells,FIREBURST
IniRead, blcFireBall, grimrock-spells-bindings.ini, BottomLeftCharacterMageSpells,FIREBALL
IniRead, blcIceShards, grimrock-spells-bindings.ini, BottomLeftCharacterMageSpells,ICESHARDS
IniRead, blcIceBolt, grimrock-spells-bindings.ini, BottomLeftCharacterMageSpells,ICEBOLT
IniRead, blcPoisonCloud, grimrock-spells-bindings.ini, BottomLeftCharacterMageSpells,POISONCLOUD
IniRead, blcPoisonBolt, grimrock-spells-bindings.ini, BottomLeftCharacterMageSpells,POISONBOLT
IniRead, blcShock, grimrock-spells-bindings.ini, BottomLeftCharacterMageSpells,SHOCK
IniRead, blcLightningBolt, grimrock-spells-bindings.ini, BottomLeftCharacterMageSpells,LIGHTNINGBOLT
if blcFireBurst
Hotkey, %blcFireBurst%, BottomLeftCharFireBurst
if blcFireBall
Hotkey, %blcFireBall%, BottomLeftCharFireBall
if blcIceShards
Hotkey, %blcIceShards%, BottomLeftCharIceShards
if blcIceBolt
Hotkey, %blcIceBolt%, BottomLeftCharFrostBolt
if blcPoisonCloud
Hotkey, %blcPoisonCloud%, BottomLeftCharPoisonCloud
if blcPoisonBolt
Hotkey, %blcPoisonBolt%, BottomLeftCharPoisonBolt
if blcShock
Hotkey, %blcShock%, BottomLeftCharShock
if blcLightningBolt
Hotkey, %blcLightningBolt%, BottomLeftCharLightningBolt
; ---------- ---------- ---------- ---------- ---------- ;
; Bottom Right Character Bindings
; ---------- ---------- ---------- ---------- ---------- ;
IniRead, brcFireBurst, grimrock-spells-bindings.ini, BottomRightCharacterMageSpells,FIREBURST
IniRead, brcFireBall, grimrock-spells-bindings.ini, BottomRightCharacterMageSpells,FIREBALL
IniRead, brcIceShards, grimrock-spells-bindings.ini, BottomRightCharacterMageSpells,ICESHARDS
IniRead, brcIceBolt, grimrock-spells-bindings.ini, BottomRightCharacterMageSpells,ICEBOLT
IniRead, brcPoisonCloud, grimrock-spells-bindings.ini, BottomRightCharacterMageSpells,POISONCLOUD
IniRead, brcPoisonBolt, grimrock-spells-bindings.ini, BottomRightCharacterMageSpells,POISONBOLT
IniRead, brcShock, grimrock-spells-bindings.ini, BottomRightCharacterMageSpells,SHOCK
IniRead, brcLightningBolt, grimrock-spells-bindings.ini, BottomRightCharacterMageSpells,LIGHTNINGBOLT
if brcFireBurst
Hotkey, %brcFireBurst%, BottomRightCharFireBurst
if brcFireBall
Hotkey, %brcFireBall%, BottomRightCharFireBall
if brcIceShards
Hotkey, %brcIceShards%, BottomRightCharIceShards
if brcIceBolt
Hotkey, %brcIceBolt%, BottomRightCharFrostBolt
if brcPoisonCloud
Hotkey, %brcPoisonCloud%, BottomRightCharPoisonCloud
if brcPoisonBolt
Hotkey, %brcPoisonBolt%, BottomRightCharPoisonBolt
if brcShock
Hotkey, %brcShock%, BottomRightCharShock
if brcLightningBolt
Hotkey, %brcLightningBolt%, BottomRightCharLightningBolt
return
}
; ---------- ---------- ---------- ---------- ---------- ;
; storeMousePos
; ---------- ---------- ---------- ---------- ---------- ;
storeMousePos()
{
global
MouseGetPos, mX, mY
}
; ---------- ---------- ---------- ---------- ---------- ;
; restoreMousePos
; ---------- ---------- ---------- ---------- ---------- ;
restoreMousePos()
{
global
MouseMove, mX, mY
}
; ---------- ---------- ---------- ---------- ---------- ;
; OFFENSIVES SPELLS - FROM THE FRONT CHARACTERS
; ---------- ---------- ---------- ---------- ---------- ;
; ---------- ---------- ---------- ---------- ---------- ;
; FIRE SPELLS
; ---------- ---------- ---------- ---------- ---------- ;
topLeftFireBurst()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx1r), chY+(chHei*dy1))
; Runes
clickRune(xLcLrC, yTcTrR)
; Cast
clickRune(xLcCsC, yTcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
topLeftFireBall()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx1r), chY+(chHei*dy1))
; Runes
clickRune(xLcLrC, yTcTrR)
clickRune(xLcRrC, yTcTrR)
clickRune(xLcRrC, yTcMrR)
; Cast
clickRune(xLcCsC, yTcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
topRightFireBurst()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx2r), chY+(chHei*dy1))
; Runes
clickRune(xRcLrC, yTcTrR)
; Cast
clickRune(xRcCsC, yTcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
topRightFireBall()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx2r), chY+(chHei*dy1))
; Runes
clickRune(xRcLrC, yTcTrR)
clickRune(xRcRrC, yTcTrR)
clickRune(xRcRrC, yTcMrR)
; Cast
clickRune(xRcCsC, yTcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
; ---------- ---------- ---------- ---------- ---------- ;
; ICE SPELLS
; ---------- ---------- ---------- ---------- ---------- ;
topLeftIceShards()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx1r), chY+(chHei*dy1))
; Runes
clickRune(xLcLrC, yTcBrR)
clickRune(xLcRrC, yTcBrR)
; Cast
clickRune(xLcCsC, yTcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
topLeftFrostBolt()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx1r), chY+(chHei*dy1))
; Runes
clickRune(xLcRrC, yTcTrR)
clickRune(xLcRrC, yTcBrR)
; Cast
clickRune(xLcCsC, yTcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
topRightIceShards()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx2r), chY+(chHei*dy1))
; Runes
clickRune(xRcLrC, yTcBrR)
clickRune(xRcRrC, yTcBrR)
; Cast
clickRune(xRcCsC, yTcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
topRightFrostBolt()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx2r), chY+(chHei*dy1))
; Runes
clickRune(xRcRrC, yTcTrR)
clickRune(xRcRrC, yTcBrR)
; Cast
clickRune(xRcCsC, yTcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
; ---------- ---------- ---------- ---------- ---------- ;
; AIR SPELLS
; ---------- ---------- ---------- ---------- ---------- ;
topLeftShock()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx1r), chY+(chHei*dy1))
; Runes
clickRune(xLcRrC, yTcTrR)
; Cast
clickRune(xLcCsC, yTcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
topLeftLightningBolt()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx1r), chY+(chHei*dy1))
; Runes
clickRune(xLcLrC, yTcMrR)
clickRune(xLcRrC, yTcTrR)
; Cast
clickRune(xLcCsC, yTcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
topRightShock()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx2r), chY+(chHei*dy1))
; Runes
clickRune(xRcRrC, yTcTrR)
; Cast
clickRune(xRcCsC, yTcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
topRightLightningBolt()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx2r), chY+(chHei*dy1))
; Runes
clickRune(xRcLrC, yTcMrR)
clickRune(xRcRrC, yTcTrR)
; Cast
clickRune(xRcCsC, yTcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
; ---------- ---------- ---------- ---------- ---------- ;
; EARTH SPELLS
; ---------- ---------- ---------- ---------- ---------- ;
topLeftPoisonCloud()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx1r), chY+(chHei*dy1))
; Runes
clickRune(xLcLrC, yTcBrR)
; Cast
clickRune(xLcCsC, yTcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
topLeftPoisonBolt()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx1r), chY+(chHei*dy1))
; Runes
clickRune(xLcLrC, yTcBrR)
clickRune(xLcRrC, yTcTrR)
; Cast
clickRune(xLcCsC, yTcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
topRightPoisonCloud()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx2r), chY+(chHei*dy1))
; Runes
clickRune(xRcLrC, yTcBrR)
; Cast
clickRune(xRcCsC, yTcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
topRightPoisonBolt()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx2r), chY+(chHei*dy1))
; Runes
clickRune(xRcLrC, yTcBrR)
clickRune(xRcRrC, yTcTrR)
; Cast
clickRune(xRcCsC, yTcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
; ---------- ---------- ---------- ---------- ---------- ;
; OFFENSIVES SPELLS - FROM THE BACK CHARACTERS
; ---------- ---------- ---------- ---------- ---------- ;
; ---------- ---------- ---------- ---------- ---------- ;
; FIRE SPELLS
; ---------- ---------- ---------- ---------- ---------- ;
bottomLeftFireBurst()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx1r), chY+(chHei*dy2))
; Runes
clickRune(xLcLrC, yBcTrR)
; Cast
clickRune(xLcCsC, yBcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
bottomLeftFireBall()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx1r), chY+(chHei*dy2))
; Runes
clickRune(xLcLrC, yBcTrR)
clickRune(xLcRrC, yBcTrR)
clickRune(xLcRrC, yBcMrR)
; Cast
clickRune(xLcCsC, yBcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
bottomRightFireBurst()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx2r), chY+(chHei*dy2))
; Runes
clickRune(xRcLrC, yBcTrR)
; Cast
clickRune(xRcCsC, yBcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
bottomRightFireBall()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx2r), chY+(chHei*dy2))
; Runes
clickRune(xRcLrC, yBcTrR)
clickRune(xRcRrC, yBcTrR)
clickRune(xRcRrC, yBcMrR)
; Cast
clickRune(xRcCsC, yBcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
; ---------- ---------- ---------- ---------- ---------- ;
; ICE SPELLS
; ---------- ---------- ---------- ---------- ---------- ;
bottomLeftIceShards()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx1r), chY+(chHei*dy2))
; Runes
clickRune(xLcLrC, yBcBrR)
clickRune(xLcRrC, yBcBrR)
; Cast
clickRune(xLcCsC, yBcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
bottomLeftFrostBolt()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx1r), chY+(chHei*dy2))
; Runes
clickRune(xLcRrC, yBcTrR)
clickRune(xLcRrC, yBcBrR)
; Cast
clickRune(xLcCsC, yBcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
bottomRightIceShards()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx2r), chY+(chHei*dy2))
; Runes
clickRune(xRcLrC, yBcBrR)
clickRune(xRcRrC, yBcBrR)
; Cast
clickRune(xRcCsC, yBcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
bottomRightFrostBolt()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx2r), chY+(chHei*dy2))
; Runes
clickRune(xRcRrC, yBcTrR)
clickRune(xRcRrC, yBcBrR)
; Cast
clickRune(xRcCsC, yBcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
; ---------- ---------- ---------- ---------- ---------- ;
; AIR SPELLS
; ---------- ---------- ---------- ---------- ---------- ;
bottomLeftShock()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx1r), chY+(chHei*dy2))
; Runes
clickRune(xLcRrC, yBcTrR)
; Cast
clickRune(xLcCsC, yBcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
bottomLeftLightningBolt()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx1r), chY+(chHei*dy2))
; Runes
clickRune(xLcLrC, yBcMrR)
clickRune(xLcRrC, yBcTrR)
; Cast
clickRune(xLcCsC, yBcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
bottomRightShock()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx2r), chY+(chHei*dy2))
; Runes
clickRune(xRcRrC, yBcTrR)
; Cast
clickRune(xRcCsC, yBcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
bottomRightLightningBolt()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx2r), chY+(chHei*dy2))
; Runes
clickRune(xRcLrC, yBcMrR)
clickRune(xRcRrC, yBcTrR)
; Cast
clickRune(xRcCsC, yBcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
; ---------- ---------- ---------- ---------- ---------- ;
; EARTH SPELLS
; ---------- ---------- ---------- ---------- ---------- ;
bottomLeftPoisonCloud()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx1r), chY+(chHei*dy2))
; Runes
clickRune(xLcLrC, yBcBrR)
; Cast
clickRune(xLcCsC, yBcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
bottomLeftPoisonBolt()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx1r), chY+(chHei*dy2))
; Runes
clickRune(xLcLrC, yBcBrR)
clickRune(xLcRrC, yBcTrR)
; Cast
clickRune(xLcCsC, yBcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
bottomRightPoisonCloud()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx2r), chY+(chHei*dy2))
; Runes
clickRune(xRcLrC, yBcBrR)
; Cast
clickRune(xRcCsC, yBcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
bottomRightPoisonBolt()
{
global
storeMousePos()
startSpellCast(chX+(chWid*dx2r), chY+(chHei*dy2))
; Runes
clickRune(xRcLrC, yBcBrR)
clickRune(xRcRrC, yBcTrR)
; Cast
clickRune(xRcCsC, yBcCsR)
restoreMousePos()
return
}
; ---------- ---------- ---------- ---------- ---------- ;
; ---------- ---------- ---------- ---------- ---------- ;
; SPELLS UTILITY FUNCTIONS
; ---------- ---------- ---------- ---------- ---------- ;
; ---------- ---------- ---------- ---------- ---------- ;
; startSpellCast
; ---------- ---------- ---------- ---------- ---------- ;
startSpellCast(x, y)
{
MouseClick, right, x, y
}
; ---------- ---------- ---------- ---------- ---------- ;
; clickRune
; ---------- ---------- ---------- ---------- ---------- ;
clickRune(xFactor, yFactor)
{
global
iX := chX+(chWid*xFactor)
iY := chY+(chHei*yFactor)
MouseMove, iX, iY
MouseClick, left, iX, iY
}
; ---------- ---------- ---------- ---------- ---------- ;
; ---------- ---------- ---------- ---------- ---------- ;
#IfWinActive Grimrock ahk_class EWindowClass
; ---------- ---------- ---------- ---------- ---------- ;
init()
; TOP LEFT CHARACTER
TopLeftCharFireBurst:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
topLeftFireBurst() ; cast fireburst
Return
TopLeftCharFireBall:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
topLeftFireBall() ; cast fireburst
Return
TopLeftCharPoisonCloud:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
topLeftPoisonCloud() ; cast poison cloud
Return
TopLeftCharPoisonBolt:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
topLeftPoisonBolt() ; cast poison bolt
Return
TopLeftCharShock:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
topLeftShock() ; cast shock
Return
TopLeftCharLightningBolt:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
topLeftLightningBolt() ; cast lightning bolt
Return
TopLeftCharIceShards:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
topLeftIceShards() ; cast ice shards
Return
TopLeftCharFrostBolt:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
topLeftFrostBolt() ; cast frostbolt
Return
; TOP RIGHT CHARACTER
TopRightCharFireBurst:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
topRightFireBurst() ; cast fireburst
Return
TopRightCharFireBall:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
topRightFireBall() ; cast fireburst
Return
TopRightCharPoisonCloud:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
topRightPoisonCloud() ; cast poison cloud
Return
TopRightCharPoisonBolt:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
topRightPoisonBolt() ; cast poison bolt
Return
TopRightCharShock:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
topRightShock() ; cast shock
Return
TopRightCharLightningBolt:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
topRightLightningBolt() ; cast lightning bolt
Return
TopRightCharIceShards:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
topRightIceShards() ; cast ice shards
Return
TopRightCharFrostBolt:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
topRightFrostBolt() ; cast frostbolt
Return
; BOTTOM LEFT CHARACTER
BottomLeftCharFireBurst:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
bottomLeftFireBurst() ; cast fireburst
Return
BottomLeftCharFireBall:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
bottomLeftFireBall() ; cast fireburst
Return
BottomLeftCharPoisonCloud:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
bottomLeftPoisonCloud() ; cast poison cloud
Return
BottomLeftCharPoisonBolt:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
bottomLeftPoisonBolt() ; cast poison bolt
Return
BottomLeftCharShock:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
bottomLeftShock() ; cast shock
Return
BottomLeftCharLightningBolt:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
bottomLeftLightningBolt() ; cast lightning bolt
Return
BottomLeftCharIceShards:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
bottomLeftIceShards() ; cast ice shards
Return
BottomLeftCharFrostBolt:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
bottomLeftFrostBolt() ; cast frostbolt
Return
; BOTTOM RIGHT CHARACTER
BottomRightCharFireBurst:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
bottomRightFireBurst() ; cast fireburst
Return
BottomRightCharFireBall:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
bottomRightFireBall() ; cast fireburst
Return
BottomRightCharPoisonCloud:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
bottomRightPoisonCloud() ; cast poison cloud
Return
BottomRightCharPoisonBolt:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
bottomRightPoisonBolt() ; cast poison bolt
Return
BottomRightCharShock:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
bottomRightShock() ; cast shock
Return
BottomRightCharLightningBolt:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
bottomRightLightningBolt() ; cast lightning bolt
Return
BottomRightCharIceShards:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
bottomRightIceShards() ; cast ice shards
Return
BottomRightCharFrostBolt:
If WinActive(titleOfGrimrockWindow) and WinActive("ahk_class EWindowClass")
bottomRightFrostBolt() ; cast frostbolt
Return
; Debug test
^t::
{
init()
MouseMove, chX, resY-10, 6
MouseMove, chX, chY, 6
MouseMove, resX-10, chY, 6
MouseMove, resX-10, resY-10, 6
MouseMove, chX, resY-10, 6
return
}
#IfWinActive
SpoilerShow
Code: Select all
; ---------- ---------- ---------- ---------- ---------- ;
; Legend of Grimrock
; ---------- ---------- ---------- ---------- ---------- ;
;
; AutoHotKey Binding Ini
; Spell Keys by LordYig
; v 0.1 21/07/2012
;
; To change the bindings, please refer to the AutoHotKey Manual.
;
; You can find the AutoHotKey Documentation Online at the following adress :
; http://www.autohotkey.com/docs/
;
; you can also find a complete key list at the follwoing page :
; http://www.autohotkey.com/docs/KeyList.htm
;
; If you do not need a specific bonding leave it empty.
; The script will check this file for a binding
; and only affect it to a comand if it exist.
; ---------- ---------- ---------- ---------- ---------- ;
[TopLeftCharacterMageSpells]
FIREBURST=
FIREBALL=
ICESHARDS=
ICEBOLT=
POISONCLOUD=
POISONBOLT=
SHOCK=
LIGHTNINGBOLT=
[TopRightCharacterMageSpells]
FIREBURST=
FIREBALL=
ICESHARDS=
ICEBOLT=
POISONCLOUD=
POISONBOLT=
SHOCK=
LIGHTNINGBOLT=
[BottomLeftCharacterMageSpells]
FIREBURST=è
FIREBALL=!è
ICESHARDS=_
ICEBOLT=!_
POISONCLOUD=
POISONBOLT=
SHOCK=
LIGHTNINGBOLT=
[BottomRightCharacterMageSpells]
FIREBURST=
FIREBALL=
ICESHARDS==
ICEBOLT=!=
POISONCLOUD=
POISONBOLT=
SHOCK=)
LIGHTNINGBOLT=!)
SpoilerShow
- Tweaking function from D32, techzen and Adakos's script :
If the script seems to miss the right areas to perform the cast, you can adjust the xAdjust & yAdjust variables in the script to modify its size (>1 means bigger - 1.1 means 110% - <1 means smaller, x for width y for height). - Merge with part of the D32, techzen and Adakos's script.
- Merge with all the D32, techzen and Adakos's script.
SpoilerShow
- 21.07.2012 : v 0.1
Original Release
![Wink ;)](./images/smilies/icon_e_wink.gif)