Torchlight II
No hay suficientes valoraciones
WASD Movement
Por 𓅃 スノ 𓅃
This is a simple AHK script that will allow you to use wasd or a gamepad if you will to move your charater.
this will auto attack becuase it use lmb for autoclick insted of the key to move. this is up to you.

Press CAPSLOCK to toggle move/attack
Press F12 to tun on and off the script
only works on v0.3 and above
   
Premio
Favoritos
Favorito
Quitar
mouse limits
Script AHK v0.8
For RAW format:
https://pastebin.com/AzVeCgz0

  • New Adjusted movement limit of the mouse not not exeded 50 pixel while diagol movement //Not how I intend it to leave it but it works.
  • New Optional you could add sound on pressing toggle CAPS / F12 by
    adding SoundOn.wav, SoundOff.wav for F12 and CAPSsoundON.wav , CAPSsoundOFF.wav for CAPS.
    you need to add your own sounds, to the same location of the script is located or edit the script to include the PATH of the files.

#Persistent ; Imposta il modo di coordinate del mouse su "Screen" CoordMode, Mouse, Screen ; Calcola le coordinate del centro dello schermo CenterX := A_ScreenWidth / 2 CenterY := A_ScreenHeight / 2 ; Definisci il raggio del cerchio Radius := 70 WDA_Distance := 50 SA_Distance := 50 On := 1 ; Flag per indicare lo stato attivo/inattivo dello script (1 = attivo, 0 = inattivo) ClickMode := 1 ; Flag per indicare lo stato attivo/inattivo della modalità di click (1 = click, 0 = backslash) SetTimer, MouseMove, % (On ? "10" : "Off") ; Imposta il timer per il movimento del mouse in base allo stato return ; Tasto per accendere/spegnere lo script F12:: On := !On ; Inverte lo stato attuale SetTimer, MouseMove, % (On ? "10" : "Off") ; Aggiorna il timer in base allo stato if (On) { TrayTip, Mouse Movement Script, Attivato SoundPlay, SoundOn.wav ; Riproduce un suono quando lo script viene attivato } else { TrayTip, Mouse Movement Script, Disattivato SoundPlay, SoundOff.wav ; Riproduce un suono quando lo script viene disattivato } return ; Tasto per alternare tra click e backslash con CAPS LOCK CapsLock:: ClickMode := !ClickMode if (ClickMode) { TrayTip, Click Mode, Attivato SoundBeep, 500, 200 ; Emetti un segnale acustico quando si attiva la modalità di click } else { TrayTip, Click Mode, Disattivato SoundBeep, 300, 200 ; Emetti un segnale acustico quando si disattiva la modalità di click } return MouseMove: ; Ottieni le coordinate correnti del cursore MouseGetPos, MouseX, MouseY ; Calcola la distanza dal centro dello schermo Distance := sqrt((MouseX - CenterX) ** 2 + (MouseY - CenterY) ** 2) ; Se la distanza è maggiore del raggio del cerchio, sposta il cursore all'interno del cerchio if (On && Distance > Radius) { ; Calcola la posizione normalizzata all'interno del cerchio NormX := (MouseX - CenterX) / Distance NormY := (MouseY - CenterY) / Distance ; Calcola le nuove coordinate all'interno del cerchio NewX := Round(CenterX + NormX * Radius) NewY := Round(CenterY + NormY * Radius) ; Sposta il cursore alle nuove coordinate DllCall("SetCursorPos", "int", NewX, "int", NewY) } ; Verifica se il tasto Home è stato premuto if (On && GetKeyState("Home", "P")) { ; Muovi il cursore al centro dello schermo MouseMove, %CenterX%, %CenterY% } ; Verifica se i tasti di movimento W, S, A, D sono premuti if (On && GetKeyState("W", "P")) { MouseMove, 0, -WDA_Distance, 0, R if (ClickMode) Click else SendInput, \ } if (On && GetKeyState("S", "P")) { MouseMove, 0, WDA_Distance, 0, R if (ClickMode) Click else SendInput, \ } if (On && GetKeyState("A", "P")) { MouseMove, -WDA_Distance, 0, 0, R if (ClickMode) Click else SendInput, \ } if (On && GetKeyState("D", "P")) { MouseMove, WDA_Distance, 0, 0, R if (ClickMode) Click else SendInput, \ } if (On && GetKeyState("W", "P") && GetKeyState("A", "P")) { MouseMove, -SA_Distance, -SA_Distance, 0, R if (ClickMode) Click else SendInput, \ } if (On && GetKeyState("W", "P") && GetKeyState("D", "P")) { MouseMove, SA_Distance, -SA_Distance, 0, R if (ClickMode) Click else SendInput, \ } if (On && GetKeyState("S", "P") && GetKeyState("A", "P")) { MouseMove, -SA_Distance, SA_Distance, 0, R if (ClickMode) Click else SendInput, \ } if (On && GetKeyState("S", "P") && GetKeyState("D", "P")) { MouseMove, SA_Distance, SA_Distance, 0, R if (ClickMode) Click else SendInput, \ } Sleep 10 return
Script AHK v0.4
#Persistent ; Imposta il modo di coordinate del mouse su "Screen" CoordMode, Mouse, Screen ; Calcola le coordinate del centro dello schermo CenterX := A_ScreenWidth / 2 CenterY := A_ScreenHeight / 2 ; Definisci il raggio del cerchio Radius := 70 On := 1 ; Flag per indicare lo stato attivo/inattivo dello script (1 = attivo, 0 = inattivo) ClickMode := 1 ; Flag per indicare lo stato attivo/inattivo della modalità di click (1 = click, 0 = backslash) SetTimer, MouseMove, % (On ? "10" : "Off") ; Imposta il timer per il movimento del mouse in base allo stato return ; Tasto per accendere/spegnere lo script F12:: On := !On ; Inverte lo stato attuale SetTimer, MouseMove, % (On ? "10" : "Off") ; Aggiorna il timer in base allo stato if (On) TrayTip, Mouse Movement Script, Attivato else TrayTip, Mouse Movement Script, Disattivato return ; Tasto per alternare tra click e backslash con CAPS LOCK CapsLock:: ClickMode := !ClickMode if (ClickMode) { TrayTip, Click Mode, Attivato } else { TrayTip, Click Mode, Disattivato } return MouseMove: ; Ottieni le coordinate correnti del cursore MouseGetPos, MouseX, MouseY ; Calcola la distanza dal centro dello schermo Distance := sqrt((MouseX - CenterX) ** 2 + (MouseY - CenterY) ** 2) ; Se la distanza è maggiore del raggio del cerchio, sposta il cursore all'interno del cerchio if (On && Distance > Radius) { ; Calcola la posizione normalizzata all'interno del cerchio NormX := (MouseX - CenterX) / Distance NormY := (MouseY - CenterY) / Distance ; Calcola le nuove coordinate all'interno del cerchio NewX := Round(CenterX + NormX * Radius) NewY := Round(CenterY + NormY * Radius) ; Sposta il cursore alle nuove coordinate DllCall("SetCursorPos", "int", NewX, "int", NewY) } ; Verifica se il tasto Home è stato premuto if (On && GetKeyState("Home", "P")) { ; Muovi il cursore al centro dello schermo MouseMove, %CenterX%, %CenterY% } ; Verifica se i tasti di movimento W, S, A, D sono premuti if (On && GetKeyState("W", "P")) { MouseMove, 0, -100, 0, R if (ClickMode) Click else SendInput, \ } if (On && GetKeyState("S", "P")) { MouseMove, 0, 100, 0, R if (ClickMode) Click else SendInput, \ } if (On && GetKeyState("A", "P")) { MouseMove, -100, 0, 0, R if (ClickMode) Click else SendInput, \ } if (On && GetKeyState("D", "P")) { MouseMove, 100, 0, 0, R if (ClickMode) Click else SendInput, \ } if (On && GetKeyState("W", "P") && GetKeyState("A", "P")) { MouseMove, -50, -50, 0, R if (ClickMode) Click else SendInput, \ } if (On && GetKeyState("W", "P") && GetKeyState("D", "P")) { MouseMove, 50, -50, 0, R if (ClickMode) Click else SendInput, \ } if (On && GetKeyState("S", "P") && GetKeyState("A", "P")) { MouseMove, -50, 50, 0, R if (ClickMode) Click else SendInput, \ } if (On && GetKeyState("S", "P") && GetKeyState("D", "P")) { MouseMove, 50, 50, 0, R if (ClickMode) Click else SendInput, \ } Sleep 10 return

NEW
Added hotkey "Capslock" to toggle Move/Click

NB: bind \ to MOVE. or edit the script

###########
for easier download:
https://pastebin.com/UMJ34hma
Script AHK 0.30
Press F12 to tun on and off the script

#Persistent ; Imposta il modo di coordinate del mouse su "Screen" CoordMode, Mouse, Screen ; Calcola le coordinate del centro dello schermo CenterX := A_ScreenWidth / 2 CenterY := A_ScreenHeight / 2 ; Definisci il raggio del cerchio Radius := 70 On := 1 ; Flag per indicare lo stato attivo/inattivo dello script (1 = attivo, 0 = inattivo) SetTimer, MouseMove, % (On ? "10" : "Off") ; Imposta il timer per il movimento del mouse in base allo stato return ; Tasto per accendere/spegnere lo script F12:: On := !On ; Inverte lo stato attuale SetTimer, MouseMove, % (On ? "10" : "Off") ; Aggiorna il timer in base allo stato if (On) TrayTip, Mouse Movement Script, Attivato else TrayTip, Mouse Movement Script, Disattivato return MouseMove: ; Ottieni le coordinate correnti del cursore MouseGetPos, MouseX, MouseY ; Calcola la distanza dal centro dello schermo Distance := sqrt((MouseX - CenterX) ** 2 + (MouseY - CenterY) ** 2) ; Se la distanza è maggiore del raggio del cerchio, sposta il cursore all'interno del cerchio if (On && Distance > Radius) { ; Calcola la posizione normalizzata all'interno del cerchio NormX := (MouseX - CenterX) / Distance NormY := (MouseY - CenterY) / Distance ; Calcola le nuove coordinate all'interno del cerchio NewX := Round(CenterX + NormX * Radius) NewY := Round(CenterY + NormY * Radius) ; Sposta il cursore alle nuove coordinate DllCall("SetCursorPos", "int", NewX, "int", NewY) } ; Verifica se il tasto Home è stato premuto if (On && GetKeyState("Home", "P")) { ; Muovi il cursore al centro dello schermo MouseMove, %CenterX%, %CenterY% } ; Verifica se i tasti di movimento W, S, A, D sono premuti if (On && GetKeyState("W", "P")) { MouseMove, 0, -100, 0, R Click } if (On && GetKeyState("S", "P")) { MouseMove, 0, 100, 0, R Click } if (On && GetKeyState("A", "P")) { MouseMove, -100, 0, 0, R Click } if (On && GetKeyState("D", "P")) { MouseMove, 100, 0, 0, R Click } if (On && GetKeyState("W", "P") && GetKeyState("A", "P")) { MouseMove, -50, -50, 0, R Click } if (On && GetKeyState("W", "P") && GetKeyState("D", "P")) { MouseMove, 50, -50, 0, R Click } if (On && GetKeyState("S", "P") && GetKeyState("A", "P")) { MouseMove, -50, 50, 0, R Click } if (On && GetKeyState("S", "P") && GetKeyState("D", "P")) { MouseMove, 50, 50, 0, R Click } Sleep 10 return

if you want to download save the file as exetion to AHK or rename the exetion to AHK:
For raw or download ==> https://pastebin.com/5xWbEXU4

look like i solve most of the issue I had before and now works as intented. I need to test it with Xpadder and i hop i had a steam controller to also test it but looks like i need to find a portable touchpad for now. using a pen table would make this script usless. they dont need limiter the might need other kinda of script if one wants to emulate a mouse with a pen table.

I will be adding a hot key feature that will reduce the radius for smaller movement or to pick up item easier in future.
after then I might want to figure out why when i press the key to move it will not register with xppader so i would probably introduce the key to the script if needs be.
Script AHK 0.2.3
Simple AHK scirpt to move and autoclick mouse with wasd.
version: 0.23
#SingleInstance force Offset := 70 W:: if GetKeyState("A") MouseMove, (Offset * -1) - 30, (Offset * -1), 0, R ; Aggiunta dell'offset di -30 pixel else if GetKeyState("D") MouseMove, Offset + 30, (Offset * -1), 0, R else MouseMove, 0, (Offset * -1), 0, R Sleep 50 Click CenterMouse() return S:: if GetKeyState("A") MouseMove, (Offset * -1) - 30, (Offset + 50), 0, R ; Aggiunta dell'offset di -30 pixel else if GetKeyState("D") MouseMove, Offset + 30, (Offset + 50), 0, R else MouseMove, 0, (Offset + 50), 0, R Sleep 50 Click CenterMouse() return A:: if GetKeyState("W") MouseMove, (Offset * -1) - 30, (Offset * -1), 0, R ; Aggiunta dell'offset di -30 pixel else if GetKeyState("S") MouseMove, (Offset * -1) - 30, Offset, 0, R ; Aggiunta dell'offset di -30 pixel else MouseMove, (Offset * -1) - 30, 0, 0, R ; Aggiunta dell'offset di -30 pixel Sleep 50 Click CenterMouse() return D:: if GetKeyState("W") MouseMove, Offset, (Offset * -1), 0, R else if GetKeyState("S") MouseMove, Offset, Offset, 0, R else MouseMove, Offset + 30, 0, 0, R Sleep 50 Click CenterMouse() return ^.::Click right ^,:: if (A_PriorHotKey = A_ThisHotKey) return Click down return ^, up::Click up CenterMouse() { CoordMode, Mouse, Screen x := A_ScreenWidth / 2 y := A_ScreenHeight / 2 MouseMove, x, y }

present bug:
when releasing W or S while pressing in simultaneous A or D. No input will be detected. needs to repress a direction.

Coursor return to center evry time to detect new input.

Xpadder introduce Extra delay for now best option is to play with mouse and keyboard
C++ soruce Code. (NoClick) (old)
Ok simple c++ code if you want better perfomace and ajust speed of the mouse movement
change the value of speedFactor = 3 to what ever you feel like it.
this code is siglty different becuase the limit is not a cirlce but a rettagle.
I have tested F12 and F11 here but they only work in the compiler when I have build the exe they no logner work for some reason.

#include <iostream> #include <windows.h> void moveMouse(int endX, int endY, int stepCount, int stepDelay, int speedFactor) { POINT startPos; GetCursorPos(&startPos); for (int step = 1; step <= stepCount; ++step) { int currX = startPos.x + (endX - startPos.x) * step / stepCount; int currY = startPos.y + (endY - startPos.y) * step / stepCount; SetCursorPos(currX, currY); Sleep(stepDelay / speedFactor); } } int main() { bool isScriptActive = true; bool isScriptRunning = true; int speedFactor = 1; // Modify this to adjust the speed factor while (isScriptRunning) { if (GetAsyncKeyState(VK_F12) & 0x8000) { isScriptActive = !isScriptActive; if (isScriptActive) { std::cout << "Script is activated." << std::endl; } else { std::cout << "Script is deactivated." << std::endl; } Sleep(200); } else if (GetAsyncKeyState(VK_F11) & 0x8000) { isScriptRunning = false; } if (isScriptActive) { // Check the state of W, A, S, D keys bool wKeyState = GetAsyncKeyState('W') & 0x8000; bool aKeyState = GetAsyncKeyState('A') & 0x8000; bool sKeyState = GetAsyncKeyState('S') & 0x8000; bool dKeyState = GetAsyncKeyState('D') & 0x8000; // Calculate the new cursor position based on key states int newX = GetSystemMetrics(SM_CXSCREEN) / 2; int newY = GetSystemMetrics(SM_CYSCREEN) / 2; if (wKeyState) { newY -= 100; } if (sKeyState) { newY += 100; } if (aKeyState) { newX -= 100; } if (dKeyState) { newX += 100; } // Move the cursor to the new position within the circle with accelerated speed moveMouse(newX, newY, 10, 10, speedFactor); } } return 0; }
C++ Soruce Code (Click) (old)
#include <iostream> #include <windows.h> void moveMouse(int endX, int endY, int stepCount, int stepDelay, int speedFactor) { POINT startPos; GetCursorPos(&startPos); for (int step = 1; step <= stepCount; ++step) { int currX = startPos.x + (endX - startPos.x) * step / stepCount; int currY = startPos.y + (endY - startPos.y) * step / stepCount; SetCursorPos(currX, currY); Sleep(stepDelay / speedFactor); } } void performMouseClick() { mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); } int main() { bool isScriptActive = true; bool isScriptRunning = true; int speedFactor = 1; // Modify this to adjust the speed factor while (isScriptRunning) { if (GetAsyncKeyState(VK_F12) & 0x8000) { isScriptActive = !isScriptActive; if (isScriptActive) { std::cout << "Script is activated." << std::endl; } else { std::cout << "Script is deactivated." << std::endl; } Sleep(200); } else if (GetAsyncKeyState(VK_F11) & 0x8000) { isScriptRunning = false; } if (isScriptActive) { // Check the state of W, A, S, D keys bool wKeyState = GetAsyncKeyState('W') & 0x8000; bool aKeyState = GetAsyncKeyState('A') & 0x8000; bool sKeyState = GetAsyncKeyState('S') & 0x8000; bool dKeyState = GetAsyncKeyState('D') & 0x8000; // Calculate the new cursor position based on key states int newX = GetSystemMetrics(SM_CXSCREEN) / 2; int newY = GetSystemMetrics(SM_CYSCREEN) / 2; if (wKeyState) { newY -= 100; performMouseClick(); } if (sKeyState) { newY += 100; performMouseClick(); } if (aKeyState) { newX -= 100; performMouseClick(); } if (dKeyState) { newX += 100; performMouseClick(); } // Move the cursor to the new position within the circle with accelerated speed moveMouse(newX, newY, 10, 10, speedFactor); } } return 0; }
Future & Suggestions
  • Toggle Move/Click (CapsLock) # DONE #
  • Ajustable raditus size.
  • toggle WASD with ARROWS or Numpad
  • (ajustable speed for the script AHK)

i may suggest to install this mod for easy menu acess.
https://gtm.you1.cn/sharedfiles/filedetails/?id=908304729

for those who play on window mode make sure the window is at the center of the screen.
you could use this program that autocenter windows.

Window Center helper by Kamilszym Borski - free
https://kamilszymborski.github.io/

and if you want the cursor to no go outside of the window you could use

lock cursor tools by digola - Freeware
https://www.digola.com/lockcursor.html
2 comentarios
𓅃 スノ 𓅃  [autor] 12 JUL 2023 a las 10:51 a. m. 
well there are 2 bugs i just discover another, while i was alt tabing caps was stuck. it will not effect you if you much this one was a rare occasion as well.
𓅃 スノ 𓅃  [autor] 12 JUL 2023 a las 10:49 a. m. 
CAPSLOCK smallbug present very rare occasion restart the script to fix it for now i will try to figure out what trigger it and fix it