This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-10-12 20:50:42

lyates93
New Scratcher
Registered: 2012-10-03
Posts: 6

Say something when background changes

[scratchblocks]
when space clicked
ask [Where do you want to go shopping? select a number 1-3]
set number to answer
if number=1
switch to background 1
if number=2
switch to background 2
if number=3
switch to background 3

I'm trying to allow the script to say, You've arrived at the location for background 1,2, or 3!
Depending on which answer the user selects.

So how do you SAY something WHEN THE BACKGROUND changes?

Any help would be great!

Offline

 

#2 2012-10-12 20:55:51

awesomeness321
Scratcher
Registered: 2012-08-10
Posts: 100+

Re: Say something when background changes

lyates93 wrote:

when [space v] key pressed
ask [Where do you want to go shopping? Select a number 1-3] and wait
set [number v] to (answer)
if <(number)=(1)>
 switch to background [background 1 v]
 broadcast [loc1 v]
end
if <(number)=(2)>
 switch to background [background 2 v]
 broadcast [loc2 v]
end
if <(number)=(3)>
 switch to background [background 3 v]
 broadcast [loc3 v]
And now for a sprite's script...
when i receive [loc1 v]
say [You've arrived at location 1!]

when i receive [loc2 v]
say [You've arrived at location 2!]

when i receive [loc3 v]
say [You've arrived at location 3!]
I'm trying to allow the script to say, You've arrived at the location for background 1,2, or 3!
Depending on which answer the user selects.

So how do you SAY something WHEN THE BACKGROUND changes?

Any help would be great!

Fixed and edited so it can say that. Use the edited script above.

EDIT: Now does it work? Tell me if anything's wrong!  smile

Last edited by awesomeness321 (2012-10-12 21:54:01)


My newest project:http://blocks.scratchr.org/API.php?user=awesomeness321&amp;action=projects&amp;type=newest&amp;return=image&amp;num=1Color:#30F9A5 I am currently http://blocks.scratchr.org/API.php?user=awesomeness321&amp;action=onlineStatus&amp;type=text

Offline

 

#3 2012-10-12 21:05:01

lyates93
New Scratcher
Registered: 2012-10-03
Posts: 6

Re: Say something when background changes

I want it to say "You have arrived at...." different for each background! How do I do this?

Offline

 

#4 2012-10-12 21:10:28

lyates93
New Scratcher
Registered: 2012-10-03
Posts: 6

Re: Say something when background changes

If I put the the first message in the sprite script it doesn't allow me to use "switch to background" and then when I put the message into the background script it doesn't like me use the "say function". The purple functions aren't universal, how do you fix this?

Offline

 

#5 2012-10-12 21:47:55

awesomeness321
Scratcher
Registered: 2012-08-10
Posts: 100+

Re: Say something when background changes

lyates93 wrote:

If I put the the first message in the sprite script it doesn't allow me to use "switch to background" and then when I put the message into the background script it doesn't like me use the "say function". The purple functions aren't universal, how do you fix this?

Hmmm... I'll edit my post and see if it's better, wait a minute....

Edited it! Now does it work?

Last edited by awesomeness321 (2012-10-12 21:54:25)


My newest project:http://blocks.scratchr.org/API.php?user=awesomeness321&amp;action=projects&amp;type=newest&amp;return=image&amp;num=1Color:#30F9A5 I am currently http://blocks.scratchr.org/API.php?user=awesomeness321&amp;action=onlineStatus&amp;type=text

Offline

 

Board footer