Generic command key handler

Chris H.'s Ultima / ACS-style game development system!

Moderators: Ice Cream Jonsey, Chris H

Post Reply
Posts: 223
Joined: Sun Jan 25, 2009 2:17 am
Location: Dallas, TX

Generic command key handler

Post by rld » Tue Jul 26, 2011 2:04 pm

In the vein of the 'extra command' options which lets you add new keys which run specified macros, I would like to add a more generalized way to add/replace commands handled in an ACK game.

Basically, the mechanism would let you (using macro commands) configure any key to trigger a macro when pressed, instead of its normal game function. The differences between this and the 'extra command' mechanism would be:
- This could override the functions of normal game commands
- No limit on the number of keys that can have commands defined
- Set up by a macro (extended DRAW) command instead of in the configuration editor, which means it can be changed on-the-fly during a game

The keys that I want to hook into this mechanism are all digit keys (0-9) and all alpha keys (A-Z), and Space. Are there any other keys that should be added? Most of the punctuation keys already have specified debugging or 'under the hood' command meanings, so I want to steer away from those unless there's a good reason.

User avatar
Posts: 5608
Joined: Fri May 16, 2008 9:25 am
Location: Arlington, Virginia

Re: Generic command key handler

Post by Tdarcos » Thu Jul 28, 2011 8:22 am

rld wrote: Are there any other keys that should be added?
Most people don't realize that a PC has FORTY EIGHT function keys. F1-F12, Shift F1-Shift F12, Alt F1-Alt F12 and Control F1-Control F12.

I wouldn't touch F1 because it's the help key, and the other keys often used are F6 and F10 in various incantations. So all the versions of F3-F5 and F7-F9 gives 24 macro combinations.

Also, a similar rule applies to the letters, of the 26 letters plus the 12 across the top, there are Control and Alt versions.

If you want to test, you can check for shift at the same time as an ALT or CTRL function key. Differentiating between right and left shift is another flavor.
"I know what you're doing, I see it all too clear."
- Duncan Sheik, Barely Breathing

Posts: 223
Joined: Sun Jan 25, 2009 2:17 am
Location: Dallas, TX

Post by rld » Thu Jul 28, 2011 10:06 am

Well, as a general principle, flexibility is always good, but...

a) I kind of want to stay away from the function keys, because many of them have predefined meanings to the underlying OS, or to DosBox.

b) If you take the existing (non-debug, etc.) command list from ACK, you have (assuming I haven't forgotten any):

A - Attack
B - Board
C - Cast
D - Drop
G - Get
I - Info/Inventory
L - Look
R - Ready
T - Talk
U - Use
X - Exit

So, there are 15 unused alphas, and then we add 10 digits, so at most you could implement *twenty-five* additional commands with this, assuming you don't scrap/reuse any of the existing command keys.

That's probably sufficient; I have a hard time imagining an ACK-style game for which that was not enough commands.

Posts: 223
Joined: Sun Jan 25, 2009 2:17 am
Location: Dallas, TX

Post by rld » Fri Jul 29, 2011 8:59 am

One place where this sort of thing would be useful is in a game that had different 'modes' with different command sets for each mode.

For example, in a sci-fi themed game you might spend part of the time in your spaceship and part of the time exploring planets on foot. So you might have one command set for 'in space':


and then a more typical command set for 'on foot':

Return to Ship

Or if you had a game where the player could transform into different creatures with different abilities. For example, if the player transformed into a dragon, the commands available might be:

Breathe Fire

Post Reply