core.components.event.actions.core module

class core.components.event.actions.core.Core[source]

Bases: object

call_event(game, action)[source]

Executes the specified event’s actions by id.

Parameters:
  • game (core.control.Control) – The main game object that contains all the game’s variables.
  • action (Tuple) – The action (tuple) retrieved from the database that contains the action’s parameters
Return type:

None

Returns:

None

Valid Parameters: event_id

  • event_id (int): The tmx id of the event to call.

Examples:

>>> action.__dict__
{
    "type": "call_event",
    "parameters": [
        "2"
    ]
}
change_state(game, action)[source]

Changes to the specified state.

Parameters:
  • game (core.control.Control) – The main game object that contains all the game’s variables.
  • action (Tuple) – The action (tuple) retrieved from the database that contains the action’s parameters
Return type:

None

Returns:

None

Valid Parameters: state_name

  • state_name (str): The state name to switch to.

Examples:

>>> action.__dict__
{
    "type": "change_state",
    "parameters": [
        "MAIN_MENU"
    ]
}
dialog(game, action)[source]

Opens a dialog window with text

Parameters:
  • game (core.control.Control) – The main game object that contains all the game’s variables.
  • action (Tuple) – The action (tuple) retrieved from the database that contains the action’s parameters
Return type:

None

Returns:

None

Valid Parameters: text_to_display

You may also use special variables in dialog events. Here is a list of available variables:

  • ${{name}} - The current player’s name.

Examples:

>>> action.__dict__
{
    "type": "dialog",
    "parameters": [
        "Red:\n This is some dialog!"
    ]
}
dialog_chain(game, action)[source]

Opens a chain of dialogs in order. Dialog chain must be ended with the ${{end}} keyword.

Parameters:
  • game (core.control.Control) – The main game object that contains all the game’s variables.
  • action (Tuple) – The action (tuple) retrieved from the database that contains the action’s parameters
Return type:

None

Returns:

None

Valid Parameters: text_to_display

You may also use special variables in dialog events. Here is a list of available variables:

  • ${{name}} - The current player’s name.
  • ${{end}} - Ends the dialog chain.

Examples:

>>> action.__dict__
{
    "type": "dialog_chain",
    "parameters": [
        "Red:\n This is some dialog!"
    ]
}
rumble(game, action)[source]

Rumbles available controllers with rumble support

Parameters:
  • game (core.control.Control) – The main game object that contains all the game’s variables.
  • action (Tuple) – The action (tuple) retrieved from the database that contains the action’s parameters
Return type:

None

Returns:

None

Valid Parameters: duration,power

  • duration (float): time in seconds to rumble for
  • power (int): percentage of power to rumble. (1-100)

Examples:

>>> action.__dict__
{
    "type": "rumble",
    "parameters": [
        "2",
        "100"
    ]
}
set_variable(game, action)[source]

Sets the key in the player.game_variables dictionary.

Parameters:
  • game (core.control.Control) – The main game object that contains all the game’s variables.
  • action (Tuple) – The action (tuple) retrieved from the database that contains the action’s parameters
Return type:

None

Returns:

None

Valid Parameters: variable_name:value

Examples:

>>> action.__dict__
{
    "type": "set_variable",
    "parameters": [
        "battle_won:yes"
    ]
}
wait_for_input(game, action)[source]

Pauses the event engine until specified button is pressed

Parameters:
  • game (core.control.Control) – The main game object that contains all the game’s variables.
  • action (Tuple) – The action (tuple) retrieved from the database that contains the action’s parameters
Return type:

None

Returns:

None

Valid Parameters: button

  • button (str): pygame key to wait for

Examples:

>>> action.__dict__
{
    "type": "wait_for_input",
    "parameters": [
        "K_RETURN"
    ]
}
wait_for_secs(game, action)[source]

Pauses the event engine for n number of seconds.

Parameters:
  • game (core.control.Control) – The main game object that contains all the game’s variables.
  • action (Tuple) – The action (tuple) retrieved from the database that contains the action’s parameters
Return type:

None

Returns:

None

Valid Parameters: duration

  • duration (float): time in seconds for the event engine to wait for

Examples:

>>> action.__dict__
{
    "type": "wait_for_secs",
    "parameters": [
        "2.0"
    ]
}