CoolColJ 87 Posted July 29, 2013 Share Posted July 29, 2013 (edited) Here is a script file for Autohotkey that maps any key you want to the left mouse click in Sacred 2, but I do use variations of this script with other games, just change the winactive bit Script will only activate when Sacred 2 is in front So when you press the up arrow key, the character will move/attack where the mouse is pointed to. Saves your mouse finger! Edit the key as needed #SingleInstance #InstallKeybdHook #InstallMouseHook SetTimer, MoveTimer, 256 return MoveTimer: IfWinActive, Sacred { GetKeyState, state, uP ; or what button you want it to be if state = D { MouseClick, left } } return Edited July 29, 2013 by CoolColJ Link to comment
wolfie2kX 528 Posted July 29, 2013 Share Posted July 29, 2013 OK.. So let's say you map the W key to forward/attack, whenever you push the W key, you wind up moving to wherever the mouse is pointing... But in order to do anything, you STILL have to move the mouse - so it's pointing to where you want to go. Do I have it right? Link to comment
CoolColJ 87 Posted July 29, 2013 Author Share Posted July 29, 2013 (edited) OK.. So let's say you map the W key to forward/attack, whenever you push the W key, you wind up moving to wherever the mouse is pointing... But in order to do anything, you STILL have to move the mouse - so it's pointing to where you want to go. Do I have it right? Yes correct. It works like the move key in TorchLight 2, except it will also attack (left click attack), without moving if the mouse cursor is on an enemy. But it will continously update as you move the mouse and keep the key held. It feels seamless Make is much more enjoyable when you travelling a lot... There is a way to make a script to act more like WSAD. Someone made one at the AutoHotkey forum for TitanQuest, so you will have to edit the winactive bit of the script to Sacred instead. In any case if just moves the mouse a bit and clicks it when you press a key in that direction ; ; WASD Movement For Titan Quest Series v3.1 ; Author: Desi Quintans <me@desiquintans.com> ; Website: http://www.desiquintans.com ; ; Script Function: ; Enables WASD controls in the Titan Quest series of RPGs. Works across all resolutions, and in both ; Windowed and Full-Screen modes. Does not mess up your typing outside the game. ; #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. #Persistent #MaxHotkeysPerInterval, 200 SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. SetDefaultMouseSpeed, 0 SetTitleMatchMode, 3 ; Initialise variables. final_x_coord = 0 final_y_coord = 0 are_coordinates_initialised = 0 SetTimer, Button_Pressed, 1 return Button_Pressed: if WinActive("Titan Quest") || WinActive("Titan Quest: Immortal Throne") { if (are_coordinates_initialised != 1) { ; Set coordinate offsets specific to the game. This only runs once, when the script first detects the game window ; as active. If the user changes game resolutions the script will need to be reloaded, but this is still much better ; than performing the same calculations to set the same variables with the same values every 1 millisecond. WinGetPos,,, total_width, total_height, A ; In case of running a Window, or in a resolution not matching the Desktop's. x_axis_centre := round(total_width//2) y_axis_centre := round(total_height*0.575) ; This is corrected for true horizontal movement. up_coord := y_axis_centre-round(total_height*0.095) down_coord := y_axis_centre+round(total_height*0.16) left_coord := x_axis_centre-round(total_width*0.07) right_coord := x_axis_centre+round(total_width*0.07) are_coordinates_initialised = 1 } if GetKeyState("w", "P") || GetKeyState("s", "P") || GetKeyState("a", "P") || GetKeyState("d", "P") { ; Remember the position of the mouse pointer before the WASD keys were pressed. MouseGetPos, prior_x_pos, prior_y_pos ; Use the chosen coordinates as their respective keys get pressed to direct the mouse pointer. if GetKeyState("w", "P") { final_y_coord := up_coord } else if GetKeyState("s", "P") { final_y_coord := down_coord } else { final_y_coord := y_axis_centre } if GetKeyState("a", "P") { final_x_coord := left_coord } else if GetKeyState("d", "P") { final_x_coord := right_coord } else { final_x_coord := x_axis_centre } ; Perform the directed click. This is a click-hold that immediately gets released. ; Click-hold is necessary as some games don't register a single click. Click down %final_x_coord% %final_y_coord% Click up ; Put the mouse pointer back in its original place. Sleep, 40 Click, %prior_x_pos% %prior_y_pos% Left 0 } } return Edited July 29, 2013 by CoolColJ Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now