• 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!

Hotkeys

Exura ATS

New Member
Joined
Feb 5, 2017
Messages
72
Reaction score
4
How can I change / edit / remove / create the Hotkeys buttons on OTC 0.6.3?

rh4lkz.png


I want to create some new custom hotkeys (after removing Add and Remove buttons), setted for some new keys like 1, 2, 3, 4, 5, 6, 7, 8, 9, and 0 on number pad that players can't remove the hotkey entry (key), only set it to some action like "exura"
 
For example remove buttons 'Add' and 'Remove':

First remove buttons in OTUI file:
OTC_Help_1_21.02.png


Second remove lua function from lua file (@onClick):
OTC_Help_2_21.02.png

OTC_Help_3_21.02.png
 
Last edited:
First remove from otui file buttons with ids:
Code:
addHotkeyButton
removeHotkeyButton

Second remove from lua:
Lua:
addHotkeyButton = nil
removeHotkeyButton = nil


 addHotkeyButton = hotkeysWindow:getChildById('addHotkeyButton')
 removeHotkeyButton = hotkeysWindow:getChildById('removeHotkeyButton')

function addHotkey()
function removeHotkey()
 
Pictures edited.
Funny situation because in my computer i see this pictures, but on my mobile phone I don't see it.
lolxD.png
 
Pictures edited.
Funny situation because in my computer i see this pictures, but on my mobile phone I don't see it.
lolxD.png

Do you know how can I change the keys from hotkeys?
I want to make hotkeys on other keys like keys from numpad or something
 
You may change default hotkeys by other in this function:
OTClient_Help_23.02.png


Change F1-F12:
1. Delete two for loop ('F1-F12' + 'Shift+F1-Shift+F4').
Lua:
for i=1,12 do
    addKeyCombo('F' .. i)
end
for i=1,4 do
    addKeyCombo('Shift+F' .. i)
end
2. New loop:
Lua:
for i=0, 9 do
    addKeyCombo(tostring(i))
end
3. Delete 'Add' and 'Remove' buttons (tutorial in second post).
 
You may change default hotkeys by other in this function:
OTClient_Help_23.02.png


Change F1-F12:
1. Delete two for loop ('F1-F12' + 'Shift+F1-Shift+F4').
Lua:
for i=1,12 do
    addKeyCombo('F' .. i)
end
for i=1,4 do
    addKeyCombo('Shift+F' .. i)
end
2. New loop:
Lua:
for i=0, 9 do
    addKeyCombo(tostring(i))
end
3. Delete 'Add' and 'Remove' buttons (tutorial in second post).

Thank you so much, brother.
REP+

Do you know how can I remove Q, Z, C and E keys to walk diagonally?
 
If you want to delete this button:
First delete in OTUI:
OTClient_Help_Console_1_23.02.png

Second delete in LUA:
OTClient_Help_Console_2_23.02.png

OTClient_Help_Console_3_23.02.png


If you want to delete only E,Q,C,Z keys you must delete:
In function enableChat():
Lua:
gameInterface.unbindWalkKey("E")
gameInterface.unbindWalkKey("Q")
gameInterface.unbindWalkKey("C")
gameInterface.unbindWalkKey("Z")
And In function disableChat():
Lua:
gameInterface.bindWalkKey("E", NorthEast)
gameInterface.bindWalkKey("Q", NorthWest)
gameInterface.bindWalkKey("C", SouthEast)
gameInterface.bindWalkKey("Z", SouthWest)
 
If you want to delete this button:
First delete in OTUI:
OTClient_Help_Console_1_23.02.png

Second delete in LUA:
OTClient_Help_Console_2_23.02.png

OTClient_Help_Console_3_23.02.png


If you want to delete only E,Q,C,Z keys you must delete:
In function enableChat():
Lua:
gameInterface.unbindWalkKey("E")
gameInterface.unbindWalkKey("Q")
gameInterface.unbindWalkKey("C")
gameInterface.unbindWalkKey("Z")
And In function disableChat():
Lua:
gameInterface.bindWalkKey("E", NorthEast)
gameInterface.bindWalkKey("Q", NorthWest)
gameInterface.bindWalkKey("C", SouthEast)
gameInterface.bindWalkKey("Z", SouthWest)

Thank you again, bro.
But something isn't working well.
If I set key "Q" to cast an "exura" (for example), when I'm writing with the chat enable and type a "q", the character heals itself with an exura, even with chat enabled. How can I solve this? ): It's happening with any key.

My idea is to make hotkeys working only with chat disabled.
Thank you for helping, by the way!

@EDIT
And want to remove "Shift+Fs" from default hotkeys.
 
Forget everything, I'll try to explain what I really want to edit on my OTC.

So...

1. Remove "Shift + Fs" on hotkeys, making only F1-F12 being default;
2. Remove actions "walk diagonally" from Q, E, Z, and C keys;
3. Make hotkeys only be cast with Chat Disabled;
4. "Enter" key changing between "Chat Mode (Disabled/Enabled)";
5. "Shift + WASD" Turn character to North, West, East and South.

I think that's all.
I don't want to delete Add and Remove hotkeys buttons anymore. But thanks for helping!!!
@MagicWall
 
Last edited:
1. Remove function mentioned to create those inside hotkeys.lua, just save for F[x].
2. Remove like mentioned above from console.lua.
3. Unbind hotkeys inside enableChat function inside console.lua and then bindthem again inside disableChat.
4. Bind it inside interface.lua or console.lua to toggleChat.
5. Add this to interface.lua (not tested)
Lua:
g_keyboard.bindKeyPress('Shift+W', function() g_game.turn(North) changeWalkDir(North) end, gameRootPanel)
g_keyboard.bindKeyPress('Shift+D', function() g_game.turn(East) changeWalkDir(East) end, gameRootPanel)
g_keyboard.bindKeyPress('Shift+S', function() g_game.turn(South) changeWalkDir(South) end, gameRootPanel)
g_keyboard.bindKeyPress('Shift+A', function() g_game.turn(West) changeWalkDir(West) end, gameRootPanel)
 
1. Remove function mentioned to create those inside hotkeys.lua, just save for F[x].
2. Remove like mentioned above from console.lua.
3. Unbind hotkeys inside enableChat function inside console.lua and then bindthem again inside disableChat.
4. Bind it inside interface.lua or console.lua to toggleChat.
5. Add this to interface.lua (not tested)
Lua:
g_keyboard.bindKeyPress('Shift+W', function() g_game.turn(North) changeWalkDir(North) end, gameRootPanel)
g_keyboard.bindKeyPress('Shift+D', function() g_game.turn(East) changeWalkDir(East) end, gameRootPanel)
g_keyboard.bindKeyPress('Shift+S', function() g_game.turn(South) changeWalkDir(South) end, gameRootPanel)
g_keyboard.bindKeyPress('Shift+A', function() g_game.turn(West) changeWalkDir(West) end, gameRootPanel)

I don't know how to do that, especially "bind" or "unbind" things.
I need the codes and where to put them (lines).
But thanks for helping, I'm grateful. REP+

The code you sent me is working, but I need to know how to make it works only with chat disabled. But thanks a lot, bro.
 
Last edited:
Nr 3.
First make functions and variables to distable keys (behind line 48, it's global functions and variables).
Lua:
consoleblocksignstable = {'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', 'X', 'C', 'V', 'B', 'N', 'M','`', '-', '=', '[', ']', ';', '<', '>', '/'}

function unbindmykeys()
  for a,b in pairs(consoleblocksignstable) do
    g_keyboard.unbindKeyPress(b)
  end
end

function bindmykeys()
  for a,b in pairs(consoleblocksignstable) do
    g_keyboard.bindKeyPress(b, modules.game_hotkeys.boundCombosCallback[b])
  end
end
OTClient_Help_1_24.02.png


Second distable keys in init function and in hotkeys_manager.lua - [function load(forceDefaults)] (because when OTC started, keys is enabled, function init())
Lua:
unbindmykeys()
OTClient_Help_2_24.02.png


Lua:
if g_game.isOnline() then
    modules.game_console.unbindmykeys()
end
OTClient_Help_5_24.02.png


Third add new functions enable/distable:
(function enableChat())
Lua:
unbindmykeys()
OTClient_Help_3_24.02.png


In function disableChat()
Lua:
bindmykeys()
OTClient_Help_4_24.02.png
 
Last edited:
Nr 3.
First make functions and variables to distable keys (behind line 48, it's global functions and variables).
Lua:
consoleblocksignstable = {'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', 'X', 'C', 'V', 'B', 'N', 'M','`', '-', '=', '[', ']', ';', '<', '>', '/'}

function unbindmykeys()
  for a,b in pairs(consoleblocksignstable) do
    g_keyboard.unbindKeyPress(b)
  end
end

function bindmykeys()
  for a,b in pairs(consoleblocksignstable) do
    g_keyboard.bindKeyPress(b, modules.game_hotkeys.boundCombosCallback[b])
  end
end
OTClient_Help_1_24.02.png


Second distable keys in init function and in hotkeys_manager.lua - [function load(forceDefaults)] (because when OTC started, keys is enabled, function init())
Lua:
unbindmykeys()
OTClient_Help_2_24.02.png


Lua:
if g_game.isOnline() then
    modules.game_console.unbindmykeys()
end
OTClient_Help_5_24.02.png


Third add new functions enable/distable:
(function enableChat())
Lua:
unbindmykeys()
OTClient_Help_3_24.02.png


In function disableChat()
Lua:
bindmykeys()
OTClient_Help_4_24.02.png

Thank you so so much, dude!
It's working perfectly.

Really grateful!!!
It's almost done... Shift + WASD is still turning character to Left / West / North / South even with chat mode enabled. Can you make me a little tutorial "how to bind/unbind keys"? I think it can be easier for me if I learn how to do that. And lesser boring for you, I though.

I was thinking about making disable chat mode "default mode", so when players want to send or speak something, they will need to press Enter key, write, and when pressing Enter again to send message, the chat mode turns to disabled again. Is it a good idea? What do you think? :s

I don't know why, but, even with chat mode enabled some hotkeys are still working, I've done everything like you said to do... ):

@EDIT
Sorry, eer... what may I edit on init?

-- this is the first file executed when the application starts
-- we have to load the first modules form here

-- setup logger
g_logger.setLogFile(g_resources.getWorkDir() .. g_app.getCompactName() .. ".log")
g_logger.info(os.date("== application started at %b %d %Y %X"))

-- print first terminal message
g_logger.info(g_app.getName() .. ' ' .. g_app.getVersion() .. ' rev ' .. g_app.getBuildRevision() .. ' (' .. g_app.getBuildCommit() .. ') built on ' .. g_app.getBuildDate() .. ' for arch ' .. g_app.getBuildArch())

-- add data directory to the search path
if not g_resources.addSearchPath(g_resources.getWorkDir() .. "data", true) then
g_logger.fatal("Unable to add data directory to the search path.")
end

-- add modules directory to the search path
if not g_resources.addSearchPath(g_resources.getWorkDir() .. "modules", true) then
g_logger.fatal("Unable to add modules directory to the search path.")
end

-- try to add mods path too
g_resources.addSearchPath(g_resources.getWorkDir() .. "mods", true)

-- setup directory for saving configurations
g_resources.setupUserWriteDir(g_app.getCompactName())

-- search all packages
g_resources.searchAndAddPackages('/', '.otpkg', true)

-- load settings
g_configs.loadSettings("/config.otml")

g_modules.discoverModules()

-- libraries modules 0-99
g_modules.autoLoadModules(99)
g_modules.ensureModuleLoaded("corelib")
g_modules.ensureModuleLoaded("gamelib")

-- client modules 100-499
g_modules.autoLoadModules(499)
g_modules.ensureModuleLoaded("client")

-- game modules 500-999
g_modules.autoLoadModules(999)
g_modules.ensureModuleLoaded("game_interface")

-- mods 1000-9999
g_modules.autoLoadModules(9999)

local script = '/' .. g_app.getCompactName() .. 'rc.lua'

if g_resources.fileExists(script) then
dofile(script)
end
 
Last edited:
It's almost done... Shift + WASD is still turning character to Left / West / North / South even with chat mode enabled. Can you make me a little tutorial "how to bind/unbind keys"? I think it can be easier for me if I learn how to do that. And lesser boring for you, I though.
You have two functions: enableChat() and disableChat(), this function is activated/deactivated when you check checkbox 'WASD'. When you add code to this functions, client realize it when you use check/uncheck this checkbox ('WASD').
@margoh functions you must add to enableChat() or disableChat() function. But bind actions is global, so when you want to change this functionally you must deactivate it, you may deactivate it with adding to opposite function unbind action.
Lua:
g_keyboard.unbindKeyPress('Shift+W')
g_keyboard.unbindKeyPress('Shift+D')
g_keyboard.unbindKeyPress('Shift+S')
g_keyboard.unbindKeyPress('Shift+A')

I don't know why, but, even with chat mode enabled some hotkeys are still working, I've done everything like you said to do... ):
Yes, my code deactivate only some keys. But you may add or delete keys who may be desactivated. To do this you must edit 'consoleblocksignstable' table.

Sorry, eer... what may I edit on init?
I do not think you need to add it. But i mean about init() from modules\game_console\console.lua.
 
@MagicWall Please, take a look on my modules\game_console\console.lua:

function toggleChat()
if consoleToggleChat:isChecked() then
disableChat()
else
enableChat()
end
end

function enableChat()
local gameInterface = modules.game_interface

consoleTextEdit:setVisible(true)
consoleTextEdit:setText("")

g_keyboard.unbindKeyUp("Space")
g_keyboard.unbindKeyUp("Enter")
g_keyboard.unbindKeyUp("Escape")

g_keyboard.unbindKeyPress("Shift+W")
g_keyboard.unbindKeyPress("Shift+D")
g_keyboard.unbindKeyPress("Shift+S")
g_keyboard.unbindKeyPress("Shift+A")


-- new
unbindmykeys()
-- new end

gameInterface.unbindWalkKey("W")
gameInterface.unbindWalkKey("D")
gameInterface.unbindWalkKey("S")
gameInterface.unbindWalkKey("A")

consoleToggleChat:setTooltip(tr("Disable chat mode"))
end

function disableChat()
local gameInterface = modules.game_interface

consoleTextEdit:setVisible(false)
consoleTextEdit:setText("")

local quickFunc = function()
if consoleToggleChat:isChecked() then
consoleToggleChat:setChecked(false)
end
enableChat()
end
g_keyboard.bindKeyUp("Space", quickFunc)
g_keyboard.bindKeyUp("Enter", quickFunc)
g_keyboard.bindKeyUp("Escape", quickFunc)

g_keyboard.bindKeyPress("Shift+W")
g_keyboard.bindKeyPress("Shift+D")
g_keyboard.bindKeyPress("Shift+S")
g_keyboard.bindKeyPress("Shift+A")


-- new
bindmykeys()
-- new end

gameInterface.bindWalkKey("W", North)
gameInterface.bindWalkKey("D", East)
gameInterface.bindWalkKey("S", South)
gameInterface.bindWalkKey("A", West)

consoleToggleChat:setTooltip(tr("Enable chat mode"))
end

function terminate()
save()

I tried to add bind and unbind functions to Shift + WASD, but they are working to turn character on both chat modes, can you have a look and tell me what I am doing wrong?

On my interface.lua I put this inside:
g_keyboard.bindKeyPress('Shift+W', function() g_game.turn(North) changeWalkDir(North) end, gameRootPanel)
g_keyboard.bindKeyPress('Shift+D', function() g_game.turn(East) changeWalkDir(East) end, gameRootPanel)
g_keyboard.bindKeyPress('Shift+S', function() g_game.turn(South) changeWalkDir(South) end, gameRootPanel)
g_keyboard.bindKeyPress('Shift+A', function() g_game.turn(West) changeWalkDir(West) end, gameRootPanel)
 
Last edited:
But in this code function bind doesn't work, because:
Lua:
g_keyboard.bindKeyPress('Shift+W')
g_keyboard.bindKeyPress('Shift+D')
g_keyboard.bindKeyPress('Shift+S')
g_keyboard.bindKeyPress('Shift+A')
You have not added binding functions second parameter:
Lua:
g_keyboard.bindKeyPress('Shift+A', ??????)

Maybe you added this functions in other place?
 
But in this code function bind doesn't work, because:
Lua:
g_keyboard.bindKeyPress('Shift+W')
g_keyboard.bindKeyPress('Shift+D')
g_keyboard.bindKeyPress('Shift+S')
g_keyboard.bindKeyPress('Shift+A')
You have not added binding functions second parameter:
Lua:
g_keyboard.bindKeyPress('Shift+A', ??????)

Maybe you added this functions in other place?
The function you mean is this: "g_game.turn(West)" ?

g_keyboard.unbindKeyPress("Shift+W", g_game.turnNorth)
g_keyboard.unbindKeyPress("Shift+D", g_game.turnEast)
g_keyboard.unbindKeyPress("Shift+S", g_game.turnSouth)
g_keyboard.unbindKeyPress("Shift+A", g_game.turnWest)
 
Last edited:
On my interface.lua I put this inside:
But you must add it to console.lua to function enableChat() or disableChat() (where you use bind function).
Because you want this only when chat is distabled, so you must delete this functions from interface.lua.
Now your binds functions from disableChat() is empty/do nothing.
 
Back
Top