[RELEASED] Mouse Attack Scripts



  • I created a script that will hold down the alternate left to right swing key, so you can perform the swing based on mouse direction instead of having to hold down the key. If you move your mouse to the left and then click it holds down the key. If you don’t move your mouse at all or move to the right it will not hold down the key. I wrote this in a scripting language called autoit.<br /><br />If you are like me and want a little touch of Mount & Blade / War of The Roses style, this is for you. I made a version that can do all 4 directions via mouse movement bellow the first script.<br /><br />How to use:<br />- install autoit scripting language <a href=“http://www.autoitscript.com/site/autoit/” target="_blank">http://www.autoitscript.com/site/autoit/</a><br />- Copy / paste script into autoit.<br />- compile (make .exe).<br />- Run program.<br />- Rebind your alternate strike key to the <strong>Home</strong>key.<br />- Rebind your Primary strike key to the <strong>Right Arrow</strong>key.<br />- Press the <strong>End</strong>key to enable / disable script.<br />- list of keys you can use for rebinding <a href=“http://www.autoitscript.com/autoit3/docs/functions/Send.htm” target="_blank">http://www.autoitscript.com/autoit3/docs/functions/Send.htm</a><br /><br /><br /><strong>Script:</strong><br /><pre>; (O)
    ; <M
    ; o <M Kill them, kill them all!!!
    ; /| … /:M------------------------------------------------,
    ; (O)[]XXXXXX[]I:K+}=====<{H}>================================------------>
    ; | ^^^^^^ :W/------------------------------------------------’’’’’’
    ; o <W Artwork By Ian Broverman
    ; <W Script made by: Sir_Pink
    ; (O)

    #include <Misc.au3>
    #include <String.au3>
    #include <Array.au3>

    #RequireAdmin ; needed to make sure it will run with any applocation with window focus.

    ; link to keys that can be used ----> [url]http://www.autoitscript.com/autoit3/docs/functions/Send.htm[/url]

    ;;;; Global variables so it retains data after function is executed ;;;;
    Global $SoundBoolean = False; sound on/off toggle.
    Global $Paused; pause the entire script true/false toggle.

    Global $XandYAxisDynamic; x1/y1 cordinate grabber.
    Global $xDynamicAxisStorage; x1 storage.
    Global $yDynamicAxisStorage; y1 storage.

    Global $CurrentCordPosition
    Global $x2
    Global $y2

    Global $xRaw
    Global $yRaw

    Global $SavedMouseState

    HotKeySet("{}", “TogglePause”)

    While 1
    Sleep(100)
    WEnd

    Func MouseStrike()

    ;Collects the current x1 and y1 axis mouse position.
    $XandYAxisDynamic = MouseGetPos()
    $xDynamicAxisStorage = $XandYAxisDynamic[0]
    $yDynamicAxisStorage = $XandYAxisDynamic[1]
    
    Sleep(1) ; 1000 = 1sec, 1/1000 of a sec pause to properly save the x1 and y2 into variables in memory.
    
    ;Collects the current x2 and y2 axis mouse position.
    $CurrentCordPosition = MouseGetPos()
    $x2 = $CurrentCordPosition[0]
    $y2 = $CurrentCordPosition[1]
    
    Sleep(1) ; 1000 = 1sec, 1/1000 of a sec pause to properly save the x2 and y2 into variables in memory.
    
    $xRaw = $xDynamicAxisStorage - $x2 ;$xRaw = x1 value - x2 value.
    $yRaw = $yDynamicAxisStorage - $y2 ;$yRaw = y1 value - y2 value.
    
    ; if the absolute value (distance from 0 regardless of + or - number) is greater than absolute y then execute condition, else execute code bellow else.
    ; This will tell is if we are going moving more on the x-axis (left/right) or move on the y-axis (up/down).
    ; From there we figure out if we are moving more to the left on the x axis or more to the right, then perform correct action else
    ; If we are moving more up and down on the y-axis, we figure out if we are moving more up or down on the axis and perform the correct action.
    if Abs($xRaw) > Abs($yRaw) Then
    
    
    	If $xRaw > 0 Then
    		;ToolTip("Left", @DesktopWidth/2, @DesktopHeight/2)
    			LeftStrikeDown()
    			$SavedMouseState = True
    	else
    		;ToolTip("Right", @DesktopWidth/2, @DesktopHeight/2)
    			;LeftStrikeUp()
    			RightStrike()
    			$SavedMouseState = False
    	EndIf
    
    
    Else
    
    
    	If $yRaw > 0 Then
    		;ToolTip("Up", @DesktopWidth/2, @DesktopHeight/2)
    			LeftStrikeUp()
    			;Overhead()
    	else
    		;ToolTip("Down", @DesktopWidth/2, @DesktopHeight/2)
    			LeftStrikeUp()
    			;Thrust()
    	EndIf
    
    
    EndIf
    
    
    If $SavedMouseState = True Then
    	LeftStrikeDown()
    Else
    	LeftStrikeUp()
    	RightStrike()
    EndIf
    

    EndFunc

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;Function toggles the script on/off and plays a sound for each on/off state.
    Func TogglePause()
    If WinActivate(“Chivalry: Medieval Warfare (32-bit, DX9)”, “”) Then

    $SoundBoolean = Not $SoundBoolean
    If $SoundBoolean = True Then
    SoundPlay(@WindowsDir & “\media\Speech On.wav”, 1)
    Else
    SoundPlay(@WindowsDir & “\media\Speech Off.wav”, 1)
    EndIf

    $Paused = NOT $Paused
    While $Paused
    sleep(1)
    MouseStrike()
    WEnd

    Else
    WinActivate(“Chivalry: Medieval Warfare (32-bit, DX9)”, “”)
    EndIf

    EndFunc
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;#########################################
    ;# Strike Command Start #
    ;#########################################
    ;Left strike
    Func LeftStrikeDown()
    Local $hDLL = DllOpen(“user32.dll”)
    if _IsPressed( “01”, $hDLL ) Then
    Send("{HOME down}")
    RightStrike()
    EndIf
    DllClose($hDLL)
    EndFunc

    Func LeftStrikeUp()
    Send("{HOME up}")
    EndFunc

    ;Right strike
    Func RightStrike()
    Local $hDLL = DllOpen(“user32.dll”)
    if _IsPressed( “01”, $hDLL ) Then
    Send("{RIGHT}")
    EndIf
    DllClose($hDLL)
    EndFunc

    Func TESTSTUFF()
    Local $hDLL = DllOpen(“user32.dll”)
    if _IsPressed( “01”, $hDLL ) Then
    SoundPlay(@WindowsDir & “\media\tada.wav”, 1)
    EndIf
    DllClose($hDLL)
    EndFunc

    ;#########################################
    ;# Strike Commands End #
    ;#########################################</pre><br /><br /><br />This script allows you to swing just like you can in Mount & Blade (4 direction strike via mouse system).<br /><br />How it works:<br />- mouse move up + left click = overhead strike<br />- mouse move down + left click = thrust<br />- mouse move left + left click = left to right swing<br />- mouse move right + left click = right to left swing<br /><br />How to use the script with its current keys:<br />- rebind left click to <strong>Right</strong> arrow key<br />- rebind mouse wheel down to <strong>Down</strong> arrow key<br />- rebind mouse wheel up to <strong>Up</strong> arrow key<br />- rebind alternate strike to <strong>Home</strong> key<br />- in game on / off script = <strong></strong><br />- list of keys you can use for rebinding <a href=“http://www.autoitscript.com/autoit3/docs/functions/Send.htm” target="_blank">http://www.autoitscript.com/autoit3/docs/functions/Send.htm</a><br /><br /><br /><strong>Scriptv2 - Four direction strike</strong><br /><pre>; (O)
    ; <M
    ; o <M Kill them, kill them all!!!
    ; /| … /:M------------------------------------------------,
    ; (O)[]XXXXXX[]I:K+}=====<{H}>================================------------>
    ; | ^^^^^^ :W/------------------------------------------------’’’’’’
    ; o <W Artwork By Ian Broverman
    ; <W Script made by: Sir_Pink
    ; (O)

    #include <Misc.au3>
    #include <String.au3>
    #include <Array.au3>

    #RequireAdmin ; needed to make sure it will run with any applocation with window focus.

    ; link to keys that can be used ----> [url]http://www.autoitscript.com/autoit3/docs/functions/Send.htm[/url]

    ;;;; Global variables so it retains data after function is executed ;;;;
    Global $SoundBoolean = False; sound on/off toggle.
    Global $Paused; pause the entire script true/false toggle.

    Global $XandYAxisDynamic; x1/y1 cordinate grabber.
    Global $xDynamicAxisStorage; x1 storage.
    Global $yDynamicAxisStorage; y1 storage.

    Global $CurrentCordPosition
    Global $x2
    Global $y2

    Global $xRaw
    Global $yRaw

    HotKeySet("{}", “TogglePause”)

    While 1
    Sleep(100)
    WEnd

    Func MouseStrike()

    ;Collects the current x1 and y1 axis mouse position.
    $XandYAxisDynamic = MouseGetPos()
    $xDynamicAxisStorage = $XandYAxisDynamic[0]
    $yDynamicAxisStorage = $XandYAxisDynamic[1]
    
    Sleep(1) ; 1000 = 1sec, 1/1000 of a sec pause to properly save the x1 and y2 into variables in memory.
    
    ;Collects the current x2 and y2 axis mouse position.
    $CurrentCordPosition = MouseGetPos()
    $x2 = $CurrentCordPosition[0]
    $y2 = $CurrentCordPosition[1]
    
    Sleep(1) ; 1000 = 1sec, 1/1000 of a sec pause to properly save the x2 and y2 into variables in memory.
    
    $xRaw = $xDynamicAxisStorage - $x2 ;$xRaw = x1 value - x2 value.
    $yRaw = $yDynamicAxisStorage - $y2 ;$yRaw = y1 value - y2 value.
    
    ; if the absolute value (distance from 0 regardless of + or - number) is greater than absolute y then execute condition, else execute code bellow else.
    ; This will tell is if we are going moving more on the x-axis (left/right) or move on the y-axis (up/down).
    ; From there we figure out if we are moving more to the left on the x axis or more to the right, then perform correct action else
    ; If we are moving more up and down on the y-axis, we figure out if we are moving more up or down on the axis and perform the correct action.
    if Abs($xRaw) > Abs($yRaw) Then
    
    
    	If $xRaw > 0 Then
    		;ToolTip("Left", @DesktopWidth/2, @DesktopHeight/2)
    			LeftStrikeDown()
    	else
    		;ToolTip("Right", @DesktopWidth/2, @DesktopHeight/2)
    			LeftStrikeUp()
    			RightStrike()
    	EndIf
    
    
    Else
    
    
    	If $yRaw > 0 Then
    		;ToolTip("Up", @DesktopWidth/2, @DesktopHeight/2)
    			LeftStrikeUp()
    			Overhead()
    	else
    		;ToolTip("Down", @DesktopWidth/2, @DesktopHeight/2)
    			LeftStrikeUp()
    			Thrust()
    	EndIf
    
    
    EndIf
    

    EndFunc

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;Function toggles the script on/off and plays a sound for each on/off state.
    Func TogglePause()
    $SoundBoolean = Not $SoundBoolean
    If $SoundBoolean = True Then
    SoundPlay(@WindowsDir & “\media\Speech On.wav”, 1)
    Else
    SoundPlay(@WindowsDir & “\media\Speech Off.wav”, 1)
    EndIf

    $Paused = NOT $Paused
    While $Paused
    sleep(1)
    MouseStrike()
    WEnd
    EndFunc
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;#########################################
    ;# Strike Command Start #
    ;#########################################
    ;Left strike
    Func LeftStrikeDown()
    Send("{HOME down}")
    RightStrike()
    EndFunc
    Func LeftStrikeUp()
    Send("{HOME up}")
    EndFunc

    ;Right strike
    Func RightStrike()
    Local $hDLL = DllOpen(“user32.dll”)
    if _IsPressed( “01”, $hDLL ) Then
    ;Send("[right]")
    Send("{RIGHT}")
    EndIf
    DllClose($hDLL)
    EndFunc

    ;Overhead
    Func Overhead()
    Local $hDLL = DllOpen(“user32.dll”)
    if _IsPressed( “01”, $hDLL ) Then
    ;Send("[Overhead]")
    Send("{DOWN}")
    EndIf
    DllClose($hDLL)
    EndFunc

    ;Thrust
    Func Thrust()
    Local $hDLL = DllOpen(“user32.dll”)
    if _IsPressed( “01”, $hDLL ) Then
    ;Send("[Thrust]")
    Send("{UP}")
    EndIf
    DllClose($hDLL)
    EndFunc
    ;#########################################
    ;# Strike Commands End #
    ;#########################################[/right]</pre>



  • Heyhey! That’s actually pretty neat! Might try it out once i get my comp working again.



  • You were talking to me about this in game! Amazing stuff!



  • I don’t know if this is legal for multiplayer games. It is scripting.



  • It’s no different than creating a looping macro on your keyboard. I made a 4 direction strike version I’ll be posting later today in the original post.



  • Good stuff, thanks for sharing.



  • I just updated my original post with the four direction mouse strike version (Mount and blade style). If anyone needs help setting it up the script feel for to send me a PM. 8-)



  • Nifty sir pink, might give it a whirl at some point. How does it feel to control it like this and do combo strikes? Awkward or not too bad?

    Also for inverted mouse use would you just swap this part around like so?

    If $yRaw > 0 Then
             ;ToolTip("Up", @DesktopWidth/2, @DesktopHeight/2)
                LeftStrikeUp()
                Thrust()
          else
             ;ToolTip("Down", @DesktopWidth/2, @DesktopHeight/2)
                LeftStrikeUp()
                Overhead()
          EndIf
    
    


  • @reapy:

    Nifty sir pink, might give it a whirl at some point. How does it feel to control it like this and do combo strikes? Awkward or not too bad?

    Also for inverted mouse use would you just swap this part around like so?

    If $yRaw > 0 Then
             ;ToolTip("Up", @DesktopWidth/2, @DesktopHeight/2)
                LeftStrikeUp()
                Thrust()
          else
             ;ToolTip("Down", @DesktopWidth/2, @DesktopHeight/2)
                LeftStrikeUp()
                Overhead()
          EndIf
    
    

    That’s correct reapy, so it would look like this.

    If $yRaw > 0 Then
             ;ToolTip("Up", @DesktopWidth/2, @DesktopHeight/2)
                LeftStrikeUp()
                Overhead()
          else
             ;ToolTip("Down", @DesktopWidth/2, @DesktopHeight/2)
                LeftStrikeUp()
                Thrust()
          EndIf
    
    

    It feels nice, but it does take a little a bit of practice. I spent some time with it vs bots and it felt real good. The script is real accurate so you only have to move your mouse a hair in the direction you want. So it still feels fine even when performing combos. On a side note, are you Reapy from Mount & Blade: Warband?



  • I already reversed the script in my example, so you reversed it back to the original way I think :)

    And yes sir, same reapy, though I am not playing the game too much, I can really only play on 16 player FFA servers since my computer craps itself when too many people get on screen. Also I’m sorta meh on the combat system, though the game is really punchy and fun, so great for flailing and blowing off steam at the end of the day.



  • This looks interesting I’ll have to give it a go.



  • Very interesting, if the devs implement it, it would be awesome …. Otherwise i have to look if i can manage, I am bad in scripting. :|

    I don’t know much about this but I think it can be done for overhead as well.
    The current mousewheel up bind -----> becomes mousewheel up and mouse direction ?



  • Neat. I didnt look through it properly, but at quick glance didnt notice two useful things:

    1. game starting command so that people could use 1 shortcut to launch the script and the game at the same time

    Something like:

    Run "steam://rungameid/219640"
    ```(Not sure if the link is right)
    
    2) add a code to automatically terminate script on game exit
    
    Like:
    
    if !WinActive("UDK")
    {
        if !WinExist("UDK") 
        {    
            ExitApp
        }
        return
    }
    


  • At start I was really enthusiast about the swing/mousemovement direction thing. I am not good in scripting so I decided to refresh my memory and try it in Mount & Blade.
    The thing with this setting is, when you turn and want to swing the other direction you have to stop in the middle of your turn to perform the opposite swing direction !!
    This makes it feel clumsy and takes a wile to get used to, but it will never be intuitive for me…

    Now I came up with a simple solution, and I really think its worth a try. The only thing is i am very bad in scripting, so I wanted to ask some of you brilliant minds in here to help me out.

    My idea is (think with me for a sec, give it a change):

    1. swingleft = left mousebutton
    2. swingright = right mousebutton
    3. block/feint/cancel attack = left + right mousebutton

    You see, not much is changing, only blocking is pressing left and right mousebutton simultaneously. And alternate swing is right mouse button. Of course you can change left to right if preferred.

    Please can somebody help me to make a script for pressing left + right mouse button simultaneously for blocking? I really think this is worth a try.

    Note; alternate overhead I did not mention because I don’t use it much, and can still be performed with Alt key.



  • @boldest:

    Please can somebody help me to make a script for pressing left + right mouse button simultaneously for blocking? I really think this is worth a try. :D

    This actually sounds like it might work well, I’ll give it a shot in autohotkey and let you know…



  • Novus you already are my hero, thanks for trying! :D



  • Ok i feel I have to give you guys an update about how things went with the attack key configuration –----> right mouse = swing and left mouse = alternate swing and right + left simultaneously = block/feint.

    Quote from Novus.

    Well the thing is, to block with the left and right buttons, by nature, there must be a delay(although slight) to see if you’re going to attack or block, which effects my game play. But i already got all that to work, the only problem i’m having is the shield mechanics, seeing how they are different than 2h or 1h perry mechanics. I got most to work but when i release the block for the shield, the script automatically swings…I dunno if it’s a bug with the programming or what but it needs polishing and i dunno if I’ll get to it today.

    So that was it, my guess is it that this is the end of it…. but thanks anyway Novus. :)

    I wounder why the core game play mechanic (basic attack/defend gameplay) is not more discussed within the community. And that ppl don’t have an open mind to try out something different… who knows we might come up with a even better system than Chiv already has. What we have to loose, I think we can only win or keep the current good one.

    For me, I have played Mount & Blade Warband for some time. I wasn’t good at it but one thing about their combat system was that when you started to attack their was some time to brake of the attack by pressing block (much like feinting in Chiv).
    With some practice you could swing one direction and brake it by blocking the opposite direction. Doing this repeatable in different directions (left right, up right, right left, etc) resulted in a spectacular sword swing dance, that came close to marchall arts fighting.
    When an opponent approached me like this, I shit in my plate. And when I performed it myself I wet my plate… ;)

    Well, you catch my drift. It was a feature that gave me a feeling of freedom, or tools to express myself, or like I am in total control of my sword.
    In Chiv I can do a battle cry, and I love it but it’s not wise to do it when a opponent is near. Ok, I can use feint, but it’s not used to impress…

    Maybe we could improve or tweak the already very good Chiv combat system and give it that little more of this intuitive total in control feeling.

    Please don’t get me wrong, I really love Chivalry and its combat system as it is now, just wanne put in my 2 cents and discus, ty. :D



  • Hmm, interesting, but doesn’t doing it Mount & Blade style prevent you from counter-attacking due to the delayed nature of having to drag your mouse a bit? As in, the sped-up attack you get for a perfect parry and simultaneous attack.



  • You only have to move your mouse cursor 1 pixel in the direction you want. (at least in the left and right swing version)



  • i am to retarded for this guide … could you give me your skype name ore something eals ??


Log in to reply