Toggle Sprint Script - best/easiest way to make one?

Discussion & Info

I was looking at trying to make a script for Elden Ring on PC with an xbox controller to toggle sprint so that I don't have to constantly use claw grip when exploring (rip the side of my index finger). I'm fine with not using the script during normal combat so I dont want to replace the standard sprint functionality completely.

I was looking at trying to use autohotkey but I'm not sure if its the most optimal way to write this code.

I'm trying to make the script activate when I click L3 + circle/b. The script would deactivate when I click L3 again OR stop inputting a control stick input for .25 seconds (ideally with possible degrees of how far its been pushed so if im barely moving the stick it stops triggering) OR if I press Y/triangle.

I found this script as a base but it was formatted for a different language. https://www.consoletuner.com/forum/viewtopic.php?f=6&t=919&sid=6e9f75890669c9eccce85b697d883fd1&start=10

Main questions:

  1. Is autohotkey the best option or is there a better way to do this?

  2. I changed the original scripts usage of A (the old interact button) to Y (the new interact button for Elden Ring). Did I miss things up there?

  3. Do I need the 360 part of this script or will it cause complications?

If the answer is yes to using AHK:

  1. How do i send an L3 input / is it possible? I found https://www.reddit.com/r/AutoHotkey/comments/q4dtn1/dualshock4_l3_input_hey_dear_community_i_want_to/ and one person says its not but the OP says they did it with "Send {Joy 12}"

  2. How do I do functions / name them? the Combo roll code and one after wont execute. I found https://www.autohotkey.com/docs/Functions.htm#DynCall but dont understand how to specify it.

This is what I had pre-figuring out it was not written for AHK which I was trying to write it in. Any and all help would be greatly appreciated!

int sprint = FALSE;
main {

    if(event_press(XB360_B) && get_ptime(XB360_B) < 500 && get_val(XB360_LY) <= -20) combo_run(Roll);

///Sets Sprint Toggle
    if(get_val(XB360_LY) <= -20 || get_val(XB360_LY) >= 20 || get_val(XB360_LX) <= -20 || get_val(XB360_LX) >= 20)
       {if(event_press(XB360_Y) && get_val(XB360_LY) < -20 || get_val(XB360_LY) > 20 ||
          get_val(XB360_LX) < -20 || get_val(XB360_LX) > 20) sprint = TRUE;}
    else if(sprint) sprint = FALSE;
    if(sprint) set_val(XB360_B, 100);

///to fix unintentional rolling
    if(get_val(XB360_Y) == 100 && get_val(XB360_LY) < -20 || get_val(XB360_LY) > 20 ||
          get_val(XB360_LX) < -20 || get_val(XB360_LX) > 20)  combo_run(ROLL_DELAY);
}

combo Roll {
    set_val(XB360_B, 0);
    wait(40);
    set_val(XB360_B, 100);
}

combo ROLL_DELAY{
    set_val(XB360_B, 100);
    wait(500);
}

Posted Feb 24, 2022, 5:17 PM UTC

212
SoopahInsayne•

Been looking for an answer to this same exact issue, thanks for the hookup. Wondering if it might be easier to set something in steam big picture mode? I'm gonna try it and report back if I remember to.

2
CandlemasterOP:restored:•

Good luck and let me know what you find! My search was kind of fruitless sadly. I learned autohotkey isnt set up to do this and I didnt feel like paying for a software.

I will say though that with 60 hours into ER, that its a looooot less annoying than when doing in DS1-3 because theres not as much sprinting and more riding torrent so its a lot easier on the side of my fingers. and when I am sprinting a lot of the paths are pretty straight anyway :)

2
PhatHamWallet:restored:•

Why wouldn’t you just hold sprint with your thumb and use your next two fingers on the triggers? What are you doing that you need to hold sprint with your index finger?

1
CandlemasterOP:restored:•

You cant adjust the camera and hold sprint at the same time without claw grip.

4
WingXCustom:hollowed2:•

I just changed the sprint button to Left Stick In. It Solved that. Still wish you could toggle sprint though

2
sfspaulding•

But you also can’t change JUST sprint to L3. With this change you’re also dodging with L3. Such terrible control design..

1
AnimeFLman•

I remapped my dodge to LT and put the skill on B.

Decided it wasn't that great and put my dodge on L3. Realized it's kind of a pain, put it back on LT. lol

Your code looks like it makes sense. I'm not sure what language AHK uses or what the syntax is, though.

1
ANCEST0R•

I tried that but my finger gets tired holding sprint so I just went back to defaults

1
Griib:restored:•

Just stop sprinting for the half second it takes to swing the camera around, don't need to write a whole ass code

0
CandlemasterOP:restored:•

Why live with the inconvenience if I can find a way to solve it?

7
OakWind1:hollowed2:•

You do you. Sorry I can't help.

2
Damocles314•

Having to hold sprint button is terrible UI design, along with auto-centering camera. It feels like I'm fighting the camera more than enemies.

1