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

#2301 2011-11-02 03:09:52

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

Re: ITopic: Welcome to your local block library!

Pecola1 wrote:

zippynk wrote:

scimonster wrote:


I think you mean cap.  wink

No, because a cap would stop the script. This would stop all scripts Except for the current one.

LOL never thought of that.

Me either. XD

Offline

 

#2302 2011-11-02 22:00:14

zippynk
Scratcher
Registered: 2011-07-23
Posts: 500+

Re: ITopic: Welcome to your local block library!

This block is for replicating one list Onto and not Into another list.

Block Picture:
https://sites.google.com/site/zippynkscratchsite/home/image-cabinet/setlisttovaluepic.gif

Download Sprite:
Download This Block As A BYOB Sprite (.ysp)

Source Code:
https://sites.google.com/site/zippynkscratchsite/home/image-cabinet/setlisttovaluesourcecode.gif

Note: At some point the links may break in some way. If so, I'll try to fix it.

Update: For the download, if it asks you, it's ok to "click here to download your attachment".

Last edited by zippynk (2011-11-02 23:19:39)


https://dl.dropbox.com/u/60598636/trifocal_interlude_soundcloud_button.png

Offline

 

#2303 2011-11-03 12:55:18

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

Re: ITopic: Welcome to your local block library!

I have an idea, one of the first posts should have the newest 5 blocks added, this way we can tell when there is a new block added, but only once it is actually added, this would catch attention, for all I know there hasn't been any added since i left for vacation, i haven't seen the new ones, it would be like:

http://scratch.mit.edu/redirect/url?link=http://weebly.com/uploads/5/4/1/3/5413503/5942334.gif
http://scratch.mit.edu/redirect/url?link=https://lh6.googleusercontent.com/B1X3VvW6MCN1Jea7DdaNXdejR6il_Vhh5r31PbcenkZkkTgei3Q7atwmVIOLdRPhYj7EwEtS8RX3MCRfjHSBvKfDfw=s512
Shared by MarioBlender

http://scratch.mit.edu/redirect/url?link=http://www.weebly.com/uploads/5/4/1/3/5413503/838603304.gif
Shared by MathWizz

http://scratch.mit.edu/redirect/url?link=http://megamod.weebly.com/uploads/7/1/5/6/7156046/8212093.gif
Shared by jslomba

http://scratch.mit.edu/redirect/url?link=http://www.weebly.com/uploads/5/4/1/3/5413503/774534017.gif
Shared by Pecola1

http://scratch.mit.edu/redirect/url?link=http://www.weebly.com/uploads/5/4/1/3/5413503/746685631.gif
Shared by Pecola1

http://scratch.mit.edu/redirect/url?link=http://weebly.com/uploads/4/0/7/6/4076678/732043.gif
No new blocks.

http://scratch.mit.edu/redirect/url?link=http://weebly.com/uploads/5/4/1/3/5413503/1967135.gif
No new blocks.


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

 

#2304 2011-11-03 12:58:29

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

Re: ITopic: Welcome to your local block library!

Hey sparks, I seem to have forgotten the pass for YourLocalBlockLib, can you email me it? Do you have my email? If not I can send you one. I will tell you a clue of what the password is because I slightly remember it, that way you know its really me.  wink


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

 

#2305 2011-11-03 14:33:48

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

Re: ITopic: Welcome to your local block library!

log in here with your account to view the password, Pecola  smile


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

Offline

 

#2306 2011-11-03 14:38:13

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

Re: ITopic: Welcome to your local block library!

sparks wrote:

log in here with your account to view the password, Pecola  smile

I knew it was something like that. XD Thanks.


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

 

#2307 2011-11-03 14:51:41

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

Re: ITopic: Welcome to your local block library!

No problem  smile


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

Offline

 

#2308 2011-11-03 21:11:53

plb36
Scratcher
Registered: 2011-10-16
Posts: 100+

Re: ITopic: Welcome to your local block library!

where do you paste "code" in the system browser on scratch. i have already done blockspecs but now i am confused...


http://i1094.photobucket.com/albums/i456/plb36/myforumssig.png

Offline

 

#2309 2011-11-03 21:15:00

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

Re: ITopic: Welcome to your local block library!

plb36 wrote:

where do you paste "code" in the system browser on scratch. i have already done blockspecs but now i am confused...

See if this post helps you.   smile

Offline

 

#2310 2011-11-06 17:10:34

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

Re: ITopic: Welcome to your local block library!

Pecola1 wrote:

I have an idea, one of the first posts should have the newest 5 blocks added, this way we can tell when there is a new block added, but only once it is actually added, this would catch attention, for all I know there hasn't been any added since i left for vacation, i haven't seen the new ones, it would be like:

http://scratch.mit.edu/redirect/url?lin … 942334.gif
http://scratch.mit.edu/redirect/url?lin … KfDfw=s512
Shared by MarioBlender

http://scratch.mit.edu/redirect/url?lin … 603304.gif
Shared by MathWizz

http://scratch.mit.edu/redirect/url?lin … 212093.gif
Shared by jslomba

http://scratch.mit.edu/redirect/url?lin … 534017.gif
Shared by Pecola1

http://scratch.mit.edu/redirect/url?lin … 685631.gif
Shared by Pecola1

http://scratch.mit.edu/redirect/url?lin … 732043.gif
No new blocks.

http://scratch.mit.edu/redirect/url?lin … 967135.gif
No new blocks.

Just click the link to the latest update.   tongue

Offline

 

#2311 2011-11-06 17:34:12

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

Re: ITopic: Welcome to your local block library!

Yes, but I mean for blocks. The recent update is saying there is a new librarian. (you know who  tongue )


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

 

#2312 2011-11-06 20:02:24

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

Re: ITopic: Welcome to your local block library!

Pecola1 wrote:

Yes, but I mean for blocks. The recent update is saying there is a new librarian. (you know who  tongue )

Yes, but I don't think that happens very often.  Maybe a link for "newest ____ update" at the beginning of each section?

Offline

 

#2313 2011-11-06 20:18:19

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

Re: ITopic: Welcome to your local block library!

Greenatic wrote:

Pecola1 wrote:

Yes, but I mean for blocks. The recent update is saying there is a new librarian. (you know who  tongue )

Yes, but I don't think that happens very often.  Maybe a link for "newest ____ update" at the beginning of each section?

Yea... That way it would show the newest updates, but for each category.


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

 

#2314 2011-11-07 15:47:05

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: ITopic: Welcome to your local block library!

2 new byob blocks:
http://i44.tinypic.com/653d5d.gif The swap block swaps all of the items in 2 lists. The for block works just like the for loop in C++ and Javascript. Here is the code:
http://i44.tinypic.com/w7ivc7.gif
http://i39.tinypic.com/zo9wtz.gif
Edit: oops i forgot in the swap block: before the second repeat loop you need to put in |delete (all) of (other list)|

Last edited by joefarebrother (2011-11-07 15:49:19)


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#2315 2011-11-07 16:22:13

jernsuz
Scratcher
Registered: 2009-11-09
Posts: 1

Re: ITopic: Welcome to your local block library!

<when green flag clicked><wait( -1  )secsc><switch to costume[

Why won't it work? It should.

Offline

 

#2316 2011-11-07 16:45:43

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

Re: ITopic: Welcome to your local block library!

jernsuz wrote:

<when green flag clicked><wait( -1  )secsc><switch to costume[

Why won't it work? It should.

Jernsuz, if you're asking why that script won't work, then this isn't the place.  Try making a thread in All About Scratch.

To answer your question, though, I believe negative numbers register as "0" in the wait block.  Try telling it to wait 1 second, not -1 seconds.   smile

Offline

 

#2317 2011-11-07 21:41:00

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

Re: ITopic: Welcome to your local block library!

I'm going to post this block here just in case someone manages an update before I do.

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

Takes a note (i.e. C4) and turns it into a MIDI note (compatible with the note-playing blocks).  Use a number sign (#) for sharps and a lowercase B (b) for flats.  Obscure/rarely used notes such as Cb and E# are accepted.

Code:

('%s%n as MIDI note' #r #AsMIDINote:Num:)

AsMIDINote: t1 Num: t2
| t3 t4 |
(t1 size) > 2 ifTrue:[^ 0].
[(#('C' 'D' 'E' 'F' 'G' 'A' 'B') detect: [:t6| t6 = (t1 at: 1) asString])] ifError:[^ 0].
t1 size = 2 ifTrue:[ [(#('#' 'b') detect: [:t7| t7 = (t1 at: 2) asString])] ifError:[^ 0]].
t4 _ 1.
(#('C' 'D' 'E' 'F' 'G' 'A' 'B')) do:[:t5|
t5 = (t1 at: 1) asString ifTrue:[
t3 _ ((#('12' '14' '16' '17' '19' '21' '23') at: t4) asNumber)].
t4 _ t4 + 1].
t1 size = 2 ifTrue:[
(t1 at: 2) asString = '#' ifTrue:[
t3 _ t3 + 1].
(t1 at: 2) asString = 'b' ifTrue:[
t3 _ t3 - 1]].
(t2 abs) timesRepeat:[
t3 _ t3 + ((t2 / t2 abs) * 12)].
^ t3

Offline

 

#2318 2011-11-08 09:38:50

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

Re: ITopic: Welcome to your local block library!

I need some other people's opinions.  I have now made a |Google I'm Feeling Lucky for: [  ]| block.  Should I keep this as its own block or fuse it into |[google v] [  ]|?

Offline

 

#2319 2011-11-08 09:46:19

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

Re: ITopic: Welcome to your local block library!

Greenatic wrote:

I need some other people's opinions.  I have now made a |Google I'm Feeling Lucky for: [  ]| block.  Should I keep this as its own block or fuse it into |[google v] [  ]|?

Merge. Update.

Offline

 

#2320 2011-11-08 10:33:42

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

Re: ITopic: Welcome to your local block library!

scimonster wrote:

Greenatic wrote:

I need some other people's opinions.  I have now made a |Google I'm Feeling Lucky for: [  ]| block.  Should I keep this as its own block or fuse it into |[google v] [  ]|?

Merge. Update.

Looks like the tables have turned...  *dramatic music*  XD

What is your opinion on the two gigantic list blocks, here?  They fused many blocks together, but do you think these two blocks should be fused together too?   hmm

@Sparks:  Are you going to remove that page where I logged in to get the password?

Last edited by Greenatic (2011-11-08 10:35:49)

Offline

 

#2321 2011-11-08 15:42:45

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

Re: ITopic: Welcome to your local block library!

The code for the I'm Feeling Lucky is:

Code:

ScratchPlugin primOpenURL: 'http://google.com/search?sourceid=navclient&btnI=1&q=', t2, '+%s'.

New Block:
http://www.freewebs.com/polyeztahpuppies/weatherfor.gif

Code:

('%X for %s' #r #Weather:For:)

Method:

Code:

Weather: t2 For: t1 
    | t3 t4 t5 t6 t7 |
    t3 _ #() asOrderedCollection.
    t7 _ #() asOrderedCollection.
    t4 _ (HTTPSocket httpGet: 'http://www.google.com/ig/api?weather=' , t1) contents.
    t5 _ 1.
    [t5 > t4 size]
        whileFalse: 
            [[(t4 at: t5) asString = '<']
                whileFalse: [t5 _ t5 + 1].
            t6 _ t5 + 1.
            [(t4 at: t6) asString = '>']
                whileFalse: [t6 _ t6 + 1].
            t3 add: (t4 copyFrom: t5 to: t6).
            t4 _ t4 copyFrom: t6 + 1 to: t4 size].
    13 timesRepeat: [t3 removeAt: 1].
    31 timesRepeat: [t3 removeAt: t3 size].
    t3 removeAt: t3 size - 1.
    t3 do: [:t9 | t7 add: (t9 copyFrom: (t9 findString: '"' startingAt: 1)
                    + 1 to: (t9 findString: '"' startingAt: (t9 findString: '"' startingAt: 1)
                        + 1)
                    - 1)].
    t7 at: 4 put: ((t7 at: 4)
            copyFrom: 11 to: (t7 at: 4) size).
    t7 add: ((t7 at: 5)
            copyFrom: ((t7 at: 5)
                    findString: ' ')
                    + 1 to: ((t7 at: 5)
                findString: 'a')
                - 2).
    t7 add: ((t7 at: 5)
            copyFrom: ((t7 at: 5)
                    findString: 't')
                    + 2 to: ((t7 at: 5)
                findString: 'm')
                - 2).
    t7 removeAt: 5.
    t4 _ 1.
    #('weather' 'temp F' 'temp C' 'humidity' 'wind direction' 'wind speed' ) do: 
        [:t10 | 
        t10 = t2 ifTrue: [^ t7 at: t4].
        t4 _ t4 + 1]

ScriptableScratchMorph > sensing ops

Code:

weatherMenu
    ^ #('weather' 'temp F' 'temp C' 'humidity' 'wind direction' 'wind speed' )

Scratch-Blocks> CommandBlockMorph> private> uncoloredArgMorphFor:  add:

Code:

$X = t2 ifTrue: [^ ChoiceOrExpressionArgMorph new getOptionsSelector: #weatherMenu;
         choice: 'weather'].

Offline

 

#2322 2011-11-08 16:38:52

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

Re: ITopic: Welcome to your local block library!

The http://www.freewebs.com/polyeztahpuppies/sayingstring.gif request inspired me to make 6 new blocks (including it):

http://www.freewebs.com/polyeztahpuppies/bubbleshowing.gif
A "bubble" counts as: asking while shown, saying, or thinking.

Code:

('bubble showing?' #b #BubbleShowing)

BubbleShowing
^ (self findA: (ScratchTalkBubbleMorph)) ~= nil

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

Code:

('bubble saying %s showing?' #b #BubbleSaying:)

BubbleSaying: t1
(self findA: (ScratchTalkBubbleMorph)) ~= nil ifTrue:[
(self findA: (ScratchTalkBubbleMorph)) message = t1 ifTrue:[ ^ true]].
^ false

The following blocks require the following new method:
Scratch-UI-Support > ScratchTalkBubbleMorph > accessing

Code:

leftPointerForm
     ^ leftPointerForm

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

Code:

('saying something?' #b #SayingSomething)

SayingSomething
(self findA: (ScratchTalkBubbleMorph)) ~= nil ifTrue:[
(self findA: (ScratchTalkBubbleMorph))  leftPointerForm = (ScratchFrameMorph skinAt: #talkBubbleTalkPointer) ifTrue:[^ true]].
^ false

http://www.freewebs.com/polyeztahpuppies/sayingstring.gif (Requested)

Code:

('saying %s?' #b #Saying:)

Saying: t1
(self findA: (ScratchTalkBubbleMorph)) ~= nil ifTrue:[
(self findA: (ScratchTalkBubbleMorph))  leftPointerForm = (ScratchFrameMorph skinAt: #talkBubbleTalkPointer) ifTrue:[
(self findA: (ScratchTalkBubbleMorph)) message = t1 ifTrue:[^ true]]].
^ false

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

Code:

('thinking something?' #b #ThinkingSomething:)

ThinkingSomething
(self findA: (ScratchTalkBubbleMorph)) ~= nil ifTrue:[
(self findA: (ScratchTalkBubbleMorph))  leftPointerForm = (ScratchFrameMorph skinAt: #talkBubbleThinkPointer) ifTrue:[^ true]].
^ false

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

Code:

('thinking %s?' #b #Thinking:)

Thinking: t1
(self findA: (ScratchTalkBubbleMorph)) ~= nil ifTrue:[
(self findA: (ScratchTalkBubbleMorph))  leftPointerForm = (ScratchFrameMorph skinAt: #talkBubbleThinkPointer) ifTrue:[
(self findA: (ScratchTalkBubbleMorph)) message = t1 ifTrue:[^ true]]].
^ false

Offline

 

#2323 2011-11-08 19:20:48

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

Re: ITopic: Welcome to your local block library!

Greenatic wrote:

The code for the I'm Feeling Lucky is:

Code:

ScratchPlugin primOpenURL: 'http://google.com/search?sourceid=navclient&btnI=1&q=', t2, '+%s'.

New Block:
http://www.freewebs.com/polyeztahpuppies/weatherfor.gif

Code:

('%X for %s' #r #Weather:For:)

Method:

Code:

Weather: t2 For: t1 
    | t3 t4 t5 t6 t7 |
    t3 _ #() asOrderedCollection.
    t7 _ #() asOrderedCollection.
    t4 _ (HTTPSocket httpGet: 'http://www.google.com/ig/api?weather=' , t1) contents.
    t5 _ 1.
    [t5 > t4 size]
        whileFalse: 
            [[(t4 at: t5) asString = '<']
                whileFalse: [t5 _ t5 + 1].
            t6 _ t5 + 1.
            [(t4 at: t6) asString = '>']
                whileFalse: [t6 _ t6 + 1].
            t3 add: (t4 copyFrom: t5 to: t6).
            t4 _ t4 copyFrom: t6 + 1 to: t4 size].
    13 timesRepeat: [t3 removeAt: 1].
    31 timesRepeat: [t3 removeAt: t3 size].
    t3 removeAt: t3 size - 1.
    t3 do: [:t9 | t7 add: (t9 copyFrom: (t9 findString: '"' startingAt: 1)
                    + 1 to: (t9 findString: '"' startingAt: (t9 findString: '"' startingAt: 1)
                        + 1)
                    - 1)].
    t7 at: 4 put: ((t7 at: 4)
            copyFrom: 11 to: (t7 at: 4) size).
    t7 add: ((t7 at: 5)
            copyFrom: ((t7 at: 5)
                    findString: ' ')
                    + 1 to: ((t7 at: 5)
                findString: 'a')
                - 2).
    t7 add: ((t7 at: 5)
            copyFrom: ((t7 at: 5)
                    findString: 't')
                    + 2 to: ((t7 at: 5)
                findString: 'm')
                - 2).
    t7 removeAt: 5.
    t4 _ 1.
    #('weather' 'temp F' 'temp C' 'humidity' 'wind direction' 'wind speed' ) do: 
        [:t10 | 
        t10 = t2 ifTrue: [^ t7 at: t4].
        t4 _ t4 + 1]

ScriptableScratchMorph > sensing ops

Code:

weatherMenu
    ^ #('weather' 'temp F' 'temp C' 'humidity' 'wind direction' 'wind speed' )

Scratch-Blocks> CommandBlockMorph> private> uncoloredArgMorphFor:  add:

Code:

$X = t2 ifTrue: [^ ChoiceOrExpressionArgMorph new getOptionsSelector: #weatherMenu;
         choice: 'weather'].

smile  I remember these in NetScratch!  smile  They are some VERY cool blocks.


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

 

#2324 2011-11-08 19:58:21

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

Re: ITopic: Welcome to your local block library!

Pecola1 wrote:

Greenatic wrote:

The code for the I'm Feeling Lucky is:

Code:

ScratchPlugin primOpenURL: 'http://google.com/search?sourceid=navclient&btnI=1&q=', t2, '+%s'.

New Block:
http://www.freewebs.com/polyeztahpuppies/weatherfor.gif

Code:

('%X for %s' #r #Weather:For:)

Method:

Code:

Weather: t2 For: t1 
    | t3 t4 t5 t6 t7 |
    t3 _ #() asOrderedCollection.
    t7 _ #() asOrderedCollection.
    t4 _ (HTTPSocket httpGet: 'http://www.google.com/ig/api?weather=' , t1) contents.
    t5 _ 1.
    [t5 > t4 size]
        whileFalse: 
            [[(t4 at: t5) asString = '<']
                whileFalse: [t5 _ t5 + 1].
            t6 _ t5 + 1.
            [(t4 at: t6) asString = '>']
                whileFalse: [t6 _ t6 + 1].
            t3 add: (t4 copyFrom: t5 to: t6).
            t4 _ t4 copyFrom: t6 + 1 to: t4 size].
    13 timesRepeat: [t3 removeAt: 1].
    31 timesRepeat: [t3 removeAt: t3 size].
    t3 removeAt: t3 size - 1.
    t3 do: [:t9 | t7 add: (t9 copyFrom: (t9 findString: '"' startingAt: 1)
                    + 1 to: (t9 findString: '"' startingAt: (t9 findString: '"' startingAt: 1)
                        + 1)
                    - 1)].
    t7 at: 4 put: ((t7 at: 4)
            copyFrom: 11 to: (t7 at: 4) size).
    t7 add: ((t7 at: 5)
            copyFrom: ((t7 at: 5)
                    findString: ' ')
                    + 1 to: ((t7 at: 5)
                findString: 'a')
                - 2).
    t7 add: ((t7 at: 5)
            copyFrom: ((t7 at: 5)
                    findString: 't')
                    + 2 to: ((t7 at: 5)
                findString: 'm')
                - 2).
    t7 removeAt: 5.
    t4 _ 1.
    #('weather' 'temp F' 'temp C' 'humidity' 'wind direction' 'wind speed' ) do: 
        [:t10 | 
        t10 = t2 ifTrue: [^ t7 at: t4].
        t4 _ t4 + 1]

ScriptableScratchMorph > sensing ops

Code:

weatherMenu
    ^ #('weather' 'temp F' 'temp C' 'humidity' 'wind direction' 'wind speed' )

Scratch-Blocks> CommandBlockMorph> private> uncoloredArgMorphFor:  add:

Code:

$X = t2 ifTrue: [^ ChoiceOrExpressionArgMorph new getOptionsSelector: #weatherMenu;
         choice: 'weather'].

smile  I remember these in NetScratch!  smile  They are some VERY cool blocks.

They were in NetScratch? ...Sorry if it looks like I copied, I promise I came up with this block and its code on my own.

Offline

 

#2325 2011-11-08 20:06:02

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

Re: ITopic: Welcome to your local block library!

Greenatic wrote:

Pecola1 wrote:

Greenatic wrote:

The code for the I'm Feeling Lucky is:

Code:

ScratchPlugin primOpenURL: 'http://google.com/search?sourceid=navclient&btnI=1&q=', t2, '+%s'.

New Block:
http://www.freewebs.com/polyeztahpuppies/weatherfor.gif

Code:

('%X for %s' #r #Weather:For:)

Method:

Code:

Weather: t2 For: t1 
    | t3 t4 t5 t6 t7 |
    t3 _ #() asOrderedCollection.
    t7 _ #() asOrderedCollection.
    t4 _ (HTTPSocket httpGet: 'http://www.google.com/ig/api?weather=' , t1) contents.
    t5 _ 1.
    [t5 > t4 size]
        whileFalse: 
            [[(t4 at: t5) asString = '<']
                whileFalse: [t5 _ t5 + 1].
            t6 _ t5 + 1.
            [(t4 at: t6) asString = '>']
                whileFalse: [t6 _ t6 + 1].
            t3 add: (t4 copyFrom: t5 to: t6).
            t4 _ t4 copyFrom: t6 + 1 to: t4 size].
    13 timesRepeat: [t3 removeAt: 1].
    31 timesRepeat: [t3 removeAt: t3 size].
    t3 removeAt: t3 size - 1.
    t3 do: [:t9 | t7 add: (t9 copyFrom: (t9 findString: '"' startingAt: 1)
                    + 1 to: (t9 findString: '"' startingAt: (t9 findString: '"' startingAt: 1)
                        + 1)
                    - 1)].
    t7 at: 4 put: ((t7 at: 4)
            copyFrom: 11 to: (t7 at: 4) size).
    t7 add: ((t7 at: 5)
            copyFrom: ((t7 at: 5)
                    findString: ' ')
                    + 1 to: ((t7 at: 5)
                findString: 'a')
                - 2).
    t7 add: ((t7 at: 5)
            copyFrom: ((t7 at: 5)
                    findString: 't')
                    + 2 to: ((t7 at: 5)
                findString: 'm')
                - 2).
    t7 removeAt: 5.
    t4 _ 1.
    #('weather' 'temp F' 'temp C' 'humidity' 'wind direction' 'wind speed' ) do: 
        [:t10 | 
        t10 = t2 ifTrue: [^ t7 at: t4].
        t4 _ t4 + 1]

ScriptableScratchMorph > sensing ops

Code:

weatherMenu
    ^ #('weather' 'temp F' 'temp C' 'humidity' 'wind direction' 'wind speed' )

Scratch-Blocks> CommandBlockMorph> private> uncoloredArgMorphFor:  add:

Code:

$X = t2 ifTrue: [^ ChoiceOrExpressionArgMorph new getOptionsSelector: #weatherMenu;
         choice: 'weather'].

smile  I remember these in NetScratch!  smile  They are some VERY cool blocks.

They were in NetScratch? ...Sorry if it looks like I copied, I promise I came up with this block and its code on my own.

No no no no no, I can tell you didn't copy it. I think NetScratch used the same type of thing as the time block, either that or an api, your block uses a different source, and more things to insert.  smile  I like blocks like this.

Last edited by Pecola1 (2011-11-08 20:06:35)


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