Hello,
I've been amending the socket.io plugin so I can receive JSON and pick a value and also emit it back.
I've been successful implementing a new LastDataAtVar("variable") expression which can pick a variable from incoming JSON object.
e.g. server does:
this.broadcast.emit("new player", {id: newPlayer.id, x: newPlayer.getX(), y: newPlayer.getY()});
I can handpick the values.
However, now I'd like do something like:
Socket On Event "move player" : Emit '{"x":"' & MyPlayer.x & '","y":"' & MyPlayer.y & '"}'
The problem is Construct 2 does not allow me to write strings in this way because of the error checking...although it is a string.
If I could do this, I could then just JSON.parse() it. Even better would be to write JSON directly into the field without it being a string.
Any ideas on getting around this?
Cheers