LiteMount

LiteMount

2M Downloads

Support for 5th (and more) key binding

zealvurte opened this issue ยท 12 comments

commented

Requesting support for a 5th key binding, as the majority of mice have at least 5 buttons available. Personally I've long been using [btn:5] in mount macros for years before switching to this addon, so I had need of it.

Achieved it locally with a few duplicated lines and replacement of a few cases of 4s with 5s, and all seems to be working well. I imagine a more extensible approach to add more as needed would be a nice goal for the future though.

commented

Thanks for the response. I don't have anything smart to say about this yet, I need to think about it a little.

Sadly, the mouse button used does not come through the key bindings API. You only get it when you're clicking a button directly. :(

Edit: FWIW, SmartMount should already deal with your case (3) shouldn't it?

commented

So I think I have a better solution for you.

Even though the button does not come through the binding interface, when you use the /click slash command you can pass arbitrary text through as the mouse button argument.

E.g.,

/click LM_B1 hello

In combination with a [click:hello] condition (not sure about the name, it probably won't be click but I feel like mousebutton would be too misleading for everyone who isn't writing a custom macro no, it is [click] after all).

So then you could have one binding and set your macro up appropriately, and it would support an infinite amount of conditions, which you can use in rules via the "Advanced" mechanism.

What do you think?

commented

There's no dynamic way to add key bindings, they are fixed forever to whats in the Bindings.xml as far as I know.

While I'm not specifically against a 5th key binding (but I will definitely not do a 6th), I'm struggling to imagine anyone needing that many.

Can you explain what's on your 5 LiteMount key bindings so I can understand your need, and make sure it's not better solved in some other way that I haven't thought of?

commented

Yeah, I wasn't sure bindings.xml was going to allow it...

I'm a clicker, so it's mostly instead of modifiers and how I've done all my macros for years.

  1. [btn:1] is normal rules, with modifiers that map button 2-5 behaviour to shift, ctrl, alt, and ctrl+alt respectively
  2. [btn:2] is normal rules, but forces a removal of a group of mounts that aesthetically aren't suited to the ground (the default flags don't really cover this aesthetic distinction, and I had to change many to be both fly and run so that SmartMount still used things like flying horses in ground areas)
  3. [btn:3] forces an underwater mount selection if swimming, otherwise normal rules
  4. [btn:4] forces a vendor mount
  5. [btn:5] forces a passenger mount

I suppose I could just do this all in advanced options with the button conditions instead of rules (?), but I'm currently using the button conditionals in a macro to target each LM_B*. I was originally expecting button conditionals to be available in rules like modifiers are, so I would only need one binding.

commented

That probably would be okay, except I'm getting "Bad condition 'click' in action list." when using it. Having a look at the conditions defined in Conditions.lua, [click] hasn't been implemented from what I can see.

commented

LOL!

commented

It's coming, it's not there yet. I'm good but I'm not predict the future good. If you want bleeding edge you better get to cloning the repo :)

commented

I was going off the wiki page that already listed it in the table was all.

commented

Ah, yeah I tend to update the doc as I add the features, not so much on release because then I tend to forget.

I expect do do a new LiteMount release once people have tested flying (no doubt there will be a bunch of bugs related to it), so should be in the next day or two. LiteMount 9.1.4 will have [click] in it.

Thanks for working with me on this, and happy adventuring!

commented

19c91a8

is the [click] support in case you want to hack it in before the release.

commented

Hm... the second argument to click seems intended for use as a button name anyway, so I just implemented it as [btn] to match normal macros:
CONDITIONS["btn"] = { handler = function (cond, env, v) return not v or v == GetMouseButtonClicked() end }
Macro then ends up as:
/click [btn:5]LM_B1 5;[btn:4]LM_B1 4;[btn:3]LM_B1 3;[btn:2]LM_B1 2;LM_B1 1

Either way works, lol.

commented

[click] condition added in LiteMount 9.1.4.

Thanks, and happy adventuring, X.

p.s. The mouse buttons when passed through from clicks are not actually 1/2/3/4/5 but LeftButton, RightButton, MiddleButton, Button4, Button5, ... I expect you probably figured that out already. :)