Discuss Scratch

AwesomeCreator9875
Scratcher
100+ posts

I need someone expert to do this (What's wrong with this)

ProjectMaker59 wrote:

zp100 wrote:

https://scratch.mit.edu/projects/98837341/#editor. Look at the third-to-last script in the Stage. Every second, it clears all the players from the list. If the players are still on, they'll immediately add their names back on. Hopefully this helps!
Thanks it helps me bit, but I still need help
I think i had the same problem.You may understand something from my problem.
My problem:
there are two players A, and B.
The way of detecting the player outside the game is by creating an updating cloud variable
and two cloud lists(Engine)
forever

set [☁ Updating v] to ((current [second v]) mod (2))
end
1-“A” joins the game. He loads the cloud list and finds no one in the game so he makes his “local” variable id =1.
2-“A” adds his username. he then saves the cloud list
3-“A” loads the other cloud list and adds the updating variable. he then saves the cloud list
B's pc is faster than A's pc
4-“B” joins the game and loads the users cloud list to find out that A is on the list.
5-“B” wants to ensure that A is on the game. The momment the cloud variable(☁ Updating) updates, He loads the second cloud list to find out that “A” did not update his number on the list(Because of two reasons.Reason-1 “B” loaded the cloud list before “A” had time to update his number.Always someone will load the list before the other.Reason-2 cloud variables didn't update instantly so even if “A” updated his number before “B” loads the list,“B” will still find the old number).
6-“B” deletes “A” from the list and sets his id to 1.
7-“A” finds himself deleted and adds himself at 1 of the list.(Because he has the id of 1).
6 and 7 keep happening repeatedly
“B” does not start from the beginning to ensure that “A” is playing Because of,
“A” does not make a new item in the list, he replaces item 1 of the list.Therefore B doesn't find more than one user.
But he doesn't find his user so he replaces 1 (his id) of list with his username



Last edited by AwesomeCreator9875 (June 23, 2016 18:39:30)


Powered by DjangoBB