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

#1 2012-02-10 05:46:55

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Need a Scratch patch

Can someone write something which broadcasts the text "command-[methodname]" whenever a block is evaluated?


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#2 2012-02-10 06:19:05

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Need a Scratch patch

Got it!
It's a two-line patch, so I'll just dictate it to you.

Navigate to Scratch-Blocks > CommandBlockMorph (instance) > evaluation > evaluateWithArgs:

Declare the variable "stage" at the top.

After the special cases section, so before the very last line of code, add the following:

(stage _ self receiver ownerThatIsA: ScratchStageMorph).
    stage broadcast: self selector.

It might not be the best way, but it's definitely the quickest  smile

Last edited by LS97 (2012-02-10 06:19:41)

Offline

 

#3 2012-02-10 06:21:33

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Need a Scratch patch

Oh, the code above only broadcasts the selector. If you want it to broadcast the 'command-' bit too, just concatenate it with a comma.

Offline

 

#4 2012-02-10 06:24:36

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: Need a Scratch patch

LS97 wrote:

Got it!
It's a two-line patch, so I'll just dictate it to you.

Navigate to Scratch-Blocks > CommandBlockMorph (instance) > evaluation > evaluateWithArgs:

Declare the variable "stage" at the top.

After the special cases section, so before the very last line of code, add the following:

(stage _ self receiver ownerThatIsA: ScratchStageMorph).
    stage broadcast: self selector.

It might not be the best way, but it's definitely the quickest  smile

*jaw drops*

How can you amaze me with perfect solutions every time?

Thanks!  big_smile


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#5 2012-02-10 06:27:22

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Need a Scratch patch

Hardmath123 wrote:

*jaw drops*

How can you amaze me with perfect solutions every time?

Thanks!  big_smile

Experience  big_smile

I did spend quite a bit of time developing Bingo, so I got accustomed with Squeak. Now these challenges are actually quite fun  smile

Offline

 

#6 2012-02-10 09:39:34

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

Re: Need a Scratch patch

Why do you need this? It seems like and odd thing to broadcast.  tongue


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

Offline

 

#7 2012-02-10 10:52:41

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Need a Scratch patch

MathWizz wrote:

Why do you need this? It seems like and odd thing to broadcast.  tongue

My guess? He's working on a language within Scratch and is using broadcasts to trigger different blocks...


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#8 2012-02-10 11:19:40

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: Need a Scratch patch

sparks wrote:

MathWizz wrote:

Why do you need this? It seems like and odd thing to broadcast.  tongue

My guess? He's working on a language within Scratch and is using broadcasts to trigger different blocks...

Nah, something for my iOS to Scratch connector.


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#9 2012-02-21 02:44:08

GP1
Scratcher
Registered: 2009-07-06
Posts: 1000+

Re: Need a Scratch patch

LS97 wrote:

Hardmath123 wrote:

*jaw drops*

How can you amaze me with perfect solutions every time?

Thanks!  big_smile

Experience  big_smile

I did spend quite a bit of time developing Bingo, so I got accustomed with Squeak. Now these challenges are actually quite fun  smile

I have no idea how much Squeak I know....
I just know my understanding of it is raising each time I develop Kitcat.  big_smile


I am currently http://blocks.scratchr.org/API.php?user=GP1&action=onlineStatus&type=imagehttp://blocks.scratchr.org/API.php?user=GP1&action=onlineStatus&type=text and I finally got over 1000 posts.

Offline

 

Board footer