Showing Posts For Terenth.2985:

mouselook toggle script

in Players Helping Players

Posted by: Terenth.2985

Terenth.2985

hey everyone, logged in to share the modded code, currently uses middle button on mouse to toggle on/off. I added 1 and 5 to the mouse while enabled for attacks (VK31/VK35) you can easily change them for others just look up the key list in the autohotkey help file

hope this helps someone.


; IMPORTANT INFO ABOUT GETTING STARTED: Lines that start with a
; semicolon, such as this one, are comments. They are not executed.

; This script has a special filename and path because it is automatically
; launched when you run the program directly. Also, any text file whose
; name ends in .ahk is associated with the program, which means that it
; can be launched simply by double-clicking it. You can have as many .ahk
; files as you want, located in any folder. You can also run more than
; one .ahk file simultaneously and each will get its own tray icon.

; SAMPLE HOTKEYS: Below are two sample hotkeys. The first is Win+Z and it
; launches a web site in the default browser. The second is Control+Alt+N
; and it launches a new Notepad window (or activates an existing one). To
; try out these hotkeys, run AutoHotkey again, which will load this file.

#SingleInstance force
#MaxThreadsBuffer On
#NoEnv
SendMode Input
SetWorkingDir A_ScriptDir
#InstallKeybdHook
#InstallMouseHook
#IfWinActive ahk_class ArenaNet_Dx_Window_Class ;hotkeys only work when GW2 is active

MouseLookKey = RButton
ToggleKey = MButton ;choose which key to toggle MouseLookKey depress

Hotkey, ~*%ToggleKey%, ToggleMouseLook

ToggleMouseLook:

if(GetKeyState(MouseLookKey))
{
HotKey, *Lbutton, off
HotKey, *Lbutton up, off
HotKey, *Rbutton, off
HotKey, *Rbutton up, off
send {%MouseLookKey% up}
}
else
{
BlockInput, Mousemove
WinGetPos,,,WinWidth,WinHeight,ahk_class ArenaNet_Dx_Window_Class
MouseMove,WinWidth/2,WinHeight/2,1
BlockInput, MouseMoveOff
send {%MouseLookKey% down}
HotKey, *Lbutton, on
HotKey, *Lbutton up, on
HotKey, *Rbutton, on
HotKey, *Rbutton up, on
Lbutton::VK31
RButton::VK35
}

; Note: From now on whenever you run AutoHotkey directly, this script
; will be loaded. So feel free to customize it to suit your needs.

; Please read the QUICK-START TUTORIAL near the top of the help file.
; It explains how to perform common automation tasks such as sending
; keystrokes and mouse clicks. It also explains more about hotkeys.