Page 2 of 3

Re: Keys for attack - Solution (autohotkey script, v 0.2)

Posted: Thu Apr 12, 2012 6:41 am
by Horrorscope
I've used Hotkey in a manner like this for mmo's for fast healing of teammates in games that didn't have that feature.

I get wanting to have a key press, is the overriding need for this, speed? If so another way to attack it is download CheatEngine.

Run that against process grimrock.exe and turn on speedhack.

Then bind keys to whatever speed you want and set keys to step + or -% points. For ex Num lock 70%, / 100%, * 130 % and key - and key + 15% increments.

When you come to a battle press num lock, game slows down to 70%, (mouse doesn't). This way you can slow the games combat mechanics down to feel more turn based yet. When over you can keep it or press / to get back to 100%.

This works for any game and to me is an amazing option for many games to enhance play for the individual. Think skyrim, when moving large area's kick up the speed. When in battle, slow it down for a more planned encounter.

Re: Keys for attack - Solution (autohotkey script, v 0.2)

Posted: Thu Apr 12, 2012 6:59 am
by NewYears1978
All these scripts are really nice :)

Personally, they defeat the purpose of the old school nostalgic feel, but to each their own. =)

Re: Keys for attack - Solution (autohotkey script, v 0.2)

Posted: Thu Apr 12, 2012 3:28 pm
by nublard
Is there any way to make a script to quick cast spells?
I am playing a party with two mages and the clicking is getting really annoying.

My understanding (although I'm not very familiar with programming in AHK) is that you could create a script that lets you:
1) Right click mouse over left hand of character 3 (with a specific resolution)
2) Click specific runes (for character 3, let's say top left for fireblast)
3) Click the "cast" button (for character 3).

The same could be applied for character 4, or right hand of each character.

Theoretically, it should be possible to "pre-program" and bind various spells for specific characters and hands, right?

Re: Keys for attack - Solution (autohotkey script, v 0.2)

Posted: Thu Apr 12, 2012 3:34 pm
by Sol_HSA
Hm, I wonder if this counts as modding =)

Re: Keys for attack - Solution (autohotkey script, v 0.2)

Posted: Thu Apr 12, 2012 3:46 pm
by Darklord
Kinda. :)

Course the modding board is locked at the moment.

Daniel.

Re: Keys for attack - Solution (autohotkey script, v 0.3)

Posted: Thu Apr 12, 2012 5:35 pm
by d32
Updated the script:
- no need to enter the resolution manually
- mouse now returns to the original position after attacking
- much better support for different resolutions

Nublard, see post by Techzen for spellcasting.
It is not included in my script yet because of accuracy issues on different resolutions, but you can use it when your resolution is fixed.

Re: Keys for attack - Solution (autohotkey script, v 0.3)

Posted: Thu Apr 12, 2012 7:59 pm
by adakos
Here's my take on the autohotkey scripting, maybe someone will improve on this and post the updates:::
(credit goes out to d32 for the original idea and techzen for the swap idea) (based on version 0.2 - i will need to update this for his new version)

Modifications include:

Numpad 4,5,1,2 will attack with the left hand of each of the characters individually (if you feel like using the numpad)

Numpad 7 and 8 are fun,
(if they work... I wrote this from work and havn't had a chance to fully test it)

Numpad 7 Should attack with the top left character (left hand) , then swap the top left with the rear left character , attack with the new top left character, then swap once more top left to rear left and everyone should be back to where they were before.

Numpad 8 does the same with the right side.

Numpad 6 will just swap the left side (no attacks)
Numpad 3 will just swap the right side (no attacks)

Code: Select all

; Legend of Grimrock
;==================
;  Attack keys v 0.2a
; Autohotkey Script
;   Original Ideas for % based locations and
; original script created by
;---------------------------
;	 d32 
;----------original swap by-
;              techzen
;---------------------------
:   Script modified by
;---------------------------
;	Adakos
;---------------------------
; Download Autohotkey at: http://www.autohotkey.com/
;==========================
;^^^^^^^^^^^^^^^^
; TO DO
;.................
;incorporate spells
;.................
;speed up swapping
;vvvvvvvvvvvvvvvvv
;
;
;
;
; YOU MUST SET YOUR RESOLUTION HERE
#SingleInstance force
resX := 1920
resY := 1080

SetTitleMatchMode, 2

#IfWinActive Grimrock ahk_class EWindowClass


dx1l := 0.8 ;x loc left weapon slot L
dx2l := 0.9 ;x loc left weapon slot R

dx1r := 0.85 ;x loc right weapon slot L
dx2r := 0.95 ;x loc right weapon slot R

dy1  := 0.8 ;Y loc top row
dy2  := 0.95 ;Y loc bottom row


tlcx1 := 0.78 ;top left character portrait x
tlcy1 := 0.73 ;top left character portrait y

blcx1 := 0.78 ;bottom left character portrait x
blcy1 := 0.88 ;bottom left character portrait y

trcx1 := 0.89 ;top right character portrait x
trcy1 := 0.73 ;top right character portrait y

brcx1 := 0.89 ;bottom right character portrait x
brcy1 := 0.88 ;bottom right character portrait y


;sysget, resX, 16
;sysget, resY, 17

i::1 ;opens inventory

Numpad4::MouseClick, right,  (resX*dx1l),  (resY*dy1) ;attack left TL
Numpad5::MouseClick, right,  (resX*dx2l),  (resY*dy1) ;attack left TR
Numpad1::MouseClick, right,  (resX*dx1l),  (resY*dy2) ;attack left BL
Numpad2::MouseClick, right,  (resX*dx2l),  (resY*dy2) ;attack left BR


j::MouseClick, right,  (resX*dx1l),  (resY*dy1) ;attack left TL
k::MouseClick, right,  (resX*dx2l),  (resY*dy1) ;attack left TR
l::MouseClick, right,  (resX*dx1l),  (resY*dy2) ;attack left BL
`;::MouseClick, right,  (resX*dx2l),  (resY*dy2) ;attack left BR

m::MouseClick, right,  (resX*dx1r),  (resY*dy1) ;attack right TL
,::MouseClick, right,  (resX*dx2r),  (resY*dy1) ;attack right TR
.::MouseClick, right,  (resX*dx1r),  (resY*dy2) ;attack right BL
/::MouseClick, right,  (resX*dx2r),  (resY*dy2) ;attack right BR




;SWAP LEFT SIDE
Numpad6::
Keywait Numpad6
BlockInput On
MouseMove, (resX*tlcx1),  (resY*tlcy1)
Sleep 50
SendEvent {LButton down}

Sleep 50
MouseClickDrag, left, (resX*tlcx1),  (resY*tlcy1), (resX*blcx1),  (resY*blcy1)

SendEvent {LButton up}

Sleep 50

BlockInput Off

return


;swap RIGHT SIDE
Numpad3::
Keywait Numpad3
BlockInput On
MouseMove, (resX*trcx1),  (resY*trcy1)
Sleep 50
SendEvent {LButton down}

Sleep 50
MouseClickDrag, left, (resX*trcx1),  (resY*trcy1), (resX*brcx1),  (resY*brcy1)

SendEvent {LButton up}

Sleep 50

BlockInput Off

return

;MouseClick, right,  (resX*tlcx1),  (resY*tlcy1) - old script to select TL
;MouseClick, right,  (resX*blcx1),  (resY*blcy1) - old script to select BL
;MouseClick, right,  (resX*trcx1),  (resY*trcy1) -loc of TR portrait
;MouseClick, right,  (resX*brcx1),  (resY*brcy1) - loc of BR portrait



;attack TL , SWAP TL - BL , attack TL, SWAP TL-BL
Numpad7::
Keywait Numpad7
BlockInput On
MouseClick, right,  (resX*dx1l),  (resY*dy1) ;attack with tl(1)
Sleep 50
MouseMove, (resX*tlcx1),  (resY*tlcy1) ;begin swap cycle (1)
Sleep 50
SendEvent {LButton down}
Sleep 50
MouseClickDrag, left, (resX*tlcx1),  (resY*tlcy1), (resX*blcx1),  (resY*blcy1)
SendEvent {LButton up}
Sleep 50
MouseClick, right,  (resX*dx1l),  (resY*dy1) ;attack with tl (2)
Sleep 50
MouseMove, (resX*tlcx1),  (resY*tlcy1) ;begin swap cycle (2)
Sleep 50
SendEvent {LButton down}
Sleep 50
MouseClickDrag, left, (resX*tlcx1),  (resY*tlcy1), (resX*blcx1),  (resY*blcy1)
SendEvent {LButton up}
Sleep 50
BlockInput Off
return

;attack TL , SWAP TL - BL , attack TL, SWAP TL-BL
Numpad8::
Keywait Numpad8
BlockInput On
MouseClick, right,  (resX*dx2l),  (resY*dy1) ;attack with tr(1)
Sleep 50
MouseMove, (resX*trcx1),  (resY*trcy1) ;begin swap cycle (1)
Sleep 50
SendEvent {LButton down}
Sleep 50
MouseClickDrag, left, (resX*trcx1),  (resY*trcy1), (resX*brcx1),  (resY*brcy1)
SendEvent {LButton up}
Sleep 50
MouseClick, right,  (resX*dx2l),  (resY*dy1) ;attack with tr(2)
Sleep 50
MouseMove, (resX*trcx1),  (resY*trcy1) ;begin swap cycle (2)
Sleep 50
SendEvent {LButton down}
Sleep 50
MouseClickDrag, left, (resX*trcx1),  (resY*trcy1), (resX*brcx1),  (resY*brcy1)
SendEvent {LButton up}
Sleep 50
BlockInput Off
return




#IfWinActive


Re: Keys for attack - Solution (autohotkey script, v 0.3)

Posted: Thu Apr 12, 2012 9:59 pm
by d32
Character swapping functionality will be merged into the script (I'm testing it right now)

Re: Keys for attack - Solution (autohotkey script, v 0.3)

Posted: Fri Apr 13, 2012 2:23 am
by adakos
My script can be modified (if you have a reasonably fast computer) to pop the delay to 15, instead of 50.
i'll post the changes here.
It makes swapping much, much faster

Code: Select all

  ; Legend of Grimrock
;==================
;  Attack keys v 0.2a
; Autohotkey Script
;   Original Ideas for % based locations and
; original script created by
;---------------------------
;	 d32 
;----------original swap by-
;              techzen
;---------------------------
;   Script modified by
;---------------------------
;	Adakos
;---------------------------
; Download Autohotkey at: http://www.autohotkey.com/
;==========================
;^^^^^^^^^^^^^^^^
; TO DO
;.................
;incorporate spells
;.................
;speed up swapping
;vvvvvvvvvvvvvvvvv
;
;
;
;

#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.

#SingleInstance force

; YOU MUST SET YOUR RESOLUTION HERE  <_DO IT
resX := 1920
resY := 1080

SetTitleMatchMode, 2

#IfWinActive Grimrock ahk_class EWindowClass


dx1l := 0.8 ;x loc left weapon slot L
dx2l := 0.9 ;x loc left weapon slot R

dx1r := 0.85 ;x loc right weapon slot L
dx2r := 0.95 ;x loc right weapon slot R

dy1  := 0.8 ;Y loc top row
dy2  := 0.95 ;Y loc bottom row


tlcx1 := 0.78 ;top left character portrait x
tlcy1 := 0.73 ;top left character portrait y

blcx1 := 0.78 ;bottom left character portrait x
blcy1 := 0.88 ;bottom left character portrait y

trcx1 := 0.89 ;top right character portrait x
trcy1 := 0.73 ;top right character portrait y

brcx1 := 0.89 ;bottom right character portrait x
brcy1 := 0.88 ;bottom right character portrait y


;sysget, resX, 16
;sysget, resY, 17

i::1 ;opens inventory

Numpad4::MouseClick, right,  (resX*dx1l),  (resY*dy1) ;attack left TL
Numpad5::MouseClick, right,  (resX*dx2l),  (resY*dy1) ;attack left TR
Numpad1::MouseClick, right,  (resX*dx1l),  (resY*dy2) ;attack left BL
Numpad2::MouseClick, right,  (resX*dx2l),  (resY*dy2) ;attack left BR

j::MouseClick, right,  (resX*dx1l),  (resY*dy1) ;attack left TL
k::MouseClick, right,  (resX*dx2l),  (resY*dy1) ;attack left TR
l::MouseClick, right,  (resX*dx1l),  (resY*dy2) ;attack left BL
`;::MouseClick, right,  (resX*dx2l),  (resY*dy2) ;attack left BR

m::MouseClick, right,  (resX*dx1r),  (resY*dy1) ;attack right TL
,::MouseClick, right,  (resX*dx2r),  (resY*dy1) ;attack right TR
.::MouseClick, right,  (resX*dx1r),  (resY*dy2) ;attack right BL
/::MouseClick, right,  (resX*dx2r),  (resY*dy2) ;attack right BR




;SWAP LEFT SIDE
Numpad6::
Keywait Numpad6
BlockInput On
MouseMove, (resX*tlcx1),  (resY*tlcy1)
Sleep 15
SendEvent {LButton down}

Sleep 15
MouseClickDrag, left, (resX*tlcx1),  (resY*tlcy1), (resX*blcx1),  (resY*blcy1)

SendEvent {LButton up}

Sleep 15

BlockInput Off

return


;swap RIGHT SIDE
Numpad3::
Keywait Numpad3
BlockInput On
MouseMove, (resX*trcx1),  (resY*trcy1)
Sleep 15
SendEvent {LButton down}

Sleep 15
MouseClickDrag, left, (resX*trcx1),  (resY*trcy1), (resX*brcx1),  (resY*brcy1)

SendEvent {LButton up}

Sleep 15

BlockInput Off

return

;MouseClick, right,  (resX*tlcx1),  (resY*tlcy1) - old script to select TL
;MouseClick, right,  (resX*blcx1),  (resY*blcy1) - old script to select BL
;MouseClick, right,  (resX*trcx1),  (resY*trcy1) -loc of TR portrait
;MouseClick, right,  (resX*brcx1),  (resY*brcy1) - loc of BR portrait



;attack TL , SWAP TL - BL , attack TL, SWAP TL-BL
Numpad7::
Keywait Numpad7
BlockInput On
MouseClick, right,  (resX*dx1l),  (resY*dy1) ;attack with tl(1)
Sleep 15
MouseMove, (resX*tlcx1),  (resY*tlcy1) ;begin swap cycle (1)
Sleep 15
SendEvent {LButton down}
Sleep 15
MouseClickDrag, left, (resX*tlcx1),  (resY*tlcy1), (resX*blcx1),  (resY*blcy1)
SendEvent {LButton up}
Sleep 15
MouseClick, right,  (resX*dx1l),  (resY*dy1) ;attack with tl (2)
Sleep 15
MouseMove, (resX*tlcx1),  (resY*tlcy1) ;begin swap cycle (2)
Sleep 15
SendEvent {LButton down}
Sleep 15
MouseClickDrag, left, (resX*tlcx1),  (resY*tlcy1), (resX*blcx1),  (resY*blcy1)
SendEvent {LButton up}
Sleep 15
BlockInput Off
return

;attack TL , SWAP TL - BL , attack TL, SWAP TL-BL
Numpad8::
Keywait Numpad8
BlockInput On
MouseClick, right,  (resX*dx2l),  (resY*dy1) ;attack with tr(1)
Sleep 15
MouseMove, (resX*trcx1),  (resY*trcy1) ;begin swap cycle (1)
Sleep 15
SendEvent {LButton down}
Sleep 15
MouseClickDrag, left, (resX*trcx1),  (resY*trcy1), (resX*brcx1),  (resY*brcy1)
SendEvent {LButton up}
Sleep 15
MouseClick, right,  (resX*dx2l),  (resY*dy1) ;attack with tr(2)
Sleep 15
MouseMove, (resX*trcx1),  (resY*trcy1) ;begin swap cycle (2)
Sleep 15
SendEvent {LButton down}
Sleep 15
MouseClickDrag, left, (resX*trcx1),  (resY*trcy1), (resX*brcx1),  (resY*brcy1)
SendEvent {LButton up}
Sleep 15
BlockInput Off
return




#IfWinActive

Re: Keys for attack, char. swapping (autohotkey script, v 0.

Posted: Fri Apr 13, 2012 10:04 am
by d32
Updated script, merged with swapping functionality by adakos (+techzen).
Now, it would be nice to have a quicksave & quickload :)