Discuss Scratch
- powercon5
-
1000+ posts
On page load
My suggestion is a hat black, on page load.
It would be used to play code when the page loads however when you re-press the green flag it does not activate again.
You could work around it by setting it to what you want and saving however if you want to test it you would have to reset it and save it again.
You could also work around it by having a variable for number of times played but you would have to reset that everytime you play it.
This is something simple but would be helpful.
The only problem with it could be that it can be used to start the game before the green flag and the only problem with that would be making a game harder and doing that would just make the game worse and it is the makers fault.
It would be used to play code when the page loads however when you re-press the green flag it does not activate again.
You could work around it by setting it to what you want and saving however if you want to test it you would have to reset it and save it again.
You could also work around it by having a variable for number of times played but you would have to reset that everytime you play it.
This is something simple but would be helpful.
The only problem with it could be that it can be used to start the game before the green flag and the only problem with that would be making a game harder and doing that would just make the game worse and it is the makers fault.
Last edited by powercon5 (May 28, 2016 05:15:48)
- alexphan
-
1000+ posts
On page load
So you mean have code run while the page is loading?
How would that work? Scratch cannot function until the whole entire project is loaded. (correct me if I'm wrong)
How would that work? Scratch cannot function until the whole entire project is loaded. (correct me if I'm wrong)
Last edited by alexphan (May 27, 2016 22:10:06)
- Skelepound
-
100+ posts
On page load
That's a bit confusing, so I'd say no support. If you're just wanting to make a block that does things only once, I'd say use the blocks below.
Just make sure to always set ‘Variable’ to 1 before sharing your project, and now you have code that executes right when you click the flag, but only once. (Unless you reload the page)
- powercon5
-
1000+ posts
On page load
No it is code that only runs once the page has loaded after that it won't run again So you mean have code run while the page is loading?
How would that work? Scratch cannot function until the whole entire project is loaded. (correct me if I'm wrong)
I already put that however I am just saying for people un-sure and so that when you test your game and forget to reset it your game does not break. That's a bit confusing, so I'd say no support. If you're just wanting to make a block that does things only once, I'd say use the blocks below.Just make sure to always set ‘Variable’ to 1 before sharing your project, and now you have code that executes right when you click the flag, but only once. (Unless you reload the page)
- f1lip
-
1000+ posts
On page load
As Skelepound said, this would be too confusing. No support.
- powercon5
-
1000+ posts
On page load
What is confusing? As Skelepound said, this would be too confusing. No support.
- alexphan
-
1000+ posts
On page load
You can just do this:No it is code that only runs once the page has loaded after that it won't run again So you mean have code run while the page is loading?
How would that work? Scratch cannot function until the whole entire project is loaded. (correct me if I'm wrong)
- powercon5
-
1000+ posts
On page load
No, that will run after every green flag clicked.You can just do this:No it is code that only runs once the page has loaded after that it won't run again So you mean have code run while the page is loading?
How would that work? Scratch cannot function until the whole entire project is loaded. (correct me if I'm wrong)
- A-KouZ1
-
100+ posts
On page load
…(whatever somewhat i can try to understand)
You should put reset data scripts after when flag is clicked block, then run your scripts,
this helps?
You should put reset data scripts after when flag is clicked block, then run your scripts,
this helps?
Last edited by A-KouZ1 (May 30, 2016 09:54:08)
- powercon5
-
1000+ posts
On page load
No I don't have a problem I even put that, maybey I should have used scratch blocks? …(whatever somewhat i can try to understand)
You should put reset data scripts after when flag is clicked block, then run your scripts,
this helps?
I am trying to say so it does to run when you press the green flag only when the project loads Because when you test a project you can forget to re-set it and your game can be broken.
- A-KouZ1
-
100+ posts
On page load
No I don't have a problem I even put that, maybey I should have used scratch blocks?
I am trying to say so it does to run when you press the green flag only when the project loads Because when you test a project you can forget to re-set it and your game can be broken.
ofc you put scratch blocks,
resetting data something is like…
I just couldnt understand what are you saying…
it does to run when you press the green flag only when the project loads Because when you test a project you can forget to re-set it and your game can be broken.agh .-.,
I try to understand somewhat like you say
The project is runs fine when you play it after loading the project, but when play it again and you forget to reset the game, project plays unexpectedlyYou want to say it right?
- powercon5
-
1000+ posts
On page load
I want it so when you first load a project it will run that code however if you ever press the green flag again it will not run unless you re-load the page.No I don't have a problem I even put that, maybey I should have used scratch blocks?
I am trying to say so it does to run when you press the green flag only when the project loads Because when you test a project you can forget to re-set it and your game can be broken.
ofc you put scratch blocks,
resetting data something is like…
I just couldnt understand what are you saying…it does to run when you press the green flag only when the project loads Because when you test a project you can forget to re-set it and your game can be broken.agh .-.,
I try to understand somewhat like you sayThe project is runs fine when you play it after loading the project, but when play it again and you forget to reset the game, project plays unexpectedlyYou want to say it right?
Sorry for hard to understand text I right most of it when I am very tired.
- maxhup010
-
57 posts
On page load
there's an easy fix for this…
1. create a variable called plays.
2. if you wanted this script to run just once you would use this. But if you wanted something else to happen after they have clicked the button more than once you would just use an if else block and put the code that would run in there.
When you saved the project and shared, Plays would HAVE to be set to 0 for this to work
1. create a variable called plays.
2. if you wanted this script to run just once you would use this. But if you wanted something else to happen after they have clicked the button more than once you would just use an if else block and put the code that would run in there.
When you saved the project and shared, Plays would HAVE to be set to 0 for this to work
Last edited by maxhup010 (May 30, 2016 10:47:40)
- jokebookservice1
-
1000+ posts
On page load
I support, But there is a workaround that does not use any variables or anything:
- powercon5
-
1000+ posts
On page load
I know about that I even said it. there's an easy fix for this…
1. create a variable called plays.
2. if you wanted this script to run just once you would use this. But if you wanted something else to happen after they have clicked the button more than once you would just use an if else block and put the code that would run in there.
When you saved the project and shared, Plays would HAVE to be set to 0 for this to work
But there is a workaround that does not use any variables or anything:That does not work. I support,
- jokebookservice1
-
1000+ posts
On page load
Oh well, anyway, I still Support.I know about that I even said it. there's an easy fix for this…
1. create a variable called plays.
2. if you wanted this script to run just once you would use this. But if you wanted something else to happen after they have clicked the button more than once you would just use an if else block and put the code that would run in there.
When you saved the project and shared, Plays would HAVE to be set to 0 for this to workBut there is a workaround that does not use any variables or anything:That does not work. I support,
- liam48D
-
1000+ posts
On page load
Yeah, I think that's what they're saying. The way somebody would I just couldnt understand what are you saying…probably make a project do something on the first green flag click is like so:it does to run when you press the green flag only when the project loads Because when you test a project you can forget to re-set it and your game can be broken.agh .-.,
I try to understand somewhat like you sayThe project is runs fine when you play it after loading the project, but when play it again and you forget to reset the game, project plays unexpectedlyYou want to say it right?
The problem is that if they forget to clickon the “set did run to no” block, it'll look like the project has ran, even though it hasn't, when somebody else opens up the project.
You could solve this like so:
That will automatically set “did run” to no every time someone opens the project. You don't need to worry about clicking on the “set did run to no” block every time you use the project!
Though I wonder, would a built-in “flag clicked yet?” block be more useful..?
- jokebookservice1
-
1000+ posts
On page load
Isn't the flag to run the project a green flag too?Yeah, I think that's what they're saying. The way somebody would I just couldnt understand what are you saying…probably make a project do something on the first green flag click is like so:it does to run when you press the green flag only when the project loads Because when you test a project you can forget to re-set it and your game can be broken.agh .-.,
I try to understand somewhat like you sayThe project is runs fine when you play it after loading the project, but when play it again and you forget to reset the game, project plays unexpectedlyYou want to say it right?
The problem is that if they forget to clickon the “set did run to no” block, it'll look like the project has ran, even though it hasn't, when somebody else opens up the project.
You could solve this like so:
That will automatically set “did run” to no every time someone opens the project. You don't need to worry about clicking on the “set did run to no” block every time you use the project!
Though I wonder, would a built-in “flag clicked yet?” block be more useful..?