Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » sensing when project stops
- skitzoid
- Scratcher
30 posts
sensing when project stops
I need to be able to tell when a project stops for cloud mutiplayer. I know there are some ways to do so, like when a project is stopped, certain things stop first, but what are those things? any help? I just need to sense a player stopping a project.
- Scratch-Minion
- Scratcher
1000+ posts
sensing when project stops
You can check if a program has been stopped as the timer will no longer be reset in the code below.
ie. it will become greater than 0.2 secs.
If you want to use the timer in your project, you will need to add 0.2s to your game elapsed time before resetting the timer - ie. use your own variable for game elapsed time.
See the comments by TheLogFather near the bottom of this forum post for more. https://scratch.mit.edu/discuss/topic/73832/
I hope this helps
.
ie. it will become greater than 0.2 secs.
when green flag clicked
forever
wait (0.2) secs
reset timer
end
If you want to use the timer in your project, you will need to add 0.2s to your game elapsed time before resetting the timer - ie. use your own variable for game elapsed time.
See the comments by TheLogFather near the bottom of this forum post for more. https://scratch.mit.edu/discuss/topic/73832/
I hope this helps
.
- skitzoid
- Scratcher
30 posts
sensing when project stops
thanks, that does! You can check if a program has been stopped as the timer will no longer be reset in the code below.
ie. it will become greater than 0.2 secs.when green flag clicked
forever
wait (0.2) secs
reset timer
end
If you want to use the timer in your project, you will need to add 0.2s to your game elapsed time before resetting the timer - ie. use your own variable for game elapsed time.
See the comments by TheLogFather near the bottom of this forum post for more. https://scratch.mit.edu/discuss/topic/73832/
I hope this helps
.
- MegaApuTurkUltra
- Scratcher
1000+ posts
sensing when project stops
For cloud multiplayer, you'll want a more versatile system. Your users could close the tab while the project is running, and then the stop code would never get to run…
What I do is have each player detect which cloud variables are changing. When you are in multiplayer, the project adds a random number to the end of the cloud variable to make sure it keeps changing so other players know there is someone there. That way, when you close the project in any way, you're guaranteed to have the other players be able to detect it.
What I do is have each player detect which cloud variables are changing. When you are in multiplayer, the project adds a random number to the end of the cloud variable to make sure it keeps changing so other players know there is someone there. That way, when you close the project in any way, you're guaranteed to have the other players be able to detect it.
$(".box-head")[0].textContent = "committing AT crimes since $whenever"
- skitzoid
- Scratcher
30 posts
sensing when project stops
do you have an example project for this? For cloud multiplayer, you'll want a more versatile system. Your users could close the tab while the project is running, and then the stop code would never get to run…
What I do is have each player detect which cloud variables are changing. When you are in multiplayer, the project adds a random number to the end of the cloud variable to make sure it keeps changing so other players know there is someone there. That way, when you close the project in any way, you're guaranteed to have the other players be able to detect it.
- deck26
- Scratcher
1000+ posts
sensing when project stops
https://scratch.mit.edu/projects/77775784/ covers it and there's a link to a demo project using the method.do you have an example project for this? For cloud multiplayer, you'll want a more versatile system. Your users could close the tab while the project is running, and then the stop code would never get to run…
What I do is have each player detect which cloud variables are changing. When you are in multiplayer, the project adds a random number to the end of the cloud variable to make sure it keeps changing so other players know there is someone there. That way, when you close the project in any way, you're guaranteed to have the other players be able to detect it.
- MegaApuTurkUltra
- Scratcher
1000+ posts
sensing when project stops
Better: I have a full blown cloud library https://scratch.mit.edu/projects/109772772/ and a post on my site http://aputurk.tk/scratch/2016/06/05/cloudy-mccloudface-building-a-friendly-scratch-apido you have an example project for this? For cloud multiplayer, you'll want a more versatile system. Your users could close the tab while the project is running, and then the stop code would never get to run…
What I do is have each player detect which cloud variables are changing. When you are in multiplayer, the project adds a random number to the end of the cloud variable to make sure it keeps changing so other players know there is someone there. That way, when you close the project in any way, you're guaranteed to have the other players be able to detect it.
$(".box-head")[0].textContent = "committing AT crimes since $whenever"
- MuffinMan09
- Scratcher
8 posts
sensing when project stops
when green flag clicked
forever
reset timer
end
when [timer] > (0.1)
do whatever tf you want under here
THERE's YOUR STOP DETECTION
when green flag clicked
forever
if <(posts) = [50]> then
say [yay]
else
say [POST MORE]
end
end
- Discussion Forums
- » Help with Scripts
- » sensing when project stops