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

#1751 2011-07-27 16:10:41

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

Re: ITopic: Welcome to your local block library!

This block does not support .jpg format, is there a way to make it so?

Code:

  | img newC |

t1_t1 asString.
    (t1 asLowercase endsWith: '.gif') ifTrue: [
        img _ (GIFReadWriter new setStream: (HTTPSocket httpGet: t1)) nextImage.]
    ifFalse: [
        (t1 asLowercase endsWith: '.png') ifTrue: [
            img _ (PNGReadWriter createAFormFrom: (HTTPSocket httpGet: t1) contents) first]
        ifFalse: [
            img _ HTTPSocket httpJpeg: t1]].

    newC _ ImageMedia new form: img; mediaName: (self unusedMediaNameFromBaseName: (self defaultImageMedia mediaName)).

    self addMediaItem: newC.

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

Offline

 

#1752 2011-07-27 16:51:42

RUMCHEERYPOOPOO
Scratcher
Registered: 2008-12-23
Posts: 100+

Re: ITopic: Welcome to your local block library!

sparks wrote:

This block does not support .jpg format, is there a way to make it so?

Code:

  | img newC |

t1_t1 asString.
    (t1 asLowercase endsWith: '.gif') ifTrue: [
        img _ (GIFReadWriter new setStream: (HTTPSocket httpGet: t1)) nextImage.]
    ifFalse: [
        (t1 asLowercase endsWith: '.png') ifTrue: [
            img _ (PNGReadWriter createAFormFrom: (HTTPSocket httpGet: t1) contents) first]
        ifFalse: [
            img _ HTTPSocket httpJpeg: t1]].

    newC _ ImageMedia new form: img; mediaName: (self unusedMediaNameFromBaseName: (self defaultImageMedia mediaName)).

    self addMediaItem: newC.

By the looks of it, it does as when it gets false for both ending with .gif and .png it assumes its a jpg (by the looks of it through my untrained eye)


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#1753 2011-07-27 17:04:56

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

Re: ITopic: Welcome to your local block library!

No, it assumes it JPEG not JPG. That's the problem  sad  All the images I want to access happen to be JPG which is the only format not supported here.


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

Offline

 

#1754 2011-07-27 17:34:30

RUMCHEERYPOOPOO
Scratcher
Registered: 2008-12-23
Posts: 100+

Re: ITopic: Welcome to your local block library!

sparks wrote:

No, it assumes it JPEG not JPG. That's the problem  sad  All the images I want to access happen to be JPG which is the only format not supported here.

Err... JPG and JPEG are the same format, the only reason why they use jpg is because it's 3 characters long and fits perfectly as a file extension JPEG stands for joint picture experts group (I think).

Also, see this if you still don't understand http://en.wikipedia.org/wiki/JPEG


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#1755 2011-07-27 17:48:10

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

Re: ITopic: Welcome to your local block library!

RUMCHEERYPOOPOO wrote:

sparks wrote:

No, it assumes it JPEG not JPG. That's the problem  sad  All the images I want to access happen to be JPG which is the only format not supported here.

Err... JPG and JPEG are the same format, the only reason why they use jpg is because it's 3 characters long and fits perfectly as a file extension JPEG stands for joint picture experts group (I think).

Also, see this if you still don't understand http://en.wikipedia.org/wiki/JPEG

Well it's not importing JPG, that's all I know  hmm


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

Offline

 

#1756 2011-07-27 17:59:08

RUMCHEERYPOOPOO
Scratcher
Registered: 2008-12-23
Posts: 100+

Re: ITopic: Welcome to your local block library!

sparks wrote:

RUMCHEERYPOOPOO wrote:

sparks wrote:

No, it assumes it JPEG not JPG. That's the problem  sad  All the images I want to access happen to be JPG which is the only format not supported here.

Err... JPG and JPEG are the same format, the only reason why they use jpg is because it's 3 characters long and fits perfectly as a file extension JPEG stands for joint picture experts group (I think).

Also, see this if you still don't understand http://en.wikipedia.org/wiki/JPEG

Well it's not importing JPG, that's all I know  hmm

Strange... well I'm no squeak/smalltalk expert, leave it to the pros I say  big_smile


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#1757 2011-07-27 19:04:32

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

Re: ITopic: Welcome to your local block library!

scimonster wrote:

Greenatic wrote:

scimonster wrote:


The second biggest was the one before the most recent: 26 blocks!

No, what I mean is, when are you going to do this gigantic update you mentioned?  You're really confusing me...

No-one said anything about a gigantic update.
Librarians, could someone do the update?

OK, I'm confused.  I thought you said you were about to do "the second biggest update in the history of the Library" or something like that...

Offline

 

#1758 2011-07-27 21:07:26

Sidharth
Scratcher
Registered: 2007-12-14
Posts: 100+

Re: ITopic: Welcome to your local block library!

I have a nice BYOB block that I think you do not already have:
http://i.imgur.com/FpG60.gif

.ysp file is here. (mediafire download link page)


http://www.danasoft.com/citysign.jpg

Offline

 

#1759 2011-07-28 12:40:27

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

Re: ITopic: Welcome to your local block library!

YourLocalBlockLib wrote:

To install a block importer in Scratch to automatically add a (downloadable) block for you, click here! But beware, this feature is untested and does not currently work!

There is something wrong here, it is untested yet we know it doesn't work?  tongue  We did test it. Otherwise we wouldn't know.  roll


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

 

#1760 2011-07-28 12:43:59

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

Re: ITopic: Welcome to your local block library!

Pecola1 wrote:

YourLocalBlockLib wrote:

To install a block importer in Scratch to automatically add a (downloadable) block for you, click here! But beware, this feature is untested and does not currently work!

There is something wrong here, it is untested yet we know it doesn't work?  tongue  We did test it. Otherwise we wouldn't know.  roll

*adds to mental list of things to fix next week*

Offline

 

#1761 2011-07-28 14:26:54

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

Re: ITopic: Welcome to your local block library!

scimonster wrote:

Pecola1 wrote:

YourLocalBlockLib wrote:

To install a block importer in Scratch to automatically add a (downloadable) block for you, click here! But beware, this feature is untested and does not currently work!

There is something wrong here, it is untested yet we know it doesn't work?  tongue  We did test it. Otherwise we wouldn't know.  roll

*adds to mental list of things to fix next week*

lol, Can someone else do an update besides Scimonster?   tongue

Offline

 

#1762 2011-07-28 14:35:06

SSBBM
Scratcher
Registered: 2009-10-09
Posts: 100+

Re: ITopic: Welcome to your local block library!

Meowmeow, I can't go to the block upload page without it logging me out. Do you know why?

Greenatic wrote:

lol, Can someone else do an update besides Scimonster?   tongue

I do BYOB updates. I fact I have a two new blocks...

Sidharth wrote:

I have a nice BYOB block that I think you do not already have:
http://i.imgur.com/FpG60.gif

.ysp file is here. (mediafire download link page)

I don't see your block in the download...

Last edited by SSBBM (2011-07-28 14:44:51)


http://goo.gl/zVfAp http://goo.gl/laci8

Offline

 

#1763 2011-07-28 14:46:23

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

Re: ITopic: Welcome to your local block library!

You can do Scratch too! Just follow the code format. If it's not too large I might take the effort to fix it.  tongue

Offline

 

#1764 2011-07-28 14:59:46

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

Re: ITopic: Welcome to your local block library!

SSBBM wrote:

Greenatic wrote:

lol, Can someone else do an update besides Scimonster?   tongue

I do BYOB updates. I fact I have a two new blocks...

Yeah, I just realized that sounded kinda mean.  I'm really sorry.

On a more constructive-sounding note, it does seem that only Scimonster is doing Scratch updates, which is what I was refering to.  Thing is, I'm about to upload an outrageous amount of blocks, which will allow you [mathematical crazy talk]to perform all Scratch numerical operations on any real integer in any real integer base from -36 to 36, with the exception of bases 0 and -1, since they do not exist.[/mathematical crazy talk].

Sorry, I had to say that.   tongue

Offline

 

#1765 2011-07-28 15:02:41

SSBBM
Scratcher
Registered: 2009-10-09
Posts: 100+

Re: ITopic: Welcome to your local block library!

Greenatic wrote:

Yeah, I just realized that sounded kinda mean.  I'm really sorry.

no problem

Last edited by SSBBM (2011-07-28 15:02:59)


http://goo.gl/zVfAp http://goo.gl/laci8

Offline

 

#1766 2011-07-28 15:08:53

YourLocalBlockLib
Scratcher
Registered: 2011-03-10
Posts: 100+

Re: ITopic: Welcome to your local block library!

.                              http://welcometoyourlocalblocklibrary.weebly.com/uploads/7/1/1/0/7110842/292223741.gif

BYOB Blocks added: 3
http://i.imgur.com/sbLnZ.gif by SSBBM
http://i.imgur.com/aSA80.gif by SSBBM
http://i.imgur.com/wgDiQ.gif by SSBBM Does not change text in BYOB. It only adds BBCode tags. Considered one block in the statistics

Update carried out by block librarian: SSBBM
________________________________________________________________________________
^home
^updates archive


http://dl.dropbox.com/u/6273449/BlockLibraryTitle.png

Offline

 

#1767 2011-07-28 17:12:37

SSBBM
Scratcher
Registered: 2009-10-09
Posts: 100+

Re: ITopic: Welcome to your local block library!

Shouldn't we get rid of the 1st anniversary logos?


http://goo.gl/zVfAp http://goo.gl/laci8

Offline

 

#1768 2011-07-28 17:25:32

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

Re: ITopic: Welcome to your local block library!

OK, here's the mega-block share I promised.  These will support numerical operations with any real integer in any real integer base -36 to 36, except 0 and -1 since they aren't possible bases.

These took FOREVER to make!  (well, actually, a week of occasional work  tongue  )

NOTE:  It's best to install all of these blocks at once.
ANOTHER NOTE:  I know that I used string arguments for operations in other bases.  Had I not used string arguments, digits in bases higher than 10, for which you use capital letters A-Z, would not have worked.

First, you need to create these methods (I KNOW, THEY'RE SUPER-LONG.  DEAL WITH IT.  Oh yeah, copy+paste is strongly advised.  And this may just set the Scratch record for longest post.   Definitely the Block Library record.   big_smile  ) :

Code:

Int: t1 toBase: t2 
    | digit t1s t1so a |
    t1 isInf ifTrue: [^ 0].
    t1 isNaN ifTrue: [^ 0].
    t2 isInf ifTrue: [^ 0].
    t2 isNaN ifTrue: [^ 0].
    t2 = 0 ifTrue: [^ 0].
    t2 = -1 ifTrue: [^ 0].
    t2 > 36 ifTrue: [^ 0].
    t2 < -36 ifTrue: [^ 0].
    t2 = 1
        ifTrue: 
            [a _ '1' asString.
            t1 - 1 timesRepeat: [a _ a asString , '1' asString].
            ^ a].
    t1 = t1 rounded ifFalse: [^ 0].
    t1s _ t1.
    t2 < 0 ifTrue: [t1s _ t1s * -1].
    t1so _ t1s.
    digit _ (t1s \\ t2) abs.
    t1so / t2 < (t1so / t2) rounded
        ifTrue: 
            [t1s _ (t1s / t2) rounded.
            t1s _ t1s - 1].
    t1so / t2 < (t1so / t2) rounded ifFalse: [t1s _ (t1s / t2) rounded].
    digit = 10 ifTrue: [digit _ 'A' asString].
    digit = 11 ifTrue: [digit _ 'B' asString].
    digit = 12 ifTrue: [digit _ 'C' asString].
    digit = 13 ifTrue: [digit _ 'D' asString].
    digit = 14 ifTrue: [digit _ 'E' asString].
    digit = 15 ifTrue: [digit _ 'F' asString].
    digit = 16 ifTrue: [digit _ 'G' asString].
    digit = 17 ifTrue: [digit _ 'H' asString].
    digit = 18 ifTrue: [digit _ 'I' asString].
    digit = 19 ifTrue: [digit _ 'J' asString].
    digit = 20 ifTrue: [digit _ 'K' asString].
    digit = 21 ifTrue: [digit _ 'L' asString].
    digit = 22 ifTrue: [digit _ 'M' asString].
    digit = 23 ifTrue: [digit _ 'N' asString].
    digit = 24 ifTrue: [digit _ 'O' asString].
    digit = 25 ifTrue: [digit _ 'P' asString].
    digit = 26 ifTrue: [digit _ 'Q' asString].
    digit = 27 ifTrue: [digit _ 'R' asString].
    digit = 28 ifTrue: [digit _ 'S' asString].
    digit = 29 ifTrue: [digit _ 'T' asString].
    digit = 30 ifTrue: [digit _ 'U' asString].
    digit = 31 ifTrue: [digit _ 'V' asString].
    digit = 32 ifTrue: [digit _ 'W' asString].
    digit = 33 ifTrue: [digit _ 'X' asString].
    digit = 34 ifTrue: [digit _ 'Y' asString].
    digit = 35 ifTrue: [digit _ 'Z' asString].
    a _ digit asString.
    [t1s abs > 0]
        whileTrue: 
            [t1so _ t1s.
            digit _ (t1s \\ t2) abs.
            t1so / t2 < (t1so / t2) rounded
                ifTrue: 
                    [t1s _ (t1s / t2) rounded.
                    t1s _ t1s - 1].
            t1so / t2 < (t1so / t2) rounded ifFalse: [t1s _ (t1s / t2) rounded].
            digit = 10 ifTrue: [digit _ 'A' asString].
    digit = 11 ifTrue: [digit _ 'B' asString].
    digit = 12 ifTrue: [digit _ 'C' asString].
    digit = 13 ifTrue: [digit _ 'D' asString].
    digit = 14 ifTrue: [digit _ 'E' asString].
    digit = 15 ifTrue: [digit _ 'F' asString].
    digit = 16 ifTrue: [digit _ 'G' asString].
    digit = 17 ifTrue: [digit _ 'H' asString].
    digit = 18 ifTrue: [digit _ 'I' asString].
    digit = 19 ifTrue: [digit _ 'J' asString].
    digit = 20 ifTrue: [digit _ 'K' asString].
    digit = 21 ifTrue: [digit _ 'L' asString].
    digit = 22 ifTrue: [digit _ 'M' asString].
    digit = 23 ifTrue: [digit _ 'N' asString].
    digit = 24 ifTrue: [digit _ 'O' asString].
    digit = 25 ifTrue: [digit _ 'P' asString].
    digit = 26 ifTrue: [digit _ 'Q' asString].
    digit = 27 ifTrue: [digit _ 'R' asString].
    digit = 28 ifTrue: [digit _ 'S' asString].
    digit = 29 ifTrue: [digit _ 'T' asString].
    digit = 30 ifTrue: [digit _ 'U' asString].
    digit = 31 ifTrue: [digit _ 'V' asString].
    digit = 32 ifTrue: [digit _ 'W' asString].
    digit = 33 ifTrue: [digit _ 'X' asString].
    digit = 34 ifTrue: [digit _ 'Y' asString].
    digit = 35 ifTrue: [digit _ 'Z' asString].
            a _ digit asString , a asString].
    t1 < 0
        ifTrue: [t2 > 0 ifTrue: [a _ '-' asString , a asString]].
    ^ a

Code:

InBase: t2 Int: t1 
    | valid letter value total place |
    t2 isNil ifTrue: [^ 0].
    t1 isNil ifTrue: [^ 0].
    t2 isInf ifTrue: [^ 0].
    t2 isNaN ifTrue: [^ 0].
    t2 = 0 ifTrue: [^ 0].
    t2 = -1 ifTrue: [^ 0].
    t2 > 36 ifTrue: [^ 0].
    t2 < -36 ifTrue: [^ 0].
    t2 = t2 rounded ifFalse: [^ 0].
    letter _ self stringLength: t1.
    place _ 1.
    total _ 0.
    (self stringLength: t1)
        timesRepeat: 
            [valid _ false.
            (self letter: letter of: t1) asNumberNoError > 0
                ifTrue: [(self letter: letter of: t1) asNumber < t2
                        ifTrue: 
                            [valid _ true.
                            value _ (self letter: letter of: t1) asNumber]].
            (self letter: letter of: t1)
                = '0'
                ifTrue: 
                    [valid _ true.
                    value _ 0].
            (self letter: letter of: t1)
                = 'A'
                ifTrue: 
                    [valid _ true.
                    value _ 10].
            (self letter: letter of: t1)
                = 'B'
                ifTrue: 
                    [valid _ true.
                    value _ 11].
            (self letter: letter of: t1)
                = 'C'
                ifTrue: 
                    [valid _ true.
                    value _ 12].
            (self letter: letter of: t1)
                = 'D'
                ifTrue: 
                    [valid _ true.
                    value _ 13].
            (self letter: letter of: t1)
                = 'E'
                ifTrue: 
                    [valid _ true.
                    value _ 14].
            (self letter: letter of: t1)
                = 'F'
                ifTrue: 
                    [valid _ true.
                    value _ 15].
            (self letter: letter of: t1)
                = 'G'
                ifTrue: 
                    [valid _ true.
                    value _ 16].
            (self letter: letter of: t1)
                = 'H'
                ifTrue: 
                    [valid _ true.
                    value _ 17].
            (self letter: letter of: t1)
                = 'I'
                ifTrue: 
                    [valid _ true.
                    value _ 18].
            (self letter: letter of: t1)
                = 'J'
                ifTrue: 
                    [valid _ true.
                    value _ 19].
            (self letter: letter of: t1)
                = 'K'
                ifTrue: 
                    [valid _ true.
                    value _ 20].
            (self letter: letter of: t1)
                = 'L'
                ifTrue: 
                    [valid _ true.
                    value _ 21].
            (self letter: letter of: t1)
                = 'M'
                ifTrue: 
                    [valid _ true.
                    value _ 22].
            (self letter: letter of: t1)
                = 'N'
                ifTrue: 
                    [valid _ true.
                    value _ 23].
            (self letter: letter of: t1)
                = 'O'
                ifTrue: 
                    [valid _ true.
                    value _ 24].
            (self letter: letter of: t1)
                = 'P'
                ifTrue: 
                    [valid _ true.
                    value _ 25].
            (self letter: letter of: t1)
                = 'Q'
                ifTrue: 
                    [valid _ true.
                    value _ 26].
            (self letter: letter of: t1)
                = 'R'
                ifTrue: 
                    [valid _ true.
                    value _ 27].
            (self letter: letter of: t1)
                = 'S'
                ifTrue: 
                    [valid _ true.
                    value _ 28].
            (self letter: letter of: t1)
                = 'T'
                ifTrue: 
                    [valid _ true.
                    value _ 29].
            (self letter: letter of: t1)
                = 'U'
                ifTrue: 
                    [valid _ true.
                    value _ 30].
            (self letter: letter of: t1)
                = 'V'
                ifTrue: 
                    [valid _ true.
                    value _ 31].
            (self letter: letter of: t1)
                = 'W'
                ifTrue: 
                    [valid _ true.
                    value _ 32].
            (self letter: letter of: t1)
                = 'X'
                ifTrue: 
                    [valid _ true.
                    value _ 33].
            (self letter: letter of: t1)
                = 'Y'
                ifTrue: 
                    [valid _ true.
                    value _ 34].
            (self letter: letter of: t1)
                = 'Z'
                ifTrue: 
                    [valid _ true.
                    value _ 35].
            valid = false ifTrue: [^ 0].
            total _ total + (value * (t2 raisedTo: place - 1)).
            letter _ letter - 1.
            place _ place + 1].
    (self letter: 1 of: t1)
        = '-' ifTrue: [total _ total * -1].
    ^ total

Those methods were important because every other block references them.  Otherwise, we would have had to copy+paste that into all these methods, sometimes more than once!   yikes

If you want, you can create these blockspecs:

Code:

('base10 integer %n to base %n' #r #Int:toBase:) 
('base%n integer %s to base10' #r #InBase:Int:)

to create these blocks:
http://polyeztahpuppies.webs.com/base10inttobase.gif
http://polyeztahpuppies.webs.com/baseinttobase10.gif

but I don't really recommend those, since the next block is much more versatile and can be used to easily do the same thing.

Now, this block is really useful:
http://polyeztahpuppies.webs.com/baseinttobase.gif

Code:

('base%n integer %s to base%n' #r #InBase:Int:toBase:)

Code:

InBase: t1 Int: t2 toBase: t3 
    ^ self Int: (self InBase: t1 Int: t2)
        toBase: t3

See, all the other methods are much shorter, since we made the first two.

To help with numerical operations in other bases:
http://polyeztahpuppies.webs.com/base+.gif
http://polyeztahpuppies.webs.com/base-.gif
http://polyeztahpuppies.webs.com/basex.gif
http://polyeztahpuppies.webs.com/basediv.gif
http://polyeztahpuppies.webs.com/basemod.gif

Code:

('(base%n integers) %s + %s' #r #InBase:add:to:) 
('(base%n integers) %s - %s' #r #InBase:sub:to:) 
('(base%n integers) %s * %s' #r #InBase:mult:to:) 
('(base%n integers) %s / %s' #r #InBase:div:to:) 
('(base%n integers) %s mod %s' #r #InBase:mod:to:)

Code:

InBase: t1 add: t2 to: t3 
    ^ self Int: (self InBase: t1 Int: t2)
            + (self InBase: t1 Int: t3) toBase: t1

Code:

InBase: t1 sub: t2 to: t3 
    ^ self Int: (self InBase: t1 Int: t2)
            - (self InBase: t1 Int: t3) toBase: t1

Code:

InBase: t1 mult: t2 to: t3 
    ^ self Int: (self InBase: t1 Int: t2)
            * (self InBase: t1 Int: t3) toBase: t1

Code:

InBase: t1 div: t2 to: t3 
    | t4 |
    (self InBase: t1 Int: t3)
        = 0 ifTrue: [^ 0].
    t4 _ (self InBase: t1 Int: t2)
                / (self InBase: t1 Int: t3).
    t4 = t4 rounded ifTrue: [^ self Int: t4 toBase: t1].
    ^ 0

Code:

InBase: t1 mod: t2 to: t3 
    ^ self Int: (self InBase: t1 Int: t2)
            \\ (self InBase: t1 Int: t3) toBase: t1

And when you need more control over the bases:
http://polyeztahpuppies.webs.com/baseint+baseint.gif
http://polyeztahpuppies.webs.com/baseint-baseint.gif
http://polyeztahpuppies.webs.com/baseintxbaseint.gif
http://polyeztahpuppies.webs.com/baseintdivbaseint.gif
http://polyeztahpuppies.webs.com/baseintmodbaseint.gif

Code:

('base%n int %s + base%n int %s, return base%n' #r #InBase:Int:addBase:Int:return:) 
('base%n int %s - base%n int %s, return base%n' #r #InBase:Int:subBase:Int:return:) 
('base%n int %s * base%n int %s, return base%n' #r #InBase:Int:multBase:Int:return:) 
('base%n int %s / base%n int %s, return base%n' #r #InBase:Int:divBase:Int:return:) 
('base%n int %s mod base%n int %s, return base%n' #r #InBase:Int:modBase:Int:return:)

Code:

InBase: t1 Int: t2 addBase: t3 Int: t4 return: t5 
    ^ self Int: (self InBase: t1 Int: t2)
            + (self InBase: t3 Int: t4) toBase: t5

Code:

InBase: t1 Int: t2 subBase: t3 Int: t4 return: t5 
    ^ self Int: (self InBase: t1 Int: t2)
            - (self InBase: t3 Int: t4) toBase: t5

Code:

InBase: t1 Int: t2 multBase: t3 Int: t4 return: t5 
    ^ self Int: (self InBase: t1 Int: t2)
            * (self InBase: t3 Int: t4) toBase: t5

Code:

InBase: t1 Int: t2 divBase: t3 Int: t4 return: t5 
    | t6 |
    (self InBase: t3 Int: t4)
        = 0 ifTrue: [^ 0].
    t6 _ (self InBase: t1 Int: t2)
                / (self InBase: t3 Int: t4).
    t6 = t6 rounded ifTrue: [^ self Int: t6 toBase: t5].
    ^ 0

Code:

InBase: t1 Int: t2 modBase: t3 Int: t4 return: t5 
    ^ self Int: (self InBase: t1 Int: t2)
            \\ (self InBase: t3 Int: t4) toBase: t5

Wow, you actually read all of that?

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

Ha!  I have uncovered your identity as an alien spy threatening to take over the world!!!  How do I know that?

Because it's not human to be able to read all that.  Reading this post puts those "do this as long as you can before you get bored" projects to shame.

But I can use an ability like that.  Go check my spelling.   wink

Last edited by Greenatic (2011-07-28 18:03:12)

Offline

 

#1769 2011-07-29 00:07:10

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

Re: ITopic: Welcome to your local block library!

SSBBM wrote:

Shouldn't we get rid of the 1st anniversary logos?

I think until August 1st.  smile

Greenatic, it looks like the next one will be a mega-update!  tongue
And I did read all that, except for the code.  tongue
You missed some capitals, but your spelling is all good. ;P

Offline

 

#1770 2011-07-29 00:48:11

Sidharth
Scratcher
Registered: 2007-12-14
Posts: 100+

Re: ITopic: Welcome to your local block library!

SSBBM wrote:

Sidharth wrote:

I have a nice BYOB block that I think you do not already have:
http://i.imgur.com/FpG60.gif

.ysp file is here. (mediafire download link page)

I don't see your block in the download...

LOL oops  smile

Here is the real one: http://www.mediafire.com/?ngj092ui6d2nk15

EDIT: I was sleepy  big_smile

Last edited by Sidharth (2011-07-29 00:48:28)


http://www.danasoft.com/citysign.jpg

Offline

 

#1771 2011-07-29 02:14:01

Sidharth
Scratcher
Registered: 2007-12-14
Posts: 100+

Re: ITopic: Welcome to your local block library!

Ok, more blocks from me:

http://i.imgur.com/drFwP.gif

Download .ysp file

EDIT: Tell me if they do not work, and I will fix them. There might be mistakes; I'm sleepy now too  big_smile

Last edited by Sidharth (2011-07-29 02:15:11)


http://www.danasoft.com/citysign.jpg

Offline

 

#1772 2011-07-29 08:19:04

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

Re: ITopic: Welcome to your local block library!

Just to let people know, I'm off to Switzerland for a week (leaving tomorrrow early morning), I'm not going to be around until Monday the 8th of August as a result. I may be able to pop in occasionally but nothing much! I'm sure the other librarians can continue doing an excellent job while I'm gone!  wink

Tschüss, bis später.


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

Offline

 

#1773 2011-07-29 11:07:52

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

Re: ITopic: Welcome to your local block library!

sparks wrote:

This block does not support .jpg format, is there a way to make it so?

Code:

  | img newC |

t1_t1 asString.
    (t1 asLowercase endsWith: '.gif') ifTrue: [
        img _ (GIFReadWriter new setStream: (HTTPSocket httpGet: t1)) nextImage.]
    ifFalse: [
        (t1 asLowercase endsWith: '.png') ifTrue: [
            img _ (PNGReadWriter createAFormFrom: (HTTPSocket httpGet: t1) contents) first]
        ifFalse: [
            img _ HTTPSocket httpJpeg: t1]].

    newC _ ImageMedia new form: img; mediaName: (self unusedMediaNameFromBaseName: (self defaultImageMedia mediaName)).

    self addMediaItem: newC.

I just realized something.  You didn't declare t1 as a temporary variable, so I'm assuming it's an argument.  In which case, isn't

Code:

 t1 _ t1 asString.

invalid?  You can't change an argument...of course, that's assuming t1 is an argument.

BTW, is anyone queueing Scratch blocks?

Last edited by Greenatic (2011-07-29 11:08:42)

Offline

 

#1774 2011-07-29 12:17:36

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

Re: ITopic: Welcome to your local block library!

No.
Next week I'll try to run another massive update; I'm in the middle of a move.  smile

Offline

 

#1775 2011-07-29 12:31:01

Sidharth
Scratcher
Registered: 2007-12-14
Posts: 100+

Re: ITopic: Welcome to your local block library!

I have improved Floppy_gunk's block (for-each-in):

http://i.imgur.com/DeiQm.gif

It comes with a counter and I have a .ysp file, too: Here

Another control block (for-with-counter):

http://i.imgur.com/ItKgO.gif

.ysp file: here

EDIT: More coming soon!

Last edited by Sidharth (2011-07-29 12:31:12)


http://www.danasoft.com/citysign.jpg

Offline

 

Board footer