Discuss Scratch

MCAnimator3D
Scratcher
500+ posts

Stop or Leave Page Detecting

I want to know how to make it so if you stop the project or leave the page, it detects that and can do an action with cloud vars. Any ideas?


scratch
turkey3_test
Scratcher
1000+ posts

Stop or Leave Page Detecting

The only thing I can think of is by setting up a computer that acts as a server by 24/7 running the project and checking the income of a cloud variable value change every 10 seconds or so.

ilikelegos
Scratcher
100+ posts

Stop or Leave Page Detecting

I hope this helps.

when green flag clicked
forever

if <(backdrop name) = ()> then
do all your cloud data stuff here
end
end

Hi! I'm a computer science student who learned coding on Scratch!
MCAnimator3D
Scratcher
500+ posts

Stop or Leave Page Detecting

ilikelegos wrote:

I hope this helps.

when green flag clicked
forever

if <(backdrop name) = ()> then
do all your cloud data stuff here
end
end
Does the backdrop change to ( ) when you stop?


scratch
1234abcdcba4321
Scratcher
1000+ posts

Stop or Leave Page Detecting

Yeah, I would like it if this was possible. It helps for login things.

I'd highly appreciate it if you were to follow me. Don't forget to go to my profile.
All of my programming suggestions <— You should really get the suggestions move back to the suggestions forum!
Five hundred posts! I never expected to get up there… In only 2-3 months.
Does anyone know what a signature is? I mean, I've already seen 6-7 people get confused.
turkey3_test
Scratcher
1000+ posts

Stop or Leave Page Detecting

MCAnimator3D wrote:

ilikelegos wrote:

I hope this helps.

when green flag clicked
forever

if <(backdrop name) = ()> then
do all your cloud data stuff here
end
end
Does the backdrop change to ( ) when you stop?
No, I don't think that script is true, when the project closes, all scripts stop no matter what, so nothing else could happen.

JAVAProgramming
Scratcher
100+ posts

Stop or Leave Page Detecting

I think turkey3_test told you what you have to do..

My Newest Project, Come Check It Out
Dots, On Scratch
Want to change the way we count? The Dozenal System.

“The story so far:
In the beginning the Universe was created.
This has made a lot of people very angry and been widely regarded as a bad move.”
― Douglas Adams, The Restaurant at the End of the Universe
BSH1
Scratcher
100+ posts

Stop or Leave Page Detecting

MCAnimator3D wrote:

I want to know how to make it so if you stop the project or leave the page, it detects that and can do an action with cloud vars. Any ideas?
To start you will need to get one computer and use it as a ‘server’
it will:
when green flag clicked
set (cloudvar) to [0]
set (lastcloudvar) to [***]
wait (0.1) secs
forever

wait (10) secs
if <(cloudvar) = (lastcloudvar)> then
do cloud stuff
else
set (lastcloudvar) to (cloudvar)
end
end

The other playing computer would have to:
when green flag clicked
forever

change (cloudvar) by (1)
wait (10) secs
end

hope this helps

Last edited by BSH1 (Dec. 24, 2013 21:47:58)

AonymousGuy
Scratcher
1000+ posts

Stop or Leave Page Detecting

Well to get it after the stop sign is pressed, do the following:
when gf clicked
forever
reset timer
end

when [timer v] > (0.1)
...

Last edited by AonymousGuy (Dec. 24, 2013 22:52:15)

Powered by DjangoBB