tuxemon.event.actions.variable_math module

final class tuxemon.event.actions.variable_math.VariableMathAction(var1, operation, var2, result=None)[source]

Bases: EventAction

Perform a mathematical operation on the player.game_variables dictionary.

Optionally accepts a fourth parameter to store the result, otherwise it is stored in var1.

Script usage

variable_math <var1>,<operation>,<var2>,<result>
variable_math <var1>,<operation>,<var2>
Script parameters:
  • var1 – First operand.

  • operation – Operator symbol.

  • var2 – Second operand.

  • result – Variable where to store the result. If missing, it will be var1.

Parameters:
  • var1 (str) –

  • operation (str) –

  • var2 (str) –

  • result (str | None) –

name: ClassVar[str] = 'variable_math'
operation: str
result: str | None = None
start()[source]

Called only once, when the action is started.

For all actions, you will need to override this method.

For actions that only need to run one frame you can simply put all the code here. If the action will need to run over several frames, you can init your action here, then override the update method.

Return type:

None

var1: str
var2: str