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

#2476 2011-12-28 11:44:11

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

Re: ITopic: Welcome to your local block library!

Splodgey wrote:

joefarebrother wrote:

Splodgey wrote:


DID I submit it correctly? If not how do I submit it correctly?

For scratch and panther. use this syntax:

image of block (with no inputs) - if you are a new scratcher, just post the url and ask someone else to add the [img] tags

blockspec:

Code:

 the blockspec in a code tag

code:

Code:

 the code in a code tag

For BYOB:

image of block (with no inputs)
image of the scripts

How do I add an image?

Code:

[img]url_of_image[/img]

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

 

#2477 2011-12-28 12:01:42

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

Re: ITopic: Welcome to your local block library!

nXIII wrote:

OS blocks! (these should go in sensing)

('operating system' r platformName) (tested)

platformName
    ^ Smalltalk platformName

('operating system version' r osVersion) (tested)

osVersion
    ^ Smalltalk osVersion

('Mac OS X?' b isMacOSX) (tested)

isMacOSX
    ^ Smalltalk isMaxOSX

('Unix?' b isUnix) (tested)

isUnix
    ^ Smalltalk isUnix

('Windows?' b isWindows) (tested)

isWindows
    ^ Smalltalk isWindows

EDIT: Tested them all!

A bunch of people just uploaded OS blocks, including myself.  (Are you sure you didn't read those is____ methods from my last post? And by the way, MathWizz already did platformName.   tongue )

The osVersion reports 'NT' for me.  What does that mean?

EDIT:  100th page of this thread!!!   big_smile

Last edited by Greenatic (2011-12-28 12:04:19)

Offline

 

#2478 2011-12-28 12:41:08

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: ITopic: Welcome to your local block library!

Greenatic wrote:

A bunch of people just uploaded OS blocks, including myself.

Constructing a new SystemDictionary isn't necessary, and your original doesn't support all systems, and could be inaccurate.

Are you sure you didn't read those is____ methods from my last post?

No, actually, I opened a Browser on SystemDictionary's instance 'miscellaneous' instance methods.

And by the way, MathWizz already did platformName.  tongue

Yeah, he posted the Smalltalk code. I was just including it with the block spec, etc. for completeness.

The osVersion reports 'NT' for me.  What does that mean?

Are you using windows?

By the way, totally unrelated, but you should stop capitalizing the first letter of your message selectors. It's not the Smalltalk naming convention. Global and class variables are UpperCamelCase, and message selectors are lowerCamelCase.

Last edited by nXIII (2011-12-28 12:41:25)


nXIII

Offline

 

#2479 2011-12-28 12:50:08

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

Re: ITopic: Welcome to your local block library!

nXIII wrote:

Greenatic wrote:

The osVersion reports 'NT' for me.  What does that mean?

Are you using windows?

Any version of windows based on the NT kernel will report this (Windows NT, Windows 2000, Windows XP, Windows Server 2003, Windows Vista, Windows Home Server, Windows Server 2008, and Windows 7).


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

Offline

 

#2480 2011-12-28 14:40:35

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: ITopic: Welcome to your local block library!

Variables
('set background color of %v to %c' - setColorOfVar:to:) (tested)

setColorOfVar: varName to: aColor
    | b w frame stage |
    frame := self ownerThatIsA: ScratchFrameMorph.
    frame ifNil: [
        (w := self ownerThatIsA: OffscreenWorldMorph) ifNil: [^ self].
        frame := w frame].
    (self varNames includes: varName) ifFalse: [
        stage := frame workPane.
        (stage varNames includes: varName) ifTrue: [^ stage setColorOfVar: varName to: aColor]].
   
    b := VariableBlockMorph new commandSpec: varName; receiver: self blockReceiver.
    w := frame watcherForBlock: b.
    w ifNotNil: [w setCategoryColor: aColor].

Control
('update from %s version %s' - update:version:) (tested)

update: aURL version: v
| version frame dir url name stream |

(aURL endsWith: '/') ifTrue: [url := aURL] ifFalse: [url := aURL, '/'].
frame := ScratchFrameMorph allInstances first.
version := (HTTPSocket httpGet: url, 'version.txt') contents lines first.
version = v ifTrue: [^ self].

(DialogBoxMorph ask: 'A new version (', version, ') is available. Would you like to download it?') ifFalse: [^ self].

name := frame projectName, '.sb'.

(dir := frame projectDirectory) deleteFileNamed: name.

stream := (dir newFileNamed: version, '.sb').
stream reset.
stream nextPutAll: (HTTPSocket httpGet: url, version, '.sb') contents.

frame openScratchProjectNamed: dir pathName, dir slash, version, '.sb'; shoutGo.


nXIII

Offline

 

#2481 2011-12-28 15:08:15

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

Re: ITopic: Welcome to your local block library!

...
nXII keep it up... soon we'll see if we can get chuck norris to help us with the update once it snowballs. XD

No but rlly, keep it up!  big_smile


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

 

#2482 2011-12-28 15:27:01

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

Re: ITopic: Welcome to your local block library!

nXIII wrote:

The osVersion reports 'NT' for me.  What does that mean?

Are you using windows?

By the way, totally unrelated, but you should stop capitalizing the first letter of your message selectors. It's not the Smalltalk naming convention. Global and class variables are UpperCamelCase, and message selectors are lowerCamelCase.

Yes, I'm using Windows XP.

About the naming: I know.  I do it personally so that all the methods I make appear at the top of my browser, so I know what methods are original to Scratch and which are added.

Offline

 

#2483 2011-12-28 15:29:49

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: ITopic: Welcome to your local block library!

Greenatic wrote:

nXIII wrote:

The osVersion reports 'NT' for me.  What does that mean?

Are you using windows?

By the way, totally unrelated, but you should stop capitalizing the first letter of your message selectors. It's not the Smalltalk naming convention. Global and class variables are UpperCamelCase, and message selectors are lowerCamelCase.

Yes, I'm using Windows XP.

About the naming: I know.  I do it personally so that all the methods I make appear at the top of my browser, so I know what methods are original to Scratch and which are added.

Put them in a new category, or just look at the changes to 'working'.


nXIII

Offline

 

#2484 2011-12-28 15:37:36

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: ITopic: Welcome to your local block library!

('tell %m to' c doTell) (tested)
Tells another sprite to perform some action(s).

ScratchProcess >> doTell
    | blocks arguments argExp |
   
    blocks := stackFrame expression firstBlockList.
   
    (blocks isNil or: [blocks size = 0]) ifTrue: [^ self popStackFrame].
   
    arguments := stackFrame arguments.
    arguments size < 1
        ifTrue:    [argExp _ stackFrame expression argumentAt: 1.
                ^self pushStackFrame: (ScratchStackFrame new expression: argExp)].
   
    arguments first = #mouse ifTrue: [self error: 'Can''t tell mouse to do something'].
   
    self setReceiverIn: blocks to: arguments first.
   
    self popStackFrame.
    self pushStackFrame: (ScratchStackFrame new expression: blocks)

('tell %m to (then continue)' c doTellAndContinue) (tested)
Tells another sprite to perform some action(s) without waiting for the sprite to finish.

ScratchProcess >> doTellAndContinue
    | blocks arguments argExp |
   
    blocks := stackFrame expression firstBlockList.
   
    (blocks isNil or: [blocks size = 0]) ifTrue: [^ self popStackFrame].
   
    arguments := stackFrame arguments.
    arguments size < 1
        ifTrue:    [argExp _ stackFrame expression argumentAt: 1.
                ^self pushStackFrame: (ScratchStackFrame new expression: argExp)].
   
    arguments first = #mouse ifTrue: [self error: 'Can''t tell mouse to do something'].
   
    self setReceiverIn: blocks to: arguments first.
   
    (stackFrame expression receiver ownerThatIsA: ScratchStageMorph) startProcessFor: blocks first.
   
    self popStackFrame.

(Helper method, required for both)

ScratchProcess >> setReceiverIn: b to: receiver

    (b isKindOf: BlockMorph) ifTrue: [
        (ScriptableScratchMorph isSpriteSpecificTarget: b receiver selector: b selector) ifTrue: [
            b receiver: receiver].
        self setReceiverIn: b nextBlock to: receiver.
        b firstBlockList do: [:block | self setReceiverIn: block to: receiver].
        b argMorphs do: [:block | self setReceiverIn: block to: receiver]].
    (b isKindOf: IfElseBlockMorph) ifTrue: [
        b falseBlockList do: [:block | self setReceiverIn: block to: receiver]].
    (b isKindOf: Collection) ifTrue: [
        b do: [:block | self setReceiverIn: block to: receiver]].

NB: There are better implementations of this that allow hot-swapping code while the 'tell' is running, but these involve heavier modification of ScratchProcess.

Last edited by nXIII (2011-12-28 15:51:12)


nXIII

Offline

 

#2485 2011-12-29 09:08:12

gbear605
Scratcher
Registered: 2008-03-06
Posts: 1000+

Re: ITopic: Welcome to your local block library!

Because of the disabled image tags, the scratch team is suggesting moving to the wiki (at least temporarily).


Yeah, I'm mostly inactive.  I check in once in a while though.  If you want to contact me, I have a contact form at my website, http://escratch.org

Offline

 

#2486 2011-12-29 09:58:40

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

Re: ITopic: Welcome to your local block library!

Tis a sad day  hmm

I've added a message to the first post and the library signature about this.

~~Sparks

Last edited by YourLocalBlockLib (2011-12-29 09:58:57)


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

Offline

 

#2487 2011-12-29 10:01:19

TRocket
Scratcher
Registered: 2009-08-18
Posts: 1000+

Re: ITopic: Welcome to your local block library!

YourLocalBlockLib wrote:

Tis a sad day  hmm

I've added a message to the first post and the library signature about this.

~~Sparks

sparks do you want any help with enabling remote sensor access i'm very good at SQL...


http://i.imgur.com/1QqnHxQ.png

Offline

 

#2488 2011-12-30 14:09:45

cocolover76
Scratcher
Registered: 2011-10-09
Posts: 500+

Re: ITopic: Welcome to your local block library!

YourLocalBlockLib wrote:

Unfortunately the Block Library is not working at the moment. This is because of the disabled image tags on forum posts at the moment. We apologise for the inconvenience and assure you that the library will be up and running again as soon as the tags are re-enabled!

Click here to enable images, does NOT work in Internet Explorer, no one uses IE though.
http://i.imgur.com/KgV9b.jpg


http://i.imgur.com/HfEPZ.gifhttp://i.imgur.com/pvKb6.png

Offline

 

#2489 2011-12-30 18:59:23

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

Re: ITopic: Welcome to your local block library!

TRocket wrote:

YourLocalBlockLib wrote:

Tis a sad day  hmm

I've added a message to the first post and the library signature about this.

~~Sparks

sparks do you want any help with enabling remote sensor access i'm very good at SQL...

Take a look here for my documentation of problems as well as screenshots  smile  I would appreciate the help!


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

Offline

 

#2490 2011-12-30 19:12:42

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

Re: ITopic: Welcome to your local block library!

People can always use http://scratch.mit.edu/forums/viewtopic.php?id=85177 to view the images on here, perhaps you can mention it in the first post?


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

Offline

 

#2491 2011-12-31 09:54:50

iPhone63
Scratcher
Registered: 2010-12-15
Posts: 87

Re: ITopic: Welcome to your local block library!

Made a scrip that downloads all the blocks XD


http://mag.racked.eu/image/6000/Pssssssssssssssssss/mca.png

Offline

 

#2492 2011-12-31 14:54:59

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

Re: ITopic: Welcome to your local block library!

iPhone63 wrote:

Made a scrip that downloads all the blocks XD

repeat(60)
    download block [number] from the library
    change number by (1)
end repeat

?


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

Offline

 

#2493 2012-01-01 04:58:03

nathanprocks
Scratcher
Registered: 2011-04-14
Posts: 1000+

Re: ITopic: Welcome to your local block library!

can someone please make a [ [colour] is similar to [colour] ? ] for Panther?


http://carrot.cassiedragonandfriends.org/Scratch_Signature/randomsig.php
http://trinary.site40.net/images/scratchrank.php?username=nathanprocks&amp;display=small

Offline

 

#2494 2012-01-01 06:04:05

euna8815
Scratcher
Registered: 2011-01-07
Posts: 29

Re: ITopic: Welcome to your local block library!

Wow, there's too many blocks to try! I want to try one, and make a block that downloads a block in the internet! Before You do I do, you have to learn Squeak and structure of how Scratch works with Shift-Click on loop of 'R' of 'SCRATCH', and leafing through Brower to learn about the classes!

Offline

 

#2495 2012-01-01 06:06:50

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

Re: ITopic: Welcome to your local block library!

nathanprocks wrote:

can someone please make a [ [colour] is similar to [colour] ? ] for Panther?

definition of similar?  tongue

Offline

 

#2496 2012-01-01 06:17:12

euna8815
Scratcher
Registered: 2011-01-07
Posts: 29

Re: ITopic: Welcome to your local block library!

nXIII wrote:

('tell %m to' c doTell) (tested)
Tells another sprite to perform some action(s).

ScratchProcess >> doTell
    | blocks arguments argExp |
   
    blocks := stackFrame expression firstBlockList.
   
    (blocks isNil or: [blocks size = 0]) ifTrue: [^ self popStackFrame].
   
    arguments := stackFrame arguments.
    arguments size < 1
        ifTrue:    [argExp _ stackFrame expression argumentAt: 1.
                ^self pushStackFrame: (ScratchStackFrame new expression: argExp)].
   
    arguments first = #mouse ifTrue: [self error: 'Can''t tell mouse to do something'].
   
    self setReceiverIn: blocks to: arguments first.
   
    self popStackFrame.
    self pushStackFrame: (ScratchStackFrame new expression: blocks)

('tell %m to (then continue)' c doTellAndContinue) (tested)
Tells another sprite to perform some action(s) without waiting for the sprite to finish.

ScratchProcess >> doTellAndContinue
    | blocks arguments argExp |
   
    blocks := stackFrame expression firstBlockList.
   
    (blocks isNil or: [blocks size = 0]) ifTrue: [^ self popStackFrame].
   
    arguments := stackFrame arguments.
    arguments size < 1
        ifTrue:    [argExp _ stackFrame expression argumentAt: 1.
                ^self pushStackFrame: (ScratchStackFrame new expression: argExp)].
   
    arguments first = #mouse ifTrue: [self error: 'Can''t tell mouse to do something'].
   
    self setReceiverIn: blocks to: arguments first.
   
    (stackFrame expression receiver ownerThatIsA: ScratchStageMorph) startProcessFor: blocks first.
   
    self popStackFrame.

(Helper method, required for both)

ScratchProcess >> setReceiverIn: b to: receiver

    (b isKindOf: BlockMorph) ifTrue: [
        (ScriptableScratchMorph isSpriteSpecificTarget: b receiver selector: b selector) ifTrue: [
            b receiver: receiver].
        self setReceiverIn: b nextBlock to: receiver.
        b firstBlockList do: [:block | self setReceiverIn: block to: receiver].
        b argMorphs do: [:block | self setReceiverIn: block to: receiver]].
    (b isKindOf: IfElseBlockMorph) ifTrue: [
        b falseBlockList do: [:block | self setReceiverIn: block to: receiver]].
    (b isKindOf: Collection) ifTrue: [
        b do: [:block | self setReceiverIn: block to: receiver]].

NB: There are better implementations of this that allow hot-swapping code while the 'tell' is running, but these involve heavier modification of ScratchProcess.

looking for how ScratchProcess works and each variables in that code works.
You're both good Scratcher, Squeaker(I made this expression) and Small-Talker!!
<say[ You're great! ]for( infinite )secs>

Offline

 

#2497 2012-01-01 06:43:38

nathanprocks
Scratcher
Registered: 2011-04-14
Posts: 1000+

Re: ITopic: Welcome to your local block library!

roijac wrote:

nathanprocks wrote:

can someone please make a [ [colour] is similar to [colour] ? ] for Panther?

definition of similar?  tongue

ok so... this colour (#ff0000) is similar to this colour (#cc0000)


http://carrot.cassiedragonandfriends.org/Scratch_Signature/randomsig.php
http://trinary.site40.net/images/scratchrank.php?username=nathanprocks&amp;display=small

Offline

 

#2498 2012-01-01 10:06:28

SJRCS_011
Scratcher
Registered: 2011-02-07
Posts: 1000+

Re: ITopic: Welcome to your local block library!

nathanprocks wrote:

roijac wrote:

nathanprocks wrote:

can someone please make a [ [colour] is similar to [colour] ? ] for Panther?

definition of similar?  tongue

ok so... this colour (#ff0000) is similar to this colour (#cc0000)

How would a computer detect that?  You would need a certain formula to figure out if they are similar.


http://i.imgur.com/vQqtH.png
Learning to Program in a Nutshell:  "You're missing a closing parentheses" - LS97

Offline

 

#2499 2012-01-02 02:22:26

nathanprocks
Scratcher
Registered: 2011-04-14
Posts: 1000+

Re: ITopic: Welcome to your local block library!

SJRCS_011 wrote:

nathanprocks wrote:

roijac wrote:


definition of similar?  tongue

ok so... this colour (#ff0000) is similar to this colour (#cc0000)

How would a computer detect that?  You would need a certain formula to figure out if they are similar.

well i need to use the computers webcam in panther to detect a certain colour which is affected by the lighting so it is impossible to make it work with out such block


http://carrot.cassiedragonandfriends.org/Scratch_Signature/randomsig.php
http://trinary.site40.net/images/scratchrank.php?username=nathanprocks&amp;display=small

Offline

 

#2500 2012-01-02 05:57:50

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: ITopic: Welcome to your local block library!

Maybe some really good programmer could make a tempory block library not on the forums, but completely new site. You could Copy/paste code and use sparks' bbcode code to make it bbcode, so you won't have to rewrite it all again  smile


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

Board footer