Pocalypse
08-19-2009, 03:01 AM
I want to share this little tidbit of code I added to my script today, that let's me chat ingame without having to pause hotkeys before or after chatting, and doesn't send any of the chat to my other windows.
This works for 4 keys to start chat:
Y (reply)
shift + Y (re-reply)
/
Enter
and these keys to stop chat:
Enter
NumpadEnter
Esc
This code also includes <If ActiveWinIs WoW> like the rest of my code, so keys work regularly if I'm browsing or doing something else with hotkeynet running. If you don't use that generally, you can remove the those lines.
I use ScrollLockOn as my Do-Not-Pass key, so this code uses ScrollLockOff.
I also had to change my Pause key (that used to be just <ToggleHotKeys>.
Also, this won't work if you start your chat with the mouse (clicking a name in the chat log or rightclicking and clicking whisper).
<Hotkey Pause>
<If Chat is 1>
<SetVar Chat 0>
<TurnHotkeysOn>
<Else If HotkeysAreOn>
<SetVar Paused 1>
<ToggleHotKeys>
<Else If Paused is 1>
<SetVar Paused 0>
<ToggleHotKeys>
<Else>
<ToggleHotKeys>
<EndIf>
<Hotkey ScrollLockOff Oem2; ScrollLockOff Y; ScrollLockOff Shift Y>
<If ActiveWinIsNot WoW>
<SendLabel Fcs>
<Key %Trigger%>
<Else If Paused is 1>
<SendLabel Fcs>
<Key %Trigger%>
<Else>
<SendLabel Fcs>
<Key %Trigger%>
<SetVar Chat 1>
<TurnHotkeysOff>
<EndIf>
<Hotkey ScrollLockOff Enter; ScrollLockOff NumpadEnter>
<If ActiveWinIsNot WoW>
<SendLabel Fcs>
<Key %Trigger%>
<Else If Paused is 1>
<SendLabel Fcs>
<Key %Trigger%>
<Else If Chat is 1>
<SetVar Chat 0>
<SendLabel Fcs>
<Key %Trigger%>
<TurnHotkeysOn>
<Else>
<SetVar Chat 1>
<SendLabel Fcs>
<Key %Trigger%>
<TurnHotkeysOff>
<EndIf>
<Hotkey ScrollLockOff Esc>
<If ActiveWinIsNot WoW>
<SendLabel Fcs>
<Key %Trigger%>
<Else If Paused is 1>
<SendLabel Fcs>
<Key %Trigger%>
<Else If Chat is 1>
<SetVar Chat 0>
<SendLabel Fcs>
<Key %Trigger%>
<TurnHotkeysOn>
<Else>
<SendLabel w01, w02, w03, w04, w05, w06, w07, w08, w09, w10>
<Key %Trigger%>
<EndIf>
This is my Fcs label, it just does SendFocusWin:
<Label Fcs Local SendFocusWin>
Edit: This proved more complicated than I originally thought. I think I have it all fixed now though, I changed the above code a bit. If anyone uses this, please let me know if it works for you.
This works for 4 keys to start chat:
Y (reply)
shift + Y (re-reply)
/
Enter
and these keys to stop chat:
Enter
NumpadEnter
Esc
This code also includes <If ActiveWinIs WoW> like the rest of my code, so keys work regularly if I'm browsing or doing something else with hotkeynet running. If you don't use that generally, you can remove the those lines.
I use ScrollLockOn as my Do-Not-Pass key, so this code uses ScrollLockOff.
I also had to change my Pause key (that used to be just <ToggleHotKeys>.
Also, this won't work if you start your chat with the mouse (clicking a name in the chat log or rightclicking and clicking whisper).
<Hotkey Pause>
<If Chat is 1>
<SetVar Chat 0>
<TurnHotkeysOn>
<Else If HotkeysAreOn>
<SetVar Paused 1>
<ToggleHotKeys>
<Else If Paused is 1>
<SetVar Paused 0>
<ToggleHotKeys>
<Else>
<ToggleHotKeys>
<EndIf>
<Hotkey ScrollLockOff Oem2; ScrollLockOff Y; ScrollLockOff Shift Y>
<If ActiveWinIsNot WoW>
<SendLabel Fcs>
<Key %Trigger%>
<Else If Paused is 1>
<SendLabel Fcs>
<Key %Trigger%>
<Else>
<SendLabel Fcs>
<Key %Trigger%>
<SetVar Chat 1>
<TurnHotkeysOff>
<EndIf>
<Hotkey ScrollLockOff Enter; ScrollLockOff NumpadEnter>
<If ActiveWinIsNot WoW>
<SendLabel Fcs>
<Key %Trigger%>
<Else If Paused is 1>
<SendLabel Fcs>
<Key %Trigger%>
<Else If Chat is 1>
<SetVar Chat 0>
<SendLabel Fcs>
<Key %Trigger%>
<TurnHotkeysOn>
<Else>
<SetVar Chat 1>
<SendLabel Fcs>
<Key %Trigger%>
<TurnHotkeysOff>
<EndIf>
<Hotkey ScrollLockOff Esc>
<If ActiveWinIsNot WoW>
<SendLabel Fcs>
<Key %Trigger%>
<Else If Paused is 1>
<SendLabel Fcs>
<Key %Trigger%>
<Else If Chat is 1>
<SetVar Chat 0>
<SendLabel Fcs>
<Key %Trigger%>
<TurnHotkeysOn>
<Else>
<SendLabel w01, w02, w03, w04, w05, w06, w07, w08, w09, w10>
<Key %Trigger%>
<EndIf>
This is my Fcs label, it just does SendFocusWin:
<Label Fcs Local SendFocusWin>
Edit: This proved more complicated than I originally thought. I think I have it all fixed now though, I changed the above code a bit. If anyone uses this, please let me know if it works for you.