I just posted a library for handling keyboard input. I was hesitant to make this because there are already several libraries out there like this, but I think this one is significant enough that it's worth posting. I'd also like to eventually update the Pixel Movement and Sidescroller libraries to use this keyboard library.

Here is the list of features:

Provides the key_up, key_down, and key_repeat procs for all objects which are passed the key and client when a keyboard event occurs.

Provides the client.focus var, which is a reference to an object that will receive keyboard events. When a key press, release, or repeat event occurs, client.focus.key_up/down/repeat will be called. By default client.focus is the client itself.

Provides a default implementation of the client's key_down and key_repeat procs which call the client's North, South, Center, etc. procs.

Provides the client.keys var which is an associative list which stores the state of each key - client.keys["a"] is 1 if the A key is being held and 0 if it's not held.

Provides the client.lock_input, unlock_input, and clear_input procs. The first two are used to lock/unlock input - while input is locked the key_up/down/repeat procs will not be called (but the keys list will still be updated to reflect key releases only). The clear_input proc clears the keys list (sets all values to zero).

Provides five demos:

focus-demo: Shows the effect of changing client.focus.

icon-selection-demo: Shows how to use client.focus to create an icon selection feature that uses keyboard events to change your icon.

mob-demo: Shows how to control other mobs by changing client.focus.

movement-demo: Shows how to create a different movement system by using the client.keys list.

simple-demo: Shows how to use the mob's key_down proc to cause actions to occur when certain keys are pressed.

The library is similar to the keyboard support currently offered by the Pixel Movement and Sidescroller libraries except it adds and changes a few things. Everything is handled on the client, not the mob. It handles key repeat events too. It provides the client.focus var, which is used to control which object is notified of the keyboard events.

The library includes five demos that show different ways it can be used. Sometimes when I post a library I deliberately don't implement all of the features I have in mind. I leave a couple of features for later updates so that I have updates to make. That wasn't the case here - I'm clean out of ideas for this one. If there are any features or demos you'd like to see added to this library, your suggestions would be very much appreciated.

If you want to, I can share the concept of direct onscreen input that can properly merge with your other libraries. Clicking on input objects that use image objects may require a bit more work at this time (since mouse_opacity is included, but does nothing). I been planning on sharing it anyway (even if the SByIo Library V3 is not available yet).

The concept of onscreen input is where one can actually type in different characters without being dependent on any skin-based input element. Very handy for chatting without being dependent on any skin elements (except for a map control) as well as creating character creation screens. One thing to take note is to make sure every key is available as possible. That is also why I implemented a macro set switching scheme based on focus (switching between input and whatever macro set you currently have set).

Still other features to add, but you can actually study the input objects. Feel free to even implement the concepts that deal with the base input object by having a look at the /InputObj type as well as the new /client features (including overridden procs that should be backwards compatible). You'll find nice things to implement with it. :D

Edit: May notice I haven't fixed default input text yet. Happened when I switched from a soley icon-based mechanism for drawing to a hybrid.

I had thought about making this keyboard library as a way to add an on-screen textbox control to the HUD Groups library (it has buttons, labels, radio buttons, and checkboxes), but I'm not sure if it's feasible. I don't know if there's a way to macro every key. For example, can you macro the quotation mark symbol or do you have to macro shift+apostrophe? There are also a lot of display and mouse issues with having textboxes that I'm not sure BYOND would easily handle (ex: clicking and dragging to select some letters you've typed, or clipping the string you've typed in the textbox so it doesn't overflow the bounds of the control).

I had thought about making this keyboard library as a way to add an on-screen textbox control to the HUD Groups library (it has buttons, labels, radio buttons, and checkboxes), but I'm not sure if it's feasible. I don't know if there's a way to macro every key. For example, can you macro the quotation mark symbol or do you have to macro shift+apostrophe? There are also a lot of display and mouse issues with having textboxes that I'm not sure BYOND would easily handle (ex: clicking and dragging to select some letters you've typed, or clipping the string you've typed in the textbox so it doesn't overflow the bounds of the control).