I suggest adding a conditional to scratch 2.0 that checks if the user has closed the window or the project frame has lost focus. This is helpful if you have a multiplayer room that says how many people are there, and if the person leaves, then you can subtract 1 from that variable.
if <session leaved> change [PeopleInRoom v] by [-1]
Last edited by MisterDuck (2012-11-13 17:46:37)
Offline
I'd say this should be a hat block, but it's a nice idea.
However, when the user leaves, it closes Scratch, meaning it can't run anymore blocks, so I'm not sure how good it would be.
Offline
roijac wrote:
you can workaround it
exactly what i was thinking
Come 2.0, you could make it so that if a person is connected, then they keep sending packets, it guess you could call them? Then, if the packets are not being sent, then they are removed from the list. I'd have to take some time to think of the actual code, though, because there is no server side scripting
EDIT: just came up with some experimental code:
when gf clicked forever if <<(☁ refresh) = [1] > and <not<[☁online v] contains (user id)>>> add (user id) to [☁online v]//a cloud list end when I receive [send_packets v] set [☁refresh v] to [0] delete (all v) of [☁online v] set [☁refresh v] to [1] wait (☁refresh rate) secs //should be determined server side broadcast [send_packets v]The cloud list "online" would contain a list of all user id's logged on
Last edited by SJRCS_011 (2012-11-14 22:04:43)
Offline