You should add a newlink on the front page. How to add a block
Offline
Question: when there is a block with code, do I just add the code After another code, from another block?
Offline
thebuilderdd wrote:
Question: when there is a block with code, do I just add the code After another code, from another block?
Not sure what you mean, if you mean when making a method which runs other methods (say move ten steps turn to the left 5 degrees) you can do:
moveTenAndTurnFive self forward: 10. self turnLeft: 5
Can you explain?
Offline
Pecola1 wrote:
thebuilderdd wrote:
Question: when there is a block with code, do I just add the code After another code, from another block?
Not sure what you mean, if you mean when making a method which runs other methods (say move ten steps turn to the left 5 degrees) you can do:
Code:
moveTenAndTurnFive self forward: 10. self turnLeft: 5Can you explain?
Here is someones block code in other ops:
Code goes here
Now, I wanted to add someone elses block to other ops, like this:
block code
In the end, would it look like this?
Code goes here block code
Is this how it works?
Offline
I made a previous costume block. Just to do away with the costume#-1. The code is
self costumeIndex: self costumeIndex - 1
I honestly don't know if I'm missing something, but still. May as well make use of my experiments.
Offline
thebuilderdd wrote:
Pecola1 wrote:
thebuilderdd wrote:
Question: when there is a block with code, do I just add the code After another code, from another block?
Not sure what you mean, if you mean when making a method which runs other methods (say move ten steps turn to the left 5 degrees) you can do:
Code:
moveTenAndTurnFive self forward: 10. self turnLeft: 5Can you explain?
Here is someones block code in other ops:
Code:
Code goes hereNow, I wanted to add someone elses block to other ops, like this:
Code:
block codeIn the end, would it look like this?
Code:
Code goes here block codeIs this how it works?
Do you mean if you name the method the same thing? If you name the method the same thing, it will replace the other one, not add on to it.
Offline
I'm getting the hang of this now. XD Although I see a random position block has been created already, I don't see any blocks leading to the panther site, so credit to Zorket and Sparks for the original url opener. I just adapted it for the panther site.
Cursor wait showWhile: [ScratchPlugin primOpenURL: 'http://pantherprogramming.weebly.com/']
Offline
metagrosslord wrote:
I'm getting the hang of this now. XD Although I see a random position block has been created already, I don't see any blocks leading to the panther site, so credit to Zorket and Sparks for the original url opener. I just adapted it for the panther site.
Code:
Cursor wait showWhile: [ScratchPlugin primOpenURL: 'http://pantherprogramming.weebly.com/']
nice! I never thought of that.
Offline
Pecola1 wrote:
metagrosslord wrote:
I'm getting the hang of this now. XD Although I see a random position block has been created already, I don't see any blocks leading to the panther site, so credit to Zorket and Sparks for the original url opener. I just adapted it for the panther site.
Code:
Cursor wait showWhile: [ScratchPlugin primOpenURL: 'http://pantherprogramming.weebly.com/']nice! I never thought of that.
Thanks!
Offline
Okay, apparently no one actually posted a Panther motion block. I guess I was looking at the wrong section. I call it "go to random position." Not much of a title. So here's a random coordinate script:
self gotoX: (self randomFrom: -240 to: 240) y: (self randomFrom: -180 to: 180)
In retrospect, I suppose that is very similar to the scratch-based one. Oh well. I didn't even see that before I came up with it.
Offline
metagrosslord wrote:
Okay, apparently no one actually posted a Panther motion block. I guess I was looking at the wrong section. I call it "go to random position." Not much of a title. So here's a random coordinate script:
Code:
self gotoX: (self randomFrom: -240 to: 240) y: (self randomFrom: -180 to: 180)In retrospect, I suppose that is very similar to the scratch-based one. Oh well. I didn't even see that before I came up with it.
It is very similar. Let me go add that.
EDIT: Forgot we need Sparks. ^^
Last edited by scimonster (2011-05-12 23:55:37)
Offline
Panther block 33 (<joined mesh?>)'s image is not working.
Offline
('View %B blocks from the Block Library' #- #viewblocks:)
viewblocks: type type = 'Motion' ifTrue: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/forums/viewtopic.php?pid=700166#p700166']. type = 'Control' ifTrue: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/forums/viewtopic.php?pid=700167#p700167']. type = 'Looks' ifTrue: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/forums/viewtopic.php?pid=700169#p700169']. type = 'Sensing' ifTrue: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/forums/viewtopic.php?pid=700171#p700171']. type = 'Sound' ifTrue: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/forums/viewtopic.php?pid=700172#p700172']. type = 'Operators' ifTrue: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/forums/viewtopic.php?pid=700176#p700176']. type = 'Pen' ifTrue: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/forums/viewtopic.php?pid=700177#p700177']. type = 'Variables' ifTrue: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/forums/viewtopic.php?pid=700179#p700179']
typeNames ^ #('Motion' 'Looks' 'Sound' 'Pen' 'Control' 'Sensing' 'Operators' 'Variables')
Scratch-Blocks»CommandBlockMorph»private»uncoloredArgMorphFor:
uncoloredArgMorphFor: t1 | t2 | t2 _ t1 at: 2. $a = t2 ifTrue: [^ AttributeArgMorph new choice: 'volume']. $b = t2 ifTrue: [^ BooleanArgMorph new]. $c = t2 ifTrue: [^ ColorArgMorph new showPalette: true]. $C = t2 ifTrue: [^ ColorArgMorph new showPalette: false]. $d = t2 ifTrue: [^ ExpressionArgMorphWithMenu new numExpression: '0'; menuSelector: #directionMenu]. $D = t2 ifTrue: [^ ExpressionArgMorphWithMenu new numExpression: '48'; menuSelector: #midiDrumMenu]. $e = t2 ifTrue: [^ EventTitleMorph new]. $f = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #mathFunctionNames; choice: 'sqrt']. $g = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #graphicEffectNames; choice: 'color']. $H = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #hookupSensorNames]. $h = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #hookupBooleanSensorNames]. $I = t2 ifTrue: [^ ExpressionArgMorphWithMenu new numExpression: '1'; menuSelector: #midiInstrumentMenu]. $i = t2 ifTrue: [^ ExpressionArgMorphWithMenu new numExpression: '1'; menuSelector: #listIndexMenu]. $k = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #keyNames; choice: 'space']. $L = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #listVarMenu]. $l = t2 ifTrue: [^ ChoiceOrExpressionArgMorph new getOptionsSelector: #costumeNames; choice: 'costume1']. $m = t2 ifTrue: [^ SpriteArgMorph new]. $M = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #motorNames]. $n = t2 ifTrue: [^ ExpressionArgMorph new numExpression: '10']. $N = t2 ifTrue: [^ ExpressionArgMorphWithMenu new numExpression: '60'; menuSelector: #noteSelector]. $s = t2 ifTrue: [^ ExpressionArgMorph new stringExpression: '']. $S = t2 ifTrue: [^ ChoiceOrExpressionArgMorph new getOptionsSelector: #soundNames; choice: 'pop']. $v = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #varNamesMenu; choice: '']. $W = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #motorDirection]. $x = t2 ifTrue: [^ ChoiceOrExpressionArgMorph new getOptionsSelector: #sceneNames; choice: '']. $y = t2 ifTrue: [^ ExpressionArgMorphWithMenu new numExpression: '1'; menuSelector: #listIndexForDeleteMenu]. $B = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #typeNames; choice: 'Motion']. ^ ExpressionArgMorph new numExpression: '10'
What it does: Opens that category of blocks in the Block Library.
Offline
Hardmath123 wrote:
Code:
('View %B blocks from the Block Library' #- #viewblocks:)Code:
viewblocks: type type = 'Motion' ifTrue: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/forums/viewtopic.php?pid=700166#p700166']. type = 'Control' ifTrue: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/forums/viewtopic.php?pid=700167#p700167']. type = 'Looks' ifTrue: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/forums/viewtopic.php?pid=700169#p700169']. type = 'Sensing' ifTrue: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/forums/viewtopic.php?pid=700171#p700171']. type = 'Sound' ifTrue: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/forums/viewtopic.php?pid=700172#p700172']. type = 'Operators' ifTrue: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/forums/viewtopic.php?pid=700176#p700176']. type = 'Pen' ifTrue: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/forums/viewtopic.php?pid=700177#p700177']. type = 'Variables' ifTrue: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/forums/viewtopic.php?pid=700179#p700179']Code:
typeNames ^ #('Motion' 'Looks' 'Sound' 'Pen' 'Control' 'Sensing' 'Operators' 'Variables')Scratch-Blocks»CommandBlockMorph»private»uncoloredArgMorphFor:
Code:
uncoloredArgMorphFor: t1 | t2 | t2 _ t1 at: 2. $a = t2 ifTrue: [^ AttributeArgMorph new choice: 'volume']. $b = t2 ifTrue: [^ BooleanArgMorph new]. $c = t2 ifTrue: [^ ColorArgMorph new showPalette: true]. $C = t2 ifTrue: [^ ColorArgMorph new showPalette: false]. $d = t2 ifTrue: [^ ExpressionArgMorphWithMenu new numExpression: '0'; menuSelector: #directionMenu]. $D = t2 ifTrue: [^ ExpressionArgMorphWithMenu new numExpression: '48'; menuSelector: #midiDrumMenu]. $e = t2 ifTrue: [^ EventTitleMorph new]. $f = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #mathFunctionNames; choice: 'sqrt']. $g = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #graphicEffectNames; choice: 'color']. $H = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #hookupSensorNames]. $h = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #hookupBooleanSensorNames]. $I = t2 ifTrue: [^ ExpressionArgMorphWithMenu new numExpression: '1'; menuSelector: #midiInstrumentMenu]. $i = t2 ifTrue: [^ ExpressionArgMorphWithMenu new numExpression: '1'; menuSelector: #listIndexMenu]. $k = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #keyNames; choice: 'space']. $L = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #listVarMenu]. $l = t2 ifTrue: [^ ChoiceOrExpressionArgMorph new getOptionsSelector: #costumeNames; choice: 'costume1']. $m = t2 ifTrue: [^ SpriteArgMorph new]. $M = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #motorNames]. $n = t2 ifTrue: [^ ExpressionArgMorph new numExpression: '10']. $N = t2 ifTrue: [^ ExpressionArgMorphWithMenu new numExpression: '60'; menuSelector: #noteSelector]. $s = t2 ifTrue: [^ ExpressionArgMorph new stringExpression: '']. $S = t2 ifTrue: [^ ChoiceOrExpressionArgMorph new getOptionsSelector: #soundNames; choice: 'pop']. $v = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #varNamesMenu; choice: '']. $W = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #motorDirection]. $x = t2 ifTrue: [^ ChoiceOrExpressionArgMorph new getOptionsSelector: #sceneNames; choice: '']. $y = t2 ifTrue: [^ ExpressionArgMorphWithMenu new numExpression: '1'; menuSelector: #listIndexForDeleteMenu]. $B = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #typeNames; choice: 'Motion']. ^ ExpressionArgMorph new numExpression: '10'What it does: Opens that category of blocks in the Block Library.
2 problems with this:
1) %B is used by Pecola1 in his <[pen down?] for [Sprite1] block (though that was missed in the old one); you may want to change it.
2) It only opens the Scratch Blocks category; what if you want Panther or BYOB?
Offline
('Ask %s' #r #askReport: #'What is your name?')
askReport: t1 ^ StringDialog ask: t1
Asks the input in a dialog box and reports it.
('Warn %s' #- #warn: 'Invalid input')
warn: t1 DialogBoxMorph warn: t1
Gives a pop-up window alerting the input. Useful if the user entered an invalid input, or just to report results.
('Pause' #- #pause)
pause DialogBoxMorph warn: 'Paused: click OK to continue'
Pauses the script until the user clicks OK.
Last edited by Hardmath123 (2011-05-13 07:25:22)
Offline
scimonster wrote:
Hardmath123 wrote:
Code:
('View %B blocks from the Block Library' #- #viewblocks:)Code:
viewblocks: type type = 'Motion' ifTrue: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/forums/viewtopic.php?pid=700166#p700166']. type = 'Control' ifTrue: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/forums/viewtopic.php?pid=700167#p700167']. type = 'Looks' ifTrue: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/forums/viewtopic.php?pid=700169#p700169']. type = 'Sensing' ifTrue: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/forums/viewtopic.php?pid=700171#p700171']. type = 'Sound' ifTrue: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/forums/viewtopic.php?pid=700172#p700172']. type = 'Operators' ifTrue: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/forums/viewtopic.php?pid=700176#p700176']. type = 'Pen' ifTrue: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/forums/viewtopic.php?pid=700177#p700177']. type = 'Variables' ifTrue: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/forums/viewtopic.php?pid=700179#p700179']Code:
typeNames ^ #('Motion' 'Looks' 'Sound' 'Pen' 'Control' 'Sensing' 'Operators' 'Variables')Scratch-Blocks»CommandBlockMorph»private»uncoloredArgMorphFor:
Code:
uncoloredArgMorphFor: t1 | t2 | t2 _ t1 at: 2. $a = t2 ifTrue: [^ AttributeArgMorph new choice: 'volume']. $b = t2 ifTrue: [^ BooleanArgMorph new]. $c = t2 ifTrue: [^ ColorArgMorph new showPalette: true]. $C = t2 ifTrue: [^ ColorArgMorph new showPalette: false]. $d = t2 ifTrue: [^ ExpressionArgMorphWithMenu new numExpression: '0'; menuSelector: #directionMenu]. $D = t2 ifTrue: [^ ExpressionArgMorphWithMenu new numExpression: '48'; menuSelector: #midiDrumMenu]. $e = t2 ifTrue: [^ EventTitleMorph new]. $f = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #mathFunctionNames; choice: 'sqrt']. $g = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #graphicEffectNames; choice: 'color']. $H = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #hookupSensorNames]. $h = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #hookupBooleanSensorNames]. $I = t2 ifTrue: [^ ExpressionArgMorphWithMenu new numExpression: '1'; menuSelector: #midiInstrumentMenu]. $i = t2 ifTrue: [^ ExpressionArgMorphWithMenu new numExpression: '1'; menuSelector: #listIndexMenu]. $k = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #keyNames; choice: 'space']. $L = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #listVarMenu]. $l = t2 ifTrue: [^ ChoiceOrExpressionArgMorph new getOptionsSelector: #costumeNames; choice: 'costume1']. $m = t2 ifTrue: [^ SpriteArgMorph new]. $M = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #motorNames]. $n = t2 ifTrue: [^ ExpressionArgMorph new numExpression: '10']. $N = t2 ifTrue: [^ ExpressionArgMorphWithMenu new numExpression: '60'; menuSelector: #noteSelector]. $s = t2 ifTrue: [^ ExpressionArgMorph new stringExpression: '']. $S = t2 ifTrue: [^ ChoiceOrExpressionArgMorph new getOptionsSelector: #soundNames; choice: 'pop']. $v = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #varNamesMenu; choice: '']. $W = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #motorDirection]. $x = t2 ifTrue: [^ ChoiceOrExpressionArgMorph new getOptionsSelector: #sceneNames; choice: '']. $y = t2 ifTrue: [^ ExpressionArgMorphWithMenu new numExpression: '1'; menuSelector: #listIndexForDeleteMenu]. $B = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #typeNames; choice: 'Motion']. ^ ExpressionArgMorph new numExpression: '10'What it does: Opens that category of blocks in the Block Library.
2 problems with this:
1) %B is used by Pecola1 in his <[pen down?] for [Sprite1] block (though that was missed in the old one); you may want to change it.
Ok, what can I make it?
2) It only opens the Scratch Blocks category; what if you want Panther or BYOB?
I'll add separate blocks for those, because Panther and BYOB have different categories.
Offline
Hardmath123 wrote:
Code:
('Ask %s' #r #askReport: #'What is your name?')Code:
askReport: t1 ^ StringDialog ask: t1Asks the input in a dialog box and reports it.
Code:
('Warn %s' #- #warn: 'Invalid input')Code:
warn: t1 DialogBoxMorph warn: t1Gives a pop-up window alerting the input. Useful if the user entered an invalid input, or just to report results.
Code:
('Pause' #- #pause)Code:
pause DialogBoxMorph warn: 'Paused: click OK to continue'Pauses the script until the user clicks OK.
1) Did you base that off the Panther one?
2) I know ProgrammingFreak shared that, but it must have gotten missed; again.
3) Made by Sparks.
Sorry Hardmath123.
@Hardmath123:
1) I guess %B is OK since the other isn't in yet. ^^
2) OK.
Offline
scimonster wrote:
1) Did you base that off the Panther one?
2) I know ProgrammingFreak shared that, but it must have gotten missed; again.
3) Made by Sparks.
Sorry Hardmath123.
Hmmm, it's ok. I did look in the library before; I must've missed 3. No, 1 isn't based on the Panther one.
Offline
Hardmath123 wrote:
scimonster wrote:
1) Did you base that off the Panther one?
2) I know ProgrammingFreak shared that, but it must have gotten missed; again.
3) Made by Sparks.
Sorry Hardmath123.Hmmm, it's ok. I did look in the library before; I must've missed 3. No, 1 isn't based on the Panther one.
Sparks didn't add it.
Offline
scimonster wrote:
Hardmath123 wrote:
scimonster wrote:
1) Did you base that off the Panther one?
2) I know ProgrammingFreak shared that, but it must have gotten missed; again.
3) Made by Sparks.
Sorry Hardmath123.Hmmm, it's ok. I did look in the library before; I must've missed 3. No, 1 isn't based on the Panther one.
Sparks didn't add it.
So... can you add all, but only give me credit for 1?
Offline
Hardmath123 wrote:
scimonster wrote:
Hardmath123 wrote:
Hmmm, it's ok. I did look in the library before; I must've missed 3. No, 1 isn't based on the Panther one.Sparks didn't add it.
So... can you add all, but only give me credit for 1?
Too busy.
Offline
scimonster wrote:
Hardmath123 wrote:
scimonster wrote:
Sparks didn't add it.
So... can you add all, but only give me credit for 1?
Too busy.
*sigh*
You should have a way to 'queue' blocks to be added. You can just link the post in the queue, and less busy librarians can view the queue and update as they go.
Mockup:
Queue
These will be linked to the post where they were submit. They're currently linked to the Scratch homepage.
(digit (20) of PI) | Scratch | Motion | Quick update
([Paddle2See]'s password) | Panther | Sensing | Lengthy post
[delete this project] | BYOB | Control | Moderate update
Offline
Hardmath123 wrote:
scimonster wrote:
Hardmath123 wrote:
So... can you add all, but only give me credit for 1?Too busy.
*sigh*
You should have a way to 'queue' blocks to be added. You can just link the post in the queue, and less busy librarians can view the queue and update as they go.
Mockup:Queue
These will be linked to the post where they were submit. They're currently linked to the Scratch homepage.
(digit (20) of PI) | Scratch | Motion | Quick update
([Paddle2See]'s password) | Panther | Sensing | Lengthy post
[delete this project] | BYOB | Control | Moderate update
That's a cool idea.
What do other Librarians think?
Offline
Better mockup:
Offline