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

#26 2010-10-06 16:19:19

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

Re: Advanced Control blocks + code

rubiks_cube_guy238 wrote:

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

It still doesn't work.

Offline

 

#27 2010-10-08 13:59:27

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

Re: Advanced Control blocks + code

TheSuccessor wrote:

Bump post 5.


/* No comment */

Offline

 

#28 2010-10-08 16:05:18

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

Re: Advanced Control blocks + code

New blocks:

pause:

Add an instance variable to ScratchProcess called isPaused.
in ScratchProcess:

Code:

doPause
    isPaused _ true.
    self pushStackFrame: (ScratchStackFrame new shouldYield: true)

play:

in ScratchProcess:

Code:

isPaused
    ^ isPaused

in ScriptableScratchMorph:

Code:

doPlay
    | t1 |
    t1 _ ScratchProcess allInstances select: [:t2 | t2 isPaused == true].
    t1 do: [:t3 | t3 popStackFrame]

Feel free to use these, but give me credit.

Last edited by TheSuccessor (2010-10-08 16:06:47)


/* No comment */

Offline

 

#29 2010-10-08 16:08:40

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Advanced Control blocks + code

TheSuccessor wrote:

New blocks:

pause:

Add an instance variable to ScratchProcess called isPaused.
in ScratchProcess:

Code:

doPause
    isPaused _ true.
    self pushStackFrame: (ScratchStackFrame new shouldYield: true)

play:

in ScriptableScratchMorph:

Code:

doPlay
    | t1 |
    t1 _ ScratchProcess allInstances select: [:t2 | t2 isPaused == true].
    t1 do: [:t3 | t3 popStackFrame]

Feel free to use these, but give me credit.

Whats the block spec


You can now reach me on Twitter @johnnydean1_

Offline

 

#30 2010-10-08 16:14:53

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

Re: Advanced Control blocks + code

('pause' #s #doPause)
('play' #- #doPlay)


/* No comment */

Offline

 

#31 2010-10-08 16:18:27

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Advanced Control blocks + code

ok!


You can now reach me on Twitter @johnnydean1_

Offline

 

#32 2010-10-08 18:29:01

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

Re: Advanced Control blocks + code

johnnydean1 wrote:

TheSuccessor wrote:

New blocks:

pause:

Add an instance variable to ScratchProcess called isPaused.
in ScratchProcess:

Code:

doPause
    isPaused _ true.
    self pushStackFrame: (ScratchStackFrame new shouldYield: true)

play:

in ScriptableScratchMorph:

Code:

doPlay
    | t1 |
    t1 _ ScratchProcess allInstances select: [:t2 | t2 isPaused == true].
    t1 do: [:t3 | t3 popStackFrame]

Feel free to use these, but give me credit.

Whats the block spec

what kind of ScratchProcces? What kind of scriptable scratch morph?


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

 

#33 2010-10-08 20:27:37

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

Re: Advanced Control blocks + code

Billybob-Mario wrote:

rubiks_cube_guy238 wrote:

rubiks_cube_guy238 wrote:


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

It still doesn't work.

Anyone?

Offline

 

#34 2010-10-09 04:50:41

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

Re: Advanced Control blocks + code

kinker wrote:

johnnydean1 wrote:

TheSuccessor wrote:

New blocks:

pause:

Add an instance variable to ScratchProcess called isPaused.
in ScratchProcess:

Code:

doPause
    isPaused _ true.
    self pushStackFrame: (ScratchStackFrame new shouldYield: true)

play:

in ScriptableScratchMorph:

Code:

doPlay
    | t1 |
    t1 _ ScratchProcess allInstances select: [:t2 | t2 isPaused == true].
    t1 do: [:t3 | t3 popStackFrame]

Feel free to use these, but give me credit.

Whats the block spec

what kind of ScratchProcces? What kind of scriptable scratch morph?

Open browser, Scratch-Execution Engine, ScratchProcess


/* No comment */

Offline

 

#35 2011-04-21 11:32:32

zorket
Scratcher
Registered: 2010-05-25
Posts: 500+

Re: Advanced Control blocks + code

Whoah, amazing! I give credit to you for these, because I am going to put some in my MOD.


Marzipan11 must learn to not spoil

Offline

 

#36 2011-04-21 11:57:01

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

Re: Advanced Control blocks + code

kinker wrote:

johnnydean1 wrote:

TheSuccessor wrote:

New blocks:

pause:

Add an instance variable to ScratchProcess called isPaused.
in ScratchProcess:

Code:

doPause
    isPaused _ true.
    self pushStackFrame: (ScratchStackFrame new shouldYield: true)

play:

in ScriptableScratchMorph:

Code:

doPlay
    | t1 |
    t1 _ ScratchProcess allInstances select: [:t2 | t2 isPaused == true].
    t1 do: [:t3 | t3 popStackFrame]

Feel free to use these, but give me credit.

Whats the block spec

what kind of ScratchProcces? What kind of scriptable scratch morph?

- ScriptableScratchMorph: The area where you can place blocks. For both Sprite and Stage. Others, like the Sprite one and the Stage one, where block specs are there, are only for a single sprite or the stage, depending on which one you've come to.

Offline

 

#37 2011-04-21 12:07:58

scratcher7_13
Scratcher
Registered: 2011-02-09
Posts: 1000+

Re: Advanced Control blocks + code

Can I put these in my tutorial mod? (Sizzle)


♫ 90% of teens can't do math. If you are one of the 40% of teens who can, copy and paste this into your signature. ♫♪
http://dl.dropbox.com/u/6273449/BlockLibraryTitle.pnghttp://i.imgur.com/mr9Hf.gif

Offline

 

Board footer