sparks wrote:
Control
[blocks, code, pix, credits edited out to save room]
Shared by Zorket
Blockspec:('set single stepping' #- #setSpeed)
Code:
setSpeed
| t1 t2 |
t1 _ CustomMenu new title: 'Single-step speed?'.
t1 add: 'Turbo speed' action: 0.
t1 add: 'Normal' action: 1.
t1 add: 'Flash blocks (fast)' action: 30.
t1 add: 'Flash blocks (slow)' action: 200.
t2 _ t1 localize startUp.
t2 ifNil: [^ self].
ScratchProcess blockHighlightMSecs: t2[b] What it does:[b]
This block lets you change the speed of your project! Very useful when you want a mix of fast computing and good graphics.
^ Back to Scratch Blocks
^ Back to Contents
mistake in the coding: [b] What it does:[b] should be [b] What it does:[/b]
Last edited by scimonster (2011-01-10 08:22:08)
Offline
zorket wrote:
[open string dialog to type in]
blockspec:('open string dialog to type in' #- #openTypeDialog)
non - tested code:
Code:
openTypeDialog | t1 | t1 _ StringDialog ask: 'type.'
Offline
I think Zorket probably misunderstood "How do I get what they typed in?" meaning something to do with how he used BBcode, and added the mistake so the bbcode would show up...
Zorket, What people are trying to say is:
Once you have run the block you posted, how can a user read the text you typed into the string dialog in the same way that you need to read the "answer" to the "ask" block with a reporter.
In answer, the block Zorket posted IS a reporter. It asks the question and then reports the answer.
Last edited by sparks (2010-12-07 10:29:59)
Offline
Are you going to update with my blocks?
just asking
Offline
Yay
Last edited by subzerostig (2010-12-08 13:33:59)
Offline
.
Scratch blocks added: [3]
Panther blocks added: [0]
BYOB blocks added: [14]
Block requests added: [2]
Other Updates:
♦ Subzerostig: your ( )^( ) block has not been added because it has already been shared, sorry
________________________________________________________________________________
^home
^updates archive
Offline
Thanks for the tip, sparks.
I have made another block. Wrote it myself.
[open user page]
blockspec:
'open user page' #- #openUserPage
openUserPage | t1 | t1 StringDialog askWithCancel: 'user name:'. t1 size = 0 ifTrue: [^ self]. Cursor wait showWhile: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/users/', t1]
Last edited by zorket (2010-12-10 16:21:15)
Offline
sparks wrote:
I think Zorket probably misunderstood "How do I get what they typed in?" meaning something to do with how he used BBcode, and added the mistake so the bbcode would show up...
Zorket, What people are trying to say is:
Once you have run the block you posted, how can a user read the text you typed into the string dialog in the same way that you need to read the "answer" to the "ask" block with a reporter.
In answer, the block Zorket posted IS a reporter. It asks the question and then reports the answer.
oh. i made it a command block
EDIT:
its reporter now. it just says "A ScratchSpriteMorph()" when it gets input
Last edited by me450 (2010-12-08 21:26:45)
Offline
Hardmath123 wrote:
Ta-Da!
Code:
getconstant: t1 t1 = 'pi' ifTrue: [^ '3.141592653']. t1 = 'phi' ifTrue: [^ '1.61803399']. t1 = 'e' ifTrue: [^ '2.71828183']. t1 = 'sqrt 2' ifTrue: [^ '1.41421356']. ^ 3.141592653Code:
('%T' #r #getconstant:)Scratch-Objects»ScriptableScratchMorph»sensing
Code:
constants ^ #('pi' 'phi' 'e' 'sqrt 2' )Scratch-Blocks»CommandBlockMorph»-- all --»uncoloredArgMorphFor:
REPLACE ALL WITHCode:
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]. $T = t2 ifTrue: [^ ChoiceOrExpressionArgMorph new getOptionsSelector: #constants; choice: 'pi']. ^ ExpressionArgMorph new numExpression: '10'Gives out the selected constants. Note the better arrows '»'
Meant to replace the pi block Zorket and I gave.
If you want to add a constant, just tell me.
*ahem*
Offline
scimonster wrote:
have you made any custom blocks in scratch?
have you made projects with them?
are you annoyed that you are the only one who can run them?
do you wish you could share those projects?
now you can!
put a link to the project here, along with the blockspecs and coding for the blocks
What are you going to do with 32 scratch blocks if not use them in projects?
Offline
@ Zorket, Thanks for the user block, but I've already made one. Mine does not ask the name of the user in a dialog, but I think that's better because otherwise you have to have a dialog box asking to input a user Also, what tip and how is it broken?
@Hardmath123, sorry, I must have missed it, I'll add it in a bit
@me450, I tried zorket's ask as reporter block code and it worked for me... you must have made a mistake somewhere.
@scimonster, what?!
Offline
sparks wrote:
@scimonster, what?!
if you make all 32 blocks you have here, what are you going to do? look at them for fun. no. use it in a project. and what's the point if you can't share it? thats what this topic is for, projects that use custom blocks.
Offline
... I never said it wasn't! I still stand by what I said on that thread though:
sparks wrote:
You might like to credit Billyedward who was the person who first came up with the code for the URL link block you posted above
Offline
Hey, I just thought you might want a cleaned up version of the Panther blocks image.
http://i55.tinypic.com/29cvqio.png
________________________________________
The pen shade block:
('pen shade' #r #penShade)
Scratch-Objects >> ScriptableSpriteMorph >> pen ops
penShade ^ penShade
Offline
Sorry about the above post... :P
I'll try that again:
Hey, I just thought you might want a cleaned up version of the Panther blocks image.
________________________________________
The pen shade block:
('pen shade' #r #penShade)
Scratch-Objects >> ScriptableSpriteMorph >> pen ops
penShade ^ penShade
Last edited by JeanTheFox (2010-12-09 15:25:17)
Offline
Tada!
BlockSpec:
('if touching %m bounce' #- #bounceOffSprite:)
Code:
bounceOffSprite: aName | sprite oldDir | sprite _ self coerceSpriteArg: aName. (self touching: sprite) ifFalse: [^ self]. oldDir _ self heading. self pointTowards: sprite. self turnRight: self heading - oldDir + 180. [self touching: sprite] whileTrue: [self forward: 1]
Not bad for my first block in the library, eh?
Offline
MathWizz wrote:
Tada!
http://img10.imageshack.us/img10/8629/i … bounce.gif
BlockSpec:Code:
('if touching %m bounce' #- #bounceOffSprite:)Code:
Code:
bounceOffSprite: aName | sprite oldDir | sprite _ self coerceSpriteArg: aName. (self touching: sprite) ifFalse: [^ self]. oldDir _ self heading. self pointTowards: sprite. self turnRight: self heading - oldDir + 180. [self touching: sprite] whileTrue: [self forward: 1]Not bad for my first block in the library, eh?
That block will be really useful for physics games!!!
Offline
subzerostig wrote:
MathWizz wrote:
Tada!
http://img10.imageshack.us/img10/8629/i … bounce.gif
BlockSpec:Code:
('if touching %m bounce' #- #bounceOffSprite:)Code:
Code:
bounceOffSprite: aName | sprite oldDir | sprite _ self coerceSpriteArg: aName. (self touching: sprite) ifFalse: [^ self]. oldDir _ self heading. self pointTowards: sprite. self turnRight: self heading - oldDir + 180. [self touching: sprite] whileTrue: [self forward: 1]Not bad for my first block in the library, eh?
That block will be really useful for physics games!!!
It's not very accurate right now... It assumes the sprites are circles, but it can still be useful.
Last edited by MathWizz (2010-12-10 12:17:46)
Offline
I have a new untested block called (letter () ).
Untested, again.
blockspec:
('letter %n' #r #letter:)
LONG code:
letter: t1 t1 = 1 ifTrue: ^ 'a'. t1 = 2 ifTrue: ^ 'b'. t1 = 3 ifTrue: ^ 'c'. t1 = 4 ifTrue: ^ 'd'. t1 = 5 ifTrue: ^ 'e'. t1 = 6 ifTrue: ^ 'f'. t1 = 7 ifTrue: ^ 'g'. t1 = 8 ifTrue: ^ 'h'. t1 = 9 ifTrue: ^ 'i'. t1 = 10 ifTrue: ^ 'j'. t1 = 11 ifTrue: ^ 'k'. t1 = 12 ifTrue: ^ 'l'. t1 = 13 ifTrue: ^ 'm'. t1 = 14 ifTrue: ^ 'n'. t1 = 15 ifTrue: ^ 'o'. t1 = 16 ifTrue: ^ 'p'. t1 = 17 ifTrue: ^ 'q'. t1 = 18 ifTrue: ^ 'r'. t1 = 19 ifTrue: ^ 's'. t1 = 20 ifTrue: ^ 't'. t1 = 21 ifTrue: ^ 'u'. t1 = 22 ifTrue: ^ 'v'. t1 = 23 ifTrue: ^ 'w'. t1 = 24 ifTrue: ^ 'x'. t1 = 25 ifTrue: ^ 'y'. t1 = 26 ifTrue: ^ 'z'. ^ 'Error!'
What I have to say that every block I say is DEFFERENT. And I work HARD on them. So please, PLEASE add them! I'm begging you!
Last edited by zorket (2010-12-10 16:22:59)
Offline
[blocks]<rotational direction[/blocks]
HI
I would like a block that senses clockwise and counterclockwise motion.
I have a scratch project with a dial that turns to the mouse pointer but even when you are turning the opposite way there is the same event. I want 2 events for this button 1 for turning clockwise and one for turning counter-clockwise. Thanks
Offline
SSBBM wrote:
Man, I have no idea what you guys are saying with your scratch code. Could anyone help me with coming up with BYOB block?
And I'm over here, wishing that people would stop coming up with BYOB blocks, 'cause I'm getting overloaded with building the BYOB Block Library project.
sparks, can you compile a list of BYOB blocks not in the project and provide easy access to them? 'Cause I'm, er, sorta behind
Offline