Abstract Event class — GramophoneTools 0.6.22-beta documentation

# Abstract Event class

class `Event.` `Event`(level)

  Generic Event object all specific Events inherit from.

  Parameters: | level (Level) – The Level this Event will be used on.

  `set_session`(session)

    Sets the Session the event will be triggered in.

    Parameters: | session (Session) – The session this Event will be triggered in.

  `trigger`()

    Triggers the Event. Prints Event information.

  `triggerable`

    Tell whether it makes sense to trigger this event at the moment.

# Specific Events

## Teleportation

class `Event.` `Teleport`(level, target_position)

  Bases: `Event.Event`

  Teleports to a set location

  Parameters: | level (Level) – The Level this Event will be used on. target_position (int) – The target of the teleportation.

  `trigger`()

    Triggers the Event. Prints Event information.

  `triggerable`

    Tell whether it makes sense to trigger this event at the moment.

## Random Teleportation

class `Event.` `RandomTeleport`(level, list_of_target_zones)

  Bases: `Event.Event`

  Teleports to a type of zone that is on the given list randomly.

  Parameters: | level (Level) – The Level this Event will be used on. list_of_target_zones ([Zone]) – The possible Zones this teleport can land is.

  `trigger`()

    Triggers the Event. Prints Event information.

  `triggerable`

    Tell whether it makes sense to trigger this event at the moment.

## Port On/Off

class `Event.` `PortOn`(level, port)

  Bases: `Event.Event`

  Turns on a port on the Level’s Gramophone.

  Parameters: | level (Level) – The Level this Event will be used on. port (int) – Which output to use on the device.

  `trigger`()

    Triggers the Event. Prints Event information.

  `triggerable`

    Tell whether it makes sense to trigger this event at the moment.

class `Event.` `PortOff`(level, port)

  Bases: `Event.Event`

  Turns off a port on the Level’s Gramophone.

  Parameters: | level (Level) – The Level this Event will be used on. port (str -- 'A', 'B' or 'C') – Which output should be turned off.

  `trigger`()

    Triggers the Event. Prints Event information.

  `triggerable`

    Tell whether it makes sense to trigger this event at the moment.

## Starting/Stopping bursting

class `Event.` `StartBurst`(level, port, on_time, pause_time)

  Bases: `Event.Event`

  Starts bursting a port on the Level’s gramophone.

  Parameters: | level (Level) – The Level this Event will be used on. port (int) – Which output to use on the device. on_time (float) – How long should the port by set to high before a pause. pause_time (float) – How long should the pauses be.

  `trigger`()

    Triggers the Event. Prints Event information.

  `triggerable`

    Tell whether it makes sense to trigger this event at the moment.

class `Event.` `StopBurst`(level, port)

  Bases: `Event.Event`

  Stops bursting a port on the Level’s gramophone.

  Parameters: | level (Level) – The Level this Event will be used on. port (int) – Which output should stop bursting.

  `trigger`()

    Triggers the Event. Prints Event information.

  `triggerable`

    Tell whether it makes sense to trigger this event at the moment.

## Pausing/Unpausing

class `Event.` `Pause`(level, pause_position=None)

  Bases: `Event.Event`

  Pauses the Level where it is or at a given position.

  Parameters: | level (Level) – The Level this Event will be used on. pause_position (int or None) – Set to None to pause at current position. None by default.

  `trigger`()

    Triggers the Event. Prints Event information.

  `triggerable`

    Tell whether it makes sense to trigger this event at the moment.

class `Event.` `UnPause`(level, unpause_position=None)

  Bases: `Event.Event`

  Unpauses the Level where it is or at a given position.

  Parameters: | level (Level) – The Level this Event will be used on. unpause_position (int or None) – Set to None to pause at current position. None by default.

  `trigger`()

    Triggers the Event. Prints Event information.

  `triggerable`

    Tell whether it makes sense to trigger this event at the moment.

## Printing messages

class `Event.` `Print`(level, message)

  Bases: `Event.Event`

  Prints the given message to the console window.

  Parameters: | message (str) – The message that will be printed when triggered

  `triggerable`

    Tell whether it makes sense to trigger this event at the moment.