Closed Artikae closed 5 months ago
The solution here would be to compile this example to use Modify Player Variable
. Some discussion is happening internally with contributors to implement this.
Let's put them in the known:
+=
, -=
, etc. gets Ast'd into Set Player Variable
because then we can do some optimizations to get back Modify Player Variable
random.choice
random.xyz
function in use, and Ast the operation to Modify Player Variable
, skipping any further optimizations.Regressed with version 7.0.1
When compiling
a += n
, OverPy seems to convert it to the form:a = a + n
. For most cases this is fine. However, ifa
results in a different variable each time it is evaluated, this transformation is incorrect.For example, this workshop action adds 5 to a random player's A variable.
It gets decompiled to this:
Re-compiling the above produces ##this:
Now, the action picks a random player, and sets their A to another random player's A, plus 5.