Code:
('%b=%b' #b #a:equalsb:)Code:
a:t1 equalsb:t2 t1 = t2 ifTrue [^true]. ^false.
reports true if the two values are equal.
Offline
zorket wrote:
blockspec:
('do nothing' #- #doNothing)
Code:
doNothing ^ selfTESTED
Actually, EVERY block has a code, sometimes the code is already there.
('do nothing' #- #-)
Modified, only blockspec needed. Kinda ironic, really, you saying
Actually, EVERY block has a code, sometimes the code is already there.
Offline
The fraction of block!
Image code:
http://i52.tinypic.com/359bgb6.png
Operators block.
blockSpecs code:
('%z of %n' #r #computeFraction:of: '1/2' #-)
Now you may not recognize computeFraction:of: or %z.
To get computeFraction:of: :
Go to Scratch-Blocks >> ScriptableScratchMorph >> other ops
And type in this code:
computeFractionOf: code
computeFraction: t1 of: t2
'1/2' = t1 ifTrue: [^ t2 / 2].
'1/3' = t1 ifTrue: [^ t2 / 3].
'1/4' = t1 ifTrue: [^ t2 / 4].
'1/5' = t1 ifTrue: [^ t2 / 5].
'1/6' = t1 ifTrue: [^ t2 / 6].
'1/7' = t1 ifTrue: [^ t2 / 7].
'1/8' = t1 ifTrue: [^ t2 / 8].
'1/9' = t1 ifTrue: [^ t2 / 9].
'1/10' = t1 ifTrue: [^ t2 / 10].
^ 0
Then make this in ScriptableScratchMorph as well:
mathFractionNames code
mathFractionNames
^ #('1/2' '1/3' '1/4' '1/5' '1/6' '1/7' '1/8' '1/9' '1/10' )
To get %z:
Go to Scratch-Objects >> CommandBlockMorph >> -- all -- >> uncoloredArgMorphFor:
and type in this code:
uncoloredArgMorphFor: code
$z = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #mathFractionNames;
choice: '1/2'].
And you'll have your fraction of block!
Offline
ESN wrote:
The fraction of block!
Image code:
http://i52.tinypic.com/359bgb6.pngOperators block.
blockSpecs code:
('%z of %n' #r #computeFraction:of: '1/2' #-)Now you may not recognize computeFraction:of: or %z.
To get computeFraction:of: :
Go to Scratch-Blocks >> ScriptableScratchMorph >> other ops
And type in this code:computeFractionOf: code
computeFraction: t1 of: t2
'1/2' = t1 ifTrue: [^ t2 / 2].
'1/3' = t1 ifTrue: [^ t2 / 3].
'1/4' = t1 ifTrue: [^ t2 / 4].
'1/5' = t1 ifTrue: [^ t2 / 5].
'1/6' = t1 ifTrue: [^ t2 / 6].
'1/7' = t1 ifTrue: [^ t2 / 7].
'1/8' = t1 ifTrue: [^ t2 / 8].
'1/9' = t1 ifTrue: [^ t2 / 9].
'1/10' = t1 ifTrue: [^ t2 / 10].
^ 0Then make this in ScriptableScratchMorph as well:
mathFractionNames code
mathFractionNames
^ #('1/2' '1/3' '1/4' '1/5' '1/6' '1/7' '1/8' '1/9' '1/10' )To get %z:
Go to Scratch-Objects >> CommandBlockMorph >> -- all -- >> uncoloredArgMorphFor:
and type in this code:uncoloredArgMorphFor: code
$z = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #mathFractionNames;
choice: '1/2'].And you'll have your fraction of block!
Awesome, I just tested it! Although, it might've been easier to do (say, 10) / (2). But it still works great!
Offline
meowmeow55 wrote:
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
I see you will not help me. Already ahead of you, sparks.
^ By subzerostig
^ By me
Oh, and the hyperpaint blocks.
Just add those blocks to this
Offline
I have a Operator block for BYOB Here is the pictures:
to download click this link: http://www.weebly.com/uploads/5/4/1/3/5 … _ascii.ysp
Last edited by Pecola1 (2010-12-12 14:03:25)
Offline
Pecola1 wrote:
I have a Operator block for BYOB:
(the word <{ word }> in ascii code)
{script variables ((word in ascii code))((target)) < >}
<set{ word }to(
<set{ target }to( 1
<repeat( length of <{ word }>
<set{ word }to( join <{ word in ascii code }> join [] ascii code of letter <{ target }> of <{ word }>
<change{ target }by( 1
<end>[/block]
I get confused with fourm blocks. Is this about what to mean?
If not is still makes a good block, and also makes case sensitive block = easy.
Last edited by SSBBM (2010-12-12 09:01:58)
Offline
I made a new block. It is below.
Scratch-objects> ScratchSpriteMorph> block specs> block specs:
('set rotation style to %r' #- #rotationStyleChange:)
Scratch-objects> ScratchSpriteMorph>motion ops
rotationStyleChange: t1 self rotationStyle: t1
Scratch objects> ScratchSpriteMorph>motion ops
rotationStyleChanger ^ #('normal' 'leftRight' 'none' )
Scratch-Blocks> CommandBlockMorph>> -- all -- > uncoleredArgMorphFor:
add the strip...
$r = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #rotationStyleChanger; choice: 'normal'].
and that’s it!
This is what it will look like:
Last edited by Pecola1 (2010-12-12 13:49:20)
Offline
This block reports the rotation style.
Scratch-objects> ScratchSpriteMorph> block specs> block specs:
('rotation style' #r #rotationStyle)
Scratch objects> ScratchSpriteMorph> [instance]> motion ops
rotationStyle ^ rotationStyle
Thats all!
This is what it will look like:
Last edited by Pecola1 (2010-12-12 13:46:41)
Offline
SSBBM wrote:
Pecola1 wrote:
I have a Operator block for BYOB:
(the word word in ascii code)
{script variables ((word in ascii code))((target)) < >}
set word to []
set target to [1]
{repeat (length of (word))
[set word to( join (word in ascii code) (join [] (ascii code of letter (target) of (word) ) )
change target by [1]I get confused with fourm blocks. Is this about what to mean?
http://img641.imageshack.us/img641/5564/ascii.gif
If not is still makes a good block, and also makes case sensitive = block easy.
I cannot see the image because I have web blocks and they do not allow me to go to image shack. However I have changed the script to words.
Here is the pictures:
Last edited by Pecola1 (2010-12-12 13:43:10)
Offline
Hey can anyone tell me how to create a forum?
Offline
Hardmath123 wrote:
Code:
('%b=%b' #b #a:equalsb:)Code:
a:t1 equalsb:t2 t1 = t2 ifTrue [^true]. ^false.reports true if the two values are equal.
You do notice that you can use the regular
[blocks]
<( <=> )>
[/blocks]
block don't you? You can drop booleans into it. like this:
[blocks]
<( <mouse down?> <=> <loud?> )>
[/blocks]
Last edited by Pecola1 (2010-12-11 18:19:16)
Offline
This block is the
[blocks]
<< <or> >>
[/blocks]
block only it choses randomly. So instead of mouse down or touching mouse pointer and the mouse is down but it isn't touching the mouse pointer, it will pick true or false. It is useful if you want a game that is different each time.
Scratch-objects> ScriptableScratchMorph> block specs> block specs:
('%b or %b' #b #booleanRandom:Or:)
Scratch-Objects> ScriptableScratchMorph> other ops:
booleanRandom: t1 Or: t2 | t3 | t3 _ self randomFrom: 0 to: 1. t3 = 1 ifTrue: [^ t1]. ^ t2
Have fun with your new block!
This is what it looks like:
Last edited by Pecola1 (2010-12-12 13:52:13)
Offline
HI! Meowmeow55, I've had an idea that I would like to add to the library, but I'd like you hear your (and others') thoughts: Rather than having one big BYOB project containing all the custom blocks, which takes a while to download, and becomes useless once a new version is uploaded, leaving you with several instances of it on your computer, how about we remove the project and replace it with a downloadable sprite per block? I'm happy to help you convert the current project into sprites if you'd like to do it, then people can view the image or download a block, depending what they want? Let me know what you think, then we can split it up between us if you like the idea?
Here's a working example of what the BYOB section would look like:
-------------------------------------------------------------------------------------------------------------------------
Shared by jonathanpb
-------------------------------------------------------------------------------------------------------------------------
A better download icon, I think, but you get the gist.
It may be possible to do this (or something very similar) for Panther blocks, in 1.0 and I'm hoping 1.1 will have a block importing button built in, but I don't think there's really a way for me to do it with a scratch block unless someone can think of a patch or something that would work...
Last edited by sparks (2010-12-12 05:31:14)
Offline
ok, if SSBBM, meowmeow55 and I work together on that... should we host them all in one place? or do we all have our own file hosting places we can use?
shall we allocate ourselves for the moment to different block types so we don't upload two of the same? If you use my example .ypr file as the basis for the others, they can all look the same!
Last edited by sparks (2010-12-12 08:31:52)
Offline
sparks wrote:
om, if SSBBM, meowmeow55 and I work together on that... should we host them all in one place? or do we all have our own file hosting places we can use?
The only advantage I see in having it at one place is for someone to see all the files at once. Other then that I think it would be easier to use our own.
Offline
shall we allocate ourselves for the moment to different block types so we don't upload two of the same? If you use my example .ypr file as the basis for the others, they can all look the same!
Offline
sparks wrote:
shall we allocate ourselves for the moment to different block types so we don't upload two of the same? If you use my example .ypr file as the basis for the others, they can all look the same!
Yep. Like one of us could do motion and the other one looks or something.
Offline
Offline
ESN, I'll get to your block in a bit, I don't update the blocks instantly, I have a life outside the fora!
SSBBM, lets start that now then. If you want to do control I'll do motion, then we can use those two as trail ones, that I'll update to see if people like it. Then the others can follow
I need a better "downoad" image...
Offline
sparks wrote:
SSBBM, lets start that now then. If you want to do control I'll do motion, then we can use those two as trail ones, that I'll update to see if people like it. Then the others can follow
I need a better "downoad" image...
I can't right now, but I'll get to it after I eat some pancake!
Offline
Hi!
Great idea, sparks! I probably could become more organized that way. I could set a folder aside on my site for all the blocks, then have an option to either go directly to that folder from here to browse the blocks or browse them from the block library.
sparks wrote:
...but I don't think there's really a way for me to do it with a scratch block unless someone can think of a patch or something that would work...
You could build off of nXIII's old patcher system for the blocks!
Last edited by meowmeow55 (2010-12-12 09:25:25)
Offline