Typed Properties

From Seltanikor
Jump to: navigation, search

A property can be any (most) of the basic Python types: str, bool, int, float, list, dict. It can also be a Python datetime, an ObjectId, or a special value.

The special values are really represented as Python dicts, with a "type" field. These are their structures.


Text

A block of text, possibly containing square-bracket markup.

  • type: 'text'
  • text: string

GenText

A block of text-generator structure. This has the syntax of a Python expression.

  • type: 'gentext'
  • text: string

Code

A block of TworldPy code.

  • type: 'code'
  • text: string
  • args: string (optional)

Event

An action that displays an event message.

  • type: 'event'
  • text: string
  • otext: string (optional, displayed to other players in the same location)

Move

An action that moves the player to another location (in the same instance).

  • type: 'move'
  • loc: string, Python identifier
  • text: string (optional, message to moving player)
  • oleave: string (optional, others see you leave, default "[$name] leaves")
  • oarrive: string (optional, others see you arrive, default "[$name] arrives")

Panic

An action that throws the player out of the instance. They will link to their preferred ("home") instance.

  • type: 'panic'
  • text: string (optional)
  • otext: string (optional)

PortList

An action that displays a bookshelf

  • type: 'portlist'
  • plistkey: string, Python identifier (the key in a portlist)
  • readaccess: int (optional, default VISITOR)
  • editaccess: int (optional, default MEMBER)
  • text: string (describes the bookshelf)
  • focus: bool (optional; if True, this is a standalone book)

SelfDesc

An action that displays the "consider your appearance" dialog. (This only works in solo worlds.)

  • type: 'selfdesc'
  • text: string

EditStr

An action that displays a string-editing dialog, as for a chalkboard or editable sign.

  • type: 'editstr'
  • key: string, Python identifier (the name of a string-value property)
  • editaccess: int (optional, default MEMBER)
  • label: string (optional)
  • text: string (optional, message when text is edited)
  • otext: string (optional, displayed to other players in the location when text is edited)