Skip to content

TriggerSelect

Attributes

TS: Type[TriggerSelect] = TriggerSelect module-attribute

Type: Type[TriggerSelect]
Value: TriggerSelect

Alias for TriggerSelect

Classes

TriggerSelect

Object used to select a trigger in many trigger related functions. For ease of use, the alias TS can be called. You can also use those in combination with the class methods (factory methods). Like so:

Selecting a trigger by its ID doesn't require this object

Most functions allow you to just input 4 into the trigger_select parameter (instead of: TS.index(4))

Examples:

TS.index(4) To select the trigger with index 4

TS.display(4) Trigger with display index 4

TS.trigger(trigger) Well... The trigger object given...

Source code in AoE2ScenarioParser/objects/support/trigger_select.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
class TriggerSelect:
    """
    Object used to select a trigger in many trigger related functions. For ease of use, the alias `TS` can be
    called. You can also use those in combination with the class methods (factory methods). Like so:

    Tip: Selecting a trigger by its ID doesn't require this object
        Most functions allow you to just input `4` into the trigger_select parameter (instead of: `TS.index(4)`)

    Examples:
        `TS.index(4)`  To select the trigger with index 4

        `TS.display(4)`  Trigger with display index 4

        `TS.trigger(trigger)`  Well... The trigger object given...
    """
    def __init__(self, trigger_index: int = None, display_index: int = None, trigger: Trigger = None):
        """
        Args:
            trigger_index: The index of the trigger. Starting from 0, based on creation time
            display_index: The display index of a trigger. Starting from 0, based on display order in the editor
            trigger: The trigger object itself.
        """
        self.trigger = trigger
        self.display_index = display_index
        self.trigger_index = trigger_index

    @classmethod
    def index(cls, index: int):
        return cls(trigger_index=index)

    @classmethod
    def display(cls, display_index: int):
        return cls(display_index=display_index)

    @classmethod
    def trigger(cls, trigger: Trigger):
        return cls(trigger=trigger)

Attributes

Attribute Type
display_index instance-attribute
trigger_index instance-attribute

Functions


def __init__(...)

Parameters:

Name Type Description Default
trigger_index int

The index of the trigger. Starting from 0, based on creation time

None
display_index int

The display index of a trigger. Starting from 0, based on display order in the editor

None
trigger Trigger

The trigger object itself.

None
Source code in AoE2ScenarioParser/objects/support/trigger_select.py
21
22
23
24
25
26
27
28
29
30
def __init__(self, trigger_index: int = None, display_index: int = None, trigger: Trigger = None):
    """
    Args:
        trigger_index: The index of the trigger. Starting from 0, based on creation time
        display_index: The display index of a trigger. Starting from 0, based on display order in the editor
        trigger: The trigger object itself.
    """
    self.trigger = trigger
    self.display_index = display_index
    self.trigger_index = trigger_index

def display(...) classmethod

Parameters:

Name Type Description Default
display_index int - required
Source code in AoE2ScenarioParser/objects/support/trigger_select.py
36
37
38
@classmethod
def display(cls, display_index: int):
    return cls(display_index=display_index)

def index(...) classmethod

Parameters:

Name Type Description Default
index int - required
Source code in AoE2ScenarioParser/objects/support/trigger_select.py
32
33
34
@classmethod
def index(cls, index: int):
    return cls(trigger_index=index)

def trigger(...) classmethod

Parameters:

Name Type Description Default
trigger Trigger - required
Source code in AoE2ScenarioParser/objects/support/trigger_select.py
40
41
42
@classmethod
def trigger(cls, trigger: Trigger):
    return cls(trigger=trigger)