Welcome! I also had this issue setting up a gaming mouse.
Here you are with a mouse with a bunch of buttons but they only output basic keys as if they were pressed on the keyboard and not the mouse. Kinda lame. It'd be easier if these were just special device keys you could set elsewhere. That's the idea right?
Here's what you can do with Keyboard Maestro:
1). Use the mouse's configuration utility app to set each button to a keyboard shortcut – something that you wouldn't hit when using your computer normally.
I suggest setting them to something like Ctrl-Option-Shift+X, where X can be any key, including symbols. Ctrl-Option-Shift doesn't really come up often so this way you won't mistakingly type this when using your computer normally.
2). Use Keyboard Maestro to make a macro with the same shortcut as a trigger.
For example, let's say I'm playing a game and I'm tired of typing the command "xt". (It actually doesn't do anything in a game I know but I'm sure you will substitute in whatever you need to do)
Well, here's a macro that does that:
Just be sure to set your application accordingly and it will work.
If for some reason you can't remap your buttons in the mouse configuration app - then you can always just use default 1-9 as triggers instead of Ctrl-Option-Shift+whatever.
So long as you use an 'if' action to ask if your particular game app is at the front (see below), then you can stop the 1 from doing something crazy when using your computer normally - as well as press 1 if the game is NOT currently at the front:
Basically they above says:
If 1 is pressed AND your game is running, then type xt, but just type 1 if not
Give it a try. You can do a lot of complex custom gaming macros with KM.