Skip to content

Instantly share code, notes, and snippets.

@fabd
Last active February 23, 2024 12:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabd/9dc65babcd3cfccc99eb21b785ea8cb0 to your computer and use it in GitHub Desktop.
Save fabd/9dc65babcd3cfccc99eb21b785ea8cb0 to your computer and use it in GitHub Desktop.
Better Mouse Look Toggle functionality for EverQuest II (EQ2) than the one built in the game. The main difference is you can press the Interact key when facing an NPC or door or chest etc. without having to toggle off MouseLook first. Simply face an NPC or object and press the Interact key to start a dialogue or grab your loot - it works well. T…
;====================================================================
;
; EverQuest II ( EQ2 ) Better Mouse Look Toggle
;
;
; INSTALL (do this once)
; 1. launch game, go to Options > Performance
; - UNCHECK "fullscreen" (we want "windowed" mode)
; - SELECT the desktop resolution
; 2. Exit game
;
; RUNNING GAME (each time you launch the game)
; 1. Run the script
; 2. Launch the game, wait for main window to be open
; 3. Right click the AHK icon in tray bar, select "ACTIVATE Fullscreen Borderless"
; (game window should move briefly, then it should be "on top" of the Windows task bar)
;
; KEYBINDS (ingame)
;
; To make use of the features, you have to rebind some keys:
; - Unbind TAB from "Select Next NPC" and "Select Previous NPC" (suggestion use 'x' and 'shift x')
; (unless you can be comfortable using another key for Mouse Look, then you can leave TAB
; for the Targetting, but whatever you bind to Toggle Mouse Look (in this script), will be
; unusable while typing in chat!)
;
;
; FEATURES
; Mouse Look:
; - Press TAB to toggle mouse look (relievs from holding down the right mouse button)
; - While Mouse Look, use Interract key to activate anything in the center of view
; (convenient to start a NPC dialog, or open a door, and exit Mouse Look at the same time)
;
; Use Ctrl-Tab in chat window to complete commands:
; - If we use Tab to mouse look, we lose ability to auto-complete commands in chat, to
; alleviate this problem, the script maps "Ctrl Tab" to the original TAB key behaviour.
; (eg. type /channell in chat, then press Ctrl-Tab, it should autocomplete to "/channellist")
;
; Press Ctrl Shift V to paste a /waypoint:
; - after copying a waypoint from eg. eq2.fandom.com, press Ctrl Shift V to activate it ingame.
;
;
; GOTCHAS
; - Watchout for "Color Correction" in game options. Any non-default values here will change
; the desktop's color settings when using windowed mode. In game "Color Correction" default
; values: 1, 1, 0, 1, 1, 1.
;
;
; KNOWN ISSUES
; - If Mouse Look is on, after Alt-tabbing the left mouse button doesn't work
; (solution: exit Mouse Look before alt-tab)
;
;
;
; IDEAS
; - Vim style command where you press Ctrl-D (example) and then the following
; letter to actiavte any shortcut. Eg "ctrl d" > "a", "ctrl d" > "b"
; (ideally, to do more things with the left hand, and not have to use keys
; on the right end of the keyboard)
;
;
;====================================================================
#Persistent
#SingleInstance force
;====================================================================
; CONFIGURABLE OPTIONS below:
;====================================================================
; Mouse Look Toggle key (default: Tab)
Toggle_key = Tab
; The "Trigger default action" key in EverQuest 2 (Options > Controls > Command Keys)
Interract_Key = f
; The "Begin command" key ingame (Options > Controls > Chat Keys)
Chat_Slash_Command_Key = :
;====================================================================
; END of configurable options.
;====================================================================
; auto borderless, but do it just once
Borderless = 0
; Misc initialization (don't change these)
mouselook = 0
Hotkey,IfWinActive,ahk_class EQ2ApplicationClass
Hotkey,%Toggle_key%,ToggleMouseLook, UseErrorLevel 2
Hotkey,%Interract_Key%,InterractKey, UseErrorLevel 2
Hotkey,%Chat_Slash_Command_Key%,ActivateChatKey, UseErrorLevel 2
;Menu, TRAY, NoStandard
Menu, Tray, Icon, %A_ScriptDir%/EQII.ico
Menu, TRAY, Add, "ACTIVATE Fullscreen Borderless", Yayfullscreen
Menu, TRAY, Add, "Exit", Quit
Return
Yayfullscreen:
if WinExist("ahk_class EQ2ApplicationClass")
{
Borderless = 1
GameWin = ahk_class EQ2ApplicationClass
WinActivate, %GameWin%
WinSet, AlwaysOnTop, On, %GameWin%
WinSet, AlwaysOnTop, Off, %GameWin%
if (!ErrorLevel)
{
; -0xC00000 to remove title bar
; -0xC40000 to remove resize borders
WinMove, %GameWin%, , 0, 0
WinSet, Style, -0xC40000, %GameWin%
WinMove, %GameWin%, , 0, 0, A_ScreenWidth, A_ScreenHeight
}
}
return
Quit:
ExitApp
Return
#IfWinActive ahk_class EQ2ApplicationClass
; '@' small key left of number 1 key & above Tab key ("tilde" on Qwerty keyboards)
; (add modifiers Shift & Alt because sometimes I meant to type "Shift 1" and press tilde key,
; which enables chat window and messes up combat)
$SC029::
$+SC029::
; Activate Interrupt skill
Send !&
Return
; Ctrl Shift V to quickly paste and activate a /waypoint copied from EQ2 wikis
$^+v::
Send {Enter}
Sleep 10
Send ^v
Send {Enter}
Soundbeep 350,100
Return
;
$^Tab::
Send {Tab}
Return
; While Mouse Look is active, allow LMB to "Interract" with anything at center of view,
; briefly, then re-activate Mouse Look (handy to open doors without leaving mouselook)
; $LButton::
; if (mouselook == 1)
; {
; ReleaseMlook()
; Sleep, 10
; ; Send {%Interract_Key%}
; Click left
; Sleep 10
; Gosub ToggleMouseLook
; Return
; }
; Click down left
; KeyWait, LButton
; Click up left
; Return
ToggleMouseLook:
if (mouselook == 0)
{
mouselook := 1
DllCall("SetCursorPos", int, (A_ScreenWidth/2-4) , int, (A_ScreenHeight/2))
Send {RButton down}
Sleep, 10
Return
}
ReleaseMlook()
return
; The Interract hotkey allows us to send a left click in the middle of the view,
; without having to remember to turn off mouselook each time.
;
; We have to release the right mouse button (free look), otherwise RMB + LMB makes character walk forward.
;
InterractKey:
if (mouselook == 1)
{
ReleaseMlook()
; Handy, but sometimes annoying behaviour
Sleep, 10
Click left
Sleep, 10
; We REPLACE the "interract" with a "left click in the center of the view"
Return
}
; If not using mouselook, let the key through -- otherwise can't use that key in chat...
Send {%Interract_Key%}
Return
; Release mouselook when activating chat window, because TAB can be used to complete /commands
ActivateChatKey:
ReleaseMlook()
Send {%Chat_Slash_Command_Key%}
Return
ReleaseMlook()
{
global mouselook
if (mouselook == 1)
{
; SoundBeep,,50
mouselook := 0
Send, {RButton UP}
}
}
; Release the Right Mouse Button when switching focus away from the game window
; (otherwise the left mouse button somehow doesn't register outside of the game)
~!TAB::
~^!DEL::
ReleaseMlook()
Return
~LWin::
ReleaseMlook()
Send, {LWin}
Return
~RWin::
ReleaseMlook()
Send, {RWin}
Return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment