Characters
The following functions and classes are defined in the phone.character namespace.
The phone Character class
class Character(object)Not to confuse with Ren’Py’s
Characterobjects (we’re in thephone.characternamespace remember), these objects form the core of the framework.When talking about a phone
Characterobject, I will (most of the time) use this notation:*character*which means the phone
Characterobject itself or itskey(you’ll see what it is just below).
def __init__(self, name, icon, key, cps, color)
name: a string, the name of the character.icon: a displayable.key: any hashable object that is notNone. this must be a unique object proper to this phoneCharacterobject.cps: an integer.color: any valid color value.
Once the object has been created, the name, icon and cps fields can be safely changed. The key and color fields are read-only.
def get_textbox(self)Returns a solid with rounded corners of the character’s color and the radius given by
phone.config.textbox_radius.def is_pov(self)(property)Returns whether the character’s key is equal to the store variable
store.pov_key.def get_typing_delay(self, message, substitute=True)Returns a number of second this character would be typing out
message(a string). Ifsubstituteis true, text substitution occurs before computing the time.
These objects are hashable (their key will be hashed).
When creating a phone Character object, you must use default and not define .
Functions
def character(x)Returns the
*character*x. Ifxis a phoneCharacter, returns it, otherwise it is taken to be the key to a phoneCharacterobject and will return that object, or raiseKeyErrorif no phoneCharacterobject has a key like this (ifNoneis passed,store.pov_keyis used).def has_character(key)Returns true if there is a phone
Characterwith the keykey, or fals if there is not.def get_textbox(color)Returns a solid with rounded corners of color
colorand the radius given byphone.config.textbox_radius.def get_all()Returns a list of all phone
Characterobjects defined.
Example
# default /!\
default p_eileen = phone.character.Character("Eileen", phone.asset("default_icon.png"), "eileen", 20, "#fff")