How do I do multiply scoreboard values?

Solution 1:

What you are looking for can be done via the aptly named scoreboard players operation set of commands.

scoreboard players operation <targetName> <targetObjective> <operation> <selector> <objective>

This sets <targetName>'s score in <targetObjective> based on <selector>'s score in <objective>, according to the <operation>.

The latter can be any of += (add), -= (subtract), *= (multiply), /= (divide), %= (modulo), = (set), < (min), > (max) or >< (swap).

In order to set var1 = var2 * var3 for "target", you can run two commands:

scoreboard players operation <target> var1 = <target> var2
scoreboard players operation <target> var1 *= <target> var3