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

#1 2010-10-02 16:00:59

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

Advanced Control blocks + code

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

Now, 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 nestedBlock

The 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: 0

Next 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!


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

Offline

 

#2 2010-10-02 17:18:13

bbbeb
Scratcher
Registered: 2009-06-11
Posts: 1000+

Re: Advanced Control blocks + code

Nice!

WARNING: SUPER 1337 BLOXZ aHEADZ


Back in my day.... there were no laws that censored the internet... now, there are.... nah.

Offline

 

#3 2010-10-03 06:21:08

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: Advanced Control blocks + code

Cool. I'm using this.


/* No comment */

Offline

 

#4 2010-10-03 08:43:24

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

Re: Advanced Control blocks + code

TheSuccessor wrote:

Cool. I'm using this.

Oh yeah BTW Successor, I like your icon.
http://scratch.mit.edu/static/icons/buddy/490144_med.png?t=2010-07-19+11%3A15%3A19
I hate IE also.

Last edited by rubiks_cube_guy238 (2010-10-03 08:43:51)


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

Offline

 

#5 2010-10-03 10:11:05

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: Advanced Control blocks + code

Oh master of the Execution Engine, can you fix this?
An example script using these blocks:
http://www.freeimagehosting.net/uploads/f233a06dae.gif
Code:

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 popStackFrame

Hope you can understand what it does.


/* No comment */

Offline

 

#6 2010-10-03 10:53:42

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: Advanced Control blocks + code

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


/* No comment */

Offline

 

#7 2010-10-03 12:07:19

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: Advanced Control blocks + code

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:

Code:

cursorFor: t1 
    (self respondsTo: t1 asSymbol) ifTrue: [^ self perform: t1 asSymbol].
    ^ self normal

Last edited by nXIII (2010-10-03 12:07:58)


nXIII

Offline

 

#8 2010-10-03 12:10:59

Sperry
Scratcher
Registered: 2010-03-09
Posts: 500+

Re: Advanced Control blocks + code

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 normal

Super-mega-optimization:

Code:

cursorFor: t1 
    (self respondsTo: t1 asSymbol) ifTrue: [^ self perform: t1 asSymbol].
    ^ self normal

Lol!  lol

They can't be that much of an expert then  tongue

nXIII: Please see my post here

Last edited by Sperry (2010-10-03 12:11:16)


http://img709.imageshack.us/img709/3252/gobanim2.gifhttp://ls.gd/bo

Offline

 

#9 2010-10-03 12:14:18

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: Advanced Control blocks + code

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)

Last edited by nXIII (2010-10-03 12:15:25)


nXIII

Offline

 

#10 2010-10-03 17:25:34

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

Re: Advanced Control blocks + code

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]


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

Offline

 

#11 2010-10-03 18:47:55

kinker
Scratcher
Registered: 2010-08-01
Posts: 100+

Re: Advanced Control blocks + code

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

Now, 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 nestedBlock

The 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: 0

Next 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?


Put in the weirdness: http://i54.tinypic.com/zl6fph.pnghttp://img821.imageshack.us/i/gobanim2.gif/kinker style! [url]http://internetometer.com/image/16724.png[/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

 

#12 2010-10-03 19:45:06

jackrulez
Scratcher
Registered: 2009-08-01
Posts: 1000+

Re: Advanced Control blocks + code

cursorFor: should be this:

Code:

cursorFor: t1
     ^ Cursor t1

FAIL.

Last edited by jackrulez (2010-10-03 19:47:23)


Yawn, another boring text signature. I should really make something better.

Offline

 

#13 2010-10-03 20:17:01

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: Advanced Control blocks + code

jackrulez wrote:

cursorFor: should be this:

Code:

cursorFor: t1
     ^ Cursor t1

FAIL.

no... that won't work at all.


nXIII

Offline

 

#14 2010-10-03 20:56:42

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

Re: Advanced Control blocks + code

kinker wrote:

not working. What kind in Scratch Procces?

Could you be a little bit more descriptive?


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

Offline

 

#15 2010-10-03 21:12:50

jackrulez
Scratcher
Registered: 2009-08-01
Posts: 1000+

Re: Advanced Control blocks + code

nXIII wrote:

jackrulez wrote:

cursorFor: should be this:

Code:

cursorFor: t1
     ^ Cursor t1

FAIL.

no... that won't work at all.

(_ _) Crud.


Yawn, another boring text signature. I should really make something better.

Offline

 

#16 2010-10-03 21:35:14

bbbeb
Scratcher
Registered: 2009-06-11
Posts: 1000+

Re: Advanced Control blocks + code

jackrulez wrote:

nXIII wrote:

jackrulez wrote:

cursorFor: should be this:

Code:

cursorFor: t1
     ^ Cursor t1

FAIL.

no... that won't work at all.

(_ _) Crud.

YouFail.ORGFail!


Back in my day.... there were no laws that censored the internet... now, there are.... nah.

Offline

 

#17 2010-10-04 11:25:21

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: Advanced Control blocks + code

Bump post 5.


/* No comment */

Offline

 

#18 2010-10-05 14:43:18

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: Advanced Control blocks + code

TheSuccessor wrote:

Bump post 5.

mad  I HATE THE 60s RULE!  mad


/* No comment */

Offline

 

#19 2010-10-06 08:04:23

Billybob-Mario
Scratcher
Registered: 2008-01-05
Posts: 500+

Re: Advanced Control blocks + code

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.

Offline

 

#20 2010-10-06 12:09:08

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: Advanced Control blocks + code

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?


/* No comment */

Offline

 

#21 2010-10-06 12:10:11

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: Advanced Control blocks + code

Bump post 5.

sad   mad  Down with 60s rule!  mad   sad


/* No comment */

Offline

 

#22 2010-10-06 14:38:22

Billybob-Mario
Scratcher
Registered: 2008-01-05
Posts: 500+

Re: Advanced Control blocks + code

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

 

#23 2010-10-06 15:17:24

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

Re: Advanced Control blocks + code

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')

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

Offline

 

#24 2010-10-06 15:36:30

Billybob-Mario
Scratcher
Registered: 2008-01-05
Posts: 500+

Re: Advanced Control blocks + code

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:

Code:

('me' #r #yourself)

but it didn't work. Something is wrong, but is it in the code or in what I put in?

Offline

 

#25 2010-10-06 15:50:46

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

Re: Advanced Control blocks + code

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

Code:

blockSpecsBlock: t1

^ self blockFromSpec: (CommandBlockMorph parseCommandSpec: t1) color: (ScriptableScratchMorph blockColorFor: 'more')

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

Offline

 

Board footer