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
. 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
i have downloaded but not sure how to work it can anyone help
Offline
lapinater12 wrote:
i have downloaded but not sure how to work it can anyone help
![]()
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!
Offline
yeh but those blocks wont do anything p.s how do you share projects on byob
Offline
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.
Offline
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
Offline
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.
![]()
were do you do this
Offline
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
how do you make a block like<touching color[
Offline
lapinater12 wrote:
how do you make a block like<touching color[
Theres a boolean setting, but i think you already know that.
Offline
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.
Offline
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?
Offline
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)
Offline
Jens wrote:
BYOB has a built-in compiler, accessible under the SHARE menu
Never saw that, thanks.
Offline
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
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:
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.
Offline
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)
Offline
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"
Offline
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"![]()
TOTAL AWESOMENESS!!!!! WHEN WILL IT COME OUT?!?!?!
Offline