GP1 wrote:
Make a block that changes pitch with a mic so that you can have a sprite move up and down according to your pitch.PLEASE?
I believe there's a block for that already...
Offline
LS97 wrote:
GP1 wrote:
Make a block that changes pitch with a mic so that you can have a sprite move up and down according to your pitch.PLEASE?
I believe there's a block for that already...
Made by Jens as a change set (in 1.3)
Offline
johnnydean1 wrote:
LS97 wrote:
GP1 wrote:
Make a block that changes pitch with a mic so that you can have a sprite move up and down according to your pitch.PLEASE?
I believe there's a block for that already...
Made by Jens as a change set (in 1.3)
Smalltalk cannot read Pitch. It has been confirmed already.
It is sad.
Offline
pen13 wrote:
a log off block
if you mean log off scratch, i think it is:
spec:
('log off scratch' #- #logOff)
method (other ops):
logOff Cursor wait showWhile: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/logout']
Offline
me450 wrote:
zorket wrote:
NOTE:
There's a second, more advanced version of the block, with a drop-down menu instead of a string inserter, but it involves extra coding. If you are willing to take the challenge, post and i'll edit this tutorial for youim fine with extra advanced tutorial as it would produce less errors
please post
Thanks (:I've copied his way exactly. here it is:
ok. note that this is for the source code. if you are using normal scratch replace the 'code' with 't2'
into Scratch-Blocks > CommandBlockMorph > all > uncoloredArgMorphFor:
add a line that looks like this:
$t = code ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #timeDates].
back in ScriptableScratchMorph, create a new method with this code:timeDates
^ #('time' 'date' 'short date' 'seconds' 'minutes' 'seconds' 'hours' 'weekday')now replace the blockSpec you created with ('get %t' r getDate: 'time')
Replace the code with:Code:
getTime: t1 t1 = 'date' ifTrue: [^ Date today]. t1 = 'short date' ifTrue: [^ Date today printFormat: #(1 2 3 $- 2 2 )]. t1 = 'time' ifTrue: [^ Time now]. t1 = 'seconds' ifTrue: [^ Time now seconds]. t1 = 'minutes' ifTrue: [^ Time now minutes]. t1 = 'hours' ifTrue: [^ Time now hours]. t1 = 'weekday' ifTrue: [^ Date today weekday]. ^ 'Error!'___________________________________________
I've edited the tutorial a little. LYSD didn't post the tutorial correctly.thanks
ive edited it a bit to make it work on normal scratch
and also it says error when i use the block
thanks
the 'getDate' part in the blockspec has to be replaced with 'getTime'.
I also have two more date pieces to insert in the 'getTime code:
t1 = 'month' ifTrue: [^ Date today month]. t1 = 'year' ifTrue: [^ Date today year].
After you placed the code, insert this strip into the 'timeDates' code after 'weekdays':
'month' 'year'
Now you can view month (month with year) and year alone with your 'get time/date ' block!
Last edited by Marioblender (2011-01-19 21:17:38)
Offline
jcml wrote:
can you make me a (last brodcasted) block
PLEASE!!!
This block works, but for some reason, there is a separate block for each sprite. (i.e. each sprite has a checkmark next to this block, but all the values are the same. Does that make sense?)
Go to Scratch-Objects>>ScriptableScratchMorph
Add a class variable called LastMessage. To do this, find the list of class variables, and add LastMessage to it, separated from the other items with a space. This would probably make the code look like this:
Morph subclass: #ScriptableScratchMorph instanceVariableNames: 'objName vars lists blocksBin isClone media costume costumeChangeMSecs filterPack visibility volume tempoBPM sceneStates ' classVariableNames: 'BlockColorDict BlockSpecDict DefaultBackgroundForm DefaultSpriteForm DoubleSize Experimental LastMessage ListBlockColor MeowSound OldMeowPrefixReversed PopSound RandomGen Recorder ScratchOrigin TimerStartMSecs ' poolDictionaries: '' category: 'Scratch-Objects'
Then go to Scratch-Objects>>ScriptableScratchMorph>>accessing
Replace the text at the bottom with the following code.
lastMessage ^ LastMessage
Save that (Alt+S) then click accessing again. The text at the bottom should be replaced by the method template. Replace that with:
lastMessage: t1 LastMessage _ t1
Then go to Scratch-Objects>>ScriptableScratchMorph>>other ops>>broadcast:
Replace the text there with:
broadcast: t1 self broadcast: t1 withArgument: 0. self lastMessage: t1
Go to Scratch-Objects>>ScriptableScratchMorph>>other ops>>broadcast:withArgument:
Replace the text there with:
broadcast: t1 withArgument: t2 | t3 | (t3 _ self ownerThatIsA: ScratchStageMorph) ifNotNil: [t3 broadcastEventNamed: t1 asString with: t2]. self lastMessage: t1
Finally, go to Scratch-Objects>>ScriptableScratchMorph>>class>>block specs>>blockSpecs
Choose where to put your block, and add the following block spec:
('last broadcast' #r #lastMessage)
If someone finds a problem in my work, or finds a better way to do it, please correct me.
Offline
It works!
If you go to Scratch-Blocks>>CommandBlockMorph>>private>>canBecomeWatcher and add the text #lastMessage with the rest, it won't show on the stage.
Offline
Can someone please make me a booklean version of the "When I recieve block"? PLEASE
Offline
('%e received?' #b #seesBroadcast:)
seesBroadcast: t1
| t2 |
t2 _ ScratchEvent allInstances.
t2
reverseDo:
[:t3 |
t3 name = t1 ifTrue: [^ true].
nil].
^ false
Credit to rubiks_cube_guy238 and (i think) nXIII.
Last edited by bbbeb (2011-01-26 14:20:45)
Offline
scimonster wrote:
It works!
If you go to Scratch-Blocks>>CommandBlockMorph>>private>>canBecomeWatcher and add the text #lastMessage with the rest, it won't show on the stage.
That sort of solves the problem. You see, the problem is not that it shows on the Stage, it's that it shows as a local variable of each sprite. For example, "answer" is a global variable, and is shown on the stage once.
last broadcasted shows up on the stage separately for each sprite, but they all have the same value because you can't have local broadcasts.
like this:
Last edited by hpotter134 (2011-01-26 17:45:18)
Offline
I know. I don't know where is the thing that determines if it's global or sprite specific. Probably in Scratch-UI-Watchers.
Offline
bbbeb wrote:
('%e received?' #b #seesBroadcast:)
seesBroadcast: t1
| t2 |
t2 _ ScratchEvent allInstances.
t2
reverseDo:
[:t3 |
t3 name = t1 ifTrue: [^ true].
nil].
^ falseCredit to rubiks_cube_guy238 and (i think) nXIII.
This doesn't work
Offline
Lightning1234 wrote:
bbbeb wrote:
('%e received?' #b #seesBroadcast:)
seesBroadcast: t1
| t2 |
t2 _ ScratchEvent allInstances.
t2
reverseDo:
[:t3 |
t3 name = t1 ifTrue: [^ true].
nil].
^ falseCredit to rubiks_cube_guy238 and (i think) nXIII.
This doesn't work
Put the 1st one in the category:
Scratch-Objects -> ScriptableScratchMorph -> Classes -> Block Specs -> Blockspecs
Put the 2nd one in:
Scratch-Objects -> ScriptableScratchMorph -> Instance -> Other ops
Offline
scimonster wrote:
I know. I don't know where is the thing that determines if it's global or sprite specific. Probably in Scratch-UI-Watchers.
I did a bit of searching, and found this method at Scratch-Objects>>ScriptableScratchMorph>>class>>other>>isSpriteSpecificTarget:Selector:
Here's the code currently there.
isSpriteSpecificTarget: t1 selector: t2 | t3 | (t1 isKindOf: ScratchSpriteMorph) ifFalse: [^ false]. t3 _ t2 asString findAnySubStr: #('answer' 'key' 'Loud' 'mouse' 'sensor' 'soundLevel' 'tempo' 'timer' ) startingAt: 1. ^ t3 > t2 asString size
Could someone please explain this to me? For last broadcast, it returns true, which causes my problem. I tried just writing ^false, and it worked fine, but local variables no longer had the name of the sprite before them.
I found this method through Scratch-UI-Watchers>>WatcherMorph>>initialization>>target:selector:parameter.
It would help if someone explained that to me too...I'm rather confused...
Offline
OMG this thread has grown so much... i have not been on it in a while, so long in fact that i forgot how to program my own blocks... guess i'll have to check up on that.
I bet i missed so many block ideas... the last time i checked there were 30 pages...
Offline
[blocks]<when[ any ]key pressed>
<key[ any ]pressed?>
I would like these blocks.
I tried making them myself but failed.
I would like mabye a tutoriol.
More blocks requested:
<change[ blur ]effect by( 25 )
<set pen color to( r: g: b: ) [/blocks]
Last edited by marley2002 (2011-01-30 04:38:34)
Offline
zorket wrote:
zorket wrote:
I am trying to make a [Draw square] block. Here my current code:
Code:
drawSquare self putPenUp. self referencePosition: -100 @ 100. self penDown. self referencePosition: 100 @ 100. self referencePosition: 100 @ -100. self referencePosition: -100 @ -100. self referencePosition: -100 @ 100. self putPenUpThis code doesn't seem to work. Maybe try and stretch it's activation out a little?
No, you never put pen down; it starts with PutPenUp!
Offline
Hey! I found out how to make repeats!
I wrote:
Here's how (follow this pattern):
Code:
<selector name> | repeatclient | repeatclient _ <number of times it should repeat> self <selector name> + <repeatno: repeatclient>Code:
<selector name> + <repeatno: repeatclient> repeatclient = 0 ifTrue: [^ self]. <coding to be repeated> self <selector name> + <repeatno: repeatclient - 1>
Quoted from the block library
Last edited by Hardmath123 (2011-01-30 05:19:08)
Offline
hpotter134 wrote:
scimonster wrote:
I know. I don't know where is the thing that determines if it's global or sprite specific. Probably in Scratch-UI-Watchers.
I did a bit of searching, and found this method at Scratch-Objects>>ScriptableScratchMorph>>class>>other>>isSpriteSpecificTarget:Selector:
Here's the code currently there.Code:
isSpriteSpecificTarget: t1 selector: t2 | t3 | (t1 isKindOf: ScratchSpriteMorph) ifFalse: [^ false]. t3 _ t2 asString findAnySubStr: #('answer' 'key' 'Loud' 'mouse' 'sensor' 'soundLevel' 'tempo' 'timer' ) startingAt: 1. ^ t3 > t2 asString sizeCould someone please explain this to me? For last broadcast, it returns true, which causes my problem. I tried just writing ^false, and it worked fine, but local variables no longer had the name of the sprite before them.
I did it! If you add 'Message' to the list in the above method, it is shown as a global variable!
Offline
I don't think you ever gave the link to the show/hide list blocks, so here it is: http://scratch.mit.edu/forums/viewtopic.php?id=32494 by nXIII
Offline
muddyfish wrote:
How do you make it so that it asks you things like broadcast(
list here...
)
what do you mean?
Offline