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

#1 2010-06-04 18:48:07

kluspossible
Scratcher
Registered: 2009-04-15
Posts: 34

What is a script for this?

In my game this is how its suposed to go.
When i dont have cheese puffs in my inventory and i click on a certain person they say one thing.
When i do have cheese puffs in my inventory that certain person says something eslse and a sprite appears.

Ive been trying to figure something out for this but everthing i try messes up. Anyone have any ideas?

Offline

 

#2 2010-06-04 18:54:45

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: What is a script for this?

I'm assuming that the inventory is a list. If not, ignore what follows  big_smile

Here's the script:

Code:

//On the sprite that speaks...
When person clicked
if <[inventory] contains [cheese puffs]>
  say "You have cheese puffs in your inventory!"
  broadcast [showSprite]
else
  says "Sorry, no cheese puffs here!"
end

//And on the sprite that shows if you do have cheese puffs in your inventory:

When I receive [showSprite]
show

When green flag clicked
hide

That should do the trick... and reset the sprite that shows when the green flag gets clicked.

Also, this may be better suited for All About Scratch, so I doth move it.

Last edited by coolstuff (2010-06-04 18:55:30)

Offline

 

#3 2010-06-06 11:34:49

Greentabby55
Scratcher
Registered: 2010-05-04
Posts: 50

Re: What is a script for this?

<when green flag clicked>
<if><(Cheese Puffs  <>> 0 )>
<say[ Message
<end>
<if><(Cheese Puffs  <=> 0 )>
<say[ Other Message
<end>

Offline

 

#4 2010-06-11 16:08:12

kluspossible
Scratcher
Registered: 2009-04-15
Posts: 34

Re: What is a script for this?

coolstuff wrote:

I'm assuming that the inventory is a list. If not, ignore what follows  big_smile

Here's the script:

Code:

//On the sprite that speaks...
When person clicked
if <[inventory] contains [cheese puffs]>
  say "You have cheese puffs in your inventory!"
  broadcast [showSprite]
else
  says "Sorry, no cheese puffs here!"
end

//And on the sprite that shows if you do have cheese puffs in your inventory:

When I receive [showSprite]
show

When green flag clicked
hide

That should do the trick... and reset the sprite that shows when the green flag gets clicked.

Also, this may be better suited for All About Scratch, so I doth move it.

Oh sry... I forgot to mention that there is another sprite that shows what there saying like in a game called exscape the school if you need an example of what it is, so the sprite doesnt acualy say anything... Sry that you figured that out for nothing...

Offline

 

#5 2010-06-11 16:10:26

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: What is a script for this?

kluspossible wrote:

Oh sry... I forgot to mention that there is another sprite that shows what there saying like in a game called exscape the school if you need an example of what it is, so the sprite doesnt acualy say anything... Sry that you figured that out for nothing...

Oh, don't worry about it. If you can describe to me what you want in greater detail, I can help you out.

Offline

 

#6 2010-06-22 16:50:10

kluspossible
Scratcher
Registered: 2009-04-15
Posts: 34

Re: What is a script for this?

coolstuff wrote:

kluspossible wrote:

Oh sry... I forgot to mention that there is another sprite that shows what there saying like in a game called exscape the school if you need an example of what it is, so the sprite doesnt acualy say anything... Sry that you figured that out for nothing...

Oh, don't worry about it. If you can describe to me what you want in greater detail, I can help you out.

Ok, in greater detail:
The game is called exscape school and you are trying to exscape from school. When a person is clicked/ something happens it brodcasts a certain thing and another sprite changes costumes to show what they are saying. in a when you enter a certain classroom there is a sprite (cheese puffs) sitting in the room. When I click it it hides and another sprite comes up in my inventory. When I go into the girls bathroom there is a girl there that is complaining she's hungry( the sprite that shows what people are saying shows it) and wants you to get her something. But she onluy saus that if you dont have the cheese puffs. If you have the cheese puffs the sprite shows her saying that shes happy and she "gives" you a bentendo gs that appers in our inventory.

Offline

 

#7 2010-06-22 17:00:01

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: What is a script for this?

Code:

--> On the first Cheese Puffs sprite that you need to click:

When Green Flag clicked
delete [all] from [inventory]

When Cheese Puffs clicked
add [cheese puffs] to [inventory]
broadcast [add cheese puffs]

--> On Cheese Puffs sprite 2 for the inventory

When Green Flag clicked
show

--> On the talking sprite

When I recieve [I'm in the girl's bathroom]
if <[inventory] contains [cheese puffs]>
  say "THANK YOU FOR THE CHEEZE PUFFEZ!"
  broadcast [showSprite]
else
  says "I'm hungry."
end

Should work great... I assumed you used broadcasts to determine that you're in the girls' bathroom, but you may need to do it differently.

Offline

 

#8 2010-06-24 16:48:05

kluspossible
Scratcher
Registered: 2009-04-15
Posts: 34

Re: What is a script for this?

coolstuff wrote:

Code:

--> On the first Cheese Puffs sprite that you need to click:

When Green Flag clicked
delete [all] from [inventory]

When Cheese Puffs clicked
add [cheese puffs] to [inventory]
broadcast [add cheese puffs]

--> On Cheese Puffs sprite 2 for the inventory

When Green Flag clicked
show

--> On the talking sprite

When I recieve [I'm in the girl's bathroom]
if <[inventory] contains [cheese puffs]>
  say "THANK YOU FOR THE CHEEZE PUFFEZ!"
  broadcast [showSprite]
else
  says "I'm hungry."
end

Should work great... I assumed you used broadcasts to determine that you're in the girls' bathroom, but you may need to do it differently.

Thanks! this is a huge help and it works great!

Last edited by kluspossible (2010-06-24 19:22:05)

Offline

 

Board footer