Closed SweetInk closed 4 years ago
Operator functions are not supported when writing their special forms (due to quirks like this). You should use eventPlayer.C = 1
and eventPlayer.U[1] = 8
.
When you compile this workshop code, you get the following result
workshop code
variables {
global:
20: U
player:
2: C
}
rule ("test") {
event {
Ongoing - Each Player;
All;
All;
}
actions {
Set Player Variable(Event Player, C, 1);
Set Player Variable At Index(Event Player, U, 1, 8);
}
}
Compilation result
/*
The decompiler is functional, but not finished.
It does not support gotos, this mean multi-line actions such as "Abort If" or "Loop If" are not properly decompiled as well.
Some special functions may also not be properly decompiled.
However, decompilation should yield a compilable gamemode. Decompiling then compiling a gamemode should result in the same functional gamemode.
*/
rule "test":
@Event eachPlayer
@Hero all
eventPlayer.C = 1
__setPlayerVariableAtIndex__(eventPlayer, U, 1, 8)
After compiling, you will get the following code
variables {
global:
20: U
player:
2: C
}
rule ("test") {
event {
Ongoing - Each Player;
All;
All;
}
actions {
Set Player Variable(Event Player, C, 1);
"It should not be a global variable here."
Set Player Variable At Index(Event Player, Global Variable(U), 1, 8);
}
}
The compiled workshop code is inconsistent with the original workshop code. As I mentioned above.
I see. The decompiler does not support the whole syntax of the Overwatch text language (as it is too difficult to parse - even Blizzard currently has a bug in their parser), but instead only supports the subset of it generated by Overwatch. Basically, the decompiler only supports output that is copy pasted from the workshop GUI.
I will leave this issue open as a reminder for myself to put a warning on the decompiler page specifying that. If you wish to decompile output generated from a third-party tool (including OverPy) then you should paste it into Overwatch and back.
Added warning in 5.5.0.
Opy code
Compilation result
This bug exists in version
5.4.0