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

#1 2011-05-13 01:14:24

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Reading identical variables in different projects?

Here's what I want to do: make a chat program using Mesh.
I want it to be only one project that interacts with itself on other computers? How can I choose which project it reads a variable from?

Offline

 

#2 2011-05-13 04:32:43

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Reading identical variables in different projects?

By only one project, do you mean that each project is the same rather than having one host and the others child programs?

If so, what I would do is give the project the capability of being the host and the capability of being the child. When two of the projects connect, choose one to be the host via the highest random number or something like that, that will then be the host until it leaves and then the selection will happen again with the remaining projects.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#3 2011-05-13 04:48:30

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Reading identical variables in different projects?

sparks wrote:

By only one project, do you mean that each project is the same rather than having one host and the others child programs?

If so, what I would do is give the project the capability of being the host and the capability of being the child. When two of the projects connect, choose one to be the host via the highest random number or something like that, that will then be the host until it leaves and then the selection will happen again with the remaining projects.

Each project is identical.

Offline

 

#4 2011-05-13 05:20:08

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Reading identical variables in different projects?

then does my suggestion work?  smile


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#5 2011-05-13 05:22:19

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Reading identical variables in different projects?

Sparks wrote:

then does my suggestion work?  smile

But does that let all of them interact like a real chat program?
Maybe what would work best is have 5 sets of variables and let 5 people max.  hmm

Offline

 

#6 2011-05-13 06:03:37

wulfmaster
Scratcher
Registered: 2011-04-23
Posts: 500+

Re: Reading identical variables in different projects?

What sparks said was correct.  If you make 1 program, then when they all run it it is based off a 'Random number' (Highest) for instance.  The rest would then just be the same,


Social Connections - Bringing communities close together! http://cyberkidscountry.com/ip.php

Offline

 

#7 2011-05-13 06:38:58

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Reading identical variables in different projects?

wulfmaster wrote:

What sparks said was correct.  If you make 1 program, then when they all run it it is based off a 'Random number' (Highest) for instance.  The rest would then just be the same,

I don't exactly get that.  hmm

Offline

 

#8 2011-05-13 06:43:40

ssss
Scratcher
Registered: 2007-07-29
Posts: 1000+

Re: Reading identical variables in different projects?

scimonster wrote:

wulfmaster wrote:

What sparks said was correct.  If you make 1 program, then when they all run it it is based off a 'Random number' (Highest) for instance.  The rest would then just be the same,

I don't exactly get that.  hmm

You have a random number generator.  All the projects compete with each other to become the Host.  Once the highest number has been generated, this project will become the 'mother' project (So you better hope they have good internet).  The 'child' projects would simply have the same coding, but they lost the competition of becoming a 'parent'.  Make more sense now?


Hey.  It's me SSSS, back from the dead!  smile

Offline

 

#9 2011-05-13 06:52:21

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Reading identical variables in different projects?

ssss wrote:

scimonster wrote:

wulfmaster wrote:

What sparks said was correct.  If you make 1 program, then when they all run it it is based off a 'Random number' (Highest) for instance.  The rest would then just be the same,

I don't exactly get that.  hmm

You have a random number generator.  All the projects compete with each other to become the Host.  Once the highest number has been generated, this project will become the 'mother' project (So you better hope they have good internet).  The 'child' projects would simply have the same coding, but they lost the competition of becoming a 'parent'.  Make more sense now?

I understand what you're saying now, but here's what I want to do. Let's say this is a three person chat:

comp1 has var1 and var2
comp2 has var1 and var2
comp3 has var1 and var2

comp3 sends a message.
How does comp1 and comp2 make sure it's reading comp3's var1, and not comp2/1's?

Offline

 

#10 2011-05-13 06:58:22

ssss
Scratcher
Registered: 2007-07-29
Posts: 1000+

Re: Reading identical variables in different projects?

scimonster wrote:

ssss wrote:

scimonster wrote:


I don't exactly get that.  hmm

You have a random number generator.  All the projects compete with each other to become the Host.  Once the highest number has been generated, this project will become the 'mother' project (So you better hope they have good internet).  The 'child' projects would simply have the same coding, but they lost the competition of becoming a 'parent'.  Make more sense now?

I understand what you're saying now, but here's what I want to do. Let's say this is a three person chat:

comp1 has var1 and var2
comp2 has var1 and var2
comp3 has var1 and var2

comp3 sends a message.
How does comp1 and comp2 make sure it's reading comp3's var1, and not comp2/1's?

Gimme a sec to design a program (After activatung mesh on Scratch, so i can upload it)


Hey.  It's me SSSS, back from the dead!  smile

Offline

 

#11 2011-05-13 07:05:15

ssss
Scratcher
Registered: 2007-07-29
Posts: 1000+

Re: Reading identical variables in different projects?

scimonster wrote:

ssss wrote:

scimonster wrote:


I don't exactly get that.  hmm

You have a random number generator.  All the projects compete with each other to become the Host.  Once the highest number has been generated, this project will become the 'mother' project (So you better hope they have good internet).  The 'child' projects would simply have the same coding, but they lost the competition of becoming a 'parent'.  Make more sense now?

I understand what you're saying now, but here's what I want to do. Let's say this is a three person chat:

comp1 has var1 and var2
comp2 has var1 and var2
comp3 has var1 and var2

comp3 sends a message.
How does comp1 and comp2 make sure it's reading comp3's var1, and not comp2/1's?

So you just want it to display the users message?  Easy!
I will upload affter i have delt with it


Hey.  It's me SSSS, back from the dead!  smile

Offline

 

#12 2011-05-13 11:27:58

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Reading identical variables in different projects?

It reads the latest variable update.


You can now reach me on Twitter @johnnydean1_

Offline

 

#13 2011-05-13 15:57:20

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Reading identical variables in different projects?

just have one variable called message. All projects update "message" and all projects wait until message isn't equal to "last message" anymore. Overwriting should hopefully be unlikely.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#14 2011-05-13 16:35:43

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Reading identical variables in different projects?

sparks wrote:

just have one variable called message. All projects update "message" and all projects wait until message isn't equal to "last message" anymore. Overwriting should hopefully be unlikely.

If overwriting does happen, you can always send it again.

Offline

 

#15 2011-05-15 01:36:29

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Reading identical variables in different projects?

sparks wrote:

just have one variable called message. All projects update "message" and all projects wait until message isn't equal to "last message" anymore. Overwriting should hopefully be unlikely.

OK, I'll try that.  smile

Offline

 

#16 2011-05-15 01:40:36

ssss
Scratcher
Registered: 2007-07-29
Posts: 1000+

Re: Reading identical variables in different projects?

scimonster wrote:

sparks wrote:

just have one variable called message. All projects update "message" and all projects wait until message isn't equal to "last message" anymore. Overwriting should hopefully be unlikely.

OK, I'll try that.  smile

Can you upload when you've tried?


Hey.  It's me SSSS, back from the dead!  smile

Offline

 

#17 2011-05-15 01:42:45

bbbeb
Scratcher
Registered: 2009-06-11
Posts: 1000+

Re: Reading identical variables in different projects?

See my chat.  tongue


Back in my day.... there were no laws that censored the internet... now, there are.... nah.

Offline

 

#18 2011-05-15 01:46:20

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Reading identical variables in different projects?

ssss wrote:

scimonster wrote:

sparks wrote:

just have one variable called message. All projects update "message" and all projects wait until message isn't equal to "last message" anymore. Overwriting should hopefully be unlikely.

OK, I'll try that.  smile

Can you upload when you've tried?

Yeah. Since I haven't worked on it yet because of this problem, it might take a few days.

Offline

 

#19 2011-05-15 01:48:24

ssss
Scratcher
Registered: 2007-07-29
Posts: 1000+

Re: Reading identical variables in different projects?

scimonster wrote:

ssss wrote:

scimonster wrote:


OK, I'll try that.  smile

Can you upload when you've tried?

Yeah. Since I haven't worked on it yet because of this problem, it might take a few days.

tongue   OK, Have you downloaded the first Rocket save?  It's www.cyberkidscountry.com/rocket/Rocket.image


Hey.  It's me SSSS, back from the dead!  smile

Offline

 

#20 2011-05-15 01:50:10

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Reading identical variables in different projects?

ssss wrote:

scimonster wrote:

ssss wrote:


Can you upload when you've tried?

Yeah. Since I haven't worked on it yet because of this problem, it might take a few days.

tongue   OK, Have you downloaded the first Rocket save?  It's www.cyberkidscountry.com/rocket/Rocket.image

Nah, I'm waiting 'till it's finished.  tongue

Offline

 

#21 2011-05-15 01:50:59

ssss
Scratcher
Registered: 2007-07-29
Posts: 1000+

Re: Reading identical variables in different projects?

scimonster wrote:

ssss wrote:

scimonster wrote:


Yeah. Since I haven't worked on it yet because of this problem, it might take a few days.

tongue   OK, Have you downloaded the first Rocket save?  It's www.cyberkidscountry.com/rocket/Rocket.image

Nah, I'm waiting 'till it's finished.  tongue

Then you'll be waiting about 1-3 months -_-  You get to see the new logo on this one  wink


Hey.  It's me SSSS, back from the dead!  smile

Offline

 

#22 2011-05-15 01:53:07

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Reading identical variables in different projects?

ssss wrote:

scimonster wrote:

ssss wrote:

tongue   OK, Have you downloaded the first Rocket save?  It's www.cyberkidscountry.com/rocket/Rocket.image

Nah, I'm waiting 'till it's finished.  tongue

Then you'll be waiting about 1-3 months -_-  You get to see the new logo on this one  wink

Can you just post an image?  tongue

Offline

 

#23 2011-05-15 01:55:20

ssss
Scratcher
Registered: 2007-07-29
Posts: 1000+

Re: Reading identical variables in different projects?

scimonster wrote:

ssss wrote:

scimonster wrote:

Nah, I'm waiting 'till it's finished.  tongue

Then you'll be waiting about 1-3 months -_-  You get to see the new logo on this one  wink

Can you just post an image?  tongue

My dad's getting cranky at my internet usage  big_smile

YAY!!!!

jk.  He thinks im d/l heaps of stuff, i'm actually playing mc server

Www.cyberkidscountry.com/rocket/default.bmp

Last edited by ssss (2011-05-15 01:58:17)


Hey.  It's me SSSS, back from the dead!  smile

Offline

 

#24 2011-05-15 01:56:52

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Reading identical variables in different projects?

ssss wrote:

scimonster wrote:

ssss wrote:


Then you'll be waiting about 1-3 months -_-  You get to see the new logo on this one  wink

Can you just post an image?  tongue

My dad's getting cranky at my internet usage  big_smile

YAY!!!!

jk.  He thinks im d/l heaps of stuff, i'm actually playing mc server

d/l?

Offline

 

#25 2011-05-15 01:58:45

ssss
Scratcher
Registered: 2007-07-29
Posts: 1000+

Re: Reading identical variables in different projects?

scimonster wrote:

ssss wrote:

scimonster wrote:


Can you just post an image?  tongue

My dad's getting cranky at my internet usage  big_smile

YAY!!!!

jk.  He thinks im d/l heaps of stuff, i'm actually playing mc server

d/l?

downloaded.  And i edited that post  tongue


Hey.  It's me SSSS, back from the dead!  smile

Offline

 

Board footer