mouselook toggle script

mouselook toggle script

in Players Helping Players

Posted by: muppet.5947

muppet.5947

i come from a background of fps games, where you don’t need to hold right-click in order to look around. i also found it quite awkward to turn with “a” and “d” — i quickly changed those to strafe left/right. i searched for a script to automatically hold down right-click for me, and found a few. but none of them were very good so i made my own using autohotkey (ahk)!

ahk is a pretty common program for creating macros. for those who are unfamiliar with it, after you download the program you should:

  • delete the contents of “AutoHotkey.ahk”
  • copy-paste my script in there; save
  • reload the script in ahk



#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 = q  ;choose which key to toggle MouseLookKey depress

Hotkey, ~*%ToggleKey%, ToggleMouseLook

~o::  ;all these hotkeys call ToggleOff()
~y::
~g::
~h::
~i::
~k::
~f12::
~f11::
~p::
~b::
~n::
~m::
~c::
~WheelDown::
~WheelUp::ToggleOff()

!TAB::  ;when you alt-tab, toggle off first
ToggleOff()
Send {Alt Down}{Tab}
return


ToggleOff()
{
	global
	if(GetKeyState(MouseLookKey))  ;key is held down
	{
		send {%MouseLookKey% up}
	}
}

ToggleMouseLook:
        if(GetKeyState(MouseLookKey))
        {
                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}
        }
return

this is what the script does:

  • when you press “q,” the right mouse button is held down, and the mouse is centered. if you press it again, the right mouse button is released. you can change ToggleKey something other than “q.”
  • when you open a dialog (e.g. you press “i” to open your inventory), right-click is released (toggled off).
  • when you alt-tab from gw2, right-click is released.
  • the script’s hotkeys are only active when gw2 is the active window.

i do not use all the default keys, in particular i use:

  • “c” for interact and “f” for aoe loot. i found it beneficial to have interact and loot on separate keys, because i want to release right click most of the times when i interact. however, when i loot i always want right click to still be held down.
  • mouse wheel for zooming in and out (WheelDown and WheelUp). right click has to be released in order to zoom in or out.

some other custom keys i use in gw2, but are not affected by my script: “a” and “d” for strafing; “e” for free camera; and, “x” for lock autotarget (use to untarget).

this is my first ahk script. let me know what you think!

mouselook toggle script

in Players Helping Players

Posted by: Saulius.8430

Saulius.8430

i think, that would make you handicapped in pvp

some skills shoot/move to where your cursor is pointing. therefor player who don’t have his cursor locked in the middle of the screen will have more control of his character

edit: btw this idea is not new, google for gw2 combat mode. topic used to be popular long time ago

kill all ze thingz

mouselook toggle script

in Players Helping Players

Posted by: muppet.5947

muppet.5947

it doesn’t lock the cursor in the middle of the screen. it only moves it there. that way, when i use an aoe skill the cursor always starts off in the middle of the screen.

mouselook toggle script

in Players Helping Players

Posted by: Brother Grimm.5176

Brother Grimm.5176

Might give this a try, but one thing I’ve found is that holding down the right mouse key (camera rotate) diminishes jumping capability in some slight way. It either effects the height / distance range of the jump slightly or enables some difference in the character’kitten box so potential terrain collisions happen differently when the rotate camera button is held during the jump.

We go out in the world and take our chances
Fate is just the weight of circumstances
That’s the way that lady luck dances

mouselook toggle script

in Players Helping Players

Posted by: Wasbunny.6531

Wasbunny.6531

This is sort of amazing.

Everything seems to be working but I can’t get my mouse wheel to continue to zoom (as I have it set now).

Nonetheless it’s a really great cruise control toggle. If there was anyway in GW2 to be able to assign a new action for the right mouse click (which with the script running is useless except to toggle it off) it would be incredible.

Great job, my mouse and I thank you.

~An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way.~

mouselook toggle script

in Players Helping Players

Posted by: muppet.5947

muppet.5947

Might give this a try, but one thing I’ve found is that holding down the right mouse key (camera rotate) diminishes jumping capability in some slight way. It either effects the height / distance range of the jump slightly or enables some difference in the character’kitten box so potential terrain collisions happen differently when the rotate camera button is held during the jump.

hmm..i haven’t noticed any difference in jumping. i can’t think of any reason why it would affect jumping either..

mouselook toggle script

in Players Helping Players

Posted by: muppet.5947

muppet.5947

This is sort of amazing.

Everything seems to be working but I can’t get my mouse wheel to continue to zoom (as I have it set now).

Nonetheless it’s a really great cruise control toggle. If there was anyway in GW2 to be able to assign a new action for the right mouse click (which with the script running is useless except to toggle it off) it would be incredible.

Great job, my mouse and I thank you.

:)

what do you mean you can’t get your mouse wheel to continue to zoom?

mouselook toggle script

in Players Helping Players

Posted by: Ameepa.6793

Ameepa.6793

Might give this a try, but one thing I’ve found is that holding down the right mouse key (camera rotate) diminishes jumping capability in some slight way. It either effects the height / distance range of the jump slightly or enables some difference in the character’kitten box so potential terrain collisions happen differently when the rotate camera button is held during the jump.

You are just imagining things.

OP:

But about the topic, are you sure that you are allowed to use that kind of thing? Usually all kinds of macros, scripts and use of 3rd party software is against the rules.

(edited by Ameepa.6793)

mouselook toggle script

in Players Helping Players

Posted by: Danikat.8537

Danikat.8537

I did something similar using the Logitech gaming software (which comes with their mice) – I have one of my mouse buttons set to a right click toggle. It works exactly like holding the button down (so the cursor disappears) but saves me having to actually hold it which stops my hand getting sore when doing jumping puzzles and things.

It can be annoying if I didn’t centre the cursor before doing it and then I try to use a ground targeted skill, but it’s just one press of either that button or the right mouse button to reset it, which I now do as soon as I go into combat, without even really thinking about it.

But about the topic, are you sure that you are allowed to use that kind of thing? Usually all kinds of macros, scripts and use of 3rd party software is against the rules.

It’s not quite that simple. The rule is that no matter what you’re using one key/button press must lead to one action in one copy of the game.

You can use things like the software that comes with gaming mice to map keyboard commands to the mouse, or programs like Xpadder to use a totally different control system and they’ve previously confirmed that the GW2 Combat Mode mod (which is basically the same as this) is ok too.

What you can’t do is set up a script, using any program, that would (for example) turn off right click, center the cursor and ready a ground-targeted skill when you enter combat. Because that’s 3 actions that would normally need 3 separate inputs from the player happening automatically.

It can seem like a grey area because the same software that allows perfectly legal things like using a gaming mouse can be used for illegal actions. (For example the Logitech Gaming Software, which as I said comes free with all their gaming mice, can be used to create a simple botting program.)

But in practice it’s relatively straight-forward and should be very obvious to anyone setting it up if what they’re doing isn’t allowed. If you’re programming in more than 1 action to a button then it’s not allowed.

Danielle Aurorel, Dear Dragon We Got Your Cookies [Nom], Desolation (EU).

“Life’s a journey, not a destination.”

mouselook toggle script

in Players Helping Players

Posted by: Brother Grimm.5176

Brother Grimm.5176

Might give this a try, but one thing I’ve found is that holding down the right mouse key (camera rotate) diminishes jumping capability in some slight way. It either effects the height / distance range of the jump slightly or enables some difference in the character’kitten box so potential terrain collisions happen differently when the rotate camera button is held during the jump.

You are just imagining things.

That’s possible, but there are several specific locations in JPs (more than one) that I will miss EVERY time if I keep the move camera button held down and yet I will make 9 out of 10 times is I release the camera button. I mentioned it to several players having the same difficulty and they noticed the difference as well (all finished the JP soon afterwards).

Maybe I am crazy.

We go out in the world and take our chances
Fate is just the weight of circumstances
That’s the way that lady luck dances

mouselook toggle script

in Players Helping Players

Posted by: kvazarsky.9468

kvazarsky.9468

I’ve found simple toggle on click rmb script:


toggle=0
return

rbutton::
toggle:=!toggle
if toggle=1
click ,right ,down
else
click, right, up
return

http://www.autohotkey.com/board/topic/90938-right-mouse-toggle-help/

BTW. Anyone found dev’s opinion about this simple-scripting thing? Is this bannable?

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.

mouselook toggle script

in Players Helping Players

Posted by: Infi.4053

Infi.4053

Hi!

I would like to tell you, that your script is absolutely amazing. I have changed some things so i can toggle off the right mouse button with R click. Still i have a question:

How can i enable left mouse button to work normally like attacking monsters or choosing target for AOE spell? When right mouse button is toggled its working like moving forward button.