Setting player custom data doesn't seem to be working
Unless I don't know how to use it properly?
https://makecode.com/_JdRW8oVghAM1
Okay, this is weird...this is happening in the same game when I add a callout to see who is who...
Maybe I'm not initializing the players correctly?
Looks like an off-by-one error in the player state array: https://github.com/microsoft/pxt-common-packages/blob/a0bcbbee0b53f5e443e5693996904fd9a186ac8a/libs/multiplayer/player.ts#L169
Should read
while (this._state.length <= key) this._state.push(0);
Workaround is to write to a state key one higher than you actually want to store.
The player number thing looks like a different issue. It isn't converting to the JavaScript I would have expected. I get this:
mp.getPlayerSprite(p4).sayText(convertToText(mp.getPlayerByNumber(number)))
What I expected:
mp.getPlayerSprite(p4).sayText(convertToText(p4.number))
Hmm. Is there something I should be doing differently there? I don't need it for my delivery tomorrow, but I anticipate it will come up again.
Forum user reporting the player custom data issue: https://forum.makecode.com/t/why-doesnt-my-set-player-state-work/27988/2