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

#2076 2011-09-17 14:08:23

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

Re: ITopic: Welcome to your local block library!

scimonster wrote:

Greenatic wrote:

IMPORTANT NOTE:  In the library post, Scimonster incorrectly stated the location of some code for my |make {  v} draggable| and |make {  v} undraggable| blocks.  Scratch-Blocks > SpriteArgMorph > event handling > presentMenu is the correct location; he used "other" instead of "event handling".

Tomorrow.

Greenatic wrote:

joefarebrother wrote:

will someone do a byob update soon?

Or how about a full Scratch blocks update?

^^;
I'm not so good at BYOB updates, but I'll try if I can find them.

Byob takes the longest XD


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

 

#2077 2011-09-17 14:14:20

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

Re: ITopic: Welcome to your local block library!

(viewing mode) has now been fixed.  See the original post on page 83 for the code.

Offline

 

#2078 2011-09-17 15:33:10

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: ITopic: Welcome to your local block library!

improved case=sensitive BYOB
http://i.imgur.com/IsZFu.gif
download link:http://www.megaupload.com/?d=MQSWDR3A

Last edited by roijac (2011-09-23 12:25:26)

Offline

 

#2079 2011-09-18 03:11:24

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: ITopic: Welcome to your local block library!

roijac wrote:

improved case=sensitive BYOB
http://i.imgur.com/5RzfD.gif
download link:http://www.megaupload.com/?d=N8WPUGWC

That's neat!

Offline

 

#2080 2011-09-18 04:18:38

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: ITopic: Welcome to your local block library!

scimonster wrote:

roijac wrote:

improved case=sensitive BYOB
http://i.imgur.com/5RzfD.gif
download link:http://www.megaupload.com/?d=N8WPUGWC

That's neat!

thanks!  smile

Offline

 

#2081 2011-09-18 10:34:26

Bklecka
Scratcher
Registered: 2011-08-27
Posts: 1000+

Re: ITopic: Welcome to your local block library!

i discovered a bug with the download block $Number$ from library block!
try to import block 0 61 or higher or nothing
and it will import a white bugged <html> block!
this is its code <link rel="shortcut icon" href="/static/images/favicon.ico"/>


http://i48.tinypic.com/106ijc9.jpg

Offline

 

#2082 2011-09-18 10:54:31

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: ITopic: Welcome to your local block library!

Bklecka wrote:

i discovered a bug with the download block $Number$ from library block!
try to import block 0 61 or higher or nothing
and it will import a white bugged <html> block!
this is its code <link rel="shortcut icon" href="/static/images/favicon.ico"/>

Hmm. Seems like a bug.

Sparks, did you say you moved all the Panther blocks to the scratchr site?

Offline

 

#2083 2011-09-18 15:21:21

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

Re: ITopic: Welcome to your local block library!

Not successfully. The code wasn't imported AND the MySQL connection doesn't always work.

The glitch is because a block higher than that does not exist.

Last edited by sparks (2011-09-18 15:21:56)


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

Offline

 

#2084 2011-09-18 16:58:32

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

Re: ITopic: Welcome to your local block library!

More blocks!  These allow you to mess with Scratch's logo! (temporarily) Please note: these blocks will (^ self) in presentation mode to avoid errors.  Also, using an invalid file path will result in annoying menus and/or errors. 

First of all, these all require a prerequisite method.  Go to Scratch-UI-Panes > ScratchFrameMorph > accessing and create a new method:

Code:

logoMorph
     ^ logoMorph

http://www.freewebs.com/polyeztahpuppies/exportbmp.gif

Code:

('export logo as %s.bmp' #- #ExportBMP:)

ExportBMP: t1
| t2 t3|
t1 size = 0 ifTrue:[^ self].
(self ownerThatIsA: ScratchFrameMorph) ifNil:[^ self].
t3 _ t1.
(t3 asLowercase endsWith: '.bmp') ifFalse: [t3 _ t3, '.bmp'].
t2 _ (self ownerThatIsA: ScratchFrameMorph) logoMorph.
((t2 form) asFormOfDepth: 32) writeBMPFileNamed: t3

http://www.freewebs.com/polyeztahpuppies/exportgif.gif

Code:

('export logo as %s.gif' #- #ExportGIF:)

ExportGIF: t1
| t2 t3|
t1 size = 0 ifTrue:[^ self].
(self ownerThatIsA: ScratchFrameMorph) ifNil: [^ self].
t3 _ t1.
(t3 asLowercase endsWith: '.gif') ifFalse: [t3 _ t3, '.gif'].
t2 _ (self ownerThatIsA: ScratchFrameMorph) logoMorph.
GIFReadWriter putForm: ((t2 form) asFormOfDepth: 32)  onFileNamed: t3

http://www.freewebs.com/polyeztahpuppies/exportjpg.gif

Code:

('export logo as %s.jpg, quality %n (1-100)' #- #ExportJPG:Quality:)

ExportJPG: t1 Quality: t2
| t3 t4 t5 t6|
(t2 < 1) | (t2 > 100) ifTrue:[^ self].
t1 size = 0 ifTrue:[^ self].
(self ownerThatIsA: ScratchFrameMorph) ifNil:[^self].
t4 _ t1.
(t4 asLowercase endsWith: '.jpg') ifFalse: [t4 _ t4, '.jpg'].
t3 _ (self ownerThatIsA: ScratchFrameMorph) logoMorph.
t5 _ FastJPEG compress: ((t3 form) asFormOfDepth: 32) quality: t2 asNumber.
    t6 _ (FileStream newFileNamed: t1) binary.
    t6 nextPutAll: t5;
     close

http://www.freewebs.com/polyeztahpuppies/readlogo.gif

Code:

('import logo from file %s' #- #ImportLogo: t1)

ImportLogo: t1
t1 size = 0 ifTrue:[^ self].
( t1 endsWith: '.jpg') | (t1 endsWith: '.jpeg') | (t1 endsWith: '.gif') | (t1 endsWith: '.bmp') | (t1 endsWith: '.png') ifFalse: [^ self].
(self ownerThatIsA: ScratchFrameMorph) ifNil:[^ self].
((self ownerThatIsA: ScratchFrameMorph) logoMorph) form: (Form fromFileNamed: t1)

http://www.freewebs.com/polyeztahpuppies/repaintlogo.gif

Code:

('repaint logo' #- #RepaintLogo)

RepaintLogo
(self ownerThatIsA: ScratchFrameMorph) ifNil:[^self].
((self ownerThatIsA: ScratchFrameMorph) logoMorph) editDrawing

Last edited by Greenatic (2011-09-18 16:59:55)

Offline

 

#2085 2011-09-19 03:27:40

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: ITopic: Welcome to your local block library!

What about PNG?

Offline

 

#2086 2011-09-19 16:27:05

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

Re: ITopic: Welcome to your local block library!

scimonster wrote:

What about PNG?

I made that one, then forgot to post it.   tongue   Let me go remake it now...

EDIT:  Actually, I didn't forget.  Scratch has no method for exporting the logo as a PNG.   sad

Last edited by Greenatic (2011-09-19 16:28:24)

Offline

 

#2087 2011-09-19 16:48:38

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

Re: ITopic: Welcome to your local block library!

More blocks!   big_smile   big_smile   big_smile

http://www.freewebs.com/polyeztahpuppies/distxyxy.gif

Code:

('distance (%n,%n) (%n,%n)' #r #DistX:y:X:y:)

DistX: t1 y: t2 X: t3 y: t4
(t1 @ t2) = (t3 @ t4) ifTrue:[^0].
^ (((t1 - t3) * (t1 - t3)) + ((t2-t4)* (t2-t4))) sqrt

http://www.freewebs.com/polyeztahpuppies/slopexyxy.gif

Code:

('slope (%n,%n) (%n,%n)' #r #SlopeX:y:X:y:)

SlopeX: t1 y: t2 X: t3 y: t4
t1 = t3 ifTrue:[^ 'Undefined'].
^ (t2 - t4)/(t1-t3)

http://www.freewebs.com/polyeztahpuppies/midxxyxy.gif

Code:

('midpoint x (%n,%n) (%n,%n)' #r #MidXX:y:X:y:)

MidXX: t1 y: t2 X: t3 y: t4
t1 = t3 ifTrue:[^ t1].
^ (t1+t3)/2

http://www.freewebs.com/polyeztahpuppies/midyxyxy.gif

Code:

('midpoint y (%n,%n) (%n,%n)' #r #MidYX:y:X:y:)

MidYX: t1 y: t2 X: t3 y: t4
(t2 = t4) ifTrue:[^ t2].
^ (t2+t4)/2

Offline

 

#2088 2011-09-20 03:58:01

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: ITopic: Welcome to your local block library!

Could you provide explanations?
And when I do that update, we'll have to crown Greenatic as the new Scratch Blocks champ. ;D

Offline

 

#2089 2011-09-20 16:04:27

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

Re: ITopic: Welcome to your local block library!

scimonster wrote:

Could you provide explanations?
And when I do that update, we'll have to crown Greenatic as the new Scratch Blocks champ. ;D

Distance:  The distance between the two points.
Slope:  The slope of the line intersecting the two points.
MidpointX:  The x value of the point exactly between the two points.
MidpointY:  The y value of the point exactly between the two points.

Offline

 

#2090 2011-09-20 20:29:41

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

Re: ITopic: Welcome to your local block library!

scimonster wrote:

Could you provide explanations?
And when I do that update, we'll have to crown Greenatic as the new Scratch Blocks champ. ;D

Sweet! NEW CHAMP? I don't even remember him/her being here before summer! LOL


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

 

#2091 2011-09-20 20:33:17

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

Re: ITopic: Welcome to your local block library!

Pecola1 wrote:

scimonster wrote:

Could you provide explanations?
And when I do that update, we'll have to crown Greenatic as the new Scratch Blocks champ. ;D

Sweet! NEW CHAMP? I don't even remember him/her being here before summer! LOL

I wasn't.   tongue   (Him, by the way!)

Lol, looking back at the first block I made, the one w/ jslomba, I imagine how quickly I could have made that now...   tongue

BTW, were you just trying to get me to pause so you could catch up?  No way that's happening!  More blocks now!

http://www.freewebs.com/polyeztahpuppies/xywithinbounds.gif

Code:

('x:%n y: %n is within my bounds?' #b #WithinBoundsX:y:)

WithinBoundsX: t1 y: t2
^ (t1 <= (self xpos + (0.5 * self width))) &  (t1 >= (self xpos - (0.5 * self width))) &  (t2 <= (self ypos + (0.5 * self height))) &  (t2 >= (self ypos - (0.5 * self height)))

NOTE: The following two blocks require an alteration to the presentMenu method.  See the |make {  v} draggable| and |make {  v} undraggable| for instructions, but remember to use the methods of these blocks.
http://www.freewebs.com/polyeztahpuppies/centerwithinbounds.gif

Code:

('%m center is within my bounds?' #b #CentWithin:)

CentWithin: t1
^ ((t1 xpos) <= (self xpos + (0.5 * self width))) &  (((t1 xpos) >= (self xpos - (0.5 * self width))) &  ((t1 ypos) <= (self ypos + (0.5 * self height))) &  ((t1 ypos) >= (self ypos - (0.5 * self height))))

http://www.freewebs.com/polyeztahpuppies/completewithinbounds.gif

Code:

('%m is completely within my bounds?' #b #CompWithin:)

CompWithin: t1
    ^ t1 xpos + (0.5 * t1 width) <= (self xpos + (0.5 * self width)) & (t1 xpos - (0.5 * t1 width) >= (self xpos - (0.5 * self width))) & (t1 ypos + (0.5 * t1 height) <= (self ypos + (0.5 * self height))) & (t1 ypos - (0.5 * t1 height) >= (self ypos - (0.5 * self height)))

Last edited by Greenatic (2011-09-20 21:10:54)

Offline

 

#2092 2011-09-21 04:01:16

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

Re: ITopic: Welcome to your local block library!

Another good collection of blocks there, Greenatic!

Can I just remind you all that whilst the title of top block contributor is something worth working towards, make sure that your blocks are actually useful rather than trying to gain the title by making every method you can find into a block!


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

Offline

 

#2093 2011-09-21 04:59:31

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: ITopic: Welcome to your local block library!

I'm pretty sure almost all of Greenatic's blocks are useful.  smile

Offline

 

#2094 2011-09-21 07:46:42

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

Re: ITopic: Welcome to your local block library!

sparks wrote:

Can I just remind you all that whilst the title of top block contributor is something worth working towards, make sure that your blocks are actually useful rather than trying to gain the title by making every method you can find into a block!

I'm not just doing that!  (Honestly, I'm a little offended...)

scimonster wrote:

I'm pretty sure almost all of Greenatic's blocks are useful.   smile

Thanks!   smile   By the way, has anyone made a |save image for end-user| block?  I would check but my computer freezes for five minutes if I so much as look at the Block Library page 1.

Offline

 

#2095 2011-09-21 08:44:48

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: ITopic: Welcome to your local block library!

Greenatic wrote:

By the way, has anyone made a |save image for end-user| block?  I would check but my computer freezes for five minutes if I so much as look at the Block Library page 1.

I have.  big_smile

Offline

 

#2096 2011-09-21 09:03:50

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: ITopic: Welcome to your local block library!

Weebly is blocked by Scratch right now, but I asked for an exception for us.

Also, I wrote something on the wiki page. Does anyone think it should go in post #41? :3

Offline

 

#2097 2011-09-21 15:08:52

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

Re: ITopic: Welcome to your local block library!

Right, I especially said that your blocks were very good to imply that you weren't creating simple blocks, Greenatic! I Agree they're fantastic! I was just sort of mentioning it to the general community  smile


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

Offline

 

#2098 2011-09-21 15:56:36

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

Re: ITopic: Welcome to your local block library!

sparks wrote:

Right, I especially said that your blocks were very good to imply that you weren't creating simple blocks, Greenatic! I Agree they're fantastic! I was just sort of mentioning it to the general community  smile

Oops.  I apologize for not reading the whole post, and for mistaking it for an implied insult.

scimonster wrote:

Greenatic wrote:

By the way, has anyone made a |save image for end-user| block?  I would check but my computer freezes for five minutes if I so much as look at the Block Library page 1.

I have.  big_smile

Did you share it?

I believe this is my 400th post.

Last edited by Greenatic (2011-09-21 17:17:07)

Offline

 

#2099 2011-09-21 18:22:39

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

Re: ITopic: Welcome to your local block library!

NOTE: These blocks intentionally will always return false in presentation mode, to avoid errors.

http://www.freewebs.com/polyeztahpuppies/imageexistsanywhere.gif

Code:

('image %s exists anywhere?' #b #ImgAnywhere:)

ImgAnywhere: t1
(self ownerThatIsA: ScratchFrameMorph) ifNil:[^ false].
(((self ownerThatIsA: ScratchFrameMorph) allProjectMedia) select: [:t2|  (t2 asString) = (t1, ' [image]')]) ~= (#() asOrderedCollection)

http://www.freewebs.com/polyeztahpuppies/soundexistsanywhere.gif

Code:

('sound %s exists anywhere?' #b #SndAnywhere:)

SndAnywhere: t1
(self ownerThatIsA: ScratchFrameMorph) ifNil:[^ false].
(((self ownerThatIsA: ScratchFrameMorph) allProjectMedia) select: [:t2|  (t2 asString) = (t1, ' [sound]')]) ~= (#() asOrderedCollection)

http://www.freewebs.com/polyeztahpuppies/mediaexistsanywhere.gif

Code:

('media item %s exists anywhere?' #b #MedAnywhere:)

MedAnywhere: t1
(self ownerThatIsA: ScratchFrameMorph) ifNil:[^ false].
(((self ownerThatIsA: ScratchFrameMorph) allProjectMedia) select: [:t2|  ((t2 asString) = (t1, ' [sound]')) | ((t2 asString) = (t1, ' [image]'))]) ~= (#() asOrderedCollection)

Offline

 

#2100 2011-09-21 19:07:44

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

Re: ITopic: Welcome to your local block library!

Greenatic wrote:

Pecola1 wrote:

scimonster wrote:

Could you provide explanations?
And when I do that update, we'll have to crown Greenatic as the new Scratch Blocks champ. ;D

Sweet! NEW CHAMP? I don't even remember him/her being here before summer! LOL

I wasn't.   tongue   (Him, by the way!)

Lol, looking back at the first block I made, the one w/ jslomba, I imagine how quickly I could have made that now...   tongue

BTW, were you just trying to get me to pause so you could catch up?  No way that's happening!  More blocks now!

Nah, XD I cant even remember the last time I made a block XD I haven't made one since i became a Librarian! LOL XD It seems weird cuz I've been trying some more advanced blocks like a working bounce block and other things like that, I keep thinking I have it but it always ends up it coincidentally worked XD.


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

 

Board footer