Keys for attack, char. swapping (autohotkey script, v 0.4)
Posted: Wed Apr 11, 2012 11:32 pm
Updated to v 0.4; Added character swapping by techzen, Adakos
--
Hello everyone. After half an hour with the game, I just had to find a way how to do the attacks by key-presses. Here it is:
1.) Download Autohotkey at http://www.autohotkey.com/
2.) Download the script file from mediafire: link
OR
Create file named 'grimrock.ahk' on your desktop (or anywhere else on your computer).
Paste the code found below into the file.
Save the file
3.) Doubleclick the file.
4.) Enjoy following features:
- Activate right hands attacks of your characters by pressing keys: j k m,
- Left hands attacks by pressing keys: l ; ./
- Open the inventory of the first character by pressing i
- Swap two left characters by pressing 9
- Swap two left characters by pressing 0
- Swap both columns with Caps
- Swap and attack with the front row immediately: o p
Sorry, still no spellcasting support. (look at posts below for partial solution)
Keys can be changed inside the file, towards the end; look for "j::" and similar.
Consider this beta version, not much tested.
Debug/tweaking:
Changelog:
v 0.4
- merged with character swapping by techzen, Adakos
v 0.3:
- no need to enter the resolution manually
- mouse now returns to the original position after attacking
- much better support for different resolutions
- debug shortcut, accuracy tweaking
v 0.2:
- support for different aspect ratios, including 16:10 (1920x1200) and 16:9 (1920x1080)
--
Hello everyone. After half an hour with the game, I just had to find a way how to do the attacks by key-presses. Here it is:
1.) Download Autohotkey at http://www.autohotkey.com/
2.) Download the script file from mediafire: link
OR
Create file named 'grimrock.ahk' on your desktop (or anywhere else on your computer).
Paste the code found below into the file.
Save the file
3.) Doubleclick the file.
4.) Enjoy following features:
- Activate right hands attacks of your characters by pressing keys: j k m,
- Left hands attacks by pressing keys: l ; ./
- Open the inventory of the first character by pressing i
- Swap two left characters by pressing 9
- Swap two left characters by pressing 0
- Swap both columns with Caps
- Swap and attack with the front row immediately: o p
Sorry, still no spellcasting support. (look at posts below for partial solution)
Keys can be changed inside the file, towards the end; look for "j::" and similar.
Consider this beta version, not much tested.
Debug/tweaking:
SpoilerShow
- if the script seems to miss the right areas to perform attack, press ctrl+t; mouse will try to run around your characters. If the rectangle is bigger/smaller than it should be, 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).
- If the swapping doesn't seem to work or has a side-effects (inventory opening etc), try increasing swapDelay value inside the file
- If the swapping doesn't seem to work or has a side-effects (inventory opening etc), try increasing swapDelay value inside the file
SpoilerShow
v 0.4
- merged with character swapping by techzen, Adakos
v 0.3:
- no need to enter the resolution manually
- mouse now returns to the original position after attacking
- much better support for different resolutions
- debug shortcut, accuracy tweaking
v 0.2:
- support for different aspect ratios, including 16:10 (1920x1200) and 16:9 (1920x1080)
Code: Select all
; Legend of Grimrock
; Attack keys v 0.2
; Autohotkey Script
; Created by d32
; Character swapping by techzen, Adakos
; Download Autohotkey at: http://www.autohotkey.com/
#SingleInstance force
SetTitleMatchMode, 2
SetDefaultMouseSpeed, 0
CoordMode, Mouse,
xAdjust := 1 ; Accuracy adjustment for the X axis
yAdjust := 1 ; Accuracy adjustment for the Y axis
swapDelay := 20
; 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
dy1b := 0.15 ; Y position of 1st and 2nd char portrait
dy2b := 0.63 ; Y position of 3rd and 4th char portrait
; 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
}
storeMousePos()
{
global
MouseGetPos, mX, mY
}
restoreMousePos()
{
global
MouseMove, mX, mY
}
rightClickAndReturn(x, y)
{
global
init()
storeMousePos()
MouseClick, right, x, y
restoreMousePos()
return
}
attackTopLeft() {
global
rightClickAndReturn(chX+(chWid*dx1l), chY+(chHei*dy1))
}
attackTopRight() {
global
rightClickAndReturn(chX+(chWid*dx2l), chY+(chHei*dy1))
}
swapAtX(xPos) {
global
BlockInput On
MouseMove, xPos, chY+(chHei*dy2b)
Sleep swapDelay
SendEvent {LButton down}
Sleep swapDelay
MouseClickDrag, left, xPos, chY+(chHei*dy2b), xPos, chY+(chHei*dy1b)
SendEvent {LButton up}
BlockInput Off
}
swapLeft() {
global
swapAtX(chX+(chWid*dx1r))
}
swapRight() {
global
swapAtX(chX+(chWid*dx2r))
}
#IfWinActive Grimrock ahk_class EWindowClass
init()
i::1
j::attackTopLeft() ;Attack with top left character's right hand
k::attackTopRight() ;Attack with top right character's right hand
m::rightClickAndReturn(chX+(chWid*dx1l), chY+(chHei*dy2)) ;Attack with bottom left character's right hand
,::rightClickAndReturn(chX+(chWid*dx2l), chY+(chHei*dy2)) ;Attack with bottom right character's right hand
l::rightClickAndReturn(chX+(chWid*dx1r), chY+(chHei*dy1)) ;Attack with top left character's left hand
`;::rightClickAndReturn(chX+(chWid*dx2r), chY+(chHei*dy1)) ;Attack with top right character's left hand
.::rightClickAndReturn(chX+(chWid*dx1r), chY+(chHei*dy2)) ;Attack with bottom left character's left hand
/::rightClickAndReturn(chX+(chWid*dx2r), chY+(chHei*dy2)) ;Attack with bottom right character's left hand
; Swap left characters and attack
o::
{
Keywait o
storeMousePos()
swapLeft()
;sleep 50
restoreMousePos()
sleep swapDelay
attackTopLeft()
return
}
; Swap right characters and attack
p::
{
Keywait p
storeMousePos()
swapRight()
;sleep 50
restoreMousePos()
sleep swapDelay
attackTopRight()
return
}
; Swap left characters
9::
{
storeMousePos()
swapLeft()
restoreMousePos()
return
}
; Swap right characters and
0::
{
storeMousePos()
swapRight()
restoreMousePos()
return
}
; Swap both left and right chars
Capslock::
{
storeMousePos()
swapLeft()
swapRight()
restoreMousePos()
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