SetConsoleKey

Development Tools Login to Add Favorites
  • 0 Likes
  • World of Warcraft
  • 11 Monthly Downloads
  • Supports: 4.3
  • 614 Total Downloads
  • Updated 11/30/2011 3:15:49 PM
  • Created 3/23/2011 12:30:24 PM
  • 0 Favorites
  • Project Site
  • Comments
  • Release Type: Release
  • License: Public Domain
  • Newest File: Release 1.0.3
or

About SetConsoleKey

This addon is used to remember your SetConsoleKey keybinding when using wow in -console mode. By design, the client will not remember your console keybind and I find myself annoyed with having to reset it every time I restart the game. This simple addon hooks the SetConsoleKey function so it can save your last console keybind and then loads it on startup.

Note: Due to the way addons are loaded, this addon can only set your console key after you have selected a character. Prior to selecting a character (that loads this addon) The console key will remain bound to the default tilde key.

I did not include any command line scripts as I did not feel they were necessary. Since this hooks the SetConsoleKey function itself, you simply set the key the normal way i.e. /script SetConsoleKey("KEYTOBIND");

If you are unfamiliar with console mode and/or the usage of this function visit: http:www.wowpedia.org/API_SetConsoleKey

------------------------------------------------------------------------
r10 | papsol | 2011-11-30 21:14:59 +0000 (Wed, 30 Nov 2011) | 1 line
Changed paths:
   A /tags/Release 1.0.3 (from /trunk:9)

Tagging as Release 1.0.3
------------------------------------------------------------------------
r9 | papsol | 2011-11-30 21:14:26 +0000 (Wed, 30 Nov 2011) | 3 lines
Changed paths:
   M /trunk/SetConsoleKey.toc

v1.0.3

TOC update
------------------------------------------------------------------------

Comments

  • #2

    Feature request: to enable/disable/toggle the console so we still have our settings and can play the game without debugging for awhile. Add /run SetConsoleKey("on"), /run SetConsoleKey("off"), or a minimap button? For example, it seems to disable the console with any invalid shift key like tilde, or enable to restore the saved variable, SCK_DATA.

    Test with the code below. Enabled if key is like "F7". Disabled if tilde in front of key like "~F7". In the future, the code could be much simpler if SCK_DATA was a table = {} and not just a value.

    function SetConsoleKey(...)
       local newkey = ... or ""
       local disabledkey = "~" -- key to disable console, e.g. tilde = Shift-`
       local lastdisabled = ( strsub(SCK_DATA,1,1) == disabledkey ) -- disabled if tilde in front of key
       local lastkey = string.gsub(SCK_DATA, "("..disabledkey..")", "") -- key without tilde
     
       if ( strlower(newkey) == "toggle" ) then -- /run SetConsoleKey("toggle")
          if ( lastdisabled and strlen(lastkey) > 0 ) then newkey = "on"
          else newkey = "off"
          end
       end
     
       -- enable console and restore old key without tilde
       if ( strlower(newkey) == "on" ) then -- /run SetConsoleKey("on")
          SCK_DATA = lastkey;
          print("SetConsoleKey:", SCK_DATA);
          BlizSetConsoleKey(SCK_DATA);
     
       -- disable console with tilde in front of key
       elseif ( strlower(newkey) == "off" ) then -- /run SetConsoleKey("off")
          SCK_DATA = disabledkey..lastkey;
          print("SetConsoleKey:", "off");
          BlizSetConsoleKey(SCK_DATA);
     
       -- set new key
       else -- /run SetConsoleKey(...)
          SCK_DATA = newkey;
          print("SetConsoleKey:", SCK_DATA);
          BlizSetConsoleKey(SCK_DATA);
       end

    P.S. Interesting how Blizz defines the default as a tilde-key, when it is really a reverse quote. Tilde is Shift-` and shifting is invalid. Probably preferring tilde since easier to say and see.

  • To post a comment, please login or register a new account.
Learn how to disable ads
Learn how to disable ads
Login to Curse

Don't have an account? Create One.

Get an epic experience with Curse Premium
  • Faster addon downloads
  • Premium-Only Beta Giveaways
  • Ad-Free Curse experience
  • Premium Curse Client
  • and many More Features
  • Learn More »

Diablo III Giveaway

Enter Now!