7 Days to Die

7 Days to Die

View Stats:
evilC Apr 7, 2015 @ 10:34am
[AHK Script] 7DTD Auto-Run / Keep max stamina
I wrote this script as I got cramp in my fingers from exploring Random Gen worlds and having to keep pulsing the Shift button to run.

This script attempts to keep you running as fast as possible whilst not depleting your Stamina (So if you encounter dogs, you still have a full stam bar to run away)

Simply hit the CAPSLOCK button to auto-run forwards.

See the instructions included in the script.


; Generic auto-run script ; Author: Clive "evilC" Galway - evilc@evilc.com ; Version 1.1 ; Requires AutoHotkey >= 1.1.20 from ahkscript.org ; Save code into a text file named like 7dtd_run.ahk and double-click to run ; Designed for 7 Days to Die, but should work with any game that uses Stamina for running. ; Will attempt to use run as much as possible whilst keeping stamina at full ; Holds run modifier (eg shift) for a certain amount of time... ; ... then releases for a certain amount of time ; May require tweaking the settings for your keybinds / character status (eg stam regen rate) #SingleInstance force ; USER DEFINED SETTINGS START run_key := "LShift" ; The Run / Sprint key move_key := "w" ; The key used to move forwards autorun_key := "CapsLock" ; The key you use to trigger AutoRun run_hold_time := 1400 ; The amount of time to hold the run modifier run_release_time := 1000 ; The amount of time to release the run modifier game_title := "7 Days To Die" ; USER DEFINED SETTINGS END autorun_mode := 0 ; Allow starting of autorun while move_key is already held... ; ... and stop pressing move_key while in autorun_mode from stopping you. Hotkey, IfWinActive, % game_title hotkey % "*$" move_key, MoveDown hotkey % "*$" move_key " up", MoveUp hotkey % "*~" autorun_key " up", AutoRunToggle ; Start the WindowCheck loop SetTimer WindowCheck, 500 return ; If we tab out of game while autorun is on, stop the loop / release the keys WindowCheck: IfWinNotActive, % game_title { if (autorun_mode){ autorun_mode := 0 } } return ; pass through down events for move key - we aren't interested in those MoveDown: Send % "{" move_key " down}" return ; Block up events for move key while in autorun mode... ; Else if we hold move_key and hit autorun_key, when we release move_key, we will stop moving MoveUp: if (!autorun_mode){ Send % "{" move_key " up}" } return ; The button that toggles autorun was pressed AutoRunToggle: if (autorun_key = "capslock"){ ; autorun_key is CapsLock - use state of caps light for autorun state autorun_mode := GetKeyState(autorun_key, "T") } else { ; autorun key does not have a light - just toggle autorun_mode := !autorun_mode } if (autorun_mode){ ; Hold move key Send % "{Blind}{" move_key " down}" ; Run AutoRun once in another thread. SetTimer, AutoRun, -0 } else { ; Make sure all keys are released immediately ; AutoRun may release them later also, but sending multiple up events not a problem Send % "{Blind}{" move_key " up}" Send % "{" run_key " up}" } return ; Pulse the run key at the specified rate AutoRun(){ global autorun_mode, run_key, move_key, run_hold_time, run_release_time Loop { if (!autorun_mode){ ; run_key was released break } ; Hold run key for specified time Send % "{" run_key " down}" Sleep % run_hold_time Send % "{" run_key " up}" ; Wait for next loop Sleep % run_release_time } }

Version History:
1.0
Initial version.

1.1
Fix: You can now press autorun_key while move_key is pressed and you will not stop moving.
Add: Now aware of when it is in-game and out of game. Will disable (and release keys) if you exit game and will
not trigger if out of game.
Add: autorun_key configuration option added - you can now use other keys than CapsLock to trigger Autorun.

Last edited by evilC; Apr 7, 2015 @ 3:23pm
< >
Showing 1-15 of 15 comments
Galenmacil Apr 7, 2015 @ 10:44am 
I use a simple AHK script too for auto-run but yours is interesting. So pulsing the run key seems to lessen stamina drop? Does your character still move at full running speed?
Lenkdrache Apr 7, 2015 @ 10:56am 
Nice cheat. I can't wait to see all the forum posts from people complaining about it.
evilC Apr 7, 2015 @ 11:05am 
NOT a cheat.

You do NOT move at max speed always.

The idea is to run a little, then stop running and let your stamina regen.

Thus leaving you with a full stamina bar should you need it.
Ketobi Apr 7, 2015 @ 11:24am 
Anything that modifies the client in any way except the settings provided by the devs are cheats per definition. As nice as your script is for singleplayer i would never use it online.
You get an advantage over vanilla players that means it is a cheat.
evilC Apr 7, 2015 @ 11:27am 
Doesn't modify the client.

Does not provide any advantage at all.

Merely a usability thing - to help stop getting wrist injury.
Ketobi Apr 7, 2015 @ 11:50am 
Don't get me wrong here i like your script and think the developers should implement something like that in the game. I am thankful that you add to the game and your script is an interesting read for me as a developer. Also you don't complain about broken wrists but use your sklls to adapt. That is awesome! We are on the same side here but let me explain...

If it was a server side script it would be okay because everyone could gain the advantage.
(It is an advantage to not have pain in the wrists, an advantage everyone should have of course, good job again!) And it modiifies the client, "Simply hit the CAPSLOCK button to auto-run forwards." is a capability the vanilla client has not so it IS modified. Even dental floss glued to your monitor to use it as a crosshair modifies the client. (Before: no crosshair, after: a crosshair).
evilC Apr 7, 2015 @ 3:09pm 
Updated - fixed miscellaneous issues and added a new configuration option. See new code in the OP.

@skamaniac - Whilst I can see that there is a degree of "cheatiness" about it for multiplayer, it's very, very marginal.
Any idiot could do what this script does, just sprint a little, then release the button and pulse it every now and then such that it never reaches the top.
Therefore, for me, this one falls the "right" side of that fuzzy line between convenience and cheat.

Bear in mind that macros like this (and worse) will be used by some people and there is nothing the game devs can realistically do about it. Some people will have either the coding knowledge or the specialized hardware (eg a gaming mouse) to do it, some will not. Therefore, I am of the opinion that if I do not think I would be bothered by an opponent using such a script on me, then I release it for all to use, to level the playing field and try to make things fairer for everybody.

When I get around to it, and I feel that the script is stable, I will post on the official forums, and we shall let the devs decide.
Darksim Mar 13, 2018 @ 11:47pm 
I disagree with EvilC & Ketobi based on the slippery slope problem with "Anything that modifies the client in any way except the settings provided by the devs are cheats per definition" or advantage over vanilla players. The reason I say this is that you can achieve the exact same thing with a rubber band on the mouse, or placing marbles on the keyboard W and SHIFT keys. Are those "cheats" to put a random object on your keyboard? Heavens I would hope nobody could conclude that, yet they would yield the exact same result [actually without the drawback of the mentioned flaw "in and out of game"].

Thus, while I don't resort to special tools because I don't trust them, I can't put such simple tools in the same category of something like putting a dense small object on my keyboard. Otherwise you have to start speeding down the slippery slope into arguments like, are rubber bands cheating tied around the mouse button, is a more-than stock button mouse cheating for having easy access buttons, etc etc. A cheat does something unusual and unfair, like aimbotting, auto-healing, pulling out a major weapon when encountering a player, that sort of stuff...not holding a button down.
evilC Apr 23, 2018 @ 1:32pm 
Heh, never knew about that.
Looking at this code, it is quite old, and I would probably write it a bit different now.
Also, obviously, the ideal way to do this would be using pixel detection to detect when the bar moves off max, obviating the need to hard-code the values (Which would change as you levelled up)
I am back playing 7DTD at the moment, I may actually take a stab at it soon.
Scooby Doo (Banned) Apr 23, 2018 @ 2:45pm 
To all that see this as a cheat a Macro would do the same if you set it up right. Or like I do in Empyrion Nailclippers and a penny would work as well. They are just old school cheats I guess. LMAO.
Ficelle Apr 23, 2018 @ 3:52pm 
This is a nice necro lol, 3 years...


Autohotkey is not a cheat
Setting a key to work as another, or to simulate being depressed, is not a cheat at all
And it doesnt modify any game file, contray to mods and file editing


Most gaming mouses / keyboards can do exactly the same too

I use a mouse button to autorun in 7D2D because i cant be bothered to hold 2 keys depressed for hours when i can just press a button once
Doesnt make the game any easier, but make it way easier for my fingers

After all, the main job of a computer is to automate (boring) tasks...
Scooby Doo (Banned) Apr 23, 2018 @ 4:03pm 
Yeah still waiting for a PC that can wash the dishes run the vacum and take out the trash. LMAO.
Ficelle Apr 23, 2018 @ 4:35pm 
Originally posted by Dawg:
Yeah still waiting for a PC that can wash the dishes run the vacum and take out the trash. LMAO.

Instant buy ;D
evilC Apr 23, 2018 @ 4:53pm 
I had a tinker and got some cool stuff working.
Pixel Detection based stamina bar monitoring - it holds a key combo while the stamina bar is above a certain amount.
ie Sprint while above a certain stamina level, or mine while above a certain stamina level
Ran outta time tonight, but will see if I can package it all up for you all.
< >
Showing 1-15 of 15 comments
Per page: 1530 50

Date Posted: Apr 7, 2015 @ 10:34am
Posts: 15