Page 1 of 1
Changing Variable Ownership on Disconnect
Posted: 27 May 2011, 18:00
by Gloryride
Is there
any way to catch a user disconnect and change ownership of their room variables? They're gone before I know the user is, and that's a problem. The persistence flag won't change this behavior.
Any ideas, anyone? I really need their data!
Thanks!

Posted: 27 May 2011, 18:07
by Gloryride
Alright, after some thorough searching, BigFIsh says:
In order for the variables to be persistent, simply set ownership to null - which will set the ownership to server thus making the variables permanent until the room gets destroyed.
My question is, if I set variable ownership to the server.. whenever a user updates a room variable, is ownership then set back to them? Or does the owner stay the room?
Edit: If the user creates the room variable, there's no way to override ownership client side (AS3). What's the best way of going about making edited and created variables (by the client), owned by the server?
Edit2: After more searching I came across this thread.
Real Persistent Room Variables. If I read this correctly.. I have to write a handler for my room extension that watches for when a room variable is created... then set ownership in the handler to 'null' and that variable is now persistent. Doesn't sound very awesome.
Edit3: Well.. I guess I sort of answered all my own questions (if the above is all true for SFS2X). I would like to request the ability to set ownership in the AS3 client api in future versions. It would be helpful and not such a gross solution.