First block: [show cursor [] while] (C-block)
First put this into the Cursor class: (located in Graphics-Display Objects)
cursorFor: t1
t1 = 'blank' ifTrue: [^ Cursor blank].
t1 = 'bottomLeft' ifTrue: [^ Cursor bottomLeft].
t1 = 'bottomRight' ifTrue: [^ Cursor bottomRight].
t1 = 'corner' ifTrue: [^ Cursor corner].
t1 = 'crossHair' ifTrue: [^ Cursor crossHair].
t1 = 'down' ifTrue: [^ Cursor down].
t1 = 'execute' ifTrue: [^ Cursor execute].
t1 = 'eyeDropper' ifTrue: [^ Cursor eyeDropper].
t1 = 'handClosed' ifTrue: [^ Cursor handClosed].
t1 = 'handOpen' ifTrue: [^ Cursor handOpen].
t1 = 'marker' ifTrue: [^ Cursor marker].
t1 = 'menu' ifTrue: [^ Cursor menu].
t1 = 'move' ifTrue: [^ Cursor move].
t1 = 'normal' ifTrue: [^ Cursor normal].
t1 = 'origin' ifTrue: [^ Cursor origin].
t1 = 'paintBucket' ifTrue: [^ Cursor paintBucket].
t1 = 'questionMark' ifTrue: [^ Cursor questionMark].
t1 = 'read' ifTrue: [^ Cursor read].
t1 = 'resizeCorner' ifTrue: [^ Cursor resizeCorner].
t1 = 'resizeHorizontally' ifTrue: [^ Cursor resizeHorizontally].
t1 = 'rightArrow' ifTrue: [^ Cursor rightArrow].
t1 = 'square' ifTrue: [^ Cursor square].
t1 = 'stamp' ifTrue: [^ Cursor stamp].
t1 = 'topLeft' ifTrue: [^ Cursor topLeft].
t1 = 'topRight' ifTrue: [^ Cursor topRight].
t1 = 'up' ifTrue: [^ Cursor up].
t1 = 'wait' ifTrue: [^ Cursor wait].
t1 = 'write' ifTrue: [^ Cursor write].
^ Cursor normalNow, put this in ScratchProcess:
showCursorWhile
| t1 t2 t3 t4 |
t1 _ stackFrame expression.
t2 _ stackFrame arguments.
t2 size = 0
ifTrue:
[t3 _ t1 argumentAt: 1.
^ self pushStackFrame: (ScratchStackFrame new expression: t3)].
(Cursor cursorFor: t2 first) show.
self popStackFrame.
t4 _ t1 firstBlockList asOrderedCollection.
t4 add: (CommandBlockMorph new commandSpec: 'temp';
selector: #resetCursor;
receiver: ScratchSpriteMorph new).
t4 _ t4 asArray.
self pushStackFrame: (ScratchStackFrame new expression: t4)If you want to make a menu for the cursors, put this in ScriptableScratchMorph:
cursors
^ #('blank' 'bottomLeft' 'bottomRight' 'corner' 'crossHair' 'down' 'execute' 'eyeDropper' 'handClosed' 'handOpen' 'marker' 'menu' 'move' 'origin' 'paintBucket' 'questionMark' 'read' 'resizeCorner' 'resizeHorizontally' 'rightArrow' 'square' 'stamp' 'topLeft' 'topRight' 'up' 'wait' 'write' ) collect: [:t1 | t1]and you should know how to make a menu for that.
The next block is a [launch] C-block.
This block 'launches' a script; it starts a process for the blocks contained, but doesn't wait for it to complete. This is like using the [broadcast] block, but it doesn't have lag.
Again, put this code into ScratchProcess:
doLaunchScript
| t1 t2 |
t1 _ stackFrame expression.
self popStackFrame.
t2 _ t1 nestedBlock receiver ownerThatIsA: ScratchStageMorph.
t2 startProcessFor: t1 nestedBlockThe next block is a [tell [sprite] to] C-block.
Again, put this into ScratchProcess:
doTellSpriteTo
| t1 t2 t3 |
t1 _ stackFrame expression.
t2 _ stackFrame arguments.
t2 size = 0
ifTrue:
[t3 _ t1 argumentAt: 1.
^ self pushStackFrame: (ScratchStackFrame new expression: t3)].
self popStackFrame.
t3 _ t1 fullCopy.
t3 firstBlockList do: [:t4 | t4 receiver: (ScriptableScratchMorph new coerceSpriteArg: t2 first)].
self pushStackFrame: (ScratchStackFrame new expression: t3 firstBlockList)and go to SpriteArgMorph presentMenu and where it says
(sel/t2) = #getAttribute:of:
change it to say
(#(#getAttribute:of: #broadcast:toSprite: #stopAllSpritesScripts: #doTellSpriteTo ) includes: (sel/t2))
(Depending on what version of Scratch you're using, it may say 'sel' or 't2'.)
Next block: [broadcast [] to sprite []] (Normal)
Put this in ScriptableScratchMorph:
broadcast: t1 toSprite: t2
(self coerceSpriteArg: t2)
eventReceived: (ScratchEvent new
name: t1
argument: 0Next block: [stop all []'s scripts] (Normal)
Put this in ScriptableScratchMorph:
stopAllSpritesScripts: t1
| t2 t3 |
t2 _ self coerceSpriteArg: t1.
t3 _ ScratchProcess allInstances select: [:t4 | t4 stackFrame expression receiver == t2].
t3 do: [:t5 | t5 stop]And the blockSpecs for these blocks are:
('broadcast %e to sprite %m' #- #broadcast:toSprite:) ('tell %m to' #c #doTellSpriteTo) ('launch' #c #doLaunchScript) ('stop all %m ''s scripts' #- #stopAllSpritesScripts:) ('show cursor %s while' #c #showCursorWhile)Let me know if any of these blocks don't work or you're having problems.
And finally, REMEMBER TO GIVE ME CREDIT!
Offline
Cool. I'm using this.
Offline
TheSuccessor wrote:
Cool. I'm using this.
Oh yeah BTW Successor, I like your icon.![]()
I hate IE also.
Last edited by rubiks_cube_guy238 (2010-10-03 08:43:51)
Offline
Oh master of the Execution Engine, can you fix this?
An example script using these blocks:
Code:
doForItemsInList
| t1 t2 t3 t4 t5 |
t1 _ stackFrame expression.
t2 _ stackFrame arguments.
t2 size = 0
ifTrue:
[t3 _ t1 argumentAt: 1.
^ self pushStackFrame: (ScratchStackFrame new expression: t3)].
t3 _ t2 first.
t4 _ t1 receiver lineCountOfList: t3 asString.
t5 _ stackFrame startTime.
t5 ifNil: [t5 _ 1].
t5 > t4
ifFalse:
[self popStackFrameNoUnhightlight.
t1 receiver currentLoopItem: (t1 receiver getLine: t5 ofList: t3).
self pushStackFrame: (ScratchStackFrame new expression: t1 firstBlockList).
stackFrame startTime: t5 + 1.
^ self].
self popStackFrameHope you can understand what it does.
Offline
I have added an instance variable called currentLoopItem to ScriptableScratchMorph.
currentLoopItem: t1 (the one for ScratchProcess)
currentLoopItem _ t1
currentLoopItem (the one for the block)
^ currentLoopItem
Offline
rubiks_cube_guy238 wrote:
First block: [show cursor [] while] (C-block)
First put this into the Cursor class: (located in Graphics-Display Objects)Code:
cursorFor: t1 t1 = 'blank' ifTrue: [^ Cursor blank]. t1 = 'bottomLeft' ifTrue: [^ Cursor bottomLeft]. t1 = 'bottomRight' ifTrue: [^ Cursor bottomRight]. t1 = 'corner' ifTrue: [^ Cursor corner]. t1 = 'crossHair' ifTrue: [^ Cursor crossHair]. t1 = 'down' ifTrue: [^ Cursor down]. t1 = 'execute' ifTrue: [^ Cursor execute]. t1 = 'eyeDropper' ifTrue: [^ Cursor eyeDropper]. t1 = 'handClosed' ifTrue: [^ Cursor handClosed]. t1 = 'handOpen' ifTrue: [^ Cursor handOpen]. t1 = 'marker' ifTrue: [^ Cursor marker]. t1 = 'menu' ifTrue: [^ Cursor menu]. t1 = 'move' ifTrue: [^ Cursor move]. t1 = 'normal' ifTrue: [^ Cursor normal]. t1 = 'origin' ifTrue: [^ Cursor origin]. t1 = 'paintBucket' ifTrue: [^ Cursor paintBucket]. t1 = 'questionMark' ifTrue: [^ Cursor questionMark]. t1 = 'read' ifTrue: [^ Cursor read]. t1 = 'resizeCorner' ifTrue: [^ Cursor resizeCorner]. t1 = 'resizeHorizontally' ifTrue: [^ Cursor resizeHorizontally]. t1 = 'rightArrow' ifTrue: [^ Cursor rightArrow]. t1 = 'square' ifTrue: [^ Cursor square]. t1 = 'stamp' ifTrue: [^ Cursor stamp]. t1 = 'topLeft' ifTrue: [^ Cursor topLeft]. t1 = 'topRight' ifTrue: [^ Cursor topRight]. t1 = 'up' ifTrue: [^ Cursor up]. t1 = 'wait' ifTrue: [^ Cursor wait]. t1 = 'write' ifTrue: [^ Cursor write]. ^ Cursor normal
Super-mega-optimization:
cursorFor: t1
(self respondsTo: t1 asSymbol) ifTrue: [^ self perform: t1 asSymbol].
^ self normalLast edited by nXIII (2010-10-03 12:07:58)
Offline
nXIII wrote:
rubiks_cube_guy238 wrote:
First block: [show cursor [] while] (C-block)
First put this into the Cursor class: (located in Graphics-Display Objects)Code:
cursorFor: t1 t1 = 'blank' ifTrue: [^ Cursor blank]. t1 = 'bottomLeft' ifTrue: [^ Cursor bottomLeft]. t1 = 'bottomRight' ifTrue: [^ Cursor bottomRight]. t1 = 'corner' ifTrue: [^ Cursor corner]. t1 = 'crossHair' ifTrue: [^ Cursor crossHair]. t1 = 'down' ifTrue: [^ Cursor down]. t1 = 'execute' ifTrue: [^ Cursor execute]. t1 = 'eyeDropper' ifTrue: [^ Cursor eyeDropper]. t1 = 'handClosed' ifTrue: [^ Cursor handClosed]. t1 = 'handOpen' ifTrue: [^ Cursor handOpen]. t1 = 'marker' ifTrue: [^ Cursor marker]. t1 = 'menu' ifTrue: [^ Cursor menu]. t1 = 'move' ifTrue: [^ Cursor move]. t1 = 'normal' ifTrue: [^ Cursor normal]. t1 = 'origin' ifTrue: [^ Cursor origin]. t1 = 'paintBucket' ifTrue: [^ Cursor paintBucket]. t1 = 'questionMark' ifTrue: [^ Cursor questionMark]. t1 = 'read' ifTrue: [^ Cursor read]. t1 = 'resizeCorner' ifTrue: [^ Cursor resizeCorner]. t1 = 'resizeHorizontally' ifTrue: [^ Cursor resizeHorizontally]. t1 = 'rightArrow' ifTrue: [^ Cursor rightArrow]. t1 = 'square' ifTrue: [^ Cursor square]. t1 = 'stamp' ifTrue: [^ Cursor stamp]. t1 = 'topLeft' ifTrue: [^ Cursor topLeft]. t1 = 'topRight' ifTrue: [^ Cursor topRight]. t1 = 'up' ifTrue: [^ Cursor up]. t1 = 'wait' ifTrue: [^ Cursor wait]. t1 = 'write' ifTrue: [^ Cursor write]. ^ Cursor normalSuper-mega-optimization:
Code:
cursorFor: t1 (self respondsTo: t1 asSymbol) ifTrue: [^ self perform: t1 asSymbol]. ^ self normal
Lol!
They can't be that much of an expert then
nXIII: Please see my post here
Last edited by Sperry (2010-10-03 12:11:16)

Offline
rubiks_cube_guy238 wrote:
cursors
^ #('blank' 'bottomLeft' 'bottomRight' 'corner' 'crossHair' 'down' 'execute' 'eyeDropper' 'handClosed' 'handOpen' 'marker' 'menu' 'move' 'origin' 'paintBucket' 'questionMark' 'read' 'resizeCorner' 'resizeHorizontally' 'rightArrow' 'square' 'stamp' 'topLeft' 'topRight' 'up' 'wait' 'write' ) collect: [:t1 | t1]
WAIT A SECOND!
WhAt ThE hEcK?!?!?
cursors
^ #(blank bottomLeft bottomRight corner crossHair down execute eyeDropper handClosed handOpen marker menu move origin paintBucket questionMark read resizeCorner resizeHorizontally rightArrow square stamp topLeft topRight up wait write)Last edited by nXIII (2010-10-03 12:15:25)
Offline
nXIII wrote:
rubiks_cube_guy238 wrote:
cursors
^ #('blank' 'bottomLeft' 'bottomRight' 'corner' 'crossHair' 'down' 'execute' 'eyeDropper' 'handClosed' 'handOpen' 'marker' 'menu' 'move' 'origin' 'paintBucket' 'questionMark' 'read' 'resizeCorner' 'resizeHorizontally' 'rightArrow' 'square' 'stamp' 'topLeft' 'topRight' 'up' 'wait' 'write' ) collect: [:t1 | t1]WAIT A SECOND!
WhAt ThE hEcK?!?!?Code:
cursors ^ #(blank bottomLeft bottomRight corner crossHair down execute eyeDropper handClosed handOpen marker menu move origin paintBucket questionMark read resizeCorner resizeHorizontally rightArrow square stamp topLeft topRight up wait write)
Oops.
Well, go complain to the Scratch Team, will ya? You find the same mistake in ScratchSpriteMorph attributeNames.
attributeNames
^ #('x position' 'y position' 'direction' 'costume #' 'costume name' 'size' 'volume' ) collect: [:t1 | t1]
Offline
rubiks_cube_guy238 wrote:
First block: [show cursor [] while] (C-block)
First put this into the Cursor class: (located in Graphics-Display Objects)Code:
cursorFor: t1 t1 = 'blank' ifTrue: [^ Cursor blank]. t1 = 'bottomLeft' ifTrue: [^ Cursor bottomLeft]. t1 = 'bottomRight' ifTrue: [^ Cursor bottomRight]. t1 = 'corner' ifTrue: [^ Cursor corner]. t1 = 'crossHair' ifTrue: [^ Cursor crossHair]. t1 = 'down' ifTrue: [^ Cursor down]. t1 = 'execute' ifTrue: [^ Cursor execute]. t1 = 'eyeDropper' ifTrue: [^ Cursor eyeDropper]. t1 = 'handClosed' ifTrue: [^ Cursor handClosed]. t1 = 'handOpen' ifTrue: [^ Cursor handOpen]. t1 = 'marker' ifTrue: [^ Cursor marker]. t1 = 'menu' ifTrue: [^ Cursor menu]. t1 = 'move' ifTrue: [^ Cursor move]. t1 = 'normal' ifTrue: [^ Cursor normal]. t1 = 'origin' ifTrue: [^ Cursor origin]. t1 = 'paintBucket' ifTrue: [^ Cursor paintBucket]. t1 = 'questionMark' ifTrue: [^ Cursor questionMark]. t1 = 'read' ifTrue: [^ Cursor read]. t1 = 'resizeCorner' ifTrue: [^ Cursor resizeCorner]. t1 = 'resizeHorizontally' ifTrue: [^ Cursor resizeHorizontally]. t1 = 'rightArrow' ifTrue: [^ Cursor rightArrow]. t1 = 'square' ifTrue: [^ Cursor square]. t1 = 'stamp' ifTrue: [^ Cursor stamp]. t1 = 'topLeft' ifTrue: [^ Cursor topLeft]. t1 = 'topRight' ifTrue: [^ Cursor topRight]. t1 = 'up' ifTrue: [^ Cursor up]. t1 = 'wait' ifTrue: [^ Cursor wait]. t1 = 'write' ifTrue: [^ Cursor write]. ^ Cursor normalNow, put this in ScratchProcess:
Code:
showCursorWhile | t1 t2 t3 t4 | t1 _ stackFrame expression. t2 _ stackFrame arguments. t2 size = 0 ifTrue: [t3 _ t1 argumentAt: 1. ^ self pushStackFrame: (ScratchStackFrame new expression: t3)]. (Cursor cursorFor: t2 first) show. self popStackFrame. t4 _ t1 firstBlockList asOrderedCollection. t4 add: (CommandBlockMorph new commandSpec: 'temp'; selector: #resetCursor; receiver: ScratchSpriteMorph new). t4 _ t4 asArray. self pushStackFrame: (ScratchStackFrame new expression: t4)If you want to make a menu for the cursors, put this in ScriptableScratchMorph:
Code:
cursors ^ #('blank' 'bottomLeft' 'bottomRight' 'corner' 'crossHair' 'down' 'execute' 'eyeDropper' 'handClosed' 'handOpen' 'marker' 'menu' 'move' 'origin' 'paintBucket' 'questionMark' 'read' 'resizeCorner' 'resizeHorizontally' 'rightArrow' 'square' 'stamp' 'topLeft' 'topRight' 'up' 'wait' 'write' ) collect: [:t1 | t1]and you should know how to make a menu for that.
The next block is a [launch] C-block.
This block 'launches' a script; it starts a process for the blocks contained, but doesn't wait for it to complete. This is like using the [broadcast] block, but it doesn't have lag.
Again, put this code into ScratchProcess:Code:
doLaunchScript | t1 t2 | t1 _ stackFrame expression. self popStackFrame. t2 _ t1 nestedBlock receiver ownerThatIsA: ScratchStageMorph. t2 startProcessFor: t1 nestedBlockThe next block is a [tell [sprite] to] C-block.
Again, put this into ScratchProcess:Code:
doTellSpriteTo | t1 t2 t3 | t1 _ stackFrame expression. t2 _ stackFrame arguments. t2 size = 0 ifTrue: [t3 _ t1 argumentAt: 1. ^ self pushStackFrame: (ScratchStackFrame new expression: t3)]. self popStackFrame. t3 _ t1 fullCopy. t3 firstBlockList do: [:t4 | t4 receiver: (ScriptableScratchMorph new coerceSpriteArg: t2 first)]. self pushStackFrame: (ScratchStackFrame new expression: t3 firstBlockList)and go to SpriteArgMorph presentMenu and where it says
Code:
(sel/t2) = #getAttribute:of:change it to say
Code:
(#(#getAttribute:of: #broadcast:toSprite: #stopAllSpritesScripts: #doTellSpriteTo ) includes: (sel/t2))(Depending on what version of Scratch you're using, it may say 'sel' or 't2'.)
Next block: [broadcast [] to sprite []] (Normal)
Put this in ScriptableScratchMorph:Code:
broadcast: t1 toSprite: t2 (self coerceSpriteArg: t2) eventReceived: (ScratchEvent new name: t1 argument: 0Next block: [stop all []'s scripts] (Normal)
Put this in ScriptableScratchMorph:Code:
stopAllSpritesScripts: t1 | t2 t3 | t2 _ self coerceSpriteArg: t1. t3 _ ScratchProcess allInstances select: [:t4 | t4 stackFrame expression receiver == t2]. t3 do: [:t5 | t5 stop]And the blockSpecs for these blocks are:
Code:
('broadcast %e to sprite %m' #- #broadcast:toSprite:) ('tell %m to' #c #doTellSpriteTo) ('launch' #c #doLaunchScript) ('stop all %m ''s scripts' #- #stopAllSpritesScripts:) ('show cursor %s while' #c #showCursorWhile)Let me know if any of these blocks don't work or you're having problems.
And finally, REMEMBER TO GIVE ME CREDIT!
not working. What kind in Scratch Procces?

kinker style! [url]
[/url]♬♫ 92% of teens have moved on to rap. If you are part of the 8% who still listen to real music, copy and paste this into your signature. ♫♪Offline
kinker wrote:
not working. What kind in Scratch Procces?
Could you be a little bit more descriptive?
Offline
nXIII wrote:
jackrulez wrote:
cursorFor: should be this:
Code:
cursorFor: t1 ^ Cursor t1FAIL.
no... that won't work at all.
(_ _) Crud.
Offline
jackrulez wrote:
nXIII wrote:
jackrulez wrote:
cursorFor: should be this:
Code:
cursorFor: t1 ^ Cursor t1FAIL.
no... that won't work at all.
(_ _) Crud.
YouFail.ORGFail!
Offline
Bump post 5.
Offline
TheSuccessor wrote:
Bump post 5.
I HATE THE 60s RULE!
Offline
I'm trying to make a block from blockspecs block (in Slash, based on BYOB, so it's possible without major messing)
My not working code is:
blockSpecsBlock: t1 ^ self blockFromSpec: t1 color: (ScriptableScratchMorph blockColorFor: 'more')
What's wrong?
If nothing is wrong, what should I put in for the input as opposed to the normal blockspecs.
Offline
Billybob-Mario wrote:
I'm trying to make a block from blockspecs block (in Slash, based on BYOB, so it's possible without major messing)
My not working code is:Code:
blockSpecsBlock: t1 ^ self blockFromSpec: t1 color: (ScriptableScratchMorph blockColorFor: 'more')What's wrong?
If nothing is wrong, what should I put in for the input as opposed to the normal blockspecs.
It returns an instance of CommandBlockMorph (or maybe a lambda since it's in BYOB). What do you want it to do?
Offline
Bump post 5.
Down with 60s rule!
Offline
TheSuccessor wrote:
Billybob-Mario wrote:
I'm trying to make a block from blockspecs block (in Slash, based on BYOB, so it's possible without major messing)
My not working code is:Code:
blockSpecsBlock: t1 ^ self blockFromSpec: t1 color: (ScriptableScratchMorph blockColorFor: 'more')What's wrong?
If nothing is wrong, what should I put in for the input as opposed to the normal blockspecs.It returns an instance of CommandBlockMorph (or maybe a lambda since it's in BYOB). What do you want it to do?
It doesn't work. What's wrong?
Offline
Billybob-Mario wrote:
I'm trying to make a block from blockspecs block (in Slash, based on BYOB, so it's possible without major messing)
My not working code is:Code:
blockSpecsBlock: t1 ^ self blockFromSpec: t1 color: (ScriptableScratchMorph blockColorFor: 'more')What's wrong?
If nothing is wrong, what should I put in for the input as opposed to the normal blockspecs.
I know what's wrong. Change the code to this:
blockSpecsBlock: t1 ^ self blockFromSpec: (ScriptableScratchMorph parseCommandSpec: t1) color: (ScriptableScratchMorph blockColorFor: 'more')
Offline
rubiks_cube_guy238 wrote:
Billybob-Mario wrote:
I'm trying to make a block from blockspecs block (in Slash, based on BYOB, so it's possible without major messing)
My not working code is:Code:
blockSpecsBlock: t1 ^ self blockFromSpec: t1 color: (ScriptableScratchMorph blockColorFor: 'more')What's wrong?
If nothing is wrong, what should I put in for the input as opposed to the normal blockspecs.I know what's wrong. Change the code to this:
Code:
blockSpecsBlock: t1 ^ self blockFromSpec: (ScriptableScratchMorph parseCommandSpec: t1) color: (ScriptableScratchMorph blockColorFor: 'more')
I did that and I tried it by putting in:
('me' #r #yourself)but it didn't work. Something is wrong, but is it in the code or in what I put in?
Offline
rubiks_cube_guy238 wrote:
Billybob-Mario wrote:
I'm trying to make a block from blockspecs block (in Slash, based on BYOB, so it's possible without major messing)
My not working code is:Code:
blockSpecsBlock: t1 ^ self blockFromSpec: t1 color: (ScriptableScratchMorph blockColorFor: 'more')What's wrong?
If nothing is wrong, what should I put in for the input as opposed to the normal blockspecs.I know what's wrong. Change the code to this:
Code:
blockSpecsBlock: t1 ^ self blockFromSpec: (ScriptableScratchMorph parseCommandSpec: t1) color: (ScriptableScratchMorph blockColorFor: 'more')
I'm sorry, it should be
blockSpecsBlock: t1 ^ self blockFromSpec: (CommandBlockMorph parseCommandSpec: t1) color: (ScriptableScratchMorph blockColorFor: 'more')
Offline