Discuss Scratch

nknknk
Scratcher
7 posts

Advanced Cloud Variable Script

I have a few cloud-variable-enhanced games, and I would like to know how many users are online. I was thinking about something like this


[Set to (0)]


| [Set to (1)]
|
| | [Set to (0)]
| |
| └——]
└——]

|
| | [Change by (1)]
| └——]
└——]

Would this work?
letmethink
Scratcher
100+ posts

Advanced Cloud Variable Script

nknknk wrote:

I have a few cloud-variable-enhanced games, and I would like to know how many users are online. I was thinking about something like this


[Set to (0)]


| [Set to (1)]
|
| | [Set to (0)]
| |
| └——]
└——]

|
| | [Change by (1)]
| └——]
└——]

Would this work?
I think you posted this thread twice…

(other here)

I can't be bothered to make a signature. Seriously, who has time to write these things? I have stuff to do, games to make, and you expect me to write a big, long signature? I'm not your slave. You can't tell me what to do, so no, I WON'T write a signature.

Oh, wait…
mitchboy
Scratcher
1000+ posts

Advanced Cloud Variable Script

nknknk wrote:

I have a few cloud-variable-enhanced games, and I would like to know how many users are online. I was thinking about something like this

[When Flag Clicked]
[Set [number 1?] to (0)]
[Wait 3 seconds]
[If <(cloud users) = (0)>]
| [Set [number 1?] to (1)]
| [Forever]
| | [Set [cloud users] to (0)]
| |
| └——]
└——]
[Forever]
| [If <(cloud users) = 0>]
| | [Change [cloud users] by (1)]
| └——]
└——]

Would this work?
Fixed.

And this wouldn't work, because all this script would do is set (cloud users) to 1, then stop because (cloud users) would not equal 0 anymore.

Capsicum annuum.
andre_rifaut
Scratcher
100+ posts

Advanced Cloud Variable Script

I think I understand your aim, but I do not understand your proposal.

Incrementing a variable seems a good idea.
However, the problem is to detect when players are leaving.

See the following discussions:

Online/Offline Help by Lone-Wolf

Cloud variables: who is online problem

Pugs23456789
Scratcher
15 posts

Advanced Cloud Variable Script

https://scratch.mit.edu/projects/540078191/ Code in here should be what your looking for

When life gives you lemons use them to cook.
if <(Cracked at fortnite)> then
set <<(Name) to [Justin]> and <(Relatshionship Status) to [Taken]>>

end
1492864
Scratcher
500+ posts

Advanced Cloud Variable Script

Pugs23456789 wrote:

https://scratch.mit.edu/projects/540078191/ Code in here should be what your looking for
No necroposting please.

Scratcheth f'rum us'r | 1 year on Scratcheth | 750+ posts| Inching to 1000 posts, 1 posteth at a timeth
Mine own most did view projecteth | Mine own most did love and fav'd projecteth | Latest projecteth |

Highlight h're and shift+down to readeth the rest.
The most did suggest suggestion:
Dark mode
ninjagor
Scratcher
100+ posts

Advanced Cloud Variable Script

Try this:
when green flag clicked
reset timer
change (☁Active Players) by (1)
forever
set [#] to (timer)
end
when (timer) > (#)
change (☁Active Players) by (-1)

Hope this helps

Last edited by ninjagor (June 4, 2021 14:08:26)


Full Stack Developer, 5 years of experience.

Expert in NextJS, TypeScript, JavaScript, NestJS, ExpressJS, React, Prisma ORM, MongoDB, PostgreSQL, MySQL, Python (Flask) and CSS (as well as TailwindCSS)
Decent knowledge in SwiftUI, React Native, Vue, Svelte.
mmnagelia
Scratcher
100+ posts

Advanced Cloud Variable Script

ninjagor wrote:

Try this:
when green flag clicked
reset timer
change (☁Active Players) by (1)
forever
set [#] to (timer)
end
when (timer) > (#)
change (☁Active Players) by (-1)

Hope this helps
When someone says, “No Necroposting”, why do you just necropost? This thread is almost a decade old. Two necroposts in a row, seems like it is time for this old thread to be closed.

Learning Node.js? Great! But, don't waste your time creating a web server. I already created a fully functional Node.js server on Github right here! It also has a very detailed documentation!
Or are you interested in making games in Unity? Want to see how I'm making my very own FPS game? Then see my FPS-Game repo right here!
ninjagor
Scratcher
100+ posts

Advanced Cloud Variable Script

Oh. Sorry. I didn’t realize.

mmnagelia wrote:

ninjagor wrote:

Try this:
when green flag clicked
reset timer
change (☁Active Players) by (1)
forever
set [#] to (timer)
end
when (timer) > (#)
change (☁Active Players) by (-1)

Hope this helps
When someone says, “No Necroposting”, why do you just necropost? This thread is almost a decade old. Two necroposts in a row, seems like it is time for this old thread to be closed.

Full Stack Developer, 5 years of experience.

Expert in NextJS, TypeScript, JavaScript, NestJS, ExpressJS, React, Prisma ORM, MongoDB, PostgreSQL, MySQL, Python (Flask) and CSS (as well as TailwindCSS)
Decent knowledge in SwiftUI, React Native, Vue, Svelte.
mmnagelia
Scratcher
100+ posts

Advanced Cloud Variable Script

ninjagor wrote:

Oh. Sorry. I didn’t realize.

mmnagelia wrote:

ninjagor wrote:

Try this:
when green flag clicked
reset timer
change (☁Active Players) by (1)
forever
set [#] to (timer)
end
when (timer) > (#)
change (☁Active Players) by (-1)

Hope this helps
When someone says, “No Necroposting”, why do you just necropost? This thread is almost a decade old. Two necroposts in a row, seems like it is time for this old thread to be closed.
Okay, it happens all the time. Next time, look at the date of the original post.

Last edited by mmnagelia (June 4, 2021 14:49:55)


Learning Node.js? Great! But, don't waste your time creating a web server. I already created a fully functional Node.js server on Github right here! It also has a very detailed documentation!
Or are you interested in making games in Unity? Want to see how I'm making my very own FPS game? Then see my FPS-Game repo right here!
ninjagor
Scratcher
100+ posts

Advanced Cloud Variable Script

mmnagelia wrote:

ninjagor wrote:

Try this:
when green flag clicked
reset timer
change (☁Active Players) by (1)
forever
set [#] to (timer)
end
when (timer) > (#)
change (☁Active Players) by (-1)

Hope this helps
When someone says, “No Necroposting”, why do you just necropost? This thread is almost a decade old. Two necroposts in a row, seems like it is time for this old thread to be closed.

I also didn’t know what “mecroposting” is. And I didn’t check the date. I’m sorry.

Full Stack Developer, 5 years of experience.

Expert in NextJS, TypeScript, JavaScript, NestJS, ExpressJS, React, Prisma ORM, MongoDB, PostgreSQL, MySQL, Python (Flask) and CSS (as well as TailwindCSS)
Decent knowledge in SwiftUI, React Native, Vue, Svelte.
mmnagelia
Scratcher
100+ posts

Advanced Cloud Variable Script

ninjagor wrote:

mmnagelia wrote:

ninjagor wrote:

Try this:
when green flag clicked
reset timer
change (☁Active Players) by (1)
forever
set [#] to (timer)
end
when (timer) > (#)
change (☁Active Players) by (-1)

Hope this helps
When someone says, “No Necroposting”, why do you just necropost? This thread is almost a decade old. Two necroposts in a row, seems like it is time for this old thread to be closed.

I also didn’t know what “mecroposting” is. And I didn’t check the date. I’m sorry.
Necroposting is when you post on a dead, abandoned thread. This is disliked among online communities since you're bumping up an old thread, which no one replies on. This makes it frustrating, when helpers like me see that a thread where it has no use to help, since no one is active on that thread. See this Scratch Wiki post on more on necroposting.

Learning Node.js? Great! But, don't waste your time creating a web server. I already created a fully functional Node.js server on Github right here! It also has a very detailed documentation!
Or are you interested in making games in Unity? Want to see how I'm making my very own FPS game? Then see my FPS-Game repo right here!

Powered by DjangoBB