Keys for attack, char. swapping (autohotkey script, v 0.4)

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
adakos
Posts: 5
Joined: Thu Apr 12, 2012 7:53 pm

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

Post by adakos »

Nice work d32!

I'm going to play around with character spell casting this afternoon/weekend.
Something like this might work for customized casting (user records/inputs the spell for each hotkey, f1,f2,f3,f4 and the spell plays it back)

Code: Select all

control+f1::
start loop while key x is not pressed
user clicks to open casting screen
user inputs spell pattern
user clicks cast
user presses X
locations are stored either in an ini file , or in an array.
return

then when the user pressed
f1::
read mouse location
store mouse location
read ini
find the key name ;f1
read the number of locations recorded and saved to f1
replay the locations with 10-30 ms pauses between clicks
return mouse position to original location

An array/ini file like this

Code: Select all

[f1]
number_of_clicks=4
1=980,765 ;open spell combo
2=373,241 ;spell component 1
3=345,423 ;spell component 2
4=1000,321 ;cast

--Another way to do this might be to find the relative position of each of the 9 elements based on where the left hand is for any given character.

There shouldn't be much variance.

--If we know the left hand for character 1 is at X,Y. We then can work out that the elements are within Px and Py pixels in any given direction.


Edit: What we'd need is , using X,Y of the center of a character's left hand slot, find the variable (% of the screen --- the number you multiply by the resolution to get a given location) for the first, second, and third columns, and the first second and third rows, in relation to the center of the hand.

Code: Select all

1,1   1,2    1,3
2,1   2,2    2,3
3,1   3,2   3,3
like, if the click to open the spells starts at 2,2 when clicking to open the cast menu, then we need to figure out RES_X * WHAT, RES_Y * WHAT gives you 2,1, 1,2, 1,3, 3,3 etc.

im guessing it's something like -0.03 * RESX to move left one, +0.03 * RESX to move right one, but these numbers are guesses based off the 0.2 script.
Last edited by adakos on Fri Apr 13, 2012 4:20 pm, edited 1 time in total.
Krotch ScroteGuzzle
Posts: 23
Joined: Fri Apr 13, 2012 4:04 pm

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

Post by Krotch ScroteGuzzle »

Thank you for these scripts. I just use it to bind attacks to 1,2,3,4 like in any MMOG.

Needless to say, binding attacks to keys should have shipped with the game. Right-clicking UI buttons to attack is the only bad design decision in an otherwise great game.
adakos
Posts: 5
Joined: Thu Apr 12, 2012 7:53 pm

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

Post by adakos »

<<<Posting as a TEST SNIPPET for D32, THIS CODE WILL NOT WORK ON IT'S OWN>>>

For me this will highlight all the spell icons, then hover over the cast icon. but only for the bottom right character. If i use this will the bottom left character, (because the inital mouseclick is off a bit, it wont highlight it all)

Solutions:
1. standardize the mouse click inital locations
2.imagesearch for runes individually (may not work with different resolutions, unless we can rip the images directly from the data file)

-- What do you think we should do, d32?

Code: Select all


;TEST CAST grid
Numpad9::



MouseClick, right,  (resX*dx2l),  (resY*dy2) ;attack left BR

Sleep 100
MouseGetPos, xzpos, yzpos 
Sleep 12

;MTA1
Sleep 12
MouseMove, xzpos, yzpos
Sleep 12
MouseMove, 0, (resY*0.03), 9, R ;ARCANE 1
Sleep 10
MouseClick, left

;MTA2
Sleep 12
MouseMove, xzpos, yzpos
Sleep 12
MouseMove, (resX*0.025), (resY*0.03), 9, R ;ARCANE 2
Sleep 10
MouseClick, left

;MTA3
Sleep 12
MouseMove, xzpos, yzpos
Sleep 12
MouseMove, (resX*0.045), (resY*0.03), 9, R ;ARCANE 3
Sleep 10
MouseClick, left

;MTA4
Sleep 12
MouseMove, xzpos, yzpos
Sleep 12
MouseMove, 0, 0, 9, R ;ARCANE 4
Sleep 10
MouseClick, left

;MTA5
Sleep 12
MouseMove, xzpos, yzpos
Sleep 12
MouseMove, (resX*0.025), 0, 9, R ;ARCANE 5
Sleep 10
MouseClick, left

;MTA6
Sleep 12
MouseMove, xzpos, yzpos
Sleep 12
MouseMove, (resX*0.045), 0, 9, R ;ARCANE 6
Sleep 10
MouseClick, left

;MTA7
Sleep 12
MouseMove, xzpos, yzpos
Sleep 12
MouseMove, 0, (resY*-0.045), 9, R ;ARCANE 7
Sleep 10
MouseClick, left

;MTA8
Sleep 12
MouseMove, xzpos, yzpos
Sleep 12
MouseMove, (resX*0.025), (resY*-0.045), 9, R ;ARCANE 8
Sleep 10
MouseClick, left

;MTA9
Sleep 12
MouseMove, xzpos, yzpos
Sleep 12
MouseMove, (resX*0.045), (resY*-0.045), 9, R ;ARCANE 9
Sleep 10
MouseClick, left

;CAST SPELL BUTTON
Sleep 12
MouseMove, xzpos, yzpos
Sleep 12
MouseMove, (resX*0.065), 0, 9, R ;Cast Icon
Sleep 10


return


edit: when i modified the location, it worked fine.

Code: Select all

dx1l := 0.785 ;x loc left weapon slot L
Now we need to incorporate something like this into your new script, d32! -- ill have a working spellcast macro using relative positions here shortly...




edit#2

bottom left character = air mage
bottom right character = fire mage

Code: Select all


!Numpad1::
MouseClick, right,  (resX*dx1l),  (resY*dy2) ;attack left BL
Sleep 10
MouseGetPos, xzpos, yzpos 
Sleep 12
MouseMove, (resX*0.045), (resY*-0.045), 9, R ;ARCANE 9
Sleep 10
MouseClick, left
Sleep 15
MouseMove, xzpos, yzpos
Sleep 12
MouseMove, (resX*0.065), 0, 9, R ;cast i think
Sleep 10
MouseClick, left
return




!Numpad2::
MouseClick, right,  (resX*dx2l),  (resY*dy2) ;attack left BR
Sleep 10
MouseGetPos, xzpos, yzpos 
Sleep 12
MouseMove, 0, (resY*-0.045), 9, R ;ARCANE 7
Sleep 10
MouseClick, left
Sleep 15
MouseMove, xzpos, yzpos
Sleep 12
MouseMove, (resX*0.065), 0, 9, R ;cast i think
Sleep 10
MouseClick, left
return

working with the new coordinates.
d32
Posts: 8
Joined: Wed Apr 11, 2012 11:20 pm

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

Post by d32 »

Sorry Adakos, I've been sick and didn't have opportunity to look at this at all. But as my script detects corners of characters' GUI (see ctrl-t) part, it should be fairly easy to determine the relative positions of runes within the rectangle. Bottom right position may not be accurate currently however.
dark
Posts: 65
Joined: Tue Mar 27, 2012 9:51 pm

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

Post by dark »

This kind of scripting would not be necessary if the developers would implement an all attach button. This would really help some of the older folks having issues with timing. This is why Eye of the Beholder 3 had the all attack button. I really think the devs should seriously consider adding this button as a pop up option like they did with the arrow keys.
adakos
Posts: 5
Joined: Thu Apr 12, 2012 7:53 pm

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

Post by adakos »

Oh no d32, I hope it was nothing serious.

I've been out of town for a few days too so I havn't had much time to play around either.

We'll get something figured out between us, eventually!
Post Reply