-
-
Notifications
You must be signed in to change notification settings - Fork 0
Simplified Scoreboard Expressions
Expressions that start with #!sb
can be used for a more concise way of doing arithmetic through
scoreboard player ...
commands.
To set, add, or remove a value from a player's score, use the format:
#!sb <targets> <objective> <=,+=,-=> <score>
Regex: (?:\s|^)#!sb (\S+) (\S+) (=|\+=|-=) (-?\d+)(?:\s|$)
This:
#!sb @a objective_name = -77
#!sb @s[type=creeper,scores={objective_name=111}] objective_name += 222
#!sb global objective_name -= 489
Turns into this:
scoreboard players set @a objective_name -77
scoreboard players add @s[type=creeper,scores={objective_name=111}] objective_name 222
scoreboard players remove global objective_name 489
To execute an operation using two player's scores, use the format:
#!sb <targets> <targetObjective> <operation> <source> <sourceObjective>
Regex: (?:\s|^)#!sb (\S+) (\S+) (\+=|-=|\*=|\/=|%=|=|<|>|><) (\S+) (\S+)(?:\s|$)
This:
#!sb @a objective_name += @p some_other_objective
#!sb @s[type=creeper,scores={objective_name=111}] objective_name = global some_other_objective
#!sb global objective_name *= @s some_other_objective
Turns into this:
scoreboard players set @a objective_name += @p some_other_objective
scoreboard players add @s[type=creeper,scores={objective_name=111}] objective_name = global some_other_objective
scoreboard players remove global objective_name *= @s some_other_objective
To reset a player's score back to its default value, use the format:
#!sb reset <targets> [<objective>]
Regex: (?:\s|^)#!sb reset (\S+)( \S+)?(?:\s|$)
This:
#!sb reset @a objective_name
#!sb reset @e[type=creeper,scores={objective_name=-111}]
Turns into this:
scoreboard players reset @a objective_name
scoreboard players reset @e[type=creeper,scores={objective_name=-111}]
To enable a player's trigger score, use the format: #!sb enable <targets> <objective>
Regex: (?:\s|^)#!sb enable (\S+) (\S+)(?:\s|$)
This:
#!sb enable @a objective_name
Turns into this:
scoreboard players enable @a objective_name