This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-10-31 09:55:08

Ideas
Scratcher
Registered: 2012-10-07
Posts: 100+

Online Views

How do you know how many people are online with a script...


http://img685.imageshack.us/img685/2010/screenshot20121110at132.pngI think that you must CLICK above

Offline

 

#2 2012-10-31 10:01:35

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Re: Online Views

You don't.
On a project, you mean?

Last edited by mythbusteranimator (2012-10-31 10:01:49)


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#3 2012-10-31 10:11:58

Ideas
Scratcher
Registered: 2012-10-07
Posts: 100+

Re: Online Views

ON a project is it possible to make a varible/list which tells you how many scratchers are viewing the project.


http://img685.imageshack.us/img685/2010/screenshot20121110at132.pngI think that you must CLICK above

Offline

 

#4 2012-10-31 10:17:25

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Re: Online Views

Ideas wrote:

ON a project is it possible to make a varible/list which tells you how many scratchers are viewing the project.

No.


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#5 2012-10-31 15:56:37

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Online Views

Just curious, is the script allowed to use Scratxh 2.0 features to figure out who's online? If yes, then I'll be able to get you a script. If not, well I can't.


http://i46.tinypic.com/35ismmc.png

Offline

 

#6 2012-10-31 16:49:47

Ideas
Scratcher
Registered: 2012-10-07
Posts: 100+

Re: Online Views

Yes, actually, because i want to create a game where you play with all the online scratchers.


http://img685.imageshack.us/img685/2010/screenshot20121110at132.pngI think that you must CLICK above

Offline

 

#7 2012-10-31 16:52:11

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Online Views

Ideas wrote:

Yes, actually, because i want to create a game where you play with all the online scratchers.

I had posted it on another we page for safe keeping, except the page refreshed, so I'll get the script to you in several minutes.

Edit: Also, do you want the scripts to say who's online?

Last edited by ErnieParke (2012-10-31 16:53:52)


http://i46.tinypic.com/35ismmc.png

Offline

 

#8 2012-11-01 10:40:03

Ideas
Scratcher
Registered: 2012-10-07
Posts: 100+

Re: Online Views

If that is possible then yes


http://img685.imageshack.us/img685/2010/screenshot20121110at132.pngI think that you must CLICK above

Offline

 

#9 2012-11-01 16:38:27

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Online Views

Ideas wrote:

If that is possible then yes

And it is possible. Anyway, I'll get your scripts to you in about 10~20 minutes.


http://i46.tinypic.com/35ismmc.png

Offline

 

#10 2012-11-01 16:57:27

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Online Views

This isn't 100% flawless, but these scripts will work. First, make 2~3 variables and two lists:

Variables:
(Cloud)Timer*
(Cloud)Timer-
Memory//Opptional

List:
(Cloud)Online
(Cloud)Anonymous

Here are the scripts:

when gf clicked
if <not<(user ID) = (0)>>
 add (user ID) to [online v]
 if <(timer*) = ()>
  set [timer- v] to (0)
  delete [all v] of [online v]
  delete [all v] of [Anonymous v]
  add (user ID) to [online v]
  set [timer* v] to [-]
  wait (3) secs//Time for cloud variables to update. 
  set [timer* v] to (item [any v] of [online v])
 end
else
 add [User] to [Anonymous v]
end
forever
 if <(timer*) = (User ID)>
  wait (.98) secs
  change [timer- v] by (1)
  if <(timer-) = (8)>//The delay between updates. Adjust it if you want.
   set [timer- v] to (0)
   delete [all v] of [online v]
   delete [all v] of [Anonymous v]
   add (user ID) to [online v]
   set [timer* v] to [-]
   wait (3) secs//Time for cloud variables to update. 
   Fillet.//You might have to edit the 2 to make this work.
   set [timer* v] to (item [any v] of [online v])
  end
 end

when gf clicked
forever
 if <(timer*) = [-]>
  if <not<(user ID) = (0)>>
   if <not <[online v] contains (userID)>>
    add (user ID) to [online v]
   end
  else
   add [User] to [Anonymous v]
   wait until <not <(timer*) = [-]>>
  end
 end

when gf clicked
forever//Use this script or...
 set [memory v] to (timer-)
 wait (5) secs
 if <<(memory) = (timer-)> and <not <(timer*) = [-]>>>
  set [timer- v] to (0)
  delete [all v] of [online v]
  delete [all v] of [Anonymous v]
  add (user ID) to [online v]
  set [timer* v] to [-]
  wait (3) secs
  set [timer* v] to (item [any v] of [online v])
 end

when gf clicked
forever//…this script.
 if <(ping) = [true]>//Replace with what you'll use to detect…
  Fillet.//…when you're rechecking who's online. 
  Fillet.//For example, you might use a button.
  if <not <(timer*) = [-]>>
   set [timer- v] to (0)
   delete [all v] of [online v]
   delete [all v] of [Anonymous v]
   add (user ID) to [online v]
   set [timer* v] to [-]
   wait (3) secs 
   set [timer* v] to (item [any v] of [online v])
  end
 end
The third script might not work if the delay for updating cloud variables is big enough, in which case you'll have to use the fourth script in place of the third. Also, once you've implemented this script, the list Online should become which scratchers are viewing your project and the list Anonymous should be the non-scratchers viewing the project. Add their lengths to get how many people are viewing your project.

I hope that this helps!

Last edited by ErnieParke (2012-11-01 17:13:51)


http://i46.tinypic.com/35ismmc.png

Offline

 

#11 2012-11-02 14:15:35

Ideas
Scratcher
Registered: 2012-10-07
Posts: 100+

Re: Online Views

What is user id's initial value?


http://img685.imageshack.us/img685/2010/screenshot20121110at132.pngI think that you must CLICK above

Offline

 

#12 2012-11-02 15:45:02

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Online Views

Ideas wrote:

What is user id's initial value?

Used ID is a new variable in Scratch 2.0 that reports the viewer # of a viewer, except when the viewer isn't a scratcher, which then it reports 0. So in other words, user ID's initial value is preset for you.


http://i46.tinypic.com/35ismmc.png

Offline

 

#13 2012-11-02 16:13:00

Ideas
Scratcher
Registered: 2012-10-07
Posts: 100+

Re: Online Views

That's cool, anyway, do you know chatbox cocepts


http://img685.imageshack.us/img685/2010/screenshot20121110at132.pngI think that you must CLICK above

Offline

 

#14 2012-11-02 16:40:07

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Online Views

Ideas wrote:

That's cool, anyway, do you know chatbox cocepts

No. Why do you ask?


http://i46.tinypic.com/35ismmc.png

Offline

 

Board footer