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

    • Ansome

      Finally got my PC back from the shop after my SSD got corrupted a week ago and damaged my motherboard. Scary stuff, but thank goodness it happened right after two months of FM development instead of wiping all my work before I could release it. New SSD, repaired Motherboard and BIOS, and we're ready to start working on my second FM with some added version control in the cloud just to be safe!
      · 0 replies
    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
×
×
  • Create New...