Skip to content

Rules and events

Zezombye edited this page May 26, 2020 · 3 revisions

Rules

A rule starts with the rule "rule name": block and ends with the end of the block (indentation back to 0). Subroutines start with def subroutineName():.

Rule-specific data is also in annotations. They can be in any order, but they must be placed before any action.

The different annotations are:

  • @Event global: specifies the event type, such as global or eachPlayer.
  • @Team all: the team targeted by this rule (can be omitted). Valid values are: all, 1, 2
  • @Slot 11: the slots targeted by this rule (can be omitted). Valid values are 0-11.
  • @Hero widowmaker: the hero targeted by this rule (can be omitted).
  • @SuppressWarnings w_unsuitable_event: suppresses a warning for this rule (instead of globally).
  • @Disabled: generates the rule as disabled.
  • @Condition A == B: specifies a rule condition.

Subroutines

The special "subroutine" event type is represented with python's function syntax. As such, a rule with a subroutine "mySub" would be:

def mySub():
    A = 2

The def statement must cover the whole rule. Due to the limitations of the workshop subroutines, no parameters are allowed, and no return value is allowed.

Subroutines can use the @Name annotation to specify a rule name. If omitted, a rule name is generated by OverPy.