Room Model

This is where all of ScalyMUCK’s model definitions are located, save for the modifications that may extend the software in such a way that it demands for extra models but that is beyond the point.

The “base” definitions located in models.py are:

All of the above classes inherit a few functions from ObjectBase as well.

class models.Room(name=None, description='<Unset>', owner=0)[source]

Base room model that ScalyMUCK uses.

Rooms are what make up the world inside of just about any MUCK really. Even if the rooms are not described as such, they still must be used to contain players, dropped items, bots, etc.

add_exit(name=None, target=None, owner=0)[source]

Gives this Room instance an Exit linking to anywhere.

This produces an Exit link from the calling Room instance to another one elsewhere. The database changes are automatically committed here due to the way the exit has to be created in the database first for the changes to properly apply without any hackery to occur.

Keyword arguments:
  • name – The name of the exit that should be used.
  • target – The ID or instance of a Room that this exit should be linking to.
  • owner – The ID or instance of a Player that should become the owner of this Exit.
bots

An array that contains all instances of Bot contained in this Room.

broadcast(message, *exceptions)[source]

Broadcasts a message to all inhabitants of the Room except those specified.

This broadcasts a set message to all inhabitants of the Room except those specified after the message: some_room.broadcast(‘Dragons are best!’, that_guy, this_guy, other_guy)

The exceptions may be an ID or an instance.

description

A 2000 character string representing the description of this Room.

exits

An array that contains all instances of Exit contained in this Room.

find_bot(id=None, name=None)[source]

Locates a Bot located in the calling instance of Room.

This is a less computionally intensive version of the world’s find_bot as there is going to be much less data to be sorting through since you actually know where the Bot is located (otherwise you wouldn’t be calling this!) and all you need is the instance.

Keyword arguments (one or the other):
  • id – The identification number of the Bot to locate inside of this room. This overrides the name if
  • both are specified.
  • name – The name of the Bot to locate.
find_exit(id=None, name=None)[source]

Locates an Item located in the calling instance of Room.

This is a less computionally intensive version of the world’s find_item as there is going to be much less data to be sorting through since you actually know where the Item is located (otherwise you wouldn’t be calling this!) and all you need is the instance.

Keyword arguments (one or the other):
  • id – The identification number of the Item to locate inside of this room. This overrides the name if
  • both are specified.
  • name – The name of the Item to locate.
find_item(id=None, name=None)[source]

Locates an Item located in the calling instance of Room.

This is a less computionally intensive version of the world’s find_item as there is going to be much less data to be sorting through since you actually know where the Item is located (otherwise you wouldn’t be calling this!) and all you need is the instance.

Keyword arguments (one or the other):
  • id – The identification number of the Item to locate inside of this room. This overrides the name if
  • both are specified.
  • name – The name of the Item to locate.
find_player(id=None, name=None)[source]

Locates a Player located in the calling instance of Room.

This is a less computionally intensive version of the world’s find_player as there is going to be much less data to be sorting through since you actually know where the Player is located (otherwise you wouldn’t be calling this!) and all you need is the instance.

Keyword arguments (one or the other):
  • id – The identification number of the Player to locate inside of this room. This overrides the name if
  • both are specified.
  • name – The name of the Player to locate.
get_exits()[source]

Return a list of all exits.

id

This is the database number of the Room.

items

An array that contains all instances of Item contained in this Room.

name

A short 25 character string representing the name of this Room that is displayed to every connection related to an instance of Player.

owner_id

This is the database number of the Player that this Room belongs to.

players

An array that contains all instances of Player contained in this Room.

Previous topic

Player Model

Next topic

Bot Model

This Page