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

#1 2011-01-27 16:43:19

jcml
Scratcher
Registered: 2010-10-08
Posts: 12

Advanced squeakers HELP!

i need a blokspec code and any other code to get a [blocks] <when I receive[ something ] [/blocks] to have a %s string inserter like a could put a varible in it

and the same with the (slider sensor value) block HELP PLEASE i will give anyone who tells me alot of love-its
please HELP!


I need help for one huge a mesh game i need to no how to make a world-wide scratch program if you have any idea's just coment on one of my projects

Offline

 

#2 2011-03-11 16:54:33

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

Re: Advanced squeakers HELP!

I will do this.


♫ 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

 

#3 2011-03-11 18:18:36

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

Re: Advanced squeakers HELP!

By the way, I had the same problem, and it turns out that the |broadcast []| block does accept dropped reporters (including variables.) Just make a new broadcast for each possible variable value (unless there are infinite variable values.)
I am working on the new hat block.


♫ 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

 

#4 2011-03-11 20:40:54

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: Advanced squeakers HELP!

I tried changing acceptsDroppedReoprters in EventTitleMorph by making it return true, and making it return "owner isKindOf: EventHatMorph", and neither worked. Weird.


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#5 2011-03-11 20:55:35

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

Re: Advanced squeakers HELP!

Make a new class.

Code:

WhenHatBlockMorph subclass: #SpecialRecievedHatBlockMorph
    instanceVariableNames: ''
    classVariableNames: ''
    poolDictionaries: ''
    category: 'Scratch-Blocks'

and include these methods:

Code:

argMorphToReplace: t1 
    t1 ~= argMorph ifTrue: [^ nil].
    ^ ExpressionArgMorph new stringExpression: ''

Code:

evaluateCondition
    ^ false

Code:

eventName
    ^ argMorph evaluate

Code:

initialize
    super initialize.
    self removeAllMorphs.
    argMorph _ ExpressionArgMorph new stringExpression: ''.
    self addMorphBack: ((StringMorph contents: 'when I receive' localized font: (ScratchFrameMorph getFont: #Label))
            color: Color white).
    self addMorphBack: argMorph

Code:

startForEvent: t1 
    | t2 |
    t1 name = 'Scratch-KeyPressedEvent' ifFalse: [scratchProc ifNotNil: [self stop]].
    self hasRunningProcess ifTrue: [^ nil].
    scriptOwner ifNil: [^ nil].
    (t2 _ scriptOwner ownerThatIsA: ScratchStageMorph) ifNil: [^ nil].
    scratchProc _ t2 startProcessFor: self.
    self changed.
    ^ scratchProc

In ScriptableScratchMorph:
in hatBlockFromTuple:receiver: change where it says

Code:

t3 = WhenHatBlockMorph

to

Code:

t3 = WhenHatBlockMorph | (t3 = SpecialRecievedHatBlockMorph)

Then, in eventRecieved: change where it says

Code:

t4 class == EventHatMorph

to

Code:

t4 class == EventHatMorph | (t4 class == SpecialRecievedHatBlockMorph)

Finally, add the following line to hatBlockType:

Code:

'Q' = t1 ifTrue: [^ SpecialRecievedHatBlockMorph new scriptOwner: self].

Oh, yeah, and the blockSpec is

Code:

('when i recieve %s' #Q #-)

Oops! I almost forgot - there's on more change you need to make to ScriptableScratchMorph. Go to blockFromTuple:reciever:, and find this list:

Code:

#EventHatMorph #KeyEventHatMorph #MouseClickEventHatMorph #WhenHatBlockMorph

and add

Code:

#SpecialRecievedHatBlockMorph

to it.
Also, go to blockFromSpec:color: and find this list:

Code:

#E #K #M #S #W

and add

Code:

#Q

to it.
_________________________________
Does it seem like I like [code] tags?

Last edited by rubiks_cube_guy238 (2011-03-13 15:35:04)


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

Offline

 

#6 2011-03-11 21:02:42

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

Re: Advanced squeakers HELP!

As for your other question, go to ChoiceArgMorph and add/change these (I forget if they were already there or not  tongue )

Code:

acceptsDroppedReporters
    ^ true

Code:

acceptsTypeOf: t1 
    ^ true

Now, every menu argument will accept reporters!
Except, of course, menus in hat blocks  sad

Last edited by rubiks_cube_guy238 (2011-03-12 08:11:51)


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

Offline

 

#7 2011-03-12 14:59:35

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

Re: Advanced squeakers HELP!

Cool! could I add this to my new 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

 

#8 2011-03-12 15:16:16

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

Re: Advanced squeakers HELP!

Wait a minute... did you test this? It works, but it looks like a command block.


♫ 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

 

#9 2011-03-13 15:35:49

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

Re: Advanced squeakers HELP!

scratcher7_13 wrote:

Wait a minute... did you test this? It works, but it looks like a command block.

Try it now. I added two more instructions to the bottom.

You can also add it to your mod, but give credit!

Last edited by rubiks_cube_guy238 (2011-03-13 15:36:47)


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

Offline

 

#10 2011-03-13 17:56:47

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

Re: Advanced squeakers HELP!

It WORKS! Thank you!


♫ 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