LS97 wrote:
The link block
Ok, finally some time to add the greatest block of all. the block links the user to a webpage, program or file as long as the path or URL is given. add in the blockspecs in the control section some kind of block code (choose whatever you want, you know how to do it). and add in the corresponding instance ops:Code:
Cursor wait showWhile: [ScratchPlugin primOpenURL: t1]So little code for such a great block... and remember to click accept!
I want the blockspec! And where exactly do I put the code? It just doesn't work for me!
Offline
Blockspec:
Source Code
('link to %s' - linkTo:)
NonSource
('link to %s' #- #linkTo:)
Code:
linkTo: url
Cursor wait showWhile: [ScratchPlugin primOpenURL: url]
Last edited by bbbeb (2010-08-26 10:33:07)
Offline
The shuffle block.
Follow this path,Scratch-Objects-->class ScriptableScratchMorph-->block specs-->block specs
Block spec under the operators:
('%s shuffled' #r #shuffle: 'world')
code that makes the block work in string ops:
shuffle: t1 ^ t1 shuffled
And there u have it!
Offline
Dominic1 wrote:
I was trying to make the showing block (I haven't made any blocks yet) and I right mouse clicked and it didn't ask me to save, just some circular buttons appeared around the browser!
Alt-click then.
Offline
How to make a password dialog:
Step 1:
Go to Scratch-UI-Dialogs > StringDialog > initialization.
Step 2:
Down in the bottom section of the browser, type "isPassword: t1". Accept, then replace "^ self" with "typeinMorph passwordMode: t1". Accept.
Step 3:
Click class, then instance creation > askWithCancel:initialAnswer
Step 4:
To the end of the bold bit, type "password: t4", then, after "initialAnswer: t2", replace the "." with a ";" and type "isPassword: t4.". Accept.
Step 5:
Click ask:, and, at the end of the bold bit, type "password: t2", then type the same right at the end. Accept.
YOU'RE DONE!!!
Wherever you want to use your password dialog, just type "StringDialog ask: 'message' password: true"!
Last edited by TheSuccessor (2010-08-26 15:31:05)
Offline
jackrulez wrote:
Dominic1 wrote:
I was trying to make the showing block (I haven't made any blocks yet) and I right mouse clicked and it didn't ask me to save, just some circular buttons appeared around the browser!
Alt-click then.
I tried that. Ctrl-click is what worked. Thanks, you gave me the idea
Offline
LS97 wrote:
The 'showing?' block
This is an easy one. It gives a boolean response (True/False) of whether the sprite is showing or not.
Like before, copy this code into the 'looks' section of blockSpecs in ScratchSpriteMorphCode:
('showing?' #b #getHidden)then go to instance, 'looks ops' and replace the code in 'hide' with the code below (by the way, you're not deleting the hide block).
Code:
getHidden self isHidden = false ifTrue: [^ true]. ^ falseThen right-click, clik accept and (maybe) type your initials. et voilà, you have your 'showing?' block up and ready.
I made the block but it didn't work. It always reported Error!
Offline
Rewind Block
-------------------------------------------------------------------
Scratch-Objects--->Class ScriptableScratchMorph--->block specs-->block specs
Block spec under the sound category
('rewind sound %S' #- #rewindSound:)
Sound Ops,
rewindSound: t1 | t2 | t2 _ self soundNamed: t1 ifAbsent: [^ self]. t2 rewindSound
And there you have it!
Offline
LS97 wrote:
The 'Get time/date' block
http://www.freeimagehosting.net/uploads/209a5b329a.gif
Here we go!
The get time/date block reports the time, date, hour, etc. without the user having to insert it manually.
Copy this line of code into a space between two blocks in the 'control' section of blockSpecs in ScriptableScratchMorph.Code:
('get %s' #r #getTime: 'date')Then go to the instance section, then to 'other ops' and replace the code of broadcast: with the following
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 = 'day' ifTrue: [^ Date today weekday]. t1 = 'help' ifTrue: [^ 'type date, short date, time, seconds, minutes, day, hours']. ^ 'Error!'then right-click and click accept. type your initials and you're ready to use the new block!
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 you
I'd like the drop down menu version
Offline
If anyone thinks that it sucks that you can't make blocks like these in BYOB, I think you actually CAN!!!!!!!
Right mouse click on a block and click edit elements. It's sort of like the squeak editor!! I'm going to try to make the link to block in BYOB!
Offline
Dominic1 wrote:
If anyone thinks that it sucks that you can't make blocks like these in BYOB, I think you actually CAN!!!!!!!
Right mouse click on a block and click edit elements. It's sort of like the squeak editor!! I'm going to try to make the link to block in BYOB!
yeah, you can. but it takes a lot because you need to go look for rach individual method in each and every individual class. and i don't always remember the Categories of the classes...
Offline
LS97 wrote:
Dominic1 wrote:
If anyone thinks that it sucks that you can't make blocks like these in BYOB, I think you actually CAN!!!!!!!
Right mouse click on a block and click edit elements. It's sort of like the squeak editor!! I'm going to try to make the link to block in BYOB!yeah, you can. but it takes a lot because you need to go look for rach individual method in each and every individual class. and i don't always remember the Categories of the classes...
Actually no, just type the lines of text in the "primitive" block and if it comes up with an error message, retype the lines of code there!!!!
I made the link block and the get block.
Offline
LS97 wrote:
johnnydean1 wrote:
Could you make me a <sprite _ touching sprite_> block
I'll try and see what i can do. Check back in a few mins, i might have it up!
EDIT: i got the block. here's the code:Code:
sprite: t1 touching: t2 | t3 | t3 _ t1 bounds intersect: t2 bounds. (t3 width > 0 and: [t3 height > 0]) ifTrue: [^ true]. ^ falsei'm so proud of myself
What the block spec?
Offline
Is it possible to make custom hat blocks? I've found the control blockspecs, but no matter what block type I mark it as (with the hashtag + letter) just gives me the appearance of the normal hat with that identifier. So if I put the tag for "when greenflag clicked", I just get a block that looks identical to it no matter what the text in quotes.
Last edited by Harakou (2010-08-27 17:18:02)
Offline
The when <> is true block.
____________________________________
block spec:
('when %W is true' #W #-)
no code.
Tada! get ready to use ur new block.
Offline
kinker wrote:
The when <> is true block.
____________________________________
block spec:Code:
('when %W is true' #W #-)no code.
Tada! get ready to use ur new block.
tisk tisk. you think it's so easy? it's not.
look at this post
Offline
Harakou wrote:
Is it possible to make custom hat blocks? I've found the control blockspecs, but no matter what block type I mark it as (with the hashtag + letter) just gives me the appearance of the normal hat with that identifier. So if I put the tag for "when greenflag clicked", I just get a block that looks identical to it no matter what the text in quotes.
and no you can't do it like that because of the blockFromSpec method which automatically adds the default text to the hat blocks. so if you want to make custom block type (for example a byte reporter) you'll have to look into
ScriptableScratchMorph > blocks > blockFromSpec:color:
and add your own letter.
that's not all done obviously...
Offline
Dominic1 wrote:
Can you make a block that opens the paint editor? I've been trying, but I can't get it to work.
if you want it to open the editor to create a new costume it's pretty easy.
i had a look at the source code and found
('paint new' - drawNewCostume)
it's as simple as that.
not sure if it works though
Offline
LS97 wrote:
The 'Get time/date' block
http://www.freeimagehosting.net/uploads/209a5b329a.gif
Here we go!
The get time/date block reports the time, date, hour, etc. without the user having to insert it manually.
Copy this line of code into a space between two blocks in the 'control' section of blockSpecs in ScriptableScratchMorph.Code:
('get %s' #r #getTime: 'date')Then go to the instance section, then to 'other ops' and replace the code of broadcast: with the following
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 = 'day' ifTrue: [^ Date today weekday]. t1 = 'help' ifTrue: [^ 'type date, short date, time, seconds, minutes, day, hours']. ^ 'Error!'then right-click and click accept. type your initials and you're ready to use the new block!
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 you
I WANT A drop down list.
Offline