Discuss Scratch

AwesomeSmilee
Scratcher
500+ posts

Detecting who is on a project

I have no idea how to do what the title says. Could someone explain how to do this?
powercon5
Scratcher
1000+ posts

Detecting who is on a project

You what to know who is using the project? you can use the username block
(username)
It reports the username of the user.



Witty signature.





AwesomeSmilee
Scratcher
500+ posts

Detecting who is on a project

I should have made it clearer
I mean a list of who is currently on a project right at a specific moment.

For example, if me, User1 and User2 were playing a project right now, I want to find out how to make a list of all the users active on the project - me, User1 and User2.

Last edited by AwesomeSmilee (Aug. 1, 2017 17:22:46)

FancyFoxy
Scratcher
500+ posts

Detecting who is on a project

AwesomeSmilee wrote:

I should have made it clearer
I mean a list of who is currently on a project right at a specific moment.

For example, if me, User1 and User2 were playing a project right now, I want to find out how to make a list of all the users active on the project - me, User1 and User2.
That's pretty complicated to do. And it won't update quickly, because of Scratch's cloud fallback. However, it is possible.

Last edited by FancyFoxy (Aug. 1, 2017 19:36:58)


THIS IS MY SIGNATURE. THIS MEANS IT IS AN AUTOMATIC MESSAGE THAT APPEARS AT THE BOTTOM OF ALL MY POSTS.
Hi! I'm FancyFoxy! I create animations and games that were never, EVER meant to be taken seriously.
FancyFoxy Heroes and #Thanksgiving are some of my latest projects, check them out!
AwesomeSmilee
Scratcher
500+ posts

Detecting who is on a project

Yeah. It's possible, which is why I asked. In griffpatch's cloud multiplayer project, that uses a method to detect who is on.
Right now I'm thinking about a “ping” method - there is a host and every few seconds they send a ping and clear the “ping” cloud list, then add their username to it. When the other users receive the ping, they add their username.
gtoal
Scratcher
1000+ posts

Detecting who is on a project

AwesomeSmilee wrote:

Yeah. It's possible, which is why I asked. In griffpatch's cloud multiplayer project, that uses a method to detect who is on.
Right now I'm thinking about a “ping” method - there is a host and every few seconds they send a ping and clear the “ping” cloud list, then add their username to it. When the other users receive the ping, they add their username.

this sort of does it. It's not great but it's a place to start.

https://scratch.mit.edu/projects/104865199/
Destroyer1727
Scratcher
500+ posts

Detecting who is on a project

forever
if <[players v] contains [[scratchblocks](username)[/scratchblocks]] ?> then



else
add username to [players v]
end
end
use this then add something to store a cloud list
for more information comment on my profile

Last edited by Destroyer1727 (Aug. 8, 2017 18:15:48)


Old Signature wrote:

I am the proud owner of Destroyer's Script Shop
Please check out my account, Destroyer1727 and look at all my super fun games!
I love to help new scratchers so also check out my studio and project that are meant for just that!
I am also part of the VIS Collaboration! Please join it.
I am the owner of Coaches of Code with LilyPuplover.
I am the 18775968th user on scratch.
I used to work at Scratch Request Shop!

AwesomeSmilee
Scratcher
500+ posts

Detecting who is on a project

Destroyer1727 wrote:

forever
if <[players v] contains [[scratchblocks](username)[/scratchblocks]] ?> then



else
add username to [players v]
end
end
use this then add something to store a cloud list
for more information comment on my profile
But if they leave, what is there to delete their name from the list?
gtoal
Scratcher
1000+ posts

Detecting who is on a project

AwesomeSmilee wrote:

Destroyer1727 wrote:

forever
if <[players v] contains [[scratchblocks](username)[/scratchblocks]] ?> then



else
add username to [players v]
end
end
use this then add something to store a cloud list
for more information comment on my profile
But if they leave, what is there to delete their name from the list?

In the one I linked to, every logged on player gets a chance to be in control for a short time, and if they don't respond, the next player in the list takes over. So someone closing their browser window will be detected after a short timeout. If they close their game cleanly with the stop flag, it's intercepted and they log themselves out which is faster. The only time the player list can contain missing players for more than a second or two is when the last player left in the game closes their browser window - there's no-one left to remove them from the list. However when a new first player arrives, he will remove the orphaned name from the list within seconds.

If you're disconnected from Scratch's cloud, you should only ever see yourself and no new players, and you can reload the project to check that it isn;t a dead cloud connection.

There is one circumstance where the cloud turns ‘read only’ for you and you see other people's updates but can't update it yourself (though changes you make appear to have happened because of local caching, but other players don't see your updates). This is potentially detectable but I don't think my code currently catches that circumstance . Otherwise it is fairly robust if all you want to do is keep track of who all is using it. If you want to actually interact with them, you'll have some more work to do…

G

Powered by DjangoBB