Reply
Thread Tools

Kibou81

LightbulbSolution: Mouselook Toggle (Autohotkey)


Mouselook Toggle via Autohotkey

Current Version of the Script: 1.2 (Juli 7th 2012)


If you want to upgrade your control scheme from Doom 1 & 2 to the modern, mouselook-based control scheme of such recent games like Quake 1, you can do so by using the tool AutoHotKey. Here's what you need to do:

1. Download AutoHotKey and install it: http://www.autohotkey.com/ (it's free)

2. Create a new, empty text file. Open it in notepad.

3. Copy & paste all the text from the box below into your text file

4. Rename your textfile to mouselook.ahk

5. Double-click mouselook.ahk to start the script

An icon showing an "H" with green background appears in your system tray while the script is running. To stop it, right-click that icon and select Exit.

While the script is running, right-clicking once counts as holding down the right mouse button, clicking again counts as releasing it. Thus, you can toggle mouse-look on and off in the game with a single click, instead of having to hold down the right mouse button for 1 hour and 55 minutes during a 2 hour play session. Instead of steering you character like some kind of tank, you can naturally look around like moving your head in the real world. You can even pull of exciting moves like strafing and turning at the same time, e.g. to circle around enemies while attacking.

Important: If you want to do anything that usually requires a single right-click (e.g. using a health potion or equiping a new weapon) you have to perform a right-double-click instead! If you're using version 1.2, a single right-click while holding Alt will also do the trick.


Have fun playing with feasible controls!


Code:
; The Secret World Mouselook Toggle ver. 1.2

#NoEnv
SendMode Input

#IfWinActive The Secret World

$RButton::
If (Toggle := !Toggle)
Send {RButton Down}
Else
Send {RButton up}
Return

$!RButton::
if (Toggle) 
{
Toggle := !Toggle
}
Send {RButton}
Return

~m::
~n::
~k::
~p::
if (Toggle)
{
Toggle := !Toggle
Send {RButton up}
}
Return


#IfWinActive

Update History


Version 1.0

The first version of the script, that was posted in the Beta Weekend #1 forum.

Version 1.1

This version was posted in the "General Discussion" section of the old forum.

Application-specific Script: Now the script is only active while "The Secret World" is running in the foreground, so it doesn't mess up the right mouse button in windows or other applications. Even if you Alt-Tab out of the Secret World, everything works fine. If you don't want to bother with starting the script each time you play, you can just put a link in your startup folder and have it running permanently.

Mouselook Off for full-screen Menus: With the new script, if you access the map, skill menu, ability menu or PvP menu while mouselook is on, mouselook is automatically turned off. This is especially helpful for the map, because you don't have to deal with the unwanted appearance of this "new marker" thingy all the time. Please note that you have to modify the script accordingly if you aren't using the default keys (m, k, n, p) for those menus.

Version 1.2

The first version to be posted in the new forum.

Workaround for normal right-clicks: The biggest drawback of my script is that, due to the way it works, you have to perform a right-double-click if you want to do something that usually requires a single right-click, e.g. drinking potions, equipping weapons and talismans or splitting up stacks of crafting materials. Especially the latter two forced you to click like crazy, so I've tried to come up with a workaround: Instead of performing a right-double-click, you can hold Alt and perform a single right-click. I'm afraid it won't get any better than that.

Version number in script: There's now a one-line comment at the beginning of the script that contains the version number. Since there are now three different version of the script, I thought it might be useful. If your script doesn't have the version number at the beginning, you should update it (to view the script, right-click your mouselook.ahk-file, select "open with" and select Notepad).

Shorter section for full-screen mouselook off: I've improved the section that automatically turns off mouselook when you access a full-screen menu. No actual difference when using the script, but it's less work to edit the script if you've changed your in-game keybindings.

haijulikani

haijulikani's Avatar
This is awesome, man. Thanks.

DaSaints

Works like intended. Thanks for sharing the code!

Phylo

Phylo's Avatar
OMG, me and my aching hand thank you for this.

A question though and I don't really know anything about scripting but is there anyway to set the toggle to just the alt key? Or any other key on the keyboard. Or even another button on the mouse? I've got these extra buttons that doesn't really do anything except forward and back on a browser.

Update: So, I haven't actually got this to work yet. I've pared down most of the code to just the right-click toggle to try troubleshooting it. Works while on the desktop. But not on the game.

Update 2: Ok, it's working now. Just restarted everything.
Last edited by Phylo; 07-08-2012 at 04:29 PM.

kimikaze

Here is the script I use. It's based on scripts I found on the old beta forums so the credit goes to them and OP. It works fantastic with my hammer/shotgun build, and might work for tanking and ranged setups too.

If you want to use this make sure left ctrl is not bound to anything as that is the toggle key.

Left, Right and Middle mouse button is bound to 1, 2, and 3 keys. In addition I have bound mouse button 4 and 5 too the 4 and 5 keys in TSW key bindings, so I only have 2 hotkeys I use from the keyboard (bound too 'g' and 'h'),

Make sure you leave mouse look mode before you exit the game or alt tabs out.

Code:
; -. Toggles mouselook when Left Ctrl is pressed
; -. Binds Left, Right, and Middle Mouse buttons to 1, 2, and 3 keys when in mouse look mode
; -. Exit Mouse look mode when you press esc

#NoEnv
#SingleInstance Force
#IfWinActive ahk_class TSW		; Only activate while in TSW

MouseLook = 1
Gosub, ToggleCursor

; Change "LCtrl" to a key of your choice - http://www.autohotkey.com/docs/KeyList.htm
~LCtrl::
Gosub, ToggleCursor
Return

Esc::
if (MouseLook)
{
Gosub, ToggleCursor
Send {Esc}
}
Else
Send {Esc}
Return

ToggleCursor:
if MouseLook = 0
{
	Send {RButton Down}
	MouseLook = 1
}
else
{
	Send {RButton Up}
	MouseLook = 0
}
Hotkey,*LButton,Toggle
Hotkey,*LButton UP,Toggle
Hotkey,*RButton,Toggle
Hotkey,*RButton UP,Toggle
Hotkey,*MButton,Toggle
Hotkey,*MButton UP,Toggle
Return

#If (MouseLook)
{
LButton::1
RButton::2
MButton::3
}
Last edited by Kimikaze; 07-30-2012 at 09:13 PM.

Freyna

Freyna's Avatar
Awesome script, props! Funcom should definitely add this feature to the game client.

jezuitx

Many thanks for this script. The camera was killing me and the OPs script made everything so much more manageable.

beren-

Thumbs upKudos

Quote:
Originally Posted by Kimikaze View Post
Here is the script I use. It's based on scripts I found on the old beta forums so the credit goes to them and OP. It works fantastic with my hammer/shotgun build, and might work for tanking and ranged setups too.

If you want to use this make sure left ctrl is not bound to anything as that is the toggle key.

Left, Right and Middle mouse button is bound to 1, 2, and 3 keys. In addition I have bound mouse button 4 and 5 too the 4 and 5 keys in TSW key bindings, so I only have 2 hotkeys I use from the keyboard (bound too 'g' and 'h'),

Make sure you leave mouse look mode before you exit the game or alt tabs out.

Code:
; 1. Toggles mouselook when Left Ctrl is pressed
; 2. Binds Left, Right, and Middle Mouse buttons to 1, 2, and 3 keys when in mouse look mode
; 3. Exit Mouse look mode when you press esc

#NoEnv
#SingleInstance Force
#IfWinActive ahk_class TSW		; Only activate while in TSW

MouseLook = 1
Gosub, ToggleCursor

; Change "LCtrl" to a key of your choice - http://www.autohotkey.com/docs/KeyList.htm
~LCtrl::
Gosub, ToggleCursor
Return

Esc::
if (MouseLook)
{
Gosub, ToggleCursor
Send {Esc}
}
Else
Send {Esc}
Return

ToggleCursor:
if MouseLook = 0
{
	Send {RButton Down}
	MouseLook = 1
}
else
{
	Send {RButton Up}
	MouseLook = 0
}
Hotkey,*LButton,Toggle
Hotkey,*LButton UP,Toggle
Hotkey,*RButton,Toggle
Hotkey,*RButton UP,Toggle
Hotkey,*MButton,Toggle
Hotkey,*MButton UP,Toggle
Return

#If (MouseLook)
{
LButton::1
RButton::2
MButton::3
}



This is exactly what I was looking for! Just like a FPS now, thanks so much!

Dragon Song

You sir are God! I'm going to start playing now.

However this should have been in at launch as a toggle in the control menu.

Browulf

Thanks very much!!! Hopefully this reduces my chance of getting carpal tunnel syndrome.
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:10 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.