Discuss Scratch

antibody_person
New Scratcher
5 posts

When I click flag to start, a few things dont activate.

My browser / operating system: Windows NT 10.0, Chrome 64.0.3282.186, Flash 28.0 (release 0)

When I press the flag to start it should run the levels, but it doesn't. When I hit the play button on the main menu, it should run a code but the code didn't activate. Only when I press again it gets to work but other things won't work when this code runs…

HELP PLZ!
Killernotch101
Scratcher
100+ posts

When I click flag to start, a few things dont activate.

Can you share your project, so we can better help you?

As for future techniques in debugging, one type is called “Rubber ducking”.
Rubber ducking consists of looking at each bit of code, stating what it SHOULD do, compared to what it ACTUALLY does.
antibody_person
New Scratcher
5 posts

When I click flag to start, a few things dont activate.

Killernotch101 wrote:

Can you share your project, so we can better help you?

As for future techniques in debugging, one type is called “Rubber ducking”.
Rubber ducking consists of looking at each bit of code, stating what it SHOULD do, compared to what it ACTUALLY does.


https://scratch.mit.edu/projects/208714009/
There is my project.
mystery4000
Scratcher
100+ posts

When I click flag to start, a few things dont activate.

Is it possibly this?

Using more than one of these blocks in a single project can create errors that are difficult to diagnose, often only appearing with every other start of the project and can cause the timing to go off. A simple solution is to use only one of these blocks followed by a broadcast to all other scripts that need to run when the project begins. Another solution is to click the flag multiple times or use turbo mode.
-scratch wiki
AlfaDragon
Scratcher
100+ posts

When I click flag to start, a few things dont activate.

It might be possible the script needs a forever block and you don't have one inputted. If this is the case, just add one in and it should run perfectly. If not, it would be nice if I could see the link so I can see if I can find any mishaps.
Hope this helps!
hellounicorns2
Scratcher
1000+ posts

When I click flag to start, a few things dont activate.

Hi! I’ll report this to be moved to the help with scripts forum, as the bugs and glitches forum is for glitches with scratch itself.
Scratch-Minion
Scratcher
1000+ posts

When I click flag to start, a few things dont activate.

When the Green Flag is clicked, you do not know which of the “When Green Flag clicked” scripts will run first.
(There are Green Flag scripts in the Stage sprite, Bacteria Menu sprite and Anti-Corpo Menu sprite).

Actually the Stage Green Flag script does not run first, and variable Main Menu is not set to 1.
The other two Green Flag scripts run first and because Main Menu is 0 they do nothing (never start the forever loops).

The Stage Green Flag script then runs and very quickly (but too late) variable Main Menu is set to 1.

But when you restart the project again, and the other Green Flag scripts run first, they now work because Main Menu is now 1.


The way to fix this is to have only one Green Flag script in your project.

I would keep the Stage one.
In it make sure that Main Menu is set to 1 before you do a broadcast eg. broadcast Start The Action.
Replace “when Green Flag clicked” in the other sprites with “when I receive Start The Action”.

when green flag clicked
broadcast [Main Menu v] and wait
broadcast [Start The Action v]


This is a common problem in projects.
One Green Flag and a “broadcast and wait” lets you do initialization of variables etc before other code is started.

(see also https://scratch.mit.edu/discuss/topic/190497/?page=1#post-1879094 )
Paddle2See
Scratch Team
1000+ posts

When I click flag to start, a few things dont activate.

Scratch-Minion wrote:

When the Green Flag is clicked, you do not know which of the “When Green Flag clicked” scripts will run first.
(There are Green Flag scripts in the Stage sprite, Bacteria Menu sprite and Anti-Corpo Menu sprite).

Actually the Stage Green Flag script does not run first, and variable Main Menu is not set to 1.
The other two Green Flag scripts run first and because Main Menu is 0 they do nothing (never start the forever loops).

The Stage Green Flag script then runs and very quickly (but too late) variable Main Menu is set to 1.

But when you restart the project again, and the other Green Flag scripts run first, they now work because Main Menu is now 1.


The way to fix this is to have only one Green Flag script in your project.

I would keep the Stage one.
In it make sure that Main Menu is set to 1 before you do a broadcast eg. broadcast Start The Action.
Replace “when Green Flag clicked” in the other sprites with “when I receive Start The Action”.

when green flag clicked
broadcast [Main Menu v] and wait
broadcast [Start The Action v]


This is a common problem in projects.
One Green Flag and a “broadcast and wait” lets you do initialization of variables etc before other code is started.

(see also https://scratch.mit.edu/discuss/topic/190497/?page=1#post-1879094 )
Another way to deal with the problem is to add a short Wait block right after the other green flag scripts so that you know which one is going to run first.
antibody_person
New Scratcher
5 posts

When I click flag to start, a few things dont activate.

Thank you all for your help but I already figgured out a way.

Powered by DjangoBB