Tale (15): more event handling

Saturday 26 May 2012, 22:34:00 | mud / i.f.

Tale Release 0.5 and Release 0.6: what has changed?

Text output

Text layout has been rewritten in two helper classes, textoutput and paragraph. This fixed all known bugs. If you've installed the colorama package, tale will use that to spice up the console output a little bit (highlights/dim, no use of color yet).

Notifications

Added event handlers: Location.notify_player_arrived/notify_player_left, Location.notify_npc_arrived/notify_npc_left.

Notify_action and the other notify_ event handlers are now queued in a new action queue in the driver, that is emptied when the processing of the player command has finished. This means for instance, that only after the player sees his new location (forced look command), the notify_player_arrived event fires. It used to fire at the exact moment the player object was inserted in the new room so the event fired before the player even got the chance to see the new room.

misc

You can now define new commands or override existing ones in story packages. Object names are now always stored lower-case (except for Locations). The rat in the village now scuttles around.

short_description added that will be shown in the room 'look' text if set. If not, the generic line "XYZ is here."

door_code attribute and key-logic added to Door so you can lock/unlock it with a matching key object. The object just needs to have a matching door_code attribute, so you have some flexibility when creating objects to unlock doors in a totally different area/source file.

Removed score/max_score. Added some confirmation questions to 'dangerous' commands. Human NPCs now accept money by default.

The money type is now configurable per story, and the driver will contain an appropriate MoneyFormatter in driver.moneyfmt.