Jump to content

Chatbox Command - Double Bind?


Dealman

Recommended Posts

Recently I started working a bit on adding a global chat, using the default chatbox.

I figured out that I can use bindKey like this to enable chatbox input with a custom prefix, in this case, "Global";

bindKey("G", "down", "chatbox", "Global", activateGlobalChat_Handler); 

However, this seem to be the only way of doing this, and I can't make use of executeCommandHandler which is preventing me from doing what I want with it - a double-bind.

What I mean with double-bind is for example, Left Shift+G, Left Alt+G and so on. I'd rather have something like this, than a separate key for each one of them.

Does anyone happen to have a workaround to solve this?

Edit:

I stumbled upon some information while reading about Control_names. This sentence in particular caught my interest;

The following are names of hard-coded MTA commands which do not use bindKey, but can act as bindKey by using them in an addCommandHandler.

However, I fail to understand what on earth they are trying to say with that.

Link to comment

I done something like this for my own server, what I did was, I binded a bind. I mean like:

  
function bindChatKey() 
    bindKey("a", "down", chatFunction) 
end 
function unbindChatKey() 
    unbindKey("a", "down", chatFunction) 
end 
bindKey ( "lshift", "down", bindChatKey) 
bindKey ( "lshift", "up", unbindChatKey) 

That's the way I done it, there might be an easier way though.

Link to comment

Cheers, it works, but only once. Then it gets stuck. This is how I made it;

function activateTeamGlobal_Bind() 
    bindKey("G", "down", "chatbox", "TeamGlobal"); 
end 
bindKey("lshift", "down", activateTeamGlobal_Bind); 
  
function deactivateTeamGlobal_Bind() 
    unbindKey("G", "down", "chatbox", "TeamGlobal"); 
    bindKey("G", "down", "chatbox", "Global"); -- In case unbind doesn't work 
end 
bindKey("lshift", "up", deactivateTeamGlobal_Bind); 

After I've done LShift+G, it forever gets stuck on TeamGlobal and I can't revert it back to Global. Not even if I bind it again. :shock:

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...