• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

OTClient Disabling space bar when chats active & adding new hotkeys - OTclientv8

nugo

Australia OT Mapper
Joined
Apr 1, 2009
Messages
396
Solutions
4
Reaction score
194
When chats active all my keys are disabled but some still cast spells while chat is active. EG: If you bind spacebar to "exura" it will say exura every time you hit space bar while typing. Were can i disable this like the other letter keys? Also is it possible to add additional hotkeys that OT client can recognize? Eg: Looking to get mouse button 4 & 5 recognizable hotkeys by otlcient, or is this a source edit?.

Cheers
 
I figured out the solution. I will leave it for the people who want to disable hotkeys & actions bars when chat is active (wasd walking is inactive).
Code:
modules/game_console/console.lua
Lua:
function toggleChat()
  if consoleToggleChat:isChecked() then
    modules.game_hotkeys.reload()
    modules.game_actionbar.setActionHotkeysActivity(true)
    disableChat()
  else
    modules.game_hotkeys.disableHotkeys()
    modules.game_actionbar.setActionHotkeysActivity(false)
    enableChat()
  end
end

To make it work we will need 2 additional functions:
Code:
modules/game_hotkeys/hotkeys_manager.lua
Lua:
function disableHotkeys()
  local gameRootPanel = modules.game_interface.getRootPanel()
  for keyCombo,callback in pairs(boundCombosCallback) do
    g_keyboard.unbindKeyPress(keyCombo, callback, gameRootPanel)
  end
end
Code:
modules/game_actionbar/actionbar.lua

Lua:
function setActionHotkeysActivity(activate)
  for index, actionbar in ipairs(actionBars) do
    if actionbar.tabBar then
      for i, actionButton in ipairs(actionbar.tabBar:getChildren()) do
        local callback = actionButton.callback
        local hotkey = actionButton.hotkey and actionButton.hotkey:len() > 0 and actionButton.hotkey or false

        if callback and hotkey then
          local gameRootPanel = modules.game_interface.getRootPanel()
          if (activate) then
            g_keyboard.bindKeyPress(hotkey, callback, gameRootPanel)
          else
            g_keyboard.unbindKeyPress(hotkey, callback, gameRootPanel)
          end
         
        end
      end
    end
  end
end

Function modules.game_hotkeys.reload() is the standard one, no need to create own.
 
Back
Top