Button down/up binds?




I've poked around a bit on the wiki pages and such for binds, but didn't see any info on button down/up functions.

Basically what I'm looking to do is bind sprint and ninja run to a key so that when I depress the key it toggles one on/off, and when I release the key it toggles the other on/off. I'm not sure of the syntax needed within the bind to do so however... anyone willing to help me out or point out a page that has those functions listed?



I forget where I picked this up, but I copied it down into my files some time ago. Hope it helps:

*** A note about the "+" and "++" prefixes in some of these commands ***

The short explanation of the + and ++ prefixes is that they represent how persistently the command will be carried out. Most of these keybindings represent "press and fire" commands -- that is, you press down on the button and the action will be performed once, until the button is pressed again.

With a "+" prefix the command will be carried out for as long as the button is pressed down, and ceases as soon as the button is no longer being pressed. For example, the default binding for the w key is +forward. For as long as the w key is pressed down your character will continue moving forward... but as soon as the button is no longer being pressed, the character stops moving.

With a "++" prefix the command will be toggled "on" and will continue to be activated until the button is pressed again, toggling it "off." If the w key were bound to ++forward, pressing the w key once would cause the character to move forward, and that character would continue to move forward until the w key were pressed again.

Any command that has a + prefix can work with a ++ prefix, and vice versa. This can lead to some redundant commands. For example, ++forward works exactly the same as ++autorun -- you run until you turn the command off.

Through trial and error, I've formed the following theory on how the "+" modifier works in binding.

The "+" modifier has two behaviors.
Behavior one: at all times when "+" is prepended to a command, it is the same as doing "command 1". Obviously this only works correctly on commands that take 1 or 0 as input. When other commands are prepended with it, it adds the 1 to the end of the arguments, and gives an error. This behavior is mirrored by the "-" modifier, which yields argument 0.

Behavior two: ( Only when directly in the bind.. in other words this does not work when made a macro which you then bind to a key! )when prepended to the first command in a bind (assuming that command is one that works with it, ie takes 1/0 argument), it gives the entire bind statement a "press/unpress" behavior. This means two things:

* a) the command prepended with the "+" turns on (aka is given argument 1) when you press the key as you would expect per behavior 1. Additionally it turns off (argument 0) when you unpress the key
* b) the rest of the commands in the bind are performed once when you press the key, and again when you unpress it

Note that this behavior is not mirrored by the "-" modifier.. it might be nice if it did at least the first part, ie turn a command off when you press the key and back on when you unpress, but it doesn't.

Side note: I am actually a bit surprised that they decided to overload the use of the "+" in this way. It seems to me it would have been more intuitive and useful to have another character modifier (> for instance) to prepend to a bind statement (without a necessary command after it) to extend the second behavior, with the addition that any commands following in the statement with a "+" would work in the on/off manner when press/unpressed instead of just the first one.

The secondary behavior of the "+" in binds makes several useful things possible. Especially when you realize that the first command doesn't always have to do something, since you can always override it with a "-" form of it elsewhere in the bind. For instance a simple yet very useful bind for fly which makes you fly only while you hold down "f":

* /bind f "+up$$-up$$powexec_name Fly"

Another behavior can be achieved by exploiting the "overwrite" effect of powers (aka if several powers are entered one after the other in a bind, only the last one will go off in most cases). A very useful binding for getting out of melee range quickly with hover is:

* /bind v "+up$$powexec_name Hover$$powexec_name Hover"

This makes you jump and then hover up in the air just out of melee range. Note the doubling up of the hover power.. this is because if you only have it once in the bind, it will turn hover on when you press it and off when you let go (usually.. sometimes the hover from press and hover from unpress go through together and one gets overwritten, but this is rare). Why doesn't it turn on/off quickly when you press it and on/off quickly when you let go if you enter it twice? Because of the power overwrite effect.. while it is busy doing the jump when you press the button down, both hovers go through and the second overwrites the first, resulting in hover being turned on. When you let go, it stops the jump and both hovers go through, turning hover off and back on very quickly (before you drop) resulting in you being left in hover mode. This causes a bit of spam to your combat messages window, but it's worth it. Note: the differing behavior here (ie overwrite happening on press but not on unpress) I believe is due to the interaction between commands and powers on timing in a bind, but this is just a guess.
You may need to use the "toggleon" & "toggleoff" commands for what you are trying to do, since you are essentially trying to "activate" two powers in a string (which is usually not allowed).


Don�t say things.
What you are stands over you the while, and thunders so that I cannot hear what you say to the contrary. - R.W. Emerson
The BIG consolidated LIST for BASE LUV
YUMMY Low-Hanging Fruit for BASE LUV



Very much appreciated. I cannot get it to work with a key down to activate one power, and key up to activate another. I know that when you do it that way you have to hold the key down to allow for the short delay required between activating powers, I just can't figure out the syntax required to make it work.

I was browsing the forums a week or two back and saw a thread about doing that with forcefield bubbles which is what got me thinking about doing it this way. I can understand why they did it this way to prevent abuses of the bind system, but it makes it a pita for non-abusive quality of life things like this. I am pretty sure there is a way to do it, I'm just not able to gather the proper train of thought to get it done right now. oh well, maybe someone will stumble in here that knows it, or I'll track down that thread or something.

I got a pretty functional setup right now that I press T T to turn on ninja run and sprint, then G to toggle them both off and switch to Combat Jumping. It's pretty functional. Not quite perfect as I wanted, but much better than managing multiple clickies on an alt bar.



"Master-Bind" reporting for duty! (lol j.k)

For this, you have two options...
1.) Keep things similar to the way you have it, but enable both powers with a single press of "T":
/bind T "+$$powexectoggleon Sprint$$powexectoggleon Ninja Run"

On key/down, it will activate NR (which automatically turns off CJ).
(Key should be held long enough to ensure NR activates)
On key/up, it will activate Sprint.
Press G to disable both and enable CJ like you already have set up.

2.) OR.. use the same key (T) to toggle back and forth between "CJ" and "NR/Sprint" (without having to use "G" anymore!)
This would require bind files:

T "powexectoggleon Ninja Run$$bindloadfilesilent C:\binds\file1.txt

T "+$$powexectoggleon Sprint$$bindloadfilesilent C:\binds\file2.txt

T "powexectoggleoff Sprint$$powexectoggleon Combat Jumping$$bindloadfilesilent C:\binds\file0.txt"

Then initialize your key:
/bindloadfile C:\binds\file0.txt

On key/down, it will activate NR (which automatically turns off CJ), and load File1.
(Key should be held long enough to ensure NR activates)
On key/up, it will run File1.. which activates Sprint and loads File2.
The next press of the key will run File2, which will turn off Sprint and turn on CJ (which automatically turns off NR), then reset the key back to File0.

I just tested and verified that it works the way I describe.
(In this case, the "+" should NOT be placed in the first file or it will cause issues with the repeated cycling).

If that's not what you are looking for, or you need help with something else.. let me know and I'll try to come up with something that suits your needs.



That, sir, is fantastic.

I'm only on for a few minutes (expecting my tabletop RPG group at the door any minute) so I've not tested the bindfiles yet, but the quick bind command worked like a charm.

Will check out the bind files later on, as that functionality would be nice for the few of my characters that do use combat jump, and easy to modify should I end up running a hoverblaster type too. Though, to be honest I don't much like hover and would likely end up using CJ anyways if I want to squeak out that last little bit of defense.

A million thanks.



Originally Posted by Humility View Post
Will check out the bind files later on, as that functionality would be nice for the few of my characters that do use combat jump, and easy to modify should I end up running a hoverblaster type too.
You can use it on characters that don't use CJ or Hover as well. Simply substitute in "powexectoggleoff Ninja Run" instead of the CJ activation in File2. Then it just becomes a toggle key for your "NR/Sprint mode" and still gets rid of the need for the separate reset key (G).

On a side note, I'm sure you realize that you can use any file names you want. If you have more than one thing that requires rotating bind files, then the file#.txt format might not necessarily be the best for you. I'd probably rename them SprintNR#.txt or something instead, unless you put each of your rotating bind sets in separate folders. That actually sounds better to keep them organized anyway. The new path examples would look like this:

Each file would have to be modified appropriately of course.

I hope you get it working the way you want it. If you've got any other projects for me to work on, feel free to ask. I love doing this stuff.



Originally Posted by Impish Kat View Post
This is why you are the Master.



Just a quick question regarding bindfiles. I've not used files before, do I need to load it each time I play the character, or once I load the files is it saved to the character as the standard binds are?



Originally Posted by Humility View Post
Just a quick question regarding bindfiles. I've not used files before, do I need to load it each time I play the character, or once I load the files is it saved to the character as the standard binds are?
Once you initialize it, you wont have to manually run it again (except to initialize it on other characters). Each time you press the key it will load the appropriate files, even after you relog, close the client, or whatever. Just make sure you keep the files there and transfer them to any other computer you may use to play the game, or the rotation will stop working.