Jump to content
The Dark Mod Forums

Adjust player speed with mouse wheel


snatcher

Recommended Posts

10 hours ago, Obsttorte said:

@OktokoloWhat would be the point then? You have two key to control speed now and you would have two keys to control speed then. The only addition might be to allow players to turn those keys into toggles.

The difference would be the additional speeds between the three currently available speeds - still controlled by only two remappable keys.

Link to comment
Share on other sites

30 minutes ago, Oktokolo said:

The difference would be the additional speeds between the three currently available speeds - still controlled by only two remappable keys.

But there are none. Currently the script only allows switching between the three different speeds via mouse wheel, it doesn't add any new functionality. And afaik noise propagation is tied to this trinary system, so you can't simple change to a system with more than three speeds without having to alter sound related files, too.

  • Like 1

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

15 minutes ago, AluminumHaste said:

You can alter the volume at which the sound plays though, which would be good enough.

Currently the game propagates one of six sounds per surface, depending on whether the player is crouched and at which of the three speeds he is moving. As far as I can see this is controlled by the SDK. So there is no straight forward way to alter the noise the player makes.

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

  • 2 weeks later...

Here is version 6 of the script.

What's new in v6?

1) Mouse wheel sensitivity (number of steps up or down) is no longer a thing. Just move the mouse wheel up one or more steps in a row to accelerate. Move the mouse wheel down one or more steps in a row to decelerate.

2) You can again navigate the inventory, turn pages, numbered dials and move objects you are holding back and forth by using Parry/Manipulate plus the mouse wheel.

Please pay attention to the configuration.

------------------------------------

ADJUST PLAYER SPEED WITH THE MOUSE WHEEL v6.0

Installation and execution:

  • Download AutoHotkey, install it, open Notepad, paste the below script inside, save it as TDM.ahk and double click on the file you just saved. The script will run in the background.
  • To end the script, go to the Windows taskbar, look for a green icon with an "H", right click on it and select Exit.

Configuration:

  • Settings > Controls > Weapons: Remove mouse wheel bindings from Next Weapon and Previous Weapon (or from any other setting you may have set the mouse wheel to)
  • Settings > Controls > General: Make sure Toggle Crouch is enabled and Always Run is disabled
  • Settings > Controls > Movement: The Forward, Backwards, Left, Right, Run and Creep keys must match in both TDM and the script.
  • Settings > Controls > Actions: The Parry/Manipulate key must match in both TDM and the script.
  • Settings > Controls > Inventory: The Next Inv. Item and Prev Inv. Item must match in both TDM and the script.

Recommended controls:

  • Forward / Backward / Left / Right: W, S, A, D
  • Run: Z
  • Creep: C
  • Parry/Manipulate: Right Mouse Button
  • Next Inv. Item / Prev Inv. Item: Right Arrow, Left Arrow

Known limitations and workarounds:

  • You can move through the inventory, turn pages, numbered dials and move objects you are holding back and forth using Next / Prev Inv. Item or Parry/Manipulate + the mouse wheel.
  • To prepare for a long jump from idle, move the mouse wheel up before executing your move.
  • Remember the script will switch you automatically from running to walking after one second of inactivity.
  • You cannot lean forward and switch speeds at the same time, for some reason...

 

; =====================================
; Adjust player speed with mouse wheel
; -------------------------------------
; An AutoHotkey script for The Dark Mod
; version 6.0 by Obsttorte & snatcher
; =====================================

; -------------------------------------
; Configure your keys below
; -------------------------------------

; In-game movement keys
key_left = a
key_right = d
key_forward = w
key_backward = s

; In-game run and creep keys
key_run = z
key_creep = c

; In-game manipulate key (recommended right mouse button: RButton)
key_manipulate = RButton

; In-game Next/Prev inventory keys
key_next = Right
key_prev = Left

; -------------------------------------
; Do not edit anything past this point
; -------------------------------------

delay = 1000 ; delay in miliseconds between running > walking [default = 1000]
speed = 0 ; init speed (-1 = creep | 0 = walk [default] | 1 = run)
state = speed; counter for state switch

#IfWinActive ahk_exe TheDarkModx64.exe ; run only when TDM is focused

HotKey, *~%key_forward% up, keyForwardHandler
return

keyForwardHandler:
if (speed == 1) ; we are running
{
    sleep, delay
    if (!GetKeyState(key_forward) && !GetKeyState(key_backward) && !GetKeyState(key_right) && !GetKeyState(key_left))
    {
        speed = 0 ; walk
        Send {%key_run% up}
    }
}
return

*wheelup::
if (GetKeyState(key_manipulate))
{
    Send {%key_next%}
}
else
{
    state += 1
    if (speed == -1) ; we are creeping
    {
        speed = 0 ; walk
        Send {%key_creep% up}
    }
    else if (speed == 0) ; we are walking
    {
        speed = 1 ; run
        Send {%key_run% down}
    }
    state = 0
    Sleep, 300
}
return

*wheeldown::
if (GetKeyState(key_manipulate))
{
    Send {%key_prev%}
}
else
{
    state -= 1
    if (speed == 0) ; we are walking
    {
        speed = -1 ; creep
        Send {%key_creep% down}
    }
    else if (speed == 1) ; we are running
    {
        speed = 0 ; walk
        Send {%key_run% up}
    }
    state = 0
    Sleep, 300
}
return

Change-log:

  • v6.0: You can now use as many mouse wheel steps as you like to switch speeds. You can navigate the inventory, turn pages, numbered dials and move objects you are holding back and forth by using Parry/Manipulate plus the mouse wheel.
  • v5.0: To prevents sudden halts when running, a one-second delay has been added between the moment the player stops going forward and the script takes you automatically back to walking mode. To allow for a greater freedom of movement, the script requires to know now your backwards, right and left keys.
  • v4.0: Altered so that when player is running and stops, you are back to walking mode.
  • v3.0: The script only runs when TDM is in focus (tested in Win 10)
  • v2.0: Second version by Obsttorte
  • v1.0: First version by Obsttorte

Cheers!

Edited by snatcher

TDM Modpack 4.0

Link to comment
Share on other sites

  • 1 year later...
1 hour ago, nbohr1more said:

@snatcher can you upload this to moddb ?

There is nothing to upload anywhere unless the ask is to create an AutoHotKey executable in which case false positives would easily become my new nightmare. Thanks but I'll pass!

This one truly is a proof of concept. I have been using this hack (with its shortcomings) since @Obsttorte and I first worked on it and I am convinced this could become a great project for an eager developer. Controlling the speed with the mouse-wheel not only feels natural but it would free us from the 3-speed limit and make some keys obsolete. An all-around improvement for those that may (optionally) use it.

TDM Modpack 4.0

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 4 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
    • nbohr1more

      Looks like the "Reverse April Fools" releases were too well hidden. Darkfate still hasn't acknowledge all the new releases. Did you play any of the new April Fools missions?
      · 5 replies
×
×
  • Create New...