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

#476 2010-01-31 22:50:24

scoreman
Scratcher
Registered: 2009-10-03
Posts: 14

Re: ITopic: Build Your Own Blocks (BYOB)

I do this:
( )

Offline

 

#477 2010-02-03 13:48:12

flopsybunny10
Scratcher
Registered: 2010-02-03
Posts: 1

Re: ITopic: Build Your Own Blocks (BYOB)

fullmoon wrote:

Doesn't "BYOB" stand for "Bring Your Own Beer"? Other than that, I am blown away! I'm supposed to be writing a Scratch presentation for school, but instead I think I'll spend the rest of the day playing with this  wink . Thank you!!!

NO!
It means B=build Y=your O=own and B=block build your own blocks was the name of the topic!

Offline

 

#478 2010-02-04 12:26:25

lapinater12
Scratcher
Registered: 2010-01-18
Posts: 24

Re: ITopic: Build Your Own Blocks (BYOB)

i have downloaded but not sure how to work it can anyone help  smile

Offline

 

#479 2010-02-04 12:29:11

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: ITopic: Build Your Own Blocks (BYOB)

lapinater12 wrote:

i have downloaded but not sure how to work it can anyone help  smile

It's just like normal scratch. If you use the create block option, you can drag blocks into the screen to create a simplified version of all those blocks!


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

#480 2010-02-04 13:39:52

lapinater12
Scratcher
Registered: 2010-01-18
Posts: 24

Re: ITopic: Build Your Own Blocks (BYOB)

yeh but those blocks wont do anything p.s how do you share projects on byob

Offline

 

#481 2010-02-04 14:42:24

technoguyx
Scratcher
Registered: 2008-10-18
Posts: 1000+

Re: ITopic: Build Your Own Blocks (BYOB)

lapinater12 wrote:

yeh but those blocks wont do anything p.s how do you share projects on byob

If you name a block, say, "move" it will not work unless you make the movement script for it yourself.  tongue


http://getgnulinux.org/links/en/linuxliberated_4_78x116.png

Offline

 

#482 2010-02-04 15:02:58

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: ITopic: Build Your Own Blocks (BYOB)

Hi lapinater12,

it's wonderful that you're interested in creating your own blocks. In BYOB you create blocks using the Block Editor much in the same way that you construct regular Scratch scripts in the scripts area of Scratch. You can drag any blocks off the palette (the area on the left hand side of the Scratch window) *into* the Block Editor and attach them to the header block (the "template"). Then when you run that block it will execute all those blocks that are attached to its header in the Block Editor. Just go ahead and try it, it's supposed to be easy! Let me know if you encounter any problems


Jens Mönig

Offline

 

#483 2010-02-06 10:04:27

lapinater12
Scratcher
Registered: 2010-01-18
Posts: 24

Re: ITopic: Build Your Own Blocks (BYOB)

technoguyx wrote:

lapinater12 wrote:

yeh but those blocks wont do anything p.s how do you share projects on byob

If you name a block, say, "move" it will not work unless you make the movement script for it yourself.  tongue

were do you do this

Offline

 

#484 2010-02-07 04:15:30

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

Re: ITopic: Build Your Own Blocks (BYOB)

jcubed wrote:

Jens wrote:

jcubed wrote:

add it so you can have more than just numbers to work with like
[blocks]<( less than )>[/blocks]

Interesting suggestion, jcubed! I have thought about this but didn't come to any conclusive result what you would be able to do with such a boolean parameter. Could you perhaps give an example?

example(as a reporter):
this is the best one
(if %b return %n else %n)

example(as a boolean):
<%b and %b or %b and %b>

example(as a command):
[if %b change var %? by %n]

also,you cant type numbers into the blocks

and add list for the blocks

"also, you cant type numbers into the blocks"
I have tested it, you should be able but not at char #1.

"and add list for the blocks"
Interesting suggestion, jcubed!

For variable drop-downs, use lower-case %v.
For list drop-downs, use capital %L.

Offline

 

#485 2010-02-07 15:25:40

lapinater12
Scratcher
Registered: 2010-01-18
Posts: 24

Re: ITopic: Build Your Own Blocks (BYOB)

how do you make a block like<touching color[

Offline

 

#486 2010-02-08 11:23:15

markyparky56
Scratcher
Registered: 2008-03-20
Posts: 1000+

Re: ITopic: Build Your Own Blocks (BYOB)

lapinater12 wrote:

how do you make a block like<touching color[

Theres a boolean setting, but i think you already know that.


http://j.mp/jgVnTq
Check out my game engine development site: NewDawn I'm a Level 171 Scratcher.I am http://bit.ly/nkvLNT

Offline

 

#487 2010-02-08 14:27:13

Repto
Scratcher
Registered: 2010-01-10
Posts: 88

Re: ITopic: Build Your Own Blocks (BYOB)

how do you share projects?


http://scratch.mit.edu/static/projects/Repto/1074910_sm.pngandhttp://scratch.mit.edu/static/projects/Repto/1184314_sm.pngMy most successful projects!

Offline

 

#488 2010-02-08 15:48:11

markyparky56
Scratcher
Registered: 2008-03-20
Posts: 1000+

Re: ITopic: Build Your Own Blocks (BYOB)

Repto wrote:

how do you share projects?

in BYOB you cant properly, but in normal scratch you click the little upload button next to save.


http://j.mp/jgVnTq
Check out my game engine development site: NewDawn I'm a Level 171 Scratcher.I am http://bit.ly/nkvLNT

Offline

 

#489 2010-02-09 05:52:28

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: ITopic: Build Your Own Blocks (BYOB)

Hi Repto, in BYOB you can share projects as Windows standalone executables, but not on the Scratch website.


Jens Mönig

Offline

 

#490 2010-02-09 12:30:13

markyparky56
Scratcher
Registered: 2008-03-20
Posts: 1000+

Re: ITopic: Build Your Own Blocks (BYOB)

Jens wrote:

Hi Repto, in BYOB you can share projects as Windows standalone executables, but not on the Scratch website.

you mean with the chirp compiler? or does it have a built in part?


http://j.mp/jgVnTq
Check out my game engine development site: NewDawn I'm a Level 171 Scratcher.I am http://bit.ly/nkvLNT

Offline

 

#491 2010-02-10 02:13:44

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: ITopic: Build Your Own Blocks (BYOB)

BYOB has a built-in compiler, accessible under the SHARE menu


Jens Mönig

Offline

 

#492 2010-02-10 05:18:42

fanofcena
Scratcher
Registered: 2008-07-03
Posts: 1000+

Re: ITopic: Build Your Own Blocks (BYOB)

Hello I have a BYOB problem type z%(variable name) will get u an empty space
typing x%g will get u the graphics menu
typing x%c will get u the color tool that means x%<an alphabet> will get u to the functions with that alphabet.
i just wanted to know how to use them as it do not change or take value if done .Is it a bug or an ester egg.

Last edited by fanofcena (2010-02-10 05:20:33)


http://i53.tinypic.com/2vxr2c0.png Click whats above u might make a cute planet happy ^_^

Offline

 

#493 2010-02-10 08:13:35

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: ITopic: Build Your Own Blocks (BYOB)

it's a "side effect"  smile  without any functionality


Jens Mönig

Offline

 

#494 2010-02-10 12:21:42

markyparky56
Scratcher
Registered: 2008-03-20
Posts: 1000+

Re: ITopic: Build Your Own Blocks (BYOB)

Jens wrote:

BYOB has a built-in compiler, accessible under the SHARE menu

Never saw that, thanks.  smile


http://j.mp/jgVnTq
Check out my game engine development site: NewDawn I'm a Level 171 Scratcher.I am http://bit.ly/nkvLNT

Offline

 

#495 2010-02-10 16:52:32

somelia
Scratcher
Registered: 2009-09-13
Posts: 1000+

Re: ITopic: Build Your Own Blocks (BYOB)

Paddle2See wrote:

Jens, this is simply amazing!  Astounding!  Incredible!  The first routine I made was "Previous Costume" - it felt so good to be able to hide that ugly equation neatly away in a routine where it belongs!  From my first baby steps, I will now stride forth confidently.  Thank you!

How on earth did you do a "previous costume" block?!?!

Offline

 

#496 2010-02-10 17:20:03

rubiks_cube_guy238
Scratcher
Registered: 2009-07-02
Posts: 100+

Re: ITopic: Build Your Own Blocks (BYOB)

Hello, Jens.
I've added some features to BYOB.
1. All argMorphs can be used in a custom block.
2. Those argMorphs now include an argMorph that is a custom menu. (you shift-click on it and you see two options that say 'add item' and 'add line')
3. The method of assigning variables/parameters in a block spec is changed. Typing in %bboolean1 creates a boolean input called boolean1.
All you have to do is file this in:

Code:

ChoiceArgMorph subclass: #CustomMenuArgMorph
    instanceVariableNames: ''
    classVariableNames: ''
    poolDictionaries: ''
    category: 'Scratch-Blocks'!

!CustomMenuArgMorph methodsFor: 'as yet unclassified'!
initialize
    super initialize.
    options _ OrderedCollection new! !

!CustomMenuArgMorph methodsFor: 'as yet unclassified'!
options
    ^ options! !

!CustomMenuArgMorph methodsFor: 'as yet unclassified'!
options: t1 
    options _ t1! !

!CustomMenuArgMorph methodsFor: 'as yet unclassified'!
presentMenu
    | t1 t2 t3 |
    t2 _ CustomMenu new.
    options do: [:t4 | t4 = '-'
            ifTrue: [t2 addLine]
            ifFalse: [t2 add: t4 action: t4]].
    Sensor shiftPressed
        ifTrue: 
            [t2 addLine.
            t2 add: 'add item' action: #~.
            t2 add: 'add line' action: #`].
    t1 _ t2 startUp.
    t1 = '~'
        ifTrue: 
            [t3 _ StringDialog ask: 'New menu item'.
            options add: t3.
            super choice: t3]
        ifFalse: [t1 = '`'
                ifTrue: [options add: #-]
                ifFalse: [t1 ifNotNil: [self choice: t1]]]! !

!ChoiceArgMorph methodsFor: 'as yet unclassified'!
acceptsDroppedReporters
    ^ true! !

!ChoiceArgMorph methodsFor: 'as yet unclassified'!
acceptsTypeOf: t1 
    ^ true! !


!CommandBlockMorph methodsFor: 'private'!
uncoloredArgMorphFor: t1 
    | t2 |
    t2 _ t1 at: 2.
    $a = t2 ifTrue: [^ AttributeArgMorph new choice: 'volume'].
    $A = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #customBlockAttributeNames;
         choice: 'x position'].
    $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].
      $z = t2 ifTrue: [^ CustomMenuArgMorph new].
    ^ ExpressionArgMorph new numExpression: '10'! !


!CustomBlockDefinition methodsFor: 'accessing'!
commandSpecFrom: t1 
    | t2 t3 |
    t2 _ ScratchServer new parse: t1.
    t3 _ WriteStream on: String new.
    t2 do: 
        [:t4 | 
        (t4 beginsWith: '%')
            ifTrue: 
                [(t4 beginsWith: '%s')
                    ifTrue: [t3 nextPutAll: '%s'].
                (t4 beginsWith: '%b')
                    ifTrue: [t3 nextPutAll: '%b'].
                (t4 beginsWith: '%n')
                    ifTrue: [t3 nextPutAll: '%n'].
                (t4 beginsWith: '%m')
                    ifTrue: [t3 nextPutAll: '%m'].
                (t4 beginsWith: '%c')
                    ifTrue: [t3 nextPutAll: '%c'].
                (t4 beginsWith: '%C')
                    ifTrue: [t3 nextPutAll: '%C'].
                (t4 beginsWith: '%k')
                    ifTrue: [t3 nextPutAll: '%k'].
                (t4 beginsWith: '%l')
                    ifTrue: [t3 nextPutAll: '%l'].
                (t4 beginsWith: '%g')
                    ifTrue: [t3 nextPutAll: '%g'].
                (t4 beginsWith: '%N')
                    ifTrue: [t3 nextPutAll: '%N'].
                (t4 beginsWith: '%I')
                    ifTrue: [t3 nextPutAll: '%I'].
                (t4 beginsWith: '%D')
                    ifTrue: [t3 nextPutAll: '%D'].
                (t4 beginsWith: '%S')
                    ifTrue: [t3 nextPutAll: '%S'].
                (t4 beginsWith: '%f')
                    ifTrue: [t3 nextPutAll: '%f'].
                (t4 beginsWith: '%e')
                    ifTrue: [t3 nextPutAll: '%e'].
                (t4 beginsWith: '%H')
                    ifTrue: [t3 nextPutAll: '%H'].
                (t4 beginsWith: '%h')
                    ifTrue: [t3 nextPutAll: '%h'].
                (t4 beginsWith: '%W')
                    ifTrue: [t3 nextPutAll: '%W'].
                        (t4 beginsWith: '%v')
                              ifTrue: [t3 nextPutAll: '%v'].
                (t4 beginsWith: '%a')
                    ifTrue: [t3 nextPutAll: '%A'].
                        (t4 beginsWith: '%z'
                              ifTrue: [t3 nextPutAll: '%z']]
            ifFalse: [(t4 beginsWith: #.)
                    ifTrue: [t3 nextPutAll: #.]
                    ifFalse: [t3 nextPutAll: t4]].
        t3 space].
    ^ t3 contents withoutTrailingBlanks! !

!CustomBlockDefinition methodsFor: 'accessing'!
parameterNamesInSpec: t1 
    | t2 t3 |
    t2 _ ScratchServer new parse: t1.
    t3 _ OrderedCollection new.
    t2 do: [:t4 | (t4 asString beginsWith: '%')
            ifTrue: [t3 add: t4 asString allButFirst allButFirst asUTF8]].
    ^ t3 asArray! !


!ScratchFrameMorph methodsFor: 'menu/button actions'!
editMenu: t1 
    | t2 |
    t2 _ CustomMenu new.
    t2 add: 'Undelete' action: #undoTool.
    t2 add: 'Undo last drop' action: #undoLastDrop.
    t2 addLine.
    ScratchProcess blockHighlightMSecs <= 1
        ifTrue: [t2 add: 'Start Single Stepping' action: #toggleSingleStepping]
        ifFalse: [t2 add: 'Stop Single Stepping' action: #toggleSingleStepping].
    t2 add: 'Set Single Stepping' action: #setSingleStepping.
    t2 addLine.
    t2 add: 'Compress Sounds' action: #compressSounds.
    t2 add: 'Compress Images' action: #compressImages.
    t2 addLine.
    workPane showMotorBlocks
        ifTrue: [t2 add: 'Hide Motor Blocks' action: #hideMotorBlocks]
        ifFalse: [t2 add: 'Show Motor Blocks' action: #showMotorBlocks].
    t2 addLine.
    fillScreenFlag
        ifTrue: 
            [t2 add: 'Exit user mode' action: #fillScreenOff.
            t2 addLine.
            t2 add: 'Save image and quit' action: #saveImageForEndUser]
        ifFalse: [t2 add: 'Enter user mode' action: #fillScreenOn].
    t2 localize.
    #(3 4 5 ) do: [:t3 | t2 labels at: t3 put: ((t2 labels at: t3)
                copyFrom: 1 to: (t2 labels at: t3) size - 1)
                , ScratchTranslator ellipsesSuffix].
    t2 invokeOn: self at: t1 bottomLeft + (0 @ 10)! !


!ScriptableScratchMorph methodsFor: 'other ops'!
customBlockAttributeNames
    ^ #('background #' '-' 'x position' 'y position' 'direction' 'costume #' 'size' 'volume' ) collect: [:t1 | t1]! !


!SpriteArgMorph methodsFor: 'event handling'!
presentMenu
    | t1 t2 t3 t4 t5 t6 |
    (t1 _ self ownerThatIsA: ScratchFrameMorph)
        ifNil: 
            [t6 _ self ownerThatIsA: BlockEditorFrameMorph.
            t6 ifNil: [^ self].
            (t1 _ t6 scratchFrame) ifNil: [^ self]].
    (owner isKindOf: CommandBlockMorph)
        ifTrue: [t2 _ owner selector].
    t3 _ t1 scratchObjects.
    t3 sort: [:t7 :t8 | t7 objName asLowercase < t8 objName asLowercase].
    t4 _ CustomMenu new.
    t2 = #getAttribute:of:
        ifTrue: [t4 add: 'Stage' localized asUTF8 action: t1 workPane]
        ifFalse: 
            [t4 add: 'mouse-pointer' localized asUTF8 action: #mouse.
            t2 = #touching:
                ifTrue: [t4 add: 'edge' localized asUTF8 action: #edge]
                ifFalse: [t2 = #doCustomBlock
                        ifTrue: 
                            [t4 add: 'Stage' localized asUTF8 action: t1 workPane.
                            t4 add: 'edge' localized asUTF8 action: #edge]].
            t3 _ t3 copyWithout: owner receiver].
    t3 size > 0 ifTrue: [t4 addLine].
    t3 do: [:t9 | t4 add: t9 objName action: t9].
    (t5 _ t4 startUp) ifNil: [^ self].
    morph _ t5.
    self fixGetAttribueBlock.
    self updateLabel! !

One problem: You can't save a custom block with a custom menu (it goes all error on you if you try). I hope you can fix this.


The glass is never half full nor half empty; it is twice as large as it needs to be.

Offline

 

#497 2010-02-10 23:33:35

fanofcena
Scratcher
Registered: 2008-07-03
Posts: 1000+

Re: ITopic: Build Your Own Blocks (BYOB)

somelia wrote:

Paddle2See wrote:

Jens, this is simply amazing!  Astounding!  Incredible!  The first routine I made was "Previous Costume" - it felt so good to be able to hide that ugly equation neatly away in a routine where it belongs!  From my first baby steps, I will now stride forth confidently.  Thank you!

How on earth did you do a "previous costume" block?!?!

Its simple make a block in byob and enter the command.
switch to costume (costume - 1)


http://i53.tinypic.com/2vxr2c0.png Click whats above u might make a cute planet happy ^_^

Offline

 

#498 2010-02-11 06:01:05

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: ITopic: Build Your Own Blocks (BYOB)

teaser for the next version of BYOB

have a look at Brian Harvey's website: http://www.eecs.berkeley.edu/~bh/
scroll down to where there are screenshots of Scratch and look closely at the one labelled "Hint"  smile


Jens Mönig

Offline

 

#499 2010-02-11 06:07:11

fanofcena
Scratcher
Registered: 2008-07-03
Posts: 1000+

Re: ITopic: Build Your Own Blocks (BYOB)

wow if its like that then for sure BYOB is going to pawn C++


http://i53.tinypic.com/2vxr2c0.png Click whats above u might make a cute planet happy ^_^

Offline

 

#500 2010-02-11 11:49:34

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: ITopic: Build Your Own Blocks (BYOB)

Jens wrote:

teaser for the next version of BYOB

have a look at Brian Harvey's website: http://www.eecs.berkeley.edu/~bh/
scroll down to where there are screenshots of Scratch and look closely at the one labelled "Hint"  smile

TOTAL AWESOMENESS!!!!! WHEN WILL IT COME OUT?!?!?!


http://block.site90.net/scratch.mit/text.php?size=30&amp;text=%20A%20signature!&amp;color=333333

Offline

 

Board footer