Implement exclusive attribute on dummy variables #1245
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds an exclusive type of dummy variable, which limits how many different values (scope keys) there can be in a dummy variable.
exclusive
supports values between 1 and 50. Please avoid using large values, if you simply don't care about the limit, do not specify one, and it'll just be infinite, at a smaller performance cost.In this example, the
last_scored
variable would, at most, have a value for one team. This in practice means that all other teams will always be reset to default whenever a team is set:<set var="last_scored" value="1234"/>
<- Sets the current scoped team value, and other teams are reset to defaultFor the
other
example, the "last 2" updated players will be kept, while players who got in "earlier" than that, are removed.PlayerA triggers:
<set var="other" value="other+1"/>
<- Player A is addedPlayerB triggers:
<set var="other" value="other+1"/>
<- Player B is addedPlayerA triggers:
<set var="other" value="other+1"/>
<- Player A was already in, just gets value set to 2PlayerC triggers:
<set var="other" value="other+1"/>
<- Player C is added, since the first added was A, A is replaced with CPlayer D triggers:
<set var="other" value="other+1"/>
<- Player D is added, since the first added was B, B is replaced with D.Realistically i don't see that much use in the second variant, but the exclusive="1" simplifies alot of use-cases that are otherways painful to reset, requiring multiple switch-scopes to get it sorted.
In this example, we want the team which gets the on-score action to add one, but the opposite team(s) to subtract one from their score, with exclusive it looks like this:
Previously, you'd need:
This is a nice to have as a pre-requisite for a potential future system for chat message interpolation of player/team names and score values