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

#2126 2011-09-25 12:05:52

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: ITopic: Welcome to your local block library!

Well. It's not the MySQL code that's the problem. It's the server itself. Also, We could host the images on the scratchr domain though our block generator will eventually replace images.

I've tried misc before for code. No one pays it any attention as it get buried under all the odd posts  tongue


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#2127 2011-09-25 13:21:05

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: ITopic: Welcome to your local block library!

Sorry for not working on the block generator, but something went wrong with Norton Internet Security and it blocked everything from accessing the internet. I've reinstalled and it works again.


/* No comment */

Offline

 

#2128 2011-09-25 13:52:53

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: ITopic: Welcome to your local block library!

Oh dear  hmm  Does that mean you can start work on it again now?  smile


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#2129 2011-09-25 14:12:56

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: ITopic: Welcome to your local block library!

sparks wrote:

Oh dear  hmm  Does that mean you can start work on it again now?  smile

Yes, although I don't have much time on weekdays, especially Wednesdays.


/* No comment */

Offline

 

#2130 2011-09-25 14:23:08

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: ITopic: Welcome to your local block library!

Well do what you can if that's alright  smile  It would be really handy to have argument support!


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#2131 2011-09-25 21:59:45

guitarherofan
Scratcher
Registered: 2010-08-20
Posts: 4

Re: ITopic: Welcome to your local block library!

I'm trying to find scripts that will let a sprite bounce off a sprite. But I cant find one!   sad  would you get it up for me?

Offline

 

#2132 2011-09-25 22:09:20

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: ITopic: Welcome to your local block library!

guitarherofan wrote:

I'm trying to find scripts that will let a sprite bounce off a sprite. But I cant find one!   sad  would you get it up for me?

The Block Library is for blocks that won't work in normal Scratch; in fact, Advanced Topics is for programming languages outside Scratch itself (including Squeak, the base for Scratch).  Questions about Scratch belong in All About Scratch. 

I believe the script you need is:

if <touching sprite> {
turn 180 degrees
}

It doesn't matter which way it turns.

Offline

 

#2133 2011-09-26 11:14:48

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: ITopic: Welcome to your local block library!

Greenatic wrote:

guitarherofan wrote:

I'm trying to find scripts that will let a sprite bounce off a sprite. But I cant find one!   sad  would you get it up for me?

The Block Library is for blocks that won't work in normal Scratch; in fact, Advanced Topics is for programming languages outside Scratch itself (including Squeak, the base for Scratch).  Questions about Scratch belong in All About Scratch. 

I believe the script you need is:

if <touching sprite> {
turn 180 degrees
}

It doesn't matter which way it turns.

turn 360 - direction

would work better


http://i.imgur.com/zeIZW.png

Offline

 

#2134 2011-09-26 16:37:31

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: ITopic: Welcome to your local block library!

rookwood101 wrote:

Greenatic wrote:

guitarherofan wrote:

I'm trying to find scripts that will let a sprite bounce off a sprite. But I cant find one!   sad  would you get it up for me?

The Block Library is for blocks that won't work in normal Scratch; in fact, Advanced Topics is for programming languages outside Scratch itself (including Squeak, the base for Scratch).  Questions about Scratch belong in All About Scratch. 

I believe the script you need is:

if <touching sprite> {
turn 180 degrees
}

It doesn't matter which way it turns.

turn 360 - direction

would work better

Actually, that wouldn't work at all.   tongue

Offline

 

#2135 2011-09-26 21:09:04

Pecola1
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: ITopic: Welcome to your local block library!

Greenatic wrote:

rookwood101 wrote:

Greenatic wrote:


The Block Library is for blocks that won't work in normal Scratch; in fact, Advanced Topics is for programming languages outside Scratch itself (including Squeak, the base for Scratch).  Questions about Scratch belong in All About Scratch. 

I believe the script you need is:

if <touching sprite> {
turn 180 degrees
}

It doesn't matter which way it turns.

turn 360 - direction

would work better

Actually, that wouldn't work at all.   tongue

LOL I have looked into this a lot, it depends on WHERE you have i hit, if its to the left one method say, turn 90-direction (cant remember) but on the top 90 - 0 would be turning 90, and that wouldn't work. I have worked hard and long on it. Haven't found it yet.


If you are reading this, please read to the end, because if you don't you won't know what's at the end. Don't just skip to the end though otherwise you won't be able to read the middle, which is most important. Now you must be wondering why you just read all that, the reason is you may have not noticed something, read it again and see if you notice it this time  smile

Offline

 

#2136 2011-09-29 14:17:57

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: ITopic: Welcome to your local block library!

sparks, what Image API were you talking about?  hmm

Offline

 

#2137 2011-09-29 14:20:17

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: ITopic: Welcome to your local block library!

Greenatic wrote:

rookwood101 wrote:

Greenatic wrote:

The Block Library is for blocks that won't work in normal Scratch; in fact, Advanced Topics is for programming languages outside Scratch itself (including Squeak, the base for Scratch).  Questions about Scratch belong in All About Scratch. 

I believe the script you need is:

if <touching sprite> {
turn 180 degrees
}

It doesn't matter which way it turns.

turn 360 - direction

would work better

Actually, that wouldn't work at all.   tongue

It seems to work in my pong project fine. (take a look at the ball sprite)

Last edited by rookwood101 (2011-09-29 14:21:00)


http://i.imgur.com/zeIZW.png

Offline

 

#2138 2011-09-29 14:35:22

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: ITopic: Welcome to your local block library!

ProgrammingFreak wrote:

sparks, what Image API were you talking about?  hmm

The block rendering one you're working on!


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#2139 2011-09-29 15:52:30

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: ITopic: Welcome to your local block library!

rookwood101 wrote:

Greenatic wrote:

rookwood101 wrote:


turn 360 - direction

would work better

Actually, that wouldn't work at all.   tongue

It seems to work in my pong project fine. (take a look at the ball sprite)

I think you meant point in direction 360 - direction.

Offline

 

#2140 2011-09-29 16:18:21

Zparx
Scratcher
Registered: 2011-03-23
Posts: 500+

Re: ITopic: Welcome to your local block library!

I'm so confused! I don't get how this stuff works. How do you use these blocks in your projects? Is there seperate software to use?


http://images3.wikia.nocookie.net/__cb20101119183412/halo/images/4/43/Hero2.png
^ My rank on Halo: Reach :3

Offline

 

#2141 2011-09-29 16:21:09

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: ITopic: Welcome to your local block library!

Zparx wrote:

I'm so confused! I don't get how this stuff works. How do you use these blocks in your projects? Is there seperate software to use?

These blocks can be added to Scratch by entering the browser, often referred to as "hacking Scratch," even though it isn't illegal.  However, very few of these blocks work on a normal, non-hacked Scratch, and I don't believe any of them (except stretch blocks, and those only in the Java player) will work online.

Offline

 

#2142 2011-09-29 16:23:23

Zparx
Scratcher
Registered: 2011-03-23
Posts: 500+

Re: ITopic: Welcome to your local block library!

Greenatic wrote:

Zparx wrote:

I'm so confused! I don't get how this stuff works. How do you use these blocks in your projects? Is there seperate software to use?

These blocks can be added to Scratch by entering the browser, often referred to as "hacking Scratch," even though it isn't illegal.  However, very few of these blocks work on a normal, non-hacked Scratch, and I don't believe any of them (except stretch blocks, and those only in the Java player) will work online.

How can I add the blocks? I would LOVE that!  big_smile


http://images3.wikia.nocookie.net/__cb20101119183412/halo/images/4/43/Hero2.png
^ My rank on Halo: Reach :3

Offline

 

#2143 2011-09-29 16:49:02

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: ITopic: Welcome to your local block library!

Zparx wrote:

Greenatic wrote:

Zparx wrote:

I'm so confused! I don't get how this stuff works. How do you use these blocks in your projects? Is there seperate software to use?

These blocks can be added to Scratch by entering the browser, often referred to as "hacking Scratch," even though it isn't illegal.  However, very few of these blocks work on a normal, non-hacked Scratch, and I don't believe any of them (except stretch blocks, and those only in the Java player) will work online.

How can I add the blocks? I would LOVE that!  big_smile

To add these blocks:

1.  Open Scratch.
2.  Hold down the shift key and click the upper-right part of the "R" in the Scratch logo in the top-left of the screen.  Note:  Some computers may use a different key, such as alt, to achieve the same effect.
3.  Select "turn fill screen off."
4.  A whitish-grey area will appear at the right and bottom of the Scratch window.

You are now in the developer mode for Scratch.  Many interesting things can be done here.  To add blocks:

1.  Click the whitish-grey area.
2.  Select "open...", then "browser".   
3.  You'll see a green window appear.

Navigate the browser to add your code.  In the forums, file paths are most often posted like this:

SomethingHere1 > SomethingHere2 > SomethingHere3 > SomethingHere4 (the "method")

Assuming this was a real filepath, you would find SomethingHere1 in the left panel and click it.  Options would appear in the next panel.  You would find SomethingHere2 and click it, and more options would appear.  You would keep doing this until you got to SomethingHere4.  When you clicked that, the code would appear.

Important Note: Instance and Class

At the second panel, you'll see two buttons, "instance" and "class".  When clicked, these change what methods you can see.  Most methods are under instance, but all blockspecs are under class.

Note: To save changes, right-click and select "accept (s)".  If it asks for your initials, type in anything.  It doesn't matter what you type, as long as you type something.

Essential to every block is the blockspec.  To do that, go to Scratch-Objects.  Pick one of these three options:

ScratchSpriteMorph: Sprite-only blocks, such as motion
ScratchStageMorph: Stage-only blocks
ScriptableScratchMorph: Sprite and Stage blocks

Note: Stage and Sprite sensing blocks must be placed under both ScratchSpriteMorph and ScratchStageMorph, instead of just ScriptableScratchMorph.

Then click "class", "block specs" and then "blockSpecs".

To add the blockspec:

Here is the code for ScratchStageMorph's blockSpec method:

Code:

blockSpecs
    | t1 |
    t1 _ #('sensing' ('ask %s and wait' #s #doAsk 'What''s your name?') ('answer' #r #answer) #- ('mouse x' #r #mouseX) ('mouse y' #r #mouseY) ('mouse down?' #b #mousePressed) #- ('key %k pressed?' #b #keyPressed: 'space') #- ('reset timer' #- #timerReset) ('timer' #r #timer) #- ('%a of %m' #r #getAttribute:of:) #- ('loudness' #r #soundLevel) ('loud?' #b #isLoud) #~ ('%H sensor value' #r #sensor: 'slider') ('sensor %h?' #b #sensorPressed: 'button pressed') 'looks' ('switch to background %l' #- #showBackground: 'background1') ('next background' #- #nextBackground) ('background #' #r #backgroundIndex) #- ('change %g effect by %n' #- #changeGraphicEffect:by: 'color' 25) ('set %g effect to %n' #- #setGraphicEffect:to: 'color' 0) ('clear graphic effects' #- #filterReset) #- 'pen' ('clear' #- #clearPenTrails) ).
    ^ t1 , super blockSpecs

If you wanted to add a block to looks, you would find the word 'looks', with quotes, put the blockspec after it, and save.

To add a method:
Go to SomethingHere1 > SomethingHere2 > SomethingHere3, but don't click anything in the far right panel.  You'll see this in the code area:

Code:

message selector and argument names
    "comment stating purpose of message"

    | temporary variable names |
    statements

Replace that with your code, and save.

To change a method: 
That's what you did when you added the blockspec.  Just do that!

IMPORTANT NOTE:

When you're done, right-click the "R" in the Scratch logo like you did to turn of fillscreen, and select "save image for end-user".  This closes Scratch and saves your changes.  Next time you open Scratch, it will use the new code.

I hope that covered everything.   tongue

Offline

 

#2144 2011-09-29 16:59:19

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: ITopic: Welcome to your local block library!

sparks wrote:

ProgrammingFreak wrote:

sparks, what Image API were you talking about?  hmm

The block rendering one you're working on!

For the Block website?

Offline

 

#2145 2011-09-29 17:28:37

Zparx
Scratcher
Registered: 2011-03-23
Posts: 500+

Re: ITopic: Welcome to your local block library!

Greenatic wrote:

I hope that covered everything.   tongue

Wow thank you!  big_smile


http://images3.wikia.nocookie.net/__cb20101119183412/halo/images/4/43/Hero2.png
^ My rank on Halo: Reach :3

Offline

 

#2146 2011-09-29 17:29:32

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: ITopic: Welcome to your local block library!

Zparx wrote:

Greenatic wrote:

I hope that covered everything.   tongue

Wow thank you!  big_smile

No problem!   smile

Offline

 

#2147 2011-09-29 17:58:00

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: ITopic: Welcome to your local block library!

Greenatic wrote:

rookwood101 wrote:

Greenatic wrote:


Actually, that wouldn't work at all.   tongue

It seems to work in my pong project fine. (take a look at the ball sprite)

I think you meant point in direction 360 - direction.

lol oh yeh  smile  silly me.


http://i.imgur.com/zeIZW.png

Offline

 

#2148 2011-09-30 02:47:02

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: ITopic: Welcome to your local block library!

ProgrammingFreak wrote:

sparks wrote:

ProgrammingFreak wrote:

sparks, what Image API were you talking about?  hmm

The block rendering one you're working on!

For the Block website?

Yes  smile


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#2149 2011-09-30 12:30:36

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: ITopic: Welcome to your local block library!

Code:

('Safe Tangent of %n' #r #tanSafe: #90)

tanSafe: aNumber
" Replace ^10000 by your desired safety catch for tan 90 "
aNumber \\ 90 = 0 ifTrue: [^ 10000].
^ aNumber degreesToRadians tan


('Safe %n / %n' #r #safe:div: #0 #0)

safe: a div: b
" Replace ^0 by your desired safety catch for n/0 "
b = 0 ifTrue: [^0].
^a/b

('Safe sqrt %n' #r #safesqrt: #-1)

safesqrt: a
^ a abs sqrt

Perform the calculations with error catching and fixing.


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#2150 2011-10-01 16:29:34

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: ITopic: Welcome to your local block library!

sparks wrote:

ProgrammingFreak wrote:

sparks wrote:


The block rendering one you're working on!

For the Block website?

Yes  smile

I don't remember saying I was going to do it.  hmm
I thought that was TheSuccessor, remember?
I can do it though.  big_smile

Offline

 

Board footer