Discuss Scratch

juicykiwi
Scratcher
86 posts

Modes

I making a random art maker where when you start it switches to a random mode. Then you can toggle the modes using the 1 and 2 keys. Somehow, it doesn't switch modes, and I don't know what's wrong. Help!
Link: http://scratch.mit.edu/projects/19330314/#player

Thanks!

I <3 clarinet!

pen down
drmcw
Scratcher
1000+ posts

Modes

Your custom blocks contain forever loops and so never finish which means they will never return to the script which called them, so no mode change!

10 !
ScratchVaders or Galaga?
Maybe Eliza can help you decide?
CodeLegend
Scratcher
500+ posts

Modes

The mode variable is changing, but a script with a forever in it is already running. The [Mode 1] and [Mode 2] blocks don't ever end because their last block is a forever.

You could do this instead:

when [1 v] key pressed
stop [other scripts in sprite v]
Mode 1 //category=custom
JAVAProgramming
Scratcher
100+ posts

Modes

Why do you have a modes variable if you aren't using it?

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
JAVAProgramming
Scratcher
100+ posts

Modes

CodeLegend wrote:

The mode variable is changing, but a script with a forever in it is already running. The [Mode 1] and [Mode 2] blocks don't ever end because their last block is a forever.

You could do this instead:

when [1 v] key pressed
stop [other scripts in sprite v]
Mode 1 //category=custom
Can't put the “stop…” block before the end of a script.

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
scubajerry
Scratcher
1000+ posts

Modes

JAVAProgramming wrote:

CodeLegend wrote:

The mode variable is changing, but a script with a forever in it is already running. The [Mode 1] and [Mode 2] blocks don't ever end because their last block is a forever.

You could do this instead:

when [1 v] key pressed
stop [other scripts in sprite v]
Mode 1 //category=custom
Can't put the “stop…” block before the end of a script.
You can put THIS stop block anywhere. You are right about the other two types of STOP blocks.
JAVAProgramming
Scratcher
100+ posts

Modes

scubajerry wrote:

JAVAProgramming wrote:

CodeLegend wrote:

The mode variable is changing, but a script with a forever in it is already running. The [Mode 1] and [Mode 2] blocks don't ever end because their last block is a forever.

You could do this instead:

when [1 v] key pressed
stop [other scripts in sprite v]
Mode 1 //category=custom
Can't put the “stop…” block before the end of a script.
You can put THIS stop block anywhere. You are right about the other two types of STOP blocks.
Ohh, I didn't realise that it changed shape

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
CodeLegend
Scratcher
500+ posts

Modes

JAVAProgramming wrote:

scubajerry wrote:

JAVAProgramming wrote:

Can't put the “stop…” block before the end of a script.
You can put THIS stop block anywhere. You are right about the other two types of STOP blocks.
Ohh, I didn't realise that it changed shape
Yep! It's very useful when you have 1-sprite projects and you want to ‘start over’ without clicking the flag. Kind of like what this is doing! Plus the [Mode x] custom block never stops, so pressing the button of the mode that's already running won't do anything.
scubajerry
Scratcher
1000+ posts

Modes

Your MODE BLOCKS have FOREVER loops in them, which means they will never return to the WHEN KEY PRESSED script to allow the STOP block to be executed. You can reverse the STOP and the MODE blocks and everything works fine.

Last edited by scubajerry (March 17, 2014 06:15:03)

disnottaken
Scratcher
26 posts

Modes

when green flag clicked
stop [ other scripts in sprite]
go to [ next] mode
kamalprasad_m
Scratcher
6 posts

Modes

move () steps
deck26
Scratcher
1000+ posts

Modes

kamalprasad_m wrote:

move () steps
Please don't spam or necropost.
SpectrumPenguin
New to Scratch
44 posts

Modes

We love the modes, it has:

Normal
Caturday
90s
Old timey
Prehistoric
1492864
Scratcher
500+ posts

Modes

SpectrumPenguin wrote:

We love the modes, it has:

Normal
Caturday
90s
Old timey
Prehistoric

deck26 wrote:

Please don't spam or necropost.

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
abculas
Scratcher
19 posts

Modes

these modes are very cool for me.
k0d3rrr
Scratcher
1000+ posts

Modes

abculas wrote:

these modes are very cool for me.

deck26 wrote:

Please don't spam or necropost.

k0d3rrr




3 forum tips for experienced forumers (in no particular order):
  1. If you are reporting a new forumer's topic to be closed, or moved to another forum, don't mention it, because then, the topic creator will think they will receive either an alert or a block.

  2. New forumers won't immediately know the rules or terminology of the forums. I have seen this happen hundreds of times (exaggeratedly), especially when experienced forumers (I won't name any) tell new forumers that they are "necroposting", which is when someone posts on an old and resolved topic (especially in the Questions about Scratch forum), causing said topic to be moved to the front page of that forum.

  3. Using Scratchblocks as a writing style is not blockspam, unless it is not relevant to the discussion. For example, this

    ExampleScratcher1 wrote:

    How do I make a smooth gliding animation?
    when green flag clicked
    repeat until <(my question) = [answered]>
    ask [How do I make a smooth gliding animation?] and wait
    end
    say [Thank you!]
    is not blockspam, but these

    ExampleScratcher2 (first post) wrote:

    when green flag clicked
    move (58) steps
    play sound [Stock Laughter Sound Effect HD - 1 Hour v]
    forever
    play sound [Stock Screaming Sound Effect HD - 1 Hour v]
    switch backdrop to [internet v]
    say [i broke the internet] for (2) secs
    turn cw (15) degrees
    go to [nearby restaurant v]
    next costume
    end

    ExampleScratcher2 (second post) wrote:

    when green flag clicked
    repeat until <(out of dorito's) = [true]>
    broadcast [eat dorito chip v]
    end
    say [IM OUT OF DORITO'S!!!!!!!!! :(]
    play sound [Scream2 v] until done
    forever
    turn cw (120) degrees
    play sound [Scream2 v]
    play sound [we have no dorito's sorry v]
    end
    are blockspam, and must be reported.

Powered by DjangoBB