生化奇兵:无限 完全版

生化奇兵:无限 完全版

评价数不足
AutoHotKey Script to Change Toggle Actions to Hold
由 twi 制作
An autohotkey script that changes aim, sprint, and walk to hold-style controls instead of toggle, and tweaks a few other things as well.
   
奖励
收藏
已收藏
取消收藏
What This Script Does
  • F13: Alt-Tab out of the game. Change this to whatever key you want (or change any of the hotkeys to match your keybindings). Left Alt subroutines in the script interfere with normal Alt-Tab behaviour, so this one may be necessary (if you keep Left Alt for Walk).
  • Left Control (Crouch): Crouching is left as toggle on/off, but now pressing Space (Jump) while crouched will make Booker stand up instead of jump. You can now exit crouching by sprinting, jumping, or pressing crouch again.
  • Left Shift (Sprint) & W (Forward): Sprint is now hold-style. Press to begin sprinting, and release to stop. You can now begin sprinting by using both W + Left Shift and Left Shift + W. You can exit sprinting by releasing either W or Left Shift. If you release Left Shift but keep W pressed, Booker will stop sprinting and seamlessly resume moving forward at normal speed.
  • Left Shift (Sprint) & Right Mouse Button (Aim): Aim is now also hold-style. The interference between sprinting and aiming has been resolved with help from user "just me" at autohotkey.com/boards.
    • If you are sprinting (holding Left Shift & W) and press RMB and begin aiming, then release RMB, Booker will stop aiming and resume sprinting.
    • If you are aiming (holding RMB) and press Left Shift to start sprinting, then release Left Shift, Booker will stop sprinting and resume aiming.
    • If you are sprinting, and begin aiming, then release Left Shift, the script will no longer result in an erroneous aim-state.
    • If you are aiming, and begin sprinting, then release RMB, the script will no longer result in an erroneous aim-state.
  • Left Alt (Walk): Walk is now hold-style. Strafing left (A) or right (D), or moving backwards (S) no longer cancels walking, so long as the Left Alt stays pressed. If you release Left Alt but keep W pressed, Booker will stop walking and begin seamlessly moving forward at normal speed.
The Script
  1. Install AutoHotkey.
  2. Copy the contents of the code block below.
  3. Save it in a code editor as an AHK file (e.g. BioShockInfinite.ahk).
  4. Edit the script to your liking. Takes some know-how, but help and reference materials can be found at autohotkey.com/boards and https://www.autohotkey.com/docs
  5. Run the script when you start the game.

#NoEnv SendMode, Input SetWorkingDir, %A_ScriptDir% SetBatchLines, -1 #IfWinActive ahk_exe BioShockInfinite.exe Aiming := False Crouching := False Advancing := False Sprinting := False AimSprint := False SprintAim := False Return F13:: Suspend Send, !{Tab} Suspend Return LControl:: Send, {LControl} KeyWait, LControl If (!Crouching) { Crouching := True } Else { Crouching := False } Return Space:: If (Crouching) { Crouching := False Send, {LControl} KeyWait, Space } Else { Send, {Space} KeyWait Space } Return w:: Advancing := True Send, {w Down} If (GetKeyState("LShift", "P")) { Send, {LShift} } Return w Up:: Advancing := False Send, {w Up} Return LShift:: Send, {LShift} If (Advancing) { Crouching := False Sprinting := True } If (Aiming) AimSprint := True While (Sprinting) Sleep, 30 Return LShift Up:: Critical Sprinting := False Send, {LShift Up} If (Advancing) And (AimSprint) { AimSprint := False Send, {w Up}{RButton} Sleep, 30 Send, {w Down} } Else If (Advancing) And (SprintAim) { SprintAim := False Send, {w Up} Sleep, 30 Send, {w Down} } Else If (Advancing) { Send, {w Up} Sleep, 30 Send, {w Down} } Else { AimSprint := False SprintAim := False } Return RButton:: Aiming := True Send, {RButton} If (Sprinting) SprintAim := True While (Aiming) Sleep, 30 Return RButton Up:: Aiming := False If (SprintAim) { SprintAim := False Send, {RButton}{LShift} } Else If (AimSprint) Or (Sprinting) { AimSprint := False SprintAim := False } Else { AimSprint := False SprintAim := False Send, {RButton} } Return LAlt:: Send, {LAlt} While (GetKeyState("LAlt", "P")) { If (GetKeyState("w", "D")) Or (GetKeyState("a", "D")) Or (GetKeyState("s", "D")) Or (GetKeyState("d", "D")) { Send, {LAlt} Sleep, 50 } } Return LAlt Up:: Critical Send, {LAlt Up} If (Advancing) { Send, {w Up} Sleep, 30 Send, {w Down} } Return #IfWinActive
Additional Notes
This script makes use of numerous variables to manage outcomes between keys and their respective in-game actions that would otherwise interfere with each other. This means that the variables are theoretically vulnerable to going out-of-sync with the game-state if some glitch or scripted event occurs.

I have extensively tested this script in the first five levels and have not encountered any problems thus far that I couldn't fix with a simple keystroke. For example, I once got caught crouching in the scripted event where Elizabeth throws Booker money, and was pressing the space bar to exit crouch when I started the interaction. This just meant that I remained in a crouch after the cut-scene ended, and all I had to do to reset the out-of-sync Crouching variable was to press space (or Left Shift + W) again.

The beauty of AutoHotKey is that you can change this script to suite your own style. If only want aiming to be hold-style, you can edit the rest of the script to make it so. If you want crouching to be hold-style, it would be somewhat complicated, since you would need additional variables to account for the jump key and sprint keys, but very much possible.