Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement message action replacements #1280

Merged
merged 1 commit into from
Dec 5, 2023
Merged

Conversation

Pablete1234
Copy link
Member

Allows replacements being defined inside message actions. It supports a list of replacements, where the id of such replacement will be evaluated when sending the message to the audience, for the scope the action is ran on.

Example

    <trigger scope="player">
      <filter>
        <pulse period="1s" duration="0.5s" filter="some-region"/>
      </filter>
      <action>
        <set var="team_score" value="team_score+1"/>
        <message text="Ding {num}!">
          <replacements>
            <decimal id="num" value="team_score"/>
          </replacements>
        </message>
      </action>
    </trigger>

Note: Currently the only supported replacement is decimal, in the future more may come (thinking of players, teams, and durations). id is required in all replacements and it's what will get used to search for a {id} text to replace.

decimal replacement has a required value attribute, which supports formulas (eg: team_score / 100), and a format attribute, which takes in a java decimal format pattern such as #.00 (always show 2 decimal places).
Eg:
<decimal id="id" value="team_score/100" format="#.00"/>

@Electroid Electroid merged commit 1838864 into dev Dec 5, 2023
2 checks passed
@Electroid Electroid deleted the message-action-replacements branch December 5, 2023 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants