Figured it out

Finally worked out the proper way to set up my action bars.  Sadly, it’s not quite the way they’re set up right now.

The old system, the one that was in use for v1 and v1.1 looked like this:  [Button].  That is, the interface button itself did everything;  it checked for being clicked on, it modified the game world in reaction to the player’s clicks, etc.  This resulted in most buttons in the UI needing to be coded separately, since they all performed different functions.

The newer system currently looks like this:  [Button] –“command”–>[Script System]–>[Effect].  So the button sends a simple text command to a scripting system, which interprets the command and then takes action (typically hiding/showing a UI, changing the cursor function, etc).  This is nice in that every Button is now the same, only varying in what string they send to the scripting system.  It also makes a very nice divide between UI code and functional code.  The problem with this approach is that it’s forward-communication-only;  that is, there’s no way for the system that’s actually doing the work to communicate back to the original button, to tell it that the operation has completed, or that it’s not legal right now.

The new new system that I’ve worked out is similar to the above, but instead looks like this:  [Button]->[Power]->[Effect].  Every Button points to a “Power”, and that “Power” then talks to something that can actually take action in the game.  This means that I still have fully generic buttons, a standard set of “Power” functionality (being enabled/disabled/recharging/etc), and the game-effecting code over in the various Effects that the “Powers” know how to perform.  This approach also allows us to have multiple buttons bound to the same power, and have them all function properly (when the power is activated, all buttons bound to it will hilight, they’ll all show it on cooldown after it’s been used, etc).

Once that’s done, I can then trivially make it so that powers can be activated from a script, instead of from a button click, and have all the buttons bound to that power actually behave properly.

I’m starting on implementing this adjustment now..  hope to have it finished and working sometime tomorrow!