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!
Offline
I will do this.
Offline
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.
Offline
I tried changing acceptsDroppedReoprters in EventTitleMorph by making it return true, and making it return "owner isKindOf: EventHatMorph", and neither worked. Weird.
Offline
Make a new class.
WhenHatBlockMorph subclass: #SpecialRecievedHatBlockMorph
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Scratch-Blocks'and include these methods:
argMorphToReplace: t1
t1 ~= argMorph ifTrue: [^ nil].
^ ExpressionArgMorph new stringExpression: ''evaluateCondition
^ falseeventName
^ argMorph evaluateinitialize
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: argMorphstartForEvent: 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.
^ scratchProcIn ScriptableScratchMorph:
in hatBlockFromTuple:receiver: change where it says
t3 = WhenHatBlockMorph
to
t3 = WhenHatBlockMorph | (t3 = SpecialRecievedHatBlockMorph)
Then, in eventRecieved: change where it says
t4 class == EventHatMorph
to
t4 class == EventHatMorph | (t4 class == SpecialRecievedHatBlockMorph)
Finally, add the following line to hatBlockType:
'Q' = t1 ifTrue: [^ SpecialRecievedHatBlockMorph new scriptOwner: self].
Oh, yeah, and the blockSpec is
('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:
#EventHatMorph #KeyEventHatMorph #MouseClickEventHatMorph #WhenHatBlockMorph
and add
#SpecialRecievedHatBlockMorph
to it.
Also, go to blockFromSpec:color: and find this list:
#E #K #M #S #W
and add
#Q
to it.
_________________________________
Does it seem like I like [code] tags?
Last edited by rubiks_cube_guy238 (2011-03-13 15:35:04)
Offline
As for your other question, go to ChoiceArgMorph and add/change these (I forget if they were already there or not
)
acceptsDroppedReporters
^ trueacceptsTypeOf: t1
^ trueNow, every menu argument will accept reporters!
Except, of course, menus in hat blocks
Last edited by rubiks_cube_guy238 (2011-03-12 08:11:51)
Offline
Cool! could I add this to my new mod? (Sizzle)
Offline
Wait a minute... did you test this? It works, but it looks like a command block.
Offline
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)
Offline
It WORKS! Thank you!
Offline