earwax.story package

Module contents

The story module.

Stories are a way of building worlds with no code at all.

They can do a fair amount on their own: You can create rooms, exits, objects, and you can add basic actions to those objects. In addition, you can create complex actions if you code them in yourself.

What you get out of the box:

  • An easy way of creating worlds with an on screen editor.
  • A main menu, with items for playing, exiting, showing credits, and loading
    saved games.
  • Basic keyboard and controller commands for interracting with your world.
  • The ability to create rich 3d environments, with all the sounds, messages,
    and music you can think of.
  • The ability to build your world into a single Python file you can compile
    with a tool such as PyInstaller, or send about as is.

If you do wish to extend your world, build it into a Python file, then edit it to add extra actions, tasks, or whatever else you can think of.

class earwax.story.DumpablePoint(x: T, y: T, z: T)

Bases: earwax.point.Point, earwax.mixins.DumpLoadMixin

A point that can be dumped and loaded.

class earwax.story.DumpableReverb(gain: float = 1.0, late_reflections_delay: float = 0.01, late_reflections_diffusion: float = 1.0, late_reflections_hf_reference: float = 500.0, late_reflections_hf_rolloff: float = 0.5, late_reflections_lf_reference: float = 200.0, late_reflections_lf_rolloff: float = 1.0, late_reflections_modulation_depth: float = 0.01, late_reflections_modulation_frequency: float = 0.5, mean_free_path: float = 0.02, t60: float = 1.0)

Bases: earwax.reverb.Reverb, earwax.mixins.DumpLoadMixin

A reverb that can be dumped.

class earwax.story.RoomExit(destination_id: str, action: earwax.story.world.WorldAction = NOTHING, position: Optional[earwax.story.world.DumpablePoint] = None)

Bases: earwax.mixins.DumpLoadMixin

An exit between two rooms.

Instances of this class rely on their action property to show messages and play sounds, as well as for the name of the exit.

The actual destination can be retrieved with the destination property.

Variables:
  • destination_id – The ID of the room on the other side of this exit.
  • location

    The location of this exit.

    This value is provided by the containing StoryWorld class.

  • action – An action to perform when using this exit.
  • position

    The position of this exit.

    If this value is None, then any ambiances will not be panned.

destination

Return the room this exit leads from.

This value is inferred from destination_id.

class earwax.story.RoomObject(id: str = NOTHING, name: str = 'Unnamed Object', actions_action: Optional[earwax.story.world.WorldAction] = None, ambiances: List[earwax.story.world.WorldAmbiance] = NOTHING, actions: List[earwax.story.world.WorldAction] = NOTHING, position: Optional[earwax.story.world.DumpablePoint] = None, drop_action: Optional[earwax.story.world.WorldAction] = None, take_action: Optional[earwax.story.world.WorldAction] = None, use_action: Optional[earwax.story.world.WorldAction] = None, type: earwax.story.world.RoomObjectTypes = NOTHING, class_names: List[str] = NOTHING)

Bases: earwax.story.world.StringMixin, earwax.mixins.DumpLoadMixin

An object in the story.

Instances of this class will either sit in a room, or be in the player’s inventory.

Variables:
  • id

    The unique ID of this object. If this ID is not provided, then picking it up will not be reliable, as the ID will be randomly generated.

    Other than the above restriction, you can set the ID to be whatever you like.

  • name

    The name of this object.

    This value will be used in any list of objects.

  • actions_action

    An action object which will be used when viewing the actions menu for this object.

    If this value is None, no music will play when viewing the actions menu for this object, and the actions_menu message will be shown.

  • ambiances – A list of ambiances to play at the position of this object.
  • actions – A list of actions that can be performed on this object.
  • position

    The position of this object.

    If this value is None, then any ambiances will not be panned.

  • drop_action

    The action that will be used when this object is dropped by the player.

    If this value is None, the containing world’s drop_action attribute will be used.

  • take_action

    The action that will be used when this object is taken by the player.

    If this value is None, the containing world’s take_action attribute will be used.

  • use_action

    The action that will be used when this object is used by the player.

    If this value is None, then this object is considered unusable.

  • type – Specifies what sort of object this is.
  • class_names

    The names of all the classes this object belongs to.

    If you want a list of RoomObjectClass instances, use the classes property.

  • location

    The room where this object is located.

    This value is set by the StoryWorld() which holds this instance.

    If this object is picked up, the location will not change, but this object will be removed from the location’s objects dictionary.

classes

Return a list of classes.

This value is inferred from the class_names list.

is_droppable

Return True if this object can be dropped.

is_stuck

Return True if this object is stuck.

is_takeable

Return True if this object can be taken.

is_usable

Return True if this object can be used.

class earwax.story.RoomObjectClass(name: str)

Bases: earwax.mixins.DumpLoadMixin

Add a class for objects.

Instances of this class let you organise objects into classes.

This is used for making exits discriminate.

Variables:name – The name of the class.
class earwax.story.RoomObjectTypes

Bases: enum.Enum

The type of a room object.

Variables:
  • stuck – This object cannot be moved.
  • takeable – This object can be picked up.
  • droppable

    This object can be dropped.

    This value automatically implies takeable.

droppable = 2
stuck = 0
takeable = 1
usable = 4
class earwax.story.StoryWorld(game: Game, name: str = 'Untitled World', author: str = 'Unknown', main_menu_musics: List[str] = NOTHING, cursor_sound: Optional[str] = None, empty_category_sound: Optional[str] = None, end_of_category_sound: Optional[str] = None, rooms: Dict[str, earwax.story.world.WorldRoom] = NOTHING, initial_room_id: Optional[str] = None, messages: earwax.story.world.WorldMessages = NOTHING, take_action: earwax.story.world.WorldAction = NOTHING, drop_action: earwax.story.world.WorldAction = NOTHING, panner_strategy: str = NOTHING, object_classes: List[earwax.story.world.RoomObjectClass] = NOTHING)

Bases: earwax.mixins.DumpLoadMixin

The top level world object.

Worlds can contain rooms and messages, as well as various pieces of information about themselves.

Variables:
  • game – The game this world is part of.
  • name – The name of this world.
  • author

    The author of this world.

    The format of this value is arbitrary, although Author Name <author@domain.com> is recommended.

  • main_menu_musics – A list of filenames to play as music while the main menu is being shown.
  • cursor_sound

    The sound that will play when moving over objects.

    If this value is None, no sound will be heard.

  • empty_category_sound – The sound which will be heard when cycling to an empty category.
  • end_of_category_sound – The sound which will be heard when cycling to the end of a category.
  • rooms – A mapping of room IDs to rooms.
  • initial_room_id – The ID of the room to be used when first starting the game.
  • messages – The messages object used by this world.
  • take_action

    The default take action.

    This value will be used when an object is taken with its take_action attribute set to None.

  • drop_action

    The default drop action.

    This value will be used when an object is dropped and has its drop_action attribute is None.

  • panner_strategy – The name of the default panner strategy to use.
  • object_classes

    A list of object classes.

    Objects are mapped to these classes by way of their class_names and classes lists.

add_room(room: earwax.story.world.WorldRoom, initial: Optional[bool] = None) → None

Add a room to this world.

Parameters:
  • room – The room to add.
  • initial

    An optional boolean to specify whether the given room should become the initial_room or not.

    If this value is None, then this room will be set as default if initial_room_id is itself None.

all_objects() → Iterator[earwax.story.world.RoomObject]

Return a generator of every object contained by this world.

dump() → Dict[str, Any]

Dump this world.

initial_room

Return the initial room for this world.

classmethod load(data: Dict[str, Any], *args) → Any

Load credits before anything else.

class earwax.story.WorldAction(name: str = 'Unnamed Action', message: Optional[str] = None, sound: Optional[str] = None, rumble_value: float = 0.0, rumble_duration: int = 0)

Bases: earwax.mixins.DumpLoadMixin

An action that can be performed.

Actions are used by the RoomObject and RoomExit classes.

If attached to a RoomObject instance, its name will appear in the action menu. If attached to a RoomExit instance, then its name will appear in the exits list.

Variables:
  • name – The name of this action.
  • message

    The message that is shown to the player when this action is used.

    If this value is omitted, no message will be shown.

  • sound

    The sound that should play when this action is used.

    If this value is omitted, no sound will be heard.

  • rumble_value

    The power of a rumble triggered by this action.

    This value should be between 0.0 (nothing) and 1.0 (full power).

    If this value is 0, no rumble will occur.

  • rumble_duration

    The time (in seconds) the rumble should continue for.

    If this value is 0, no rumble will occur.

class earwax.story.WorldAmbiance(path: str, volume_multiplier: float = 1.0)

Bases: earwax.mixins.DumpLoadMixin

An ambiance.

This class represents a looping sound, which is either attached to a WorldRoom instance, or a RoomObject instance.

Variables:
  • path – The path to a sound file.
  • volume_multiplier – A value to multiply the ambiance volume by to get the volume for this sound..
class earwax.story.WorldMessages(no_objects: str = 'This room is empty.', no_actions: str = 'There is nothing you can do with this object.', no_exits: str = 'There is no way out of this room.', no_use: str = 'You cannot use {}.', nothing_to_use: str = 'You have nothing that can be used.', nothing_to_drop: str = 'You have nothing that can be dropped.', empty_inventory: str = "You aren't carrying anything.", room_activate: str = 'You cannot do that.', room_category: str = 'Location', objects_category: str = 'Objects', exits_category: str = 'Exits', actions_menu: str = 'You step up to {}.', inventory_menu: str = 'Inventory', main_menu: str = 'Main Menu', play_game: str = 'Start new game', load_game: str = 'Load game', show_credits: str = 'Show Credits', credits_menu: str = 'Credits', welcome: str = 'Welcome to this game.', no_saved_game: str = 'You have no game saved.', exit: str = 'Exit')

Bases: earwax.mixins.DumpLoadMixin

All the messages that can be shown to the player.

When adding a message to this class, make sure to add the same message and an appropriate description to the message_descriptions in earwax/story/edit_level.py.

Variables:
  • no_objects – The message which is shown when the player cycles to an empty list of objects.
  • no_actions – The message which is shown when there are no actions for an object.
  • no_exits – The message which is shown when the player cycles to an empty list of exits.
  • no_use – The message which is shown when the player tries to use an object which cannot be used.
  • nothing_to_use – The message which is shown when accessing the use menu with no usable objects.
  • nothing_to_drop – The message which is shown when accessing the drop menu with no droppable items.
  • empty_inventory – The message which is shown when trying to access an empty inventory menu.
  • room_activate

    The message which is shown when enter is pressed with the room category selected.

    Maybe an action attribute should be added to rooms, so that enter can be used everywhere?

  • room_category – The name of the “room” category.
  • objects_category – The name of the “objects” category.
  • exits_category – The name of the “exits” category.
  • actions_menu – The message which is shown when the actions menu is activated.
  • inventory_menu

    The title of the inventory menu.

    You can include the name of the object in question, by including a set of braces:

    <message id="actions_menu">You examine {}.</message>
    
  • main_menu – The title of the main menu.
  • play_game – The title of the “play game” entry in the main menu.
  • load_game – The title of the “load game” entry in the main menu.
  • show_credits – The title of the “show credits” entry in the main menu.
  • credits_menu – The title of the credits menu.
  • welcome – The message which is shown when play starts.
  • no_saved_game – The message which is spoken when there is no game to load.
  • exit – The title of the “exit” entry of the main menu.
class earwax.story.WorldRoom(id: str = NOTHING, name: str = 'Unnamed Room', description: str = 'Not described.', ambiances: List[earwax.story.world.WorldAmbiance] = NOTHING, objects: Dict[str, earwax.story.world.RoomObject] = NOTHING, exits: List[earwax.story.world.RoomExit] = NOTHING, reverb: Optional[earwax.story.world.DumpableReverb] = None)

Bases: earwax.mixins.DumpLoadMixin, earwax.story.world.StringMixin

A room in a world.

Rooms can contain exits and object.

It is worth noting that both the room name and description can either be straight text, or they can consist of a hash character (#) followed by the ID of another room, from which the relevant attribute will be presented at runtime.

If this is the case, changing the name or description of the referenced room will change the corresponding attribute on the first instance.

This convertion can only happen once, as otherwise there is a risk of circular dependencies, causing a RecursionError to be raised.

Variables:
  • world

    The world this room is part of.

    This value is set by the containing StoryRoom instance.

  • id

    The unique ID of this room.

    If this value is not provided, then an ID will be generated, based on the number of rooms that have already been loaded.

    If you want to link this room with exits, it is highly recommended that you provide your own ID.

  • name – The name of this room, or the #id of a room to inherit the name from.
  • description – The description of this room, or the #id of another room to inherit the description from.
  • ambiances – A list of ambiances to play when this room is in focus.
  • objects

    A mapping of object ids to objects.

    To get a list of objects, the canonical way is to use the earwax.story.play_level.PlayLevel.get_objects() method, as this will properly hide objects which are in the player’s inventory.

  • exits – A list of exits from this room.
create_exit(destination: earwax.story.world.WorldRoom, **kwargs) → earwax.story.world.RoomExit

Create and return an exit that links this room to another.

This method will add the new exits to this room’s exits list, and set the appropriate location on the new exit.

Parameters:
  • destination – The destination whose ID will become the new exit’s destination_id.
  • kwargs – Extra keyword arguments to pass to the RoomExit constructor..
create_object(**kwargs) → earwax.story.world.RoomObject

Create and return an exit from the provided kwargs.

This method will add the created object to this room’s objects dictionary, and set the appropriate location attribute.

Parameters:kwargs – Keyword arguments to pass to the constructor of RoomObject.
get_description() → str

Return the actual description of this room.

get_name() → str

Return the actual name of this room.

class earwax.story.WorldState(world: earwax.story.world.StoryWorld, room_id: str = NOTHING, inventory_ids: List[str] = NOTHING, category_index: int = NOTHING, object_index: Optional[int] = None)

Bases: earwax.mixins.DumpLoadMixin

The state of a story.

With the exception of the world attribute, this class should only have primitive types as its attributes, so that instances can be easily dumped to yaml.

Variables:
  • world – The world this state represents.
  • room_id – The ID of the current room.
  • inventory_ids – A list of object IDs which make up the player’s inventory.
  • category_index – The player’s position in the list of categories.
  • object_index – The player’s position in the current category.
category

Return the current category.

get_default_room_id() → str

Get the first room ID from the attached world.

Parameters:instance – The instance to work on.
room

Get the current room.

class earwax.story.WorldStateCategories

Bases: enum.Enum

The various categories the player can select.

Variables:
  • room – The category where the name and description of a room are shown.
  • objects – The category where the objects of a room are shown.
  • exits – The category where the exits of a room are shown.
exits = 2
objects = 1
room = 0
class earwax.story.EditLevel(game: Game, world_context: StoryContext, cursor_sound: Optional[earwax.sound.Sound] = None, inventory: List[earwax.story.world.RoomObject] = NOTHING, reverb: Optional[GlobalFdnReverb] = None, object_ambiances: Dict[str, List[earwax.ambiance.Ambiance]] = NOTHING, object_tracks: Dict[str, List[earwax.track.Track]] = NOTHING, filename: Optional[pathlib.Path] = None, builder_menu_actions: List[earwax.action.Action] = NOTHING)

Bases: earwax.story.play_level.PlayLevel

A level for editing stories.

add_action(obj: Union[earwax.story.world.RoomObject, earwax.story.world.RoomExit, earwax.story.world.StoryWorld], name: str) → Callable[[], None]

Add a new action to the given object.

Parameters:
  • obj – The object to assign the new action to.
  • name – The attribute name to use.
add_ambiance(ambiances: List[earwax.story.world.WorldAmbiance]) → Callable[[], Generator[None, None, None]]

Add a new ambiance to the given list.

ambiance_menu(ambiances: List[earwax.story.world.WorldAmbiance], ambiance: earwax.story.world.WorldAmbiance) → Callable[[], Generator[None, None, None]]

Push the edit ambiance menu.

ambiances_menu() → Generator[None, None, None]

Push a menu that can edit ambiances.

builder_menu() → Generator[None, None, None]

Push the builder menu.

configure_reverb() → None

Configure the reverb for the current room.

create_exit() → Generator[None, None, None]

Link this room to another.

create_menu() → Generator[None, None, None]

Show the creation menu.

create_object() → None

Create a new object in the current room.

create_room() → None

Create a new room.

delete() → None

Delete the currently focused object.

delete_ambiance(ambiances: List[earwax.story.world.WorldAmbiance], ambiance: earwax.story.world.WorldAmbiance) → Callable[[], None]

Delete the ambiance.

describe_room() → Generator[None, None, None]

Set the description for the current room.

edit_action(obj: Union[earwax.story.world.RoomObject, earwax.story.world.RoomExit, earwax.story.world.StoryWorld], action: earwax.story.world.WorldAction) → Callable[[], None]

Push a menu that allows editing of the action.

Parameters:
  • obj – The object the action is attached to.
  • action – The action to edit (or delete).
edit_ambiance(ambiance: earwax.story.world.WorldAmbiance) → Callable[[], Generator[None, None, None]]

Edit the ambiance.

edit_object_class(class_: earwax.story.world.RoomObjectClass) → Callable[[], None]

Push a menu for editing object classes.

Parameters:class – The object class to edit.
edit_object_class_names() → None

Push a menu that can edit object class names.

edit_object_classes() → None

Push a menu for editing object classes.

edit_volume_multiplier(ambiance: earwax.story.world.WorldAmbiance) → Callable[[], Generator[None, None, None]]

Return a callable that can be used to set an ambiance volume multiplier.

Parameters:ambiance – The ambiance whose volume multiplier will be changed.
get_rooms(include_current: bool = True) → List[earwax.story.world.WorldRoom]

Return a list of rooms from this world.

Parameters:include_current – If this value is True, the current room will be included.
goto_room() → Generator[None, None, None]

Let the player choose a room to go to.

object_actions() → Generator[None, None, None]

Push a menu that lets you configure object actions.

remessage() → Optional[Generator[None, None, None]]

Set a message on the currently-focused object.

rename() → Generator[None, None, None]

Rename the currently focused object.

reposition_object() → None

Reposition the currently selected object.

room

Return the current room.

save_world() → None

Save the world.

set_action_sound(action: earwax.story.world.WorldAction) → Generator[None, None, None]

Set the sound on the given action.

Parameters:action – The action whose sound will be changed.
set_message(action: earwax.story.world.WorldAction) → Generator[None, None, None]

Push an editor to set the message on the provided action.

Parameters:action – The action whose message attribute will be modified.
set_name(obj: Union[earwax.story.world.WorldAction, earwax.story.world.RoomObject, earwax.story.world.WorldRoom]) → Generator[None, None, None]

Push an editor that can be used to change the name of obj.

Parameters:obj – The object to rename.
set_object_type() → None

Change the type of an object.

set_world_messages() → Generator[None, None, None]

Push a menu that allows the editing of world messages.

set_world_sound(name: str) → Callable[[], Generator[None, None, None]]

Set the given sound.

Parameters:name – The name of the sound to edit.
shadow_description() → None

Set the description of this room from another room.

shadow_name() → None

Sow a menu to select another room whose name will be shadowed.

sounds_menu() → Optional[Generator[None, None, None]]

Add or remove ambiances for the currently focused object.

world_sounds() → Generator[None, None, None]

Push a menu that can be used to configure world sounds.

class earwax.story.ObjectPositionLevel(game: Game, object: Union[earwax.story.world.RoomObject, earwax.story.world.RoomExit], level: EditLevel, initial_position: Optional[earwax.story.world.DumpablePoint] = NOTHING)

Bases: earwax.level.Level

A level for editing the position of an object.

Variables:
  • object – The object or exit whose position will be edited.
  • level – The edit level which pushed this level.
backward() → None

Move the sound backwards.

cancel() → None

Undo the move, and return everything to how it was.

clear() → None

Clear the object position.

done() → None

Finish editing.

down() → None

Move the sound down.

forward() → None

Move the sound forwards.

get_initial_position() → Optional[earwax.story.world.DumpablePoint]

Get the object position.

left() → None

Move the sound left.

move(x: int = 0, y: int = 0, z: int = 0) → None

Change the position of this object.

reset() → None

Reset the current room.

right() → None

Move the sound right.

up() → None

Move the sound up.

class earwax.story.PlayLevel(game: Game, world_context: StoryContext, cursor_sound: Optional[earwax.sound.Sound] = None, inventory: List[earwax.story.world.RoomObject] = NOTHING, reverb: Optional[GlobalFdnReverb] = None, object_ambiances: Dict[str, List[earwax.ambiance.Ambiance]] = NOTHING, object_tracks: Dict[str, List[earwax.track.Track]] = NOTHING)

Bases: earwax.level.Level

A level that can be used to play a story.

Instances of this class can only play stories, not edit them.

Variables:
  • world_context – The context that contains the world, and the state for this story.
  • action_sounds – The sounds which were started by object actions.
  • cursor_sound – The sound that plays when moving through objects and ambiances.
  • inventory – The list of Roomobject instances that the player is carrying.
  • reverb – The reverb object for the current room.
  • object_ambiances – The ambiances for a all objects in the room, excluding those in the players’ inventory.
  • object_tracks – The tracks for each object in the current room, excluding those objects that are in the player’s inventory.
actions_menu(obj: earwax.story.world.RoomObject, menu_action: Optional[earwax.story.world.WorldAction] = None) → None

Show a menu of object actions.

Parameters:
  • obj – The object which the menu will be shown for.
  • menu_action – The action which will be used instead of the default actions_action.
activate() → None

Activate the currently focussed object.

build_inventory() → None

Build the player inventory.

This method should be performed any time state changes.

cycle_category(direction: int) → Generator[None, None, None]

Cycle through information categories.

cycle_object(direction: int) → None

Cycle through objects.

do_action(action: earwax.story.world.WorldAction, obj: Union[earwax.story.world.RoomObject, earwax.story.world.RoomExit], pan: bool = True) → None

Actually perform an action.

Parameters:
  • action – The action to perform.
  • obj

    The object that owns this action.

    If this value is of type RoomObject, and its position value is not None, then the action sound will be panned accordingly..

  • pan – If this value evaluates to False, then regardless of the obj value, no panning will be performed.
drop_object(obj: earwax.story.world.RoomObject) → Callable[[], None]

Return a callable that can be used to drop an object.

drop_object_menu() → None

Push a menu that can be used to drop an object.

get_gain(type: earwax.track.TrackTypes, multiplier: float) → float

Return the proper gain.

get_objects() → List[earwax.story.world.RoomObject]

Return a list of objects that the player can see.

This method will exclude objects which are in the as yet unimplemented player inventory.

The resulting list will be sorted with Python’s sorted builtin.

inventory_menu() → None

Show the inventory menu.

main_menu() → Generator[None, None, None]

Return to the main menu.

next_category() → Generator[None, None, None]

Next information category.

next_object() → None

Go to the next object.

object

Return the object from self.state.

object_menu(obj: earwax.story.world.RoomObject) → Callable[[], None]

Return a callable which shows the inventory menu for an object.

objects_menu(objects: List[earwax.story.world.RoomObject], func: Callable[[earwax.story.world.RoomObject], Callable[[], None]], title: str) → None

Push a menu of objects.

on_pop() → None

Stop all the action sounds.

on_push() → None

Set the initial room.

The room is the world from the state object, rather than the initial_room.

pause() → None

Pause All the currently-playing room sounds.

perform_action(obj: earwax.story.world.RoomObject, action: earwax.story.world.WorldAction) → Callable[[], None]

Return a function that will perform an object action.

This method is used by actions_menu() to allow the player to trigger object actions.

The inner method performs the following actions:

  • Shows the action message to the player.
  • Plays the action sound. If obj has coordinates, the sound will be
    heard at those coordinates.
  • Pops the level to remove the actions menu from the stack.
Parameters:
  • obj – The object which has the action.
  • action – The action which should be performed.
play_action_sound(sound: str, position: Optional[earwax.point.Point] = None) → None

Play an action sound.

Parameters:
  • sound – The filename of the sound to play.
  • position

    The position of the owning object.

    If this value is None, the sound will not be panned.

play_cursor_sound(position: Optional[earwax.point.Point]) → None

Play and set the cursor sound.

play_object_ambiances(obj: earwax.story.world.RoomObject) → None

Play all the ambiances for the given object.

Parameters:obj – The object whose ambiances will be played.
previous_category() → Generator[None, None, None]

Previous information category.

previous_object() → None

Go to the previous object.

save_state() → None

Save the current state.

set_room(room: earwax.story.world.WorldRoom) → None

Move to a new room.

state

Return the current state.

stop_action_sounds() → None

Stop all action sounds.

stop_object_ambiances(obj: earwax.story.world.RoomObject) → None

Stop all the ambiances for the given object.

Parameters:obj – The object whose ambiances will be stopped.
take_object(obj: earwax.story.world.RoomObject) → None

Take an object.

use_exit(x: earwax.story.world.RoomExit) → None

Use the given exit.

This method is called by the activate() method.

Parameters:x – The exit to use.
use_object(obj: earwax.story.world.RoomObject) → Callable[[], None]

Return a callable that can be used to use an object.

use_object_menu() → None

Push a menu that allows using an object.

world

Get the attached world.

class earwax.story.StoryContext(game: earwax.game.Game, world: earwax.story.world.StoryWorld, edit: bool = NOTHING, state: earwax.story.world.WorldState = NOTHING, errors: List[str] = NOTHING, warnings: List[str] = NOTHING)

Bases: object

Holds references to various objects required to make a story work.

before_run() → None

Set the default panning strategy.

configure_earwax() → None

Push a menu that can be used to configure Earwax.

configure_music() → None

Allow adding and removing main menu music.

credit_menu(credit: earwax.credit.Credit) → Callable[[], None]

Push a menu that can deal with credits.

credits_menu() → None

Add or remove credits.

earwax_bug() → None

Open the Earwax new issue URL.

get_default_config_file() → pathlib.Path

Get the default configuration filename.

get_default_logger() → logging.Logger

Return a default logger.

get_default_state() → earwax.story.world.WorldState

Get a default state.

get_main_menu() → earwax.menus.menu.Menu

Create a main menu for this world.

get_window_caption() → str

Return a suitable window title.

load() → None

Load an existing game, and start it.

play() → None

Push the world level.

push_credits() → None

Push the credits menu.

set_initial_room() → None

Set the initial room.

set_panner_strategy() → None

Allow the changing of the panner strategy.

show_warnings() → None

Show any generated warnings.

world_options() → None

Configure the world.