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

#126 2012-10-20 14:35:55

zubblewu
Scratcher
Registered: 2011-02-17
Posts: 1000+

Re: Scripts Workshop: Give and get help with scripts

chriskneller; a simple solution to your problem would be to add a forever block surrounding the script that causes it to move up if touching green at the beginning. For example,

forever  

if <touching color [#00FF52]?> 

change y by (10)
end

end

Does this make sense? Basically, it would cause the sprite to move up if it was touching the green. This is the solution I see that would least modify the scripts. You could rescript the whole thing, but that would ruin the point of them creating it. When I tested this, it worked consistently, and you could still jump.

Last edited by zubblewu (2012-10-20 14:36:48)


........................................................................................................................................................................................................................................

Offline

 

#127 2012-10-20 14:46:07

HimalB
New Scratcher
Registered: 2012-10-20
Posts: 1

Re: Scripts Workshop: Give and get help with scripts

Hi guys I'm new to scratch and I really want a detailed description about the loop blocks in scratch. Like the forever, forever if, if, repeat until.. Etc I really need a detailed description about the loops like all of them and how they work etc etc:).
Pls can you reply to my email himalbissessar@gmail.com
Thank you so much for help  smile

Offline

 

#128 2012-10-20 15:32:33

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Scripts Workshop: Give and get help with scripts

zubblewu wrote:

chriskneller; a simple solution to your problem would be to add a forever block surrounding the script that causes it to move up if touching green at the beginning. For example,

forever  

if <touching color [#00FF52]?> 

change y by (10)
end

end

Does this make sense? Basically, it would cause the sprite to move up if it was touching the green. This is the solution I see that would least modify the scripts. You could rescript the whole thing, but that would ruin the point of them creating it. When I tested this, it worked consistently, and you could still jump.

But the problem with that is that walls couldn't be added to the game later on. And your solution would only affect the green platform, not the others.

To chriskneller:
I finally decided to use a sensor to solve your problem and I also cleaned up some of your scripts. Here it is:
(link to project)

Last edited by ErnieParke (2012-10-20 15:40:53)


http://i46.tinypic.com/35ismmc.png

Offline

 

#129 2012-10-20 16:17:49

zubblewu
Scratcher
Registered: 2011-02-17
Posts: 1000+

Re: Scripts Workshop: Give and get help with scripts

ErnieParke wrote:

zubblewu wrote:

chriskneller; a simple solution to your problem would be to add a forever block surrounding the script that causes it to move up if touching green at the beginning. For example,

forever  

if <touching color [#00FF52]?> 

change y by (10)
end

end

Does this make sense? Basically, it would cause the sprite to move up if it was touching the green. This is the solution I see that would least modify the scripts. You could rescript the whole thing, but that would ruin the point of them creating it. When I tested this, it worked consistently, and you could still jump.

But the problem with that is that walls couldn't be added to the game later on. And your solution would only affect the green platform, not the others.

To chriskneller:
I finally decided to use a sensor to solve your problem and I also cleaned up some of your scripts. Here it is:
(link to project)

But, considering what is in the project, what i posted is the least modification possible. Those are the scripts that their student made, and they probably don't want to change them.


........................................................................................................................................................................................................................................

Offline

 

#130 2012-10-20 16:35:06

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Scripts Workshop: Give and get help with scripts

zubblewu wrote:

ErnieParke wrote:

zubblewu wrote:

chriskneller; a simple solution to your problem would be to add a forever block surrounding the script that causes it to move up if touching green at the beginning. For example,

forever  

if <touching color [#00FF52]?> 

change y by (10)
end

end

Does this make sense? Basically, it would cause the sprite to move up if it was touching the green. This is the solution I see that would least modify the scripts. You could rescript the whole thing, but that would ruin the point of them creating it. When I tested this, it worked consistently, and you could still jump.

But the problem with that is that walls couldn't be added to the game later on. And your solution would only affect the green platform, not the others.

To chriskneller:
I finally decided to use a sensor to solve your problem and I also cleaned up some of your scripts. Here it is:
(link to project)

But, considering what is in the project, what i posted is the least modification possible. Those are the scripts that their student made, and they probably don't want to change them.

Yes, I know that this requires less modification, but does it solve the problem? I just redownloaded chriskneller's project and did exactly what you recommended chriskneller to do. Now you can jump through the bottom of green platforms, you can still walk through any platform, Mario is jittery, and jumping only works half of the time.

Last edited by ErnieParke (2012-10-20 17:28:47)


http://i46.tinypic.com/35ismmc.png

Offline

 

#131 2012-10-20 17:17:51

zubblewu
Scratcher
Registered: 2011-02-17
Posts: 1000+

Re: Scripts Workshop: Give and get help with scripts

ErnieParke wrote:

zubblewu wrote:

ErnieParke wrote:


But the problem with that is that walls couldn't be added to the game later on. And your solution would only affect the green platform, not the others.

To chriskneller:
I finally decided to use a sensor to solve your problem and I also cleaned up some of your scripts. Here it is:
(link to project)

But, considering what is in the project, what i posted is the least modification possible. Those are the scripts that their student made, and they probably don't want to change them.

Yes, I know that this requires less modification, but does it solve the problem? I just redoenloaded chriskneller's project and did exactly what you recommended chriskneller to do. Now you can jump through the bottom of green platforms, you can still walk through any platform, Mario is jittery, and jumping only works half of the time.

Let me stress least modification. I'm not saying it's perfect, or even good, but it works, and it's the least modification probably. Do you think I should rescript it like this or something? ...


........................................................................................................................................................................................................................................

Offline

 

#132 2012-10-20 18:11:32

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Scripts Workshop: Give and get help with scripts

zubblewu wrote:

ErnieParke wrote:

zubblewu wrote:

But, considering what is in the project, what i posted is the least modification possible. Those are the scripts that their student made, and they probably don't want to change them.

Yes, I know that this requires less modification, but does it solve the problem? I just redoenloaded chriskneller's project and did exactly what you recommended chriskneller to do. Now you can jump through the bottom of green platforms, you can still walk through any platform, Mario is jittery, and jumping only works half of the time.

Let me stress least modification. I'm not saying it's perfect, or even good, but it works, and it's the least modification probably. Do you think I should rescript it like this or something? ...

No, but when you try and fix a glitch, you shouldn't introduce several other glitches. Look, I'm not criticising the way you fix glitches; I was trying to point out that your idea introduced new glitches which orignally souldn't have been there.

Last edited by ErnieParke (2012-10-20 18:11:45)


http://i46.tinypic.com/35ismmc.png

Offline

 

#133 2012-10-20 18:19:03

zubblewu
Scratcher
Registered: 2011-02-17
Posts: 1000+

Re: Scripts Workshop: Give and get help with scripts

ErnieParke wrote:

zubblewu wrote:

ErnieParke wrote:


Yes, I know that this requires less modification, but does it solve the problem? I just redoenloaded chriskneller's project and did exactly what you recommended chriskneller to do. Now you can jump through the bottom of green platforms, you can still walk through any platform, Mario is jittery, and jumping only works half of the time.

Let me stress least modification. I'm not saying it's perfect, or even good, but it works, and it's the least modification probably. Do you think I should rescript it like this or something? ...

No, but when you try and fix a glitch, you shouldn't introduce several other glitches. Look, I'm not criticising the way you fix glitches; I was trying to point out that your idea introduced new glitches which orignally souldn't have been there.

Well, I'm thinking this is a special case since it isn't a random user, but rather a student in a class. We should, IMHO,give the least possible modification for them.


........................................................................................................................................................................................................................................

Offline

 

#134 2012-10-20 18:46:06

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Scripts Workshop: Give and get help with scripts

zubblewu wrote:

ErnieParke wrote:

zubblewu wrote:

Let me stress least modification. I'm not saying it's perfect, or even good, but it works, and it's the least modification probably. Do you think I should rescript it like this or something? ...

No, but when you try and fix a glitch, you shouldn't introduce several other glitches. Look, I'm not criticising the way you fix glitches; I was trying to point out that your idea introduced new glitches which orignally souldn't have been there.

Well, I'm thinking this is a special case since it isn't a random user, but rather a student in a class. We should, IMHO,give the least possible modification for them.

True, but then agian, these modifications could help teach the student a thing or two about Scratch. Also, if they don't want the modifications, they aren't forced to use them.

Last edited by ErnieParke (2012-10-20 18:47:04)


http://i46.tinypic.com/35ismmc.png

Offline

 

#135 2012-10-21 02:15:25

JH1010
Scratcher
Registered: 2012-05-31
Posts: 1000+

Re: Scripts Workshop: Give and get help with scripts

ErnieParke wrote:

zubblewu wrote:

ErnieParke wrote:


No, but when you try and fix a glitch, you shouldn't introduce several other glitches. Look, I'm not criticising the way you fix glitches; I was trying to point out that your idea introduced new glitches which orignally souldn't have been there.

Well, I'm thinking this is a special case since it isn't a random user, but rather a student in a class. We should, IMHO,give the least possible modification for them.

True, but then agian, these modifications could help teach the student a thing or two about Scratch. Also, if they don't want the modifications, they aren't forced to use them.

Please don't start a flame war.

Offline

 

#136 2012-10-21 08:21:46

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Scripts Workshop: Give and get help with scripts

JH1010 wrote:

ErnieParke wrote:

zubblewu wrote:


Well, I'm thinking this is a special case since it isn't a random user, but rather a student in a class. We should, IMHO,give the least possible modification for them.

True, but then agian, these modifications could help teach the student a thing or two about Scratch. Also, if they don't want the modifications, they aren't forced to use them.

Please don't start a flame war.

Sorry. I didn't even notice that it was going that direction, so thanks for catching it. I really do need to be more careful next time.


http://i46.tinypic.com/35ismmc.png

Offline

 

#137 2012-10-21 12:56:29

Wernich
New Scratcher
Registered: 2012-01-28
Posts: 7

Re: Scripts Workshop: Give and get help with scripts

hello

i am working on an project and i am stuck. how do you throw or shoot an object relative to the scrolling? i want the object to go towards where i click on the screen relative to the scrolling sprite?? so if the player sprite moves in the game the projectile will not move slower or faster it will move like in real life. currently i just moves 4 steps in the direction of the mouse and if i move back it goes slower because of the scrolling and forward it goes faster.

Please I am a rookie still in school and it is my passion please help me.

Offline

 

#138 2012-10-21 13:28:27

JH1010
Scratcher
Registered: 2012-05-31
Posts: 1000+

Re: Scripts Workshop: Give and get help with scripts

Wernich wrote:

hello

i am working on an project and i am stuck. how do you throw or shoot an object relative to the scrolling? i want the object to go towards where i click on the screen relative to the scrolling sprite?? so if the player sprite moves in the game the projectile will not move slower or faster it will move like in real life. currently i just moves 4 steps in the direction of the mouse and if i move back it goes slower because of the scrolling and forward it goes faster.

Please I am a rookie still in school and it is my passion please help me.

I am going to assume that you have a scroll x variable. Just put this script on the projectile:

When I receive [insert broadcast name here v]
forever
change x by <(0)-(scroll x)>
OMG New Scratchblocks look!

Last edited by JH1010 (2012-10-21 13:29:29)

Offline

 

#139 2012-10-21 15:11:20

Seil
Scratcher
Registered: 2011-09-02
Posts: 100+

Re: Scripts Workshop: Give and get help with scripts

I would be interested in signing up.  smile

I'm not a great Scratch programmer and I find bugs in my programs all the time. But I can extricate them relatively quick though. Sometimes  tongue

Last edited by Seil (2012-10-21 15:11:45)


http://legacy-cdn.smosh.com/smosh-pit/022011/spongebob-gif-lol.gif

Offline

 

#140 2012-10-21 16:35:21

bullelk12
Scratcher
Registered: 2012-05-26
Posts: 100+

Re: Scripts Workshop: Give and get help with scripts

Hey Wernich, I answered that question in both of your posts.


http://mag.racked.eu/cimage/i6000/Achievement++get%21/Scratcher+love+minecraft%21/mca.png

Offline

 

#141 2012-10-21 18:40:10

genxjin
New Scratcher
Registered: 2012-10-17
Posts: 8

Re: Scripts Workshop: Give and get help with scripts

hi, I'm a newbie and  i have been working on my game for a project for a week now but i can't come up with the following:
a.) how to come up with a YOU WIN & GAME OVER ending.
b.) my sprites end up moving around in limbo despite my timer hits 0. once the timer continues to show -1 it keeps on playing the game  sad   can you please help me?

Offline

 

#142 2012-10-21 18:52:19

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Scripts Workshop: Give and get help with scripts

genxjin wrote:

hi, I'm a newbie and  i have been working on my game for a project for a week now but i can't come up with the following:
a.) how to come up with a YOU WIN & GAME OVER ending.
b.) my sprites end up moving around in limbo despite my timer hits 0. once the timer continues to show -1 it keeps on playing the game  sad   can you please help me?

I assume that once the timer goes below 0 that the game ends, right? Well then, this isn't the best method, but you could use this in your You Win/You Lose sprite:

when gf clicked
hide
set [timer v] to (1)//To make sure that the game doesn't end the game early.
forever
 if <not <(timer*) > (0)>>//Ignore the *.
  if (winning?)//Whatever you use to know if you're winning.
   switch to costume [You win! v]
  else
   switch to costume [You lose! v]
  end
  show
  go to front
  stop all//Stops the game and all sprites.
 end
I hope that this helps!

Last edited by ErnieParke (2012-10-21 21:06:52)


http://i46.tinypic.com/35ismmc.png

Offline

 

#143 2012-10-21 20:13:24

leewyndelf
New Scratcher
Registered: 2012-10-21
Posts: 4

Re: Scripts Workshop: Give and get help with scripts

I just made a separate thread with this question, but in case this is faster - I'm making a game with a sprite with one "costume."  I'd like something different to happen when another sprite is touching the front of him versus the back of him.  Is that doable?

Thanks!

Offline

 

#144 2012-10-21 21:34:16

TheSupremeOverLord
Scratcher
Registered: 2012-09-29
Posts: 100+

Re: Scripts Workshop: Give and get help with scripts

Can you give me code for all the scratch blocks?


http://i1154.photobucket.com/albums/p522/lizzyhipo/MINIPIG.jpg

Offline

 

#145 2012-10-21 22:59:15

Nodrogchavez
New Scratcher
Registered: 2012-10-21
Posts: 7

Re: Scripts Workshop: Give and get help with scripts

I have a script built, but the file opens with the numerous sprites showing until the Start flag is clicked. When it is clicked they all Hide. How can I start with a blank page, or alternately, one that has a brief one-line comment or an arrow moving on an angle to the Start flag in the upper right corner?

Offline

 

#146 2012-10-22 01:39:56

JH1010
Scratcher
Registered: 2012-05-31
Posts: 1000+

Re: Scripts Workshop: Give and get help with scripts

JH1010 wrote:

Wernich wrote:

hello

i am working on an project and i am stuck. how do you throw or shoot an object relative to the scrolling? i want the object to go towards where i click on the screen relative to the scrolling sprite?? so if the player sprite moves in the game the projectile will not move slower or faster it will move like in real life. currently i just moves 4 steps in the direction of the mouse and if i move back it goes slower because of the scrolling and forward it goes faster.

Please I am a rookie still in school and it is my passion please help me.

I am going to assume that you have a scroll x variable. Just put this script on the projectile:

When I receive [insert broadcast name here v]
forever
change x by <(0)-(scroll x)>
OMG New Scratchblocks look!

They're back to normal now.

Seil wrote:

I would be interested in signing up.  smile

I'm not a great Scratch programmer and I find bugs in my programs all the time. But I can extricate them relatively quick though. Sometimes  tongue

You are in!

leewyndelf wrote:

I just made a separate thread with this question, but in case this is faster - I'm making a game with a sprite with one "costume."  I'd like something different to happen when another sprite is touching the front of him versus the back of him.  Is that doable?

Thanks!

Yes, but I am not sure exactly how, you would need to use the layers block, the sensing blocks and the effect blocks (so that there is still only 1 costume).

TheSupremeOverLord wrote:

Can you give me code for all the scratch blocks?

What do you mean?

Nodrogchavez wrote:

I have a script built, but the file opens with the numerous sprites showing until the Start flag is clicked. When it is clicked they all Hide. How can I start with a blank page, or alternately, one that has a brief one-line comment or an arrow moving on an angle to the Start flag in the upper right corner?

This will not be a problem online because it presses the green flag as soon as it loads.

Offline

 

#147 2012-10-22 05:09:45

genxjin
New Scratcher
Registered: 2012-10-17
Posts: 8

Re: Scripts Workshop: Give and get help with scripts

ErnieParke wrote:

genxjin wrote:

hi, I'm a newbie and  i have been working on my game for a project for a week now but i can't come up with the following:
a.) how to come up with a YOU WIN & GAME OVER ending.
b.) my sprites end up moving around in limbo despite my timer hits 0. once the timer continues to show -1 it keeps on playing the game  sad   can you please help me?

I assume that once the timer goes below 0 that the game ends, right? Well then, this isn't the best method, but you could use this in your You Win/You Lose sprite:

when gf clicked
hide
set [timer v] to (1)//To make sure that the game doesn't end the game early.
forever
 if <not <(timer*) > (0)>>//Ignore the *.
  if (winning?)//Whatever you use to know if you're winning.
   switch to costume [You win! v]
  else
   switch to costume [You lose! v]
  end
  show
  go to front
  stop all//Stops the game and all sprites.
 end
I hope that this helps!

--------------------------------------
Hi Ernie, first of all thank you very much for your reply. Appreciate it very much.  While waiting for your help, i tried working on several scripts how to solve my problem but i always end having my sprites freeze up like crazy and unable to respond to my script for the you win / game over sprite  sad  i know i may lack or oversee something on the script but i can't figure it out until now. here is the original script i wrote for:

YOU WIN Sprite

when gf clicked
hide
forever <(score) > [50]>
    show
end
stop all
[/scratcblocks]


GAME OVER Sprite
when gf clicked
hide
forever <(score) <  [50]>
    show
end
stop all
STAGE
when gf clicked
set [score v] to (0)
set [time v] to (10)
[/scratcblocks]


when gf clicked
forever
   wait (1) secs
   change [time] by (-1)
   play sound [cave] until done
end
P.S. my other sprites works well on the stage however when i make the scripts for you win / game over, my other sprites over laps the background for you win/game over and freezes.

Offline

 

#148 2012-10-22 05:13:43

genxjin
New Scratcher
Registered: 2012-10-17
Posts: 8

Re: Scripts Workshop: Give and get help with scripts

genxjin wrote:

ErnieParke wrote:

genxjin wrote:

hi, I'm a newbie and  i have been working on my game for a project for a week now but i can't come up with the following:
a.) how to come up with a YOU WIN & GAME OVER ending.
b.) my sprites end up moving around in limbo despite my timer hits 0. once the timer continues to show -1 it keeps on playing the game  sad   can you please help me?

I assume that once the timer goes below 0 that the game ends, right? Well then, this isn't the best method, but you could use this in your You Win/You Lose sprite:

when gf clicked
hide
set [timer v] to (1)//To make sure that the game doesn't end the game early.
forever
 if <not <(timer*) > (0)>>//Ignore the *.
  if (winning?)//Whatever you use to know if you're winning.
   switch to costume [You win! v]
  else
   switch to costume [You lose! v]
  end
  show
  go to front
  stop all//Stops the game and all sprites.
 end
I hope that this helps!

--------------------------------------
Hi Ernie, first of all thank you very much for your reply. Appreciate it very much.  While waiting for your help, i tried working on several scripts how to solve my problem but i always end having my sprites freeze up like crazy and unable to respond to my script for the you win / game over sprite  sad  i know i may lack or oversee something on the script but i can't figure it out until now. here is the original script i wrote for:

YOU WIN Sprite

when gf clicked
hide
forever <(score) > [50]>
    show
end
stop all
GAME OVER Sprite

when gf clicked
hide
forever <(score) <  [50]>
    show
end
stop all
STAGE Sprite

when gf clicked
set [score v] to (0)
set [time v] to (10)
when gf clicked
forever
   wait (1) secs
   change [time] by (-1)
   play sound [cave] until done
end
P.S. my other sprites works well on the stage however when i make the scripts for you win / game over, my other sprites over laps the background for you win/game over and freezes.

Offline

 

#149 2012-10-22 05:19:04

genxjin
New Scratcher
Registered: 2012-10-17
Posts: 8

Re: Scripts Workshop: Give and get help with scripts

genxjin wrote:

genxjin wrote:

ErnieParke wrote:

I assume that once the timer goes below 0 that the game ends, right? Well then, this isn't the best method, but you could use this in your You Win/You Lose sprite:

when gf clicked
hide
set [timer v] to (1)//To make sure that the game doesn't end the game early.
forever
 if <not <(timer*) > (0)>>//Ignore the *.
  if (winning?)//Whatever you use to know if you're winning.
   switch to costume [You win! v]
  else
   switch to costume [You lose! v]
  end
  show
  go to front
  stop all//Stops the game and all sprites.
 end
I hope that this helps!

--------------------------------------
Hi Ernie, first of all thank you very much for your reply. Appreciate it very much.  While waiting for your help, i tried working on several scripts how to solve my problem but i always end having my sprites freeze up like crazy and unable to respond to my script for the you win / game over sprite  sad  i know i may lack or oversee something on the script but i can't figure it out until now. here is the original script i wrote for:

YOU WIN Sprite

when gf clicked
hide
forever <(score) > [50]>
    show
end
stop all
GAME OVER Sprite

when gf clicked
hide
forever <(score) <  [50]>
    show
end
stop all
STAGE Sprite

when gf clicked
set [score v] to (0)
set [time v] to (10)
when gf clicked
forever
   wait (1) secs
   change [time] by (-1)
   play sound [cave] until done
end
P.S. my other sprites works well on the stage however when i make the scripts for you win / game over, my other sprites over laps the background for you win/game over and freezes.

----sorry for the wrong post seconds ago. i accidentally hit the submit button with my mouse instead of preview.

GAME OVER Sprite

when gf clicked
hide
forever <(score) > [100]>
    show
end
stop all

Offline

 

#150 2012-10-22 07:03:02

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Scripts Workshop: Give and get help with scripts

JH1010 wrote:

TheSupremeOverLord wrote:

Can you give me code for all the scratch blocks?

What do you mean?

I think TheSupremeOverLord is talking about the scratchblocks code.

To TheSupremeOverLord:
I could give you every scratch block there is in scratch, but do you know how long that would take to type? Instead, I'll tell you a different way. To make a scratchblock, put it between [scratchblock] [/scratchblock] tags. Then, type what you would see in Scratch. For example, in scratch, the green flag hat block has "when gf (green flag) clicked", so that's what you would type. The one exception to this are the c-blocks (repeat, if, ect.. Excluding forever and forever if.) which you'll have to put "end" where you want the c-block to end. Also, there should only be one block per line.

Now into the finer deatails:
If you want to add a drop down menu, use [ v]. If you want to add a place where you can type, again use ( ) or [ ]. And if you want to add arrows, type cw (clockwise) or ccw (counter-clock wise). Finally, if you want to leave a comment, use // after a scratchblock and type your comment after the two dashes.

Into conditionals/variables (mouse down?, touching [Sprite1 v]?, ect...): Basically, they follow the same rules as above, except variables should have parentheses around them. Also, conditionals (the blocks with green, pointy ends) should have < and > surrounding them.

Here's a sample code:

when gf clicked
set [pie v] to (98)
if <not <(pie) = (5)>>
 repeat (5)
  turn cw (5) degrees
  say [Pie!] for (5) secs//This is a comment.
 end
end
And this is what I wrote:

Code:

[scratchblocks]
when gf clicked
set [pie v] to (98)
if <not <(pie) = (5)>>
 repeat (5)
  turn cw (5) degrees
  say [Pie!] for (5) secs//This is a comment.
 end
end
[/scratchblocks]

Now that you know the code, you could practice making scratchblocks here.

I hope that this helps!

Last edited by ErnieParke (2012-10-26 15:41:56)


http://i46.tinypic.com/35ismmc.png

Offline

 

Board footer