0%
January 11, 2024

Advanced Combat Tracker (ACT): Scriping for Trigger

act

Capture Variables from Event Text

In ACT every event text will be processed by our triggers (we can fire event text from our action as well, see conditional action in the next section).

The trigger determines if the subsequent actions take place by the following regular expression:

Let's analyse the grouping here:

(?<=\[notice\]\s)(?<sentence>.*),位置(?<position>((\d|\w){1}))(?=|)

They all follow the pattern:

(?<variable-name><matching-pattern>)

which means that

  1. Once matching-pattern matched
  2. Assign the matched string to variable-name.

Note that we always just want the partially matched string. The match-group is exactly what we want.

Actions to the Event Text: Scalar Variable Operation and Trigger Operation

Set-variable Action: Set the captured variable into global state

Assume a regular expression is met, let's add an action:

Here the variable sentence is captured from (?<sentence>.*) in the example of previous section. Under the hood it:

  1. Created a new variable called sigma_content in global scope.

  2. Assigned a scoped variable (on captured) sentence into sigma_content. The value is dereferrenced by ${sigma_content}.

  3. This is equivalent to

    global_state["sigma_content"] = sentence;

    To access this global state, we will use ${var:sigma_content} later.

Conditional Action: Fire another trigger conditionally using global state

Let's add an action and select Trigger Operation:

This time we choose to fire another trigger with the information captured from scoped varaiable position.

You will be adding another trigger to be fired by the action we discuss just now.

Now let's switch to Action condition, you are free to add any condition using the global states as follows:

Reset Variables

We need to reset variables when next fight starts:

戦闘開始!