Another BYOB block inbound from me!
Okay, this block is VERY simple, and I only made it because I don't like the text.
THE BLOCK IS: list[1]
If you know Lua, or any language similar to it, you may recognise this block as a way of getting an item of a list. Of course, that's what it does.
Downloads: Here!
Pictures: - Block look,
- Code
Offline
roijac wrote:
Hey, does any librarian have plans for S2.0? I'd love to have a gallery or something with MaB blocks from users, I'm willing to do it if nobody else wants (But I'd need the password
)
I think that may be a good idea. Galleries are known as "studios" in 2.0, though.
I would like to hear other librarians' opinions.
Offline
BYOB Blocks:
and
download(both) here
almost the same thing
Offline
DigiTechs wrote:
I have a block to submit, If you've used Lua you may understand it, if not, I'll provide a handy link to a page to explain what it means. Here it is!
Anyway here's the block! It's name is string.gsub and it's purpose is to find a substring in a string and if it matches the 2nd input then replace it with the third.
BLOCK LOOKS: HERE
CODE: HERE
BLOCK'S OUTPUT: HERE
BLOCK DOWNLOAD: HERE
EDIT: Oops. I did somthing wrong. Fixed!
only works with words. without download you can tell that
will report helloworldstring.gsub [helloworld], [lowo], [lo wo]
Offline
I have a new pen block for scratch
blockspec:
('stamp text %s at x: %n y: %n font: %G size: %n color: %c' #- #stamp:X:Y:Font:Size:Color:)
code:
stamp: t1 X: t2: Y: t3 Font: t4 Size: t5 Color: t6 | stage form canvas | (stage := self ownerThatIsA: ScratchStageMorph) ifNotNil: [stage createOrResizeTrailsForm. form := stage penTrailsForm] ifNil: [^self]. canvas := FormCanvas on: form. canvas text: t1 at: t2+240@(t3 negated + 180) font: (StrikeFont fontName: t4 size: t5) color: t6. stage changed.
Scratch-Blocks>ConnamdBlockMorph>uncoloredArgMorphFor:
$G = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #fontNames; choice: 'Times New Roman'].
Some more code:
fontNames ^ UnicodePlugin getfontList
Last edited by jslomba (2013-01-27 13:33:10)
Offline
Interest wrote:
BYOB Blocks:
http://i47.tinypic.com/wvwpok.gif
and
http://i50.tinypic.com/2h82vc6.gif
download(both) here
almost the same thing![]()
If 2 scripts are very similar except for one small thing, consider combining them.
Offline
joefarebrother wrote:
Interest wrote:
BYOB Blocks:
and
download(both) here
almost the same thing![]()
If 2 scripts are very similar except for one small thing, consider combining them.
the point is, you can't without a dropdown menu or an input, which would be very unwieldy
Offline
Interest wrote:
joefarebrother wrote:
Interest wrote:
BYOB Blocks:
http://i47.tinypic.com/wvwpok.gif
and
http://i50.tinypic.com/2h82vc6.gif
download(both) here
almost the same thing![]()
If 2 scripts are very similar except for one small thing, consider combining them.
the point is, you can't without a dropdown menu or an input, which would be very unwieldy
You could use an input that is a procedure.
Offline
here are two of my blocks (for scratch)
block 1
image at: https://527c7291-a-62cb3a1a-s-sites.googlegroups.com/site/myscratchblocks/home/screenshot45.png?attachauth=ANoY7cpnD8rR51sN58q28zy0x7JOvOCff9ZDG8_OZH7jHPf6cPVWwcdeHfcVLmkNItU_okgkcuGFw9z6RgTt-wNH7qjhhKP7KTd03ocn7rvFBHnFIvE7VAY-Rj26ax2FXc7sc3LSbeTZOOnVfJdwGO0GndJkr14GDU3xyWNPsuXg3AIL0jofeixW0waDT0LtpmFlcSvKB6vt3jZn7Nu3nwDsna81Bm68C1XOVKLited0gmlEFY4z2Ec%3D&attredirects=0
blockspec
('%s <= %s' #b #lessEqual:equalLess:)
Code
lessEqual: t1 equalLess: t2 t1 = t2 ifTrue: [^ true]. t1 < t2 ifTrue: [^ true]. ^ false
now block 2
image at: https://527c7291-a-62cb3a1a-s-sites.googlegroups.com/site/myscratchblocks/home/screenshot45.png?attachauth=ANoY7cqPVAjRrrvGxOY2d6-ykXxVkTXNMpFBOcmqOgYwL1MCaAkwn-Qu4tzY-mS_FJ_iGt9oT6JWXrS-MlgA2ErtVodm6sC43id7siG-XhpG-gQHAKasqt69LcAtAKLNqz0RPVouNaNtG7d6UMOGyZhRYelgbNai8U4eKNMCC7PXyTdyGISVWrWAPwUFChykks8DcYnPjkHuZ6xHgUE5FYhf7jl5N0FnkJqCYGEvw0G6tNiwOJAs-a8%3D&attredirects=0
('%s => %s' #b #greatEqual:equalGreat:)
Code
greatEqual: t1 equalGreat: t2 t1 = t2 ifTrue: [^ true]. t1 > t2 ifTrue: [^ true]. ^ false
And there, a <[] <= []> (less than or equal) and <[] => []> (greater than or equal) block!
Offline
New BYOB Blocks
Detect if offline/online
REQUIRES Variable:Online/Offline
script
set "Offline/Online" to [Online]
obselete!
set "Offline/Online" to [Online]
Detect Player
REQUIRES Variable:Playing
set"Playing" to [Offline]
brodcast (0/0)
set [playing] to [Online Java]
obsolete!
set [Playing] to [Flash]
Set colour effect to random
NO VARIABLES
forever
set colour effect to (pick random(1) to (10)
/forever
Offline
Here is a while block, I found it while looking in the c blocks. This one was disabled i think... well anyways...
blockspec
('while %b' #c #doWhile)
That is it! Just the block spec, nothing else needed.
Offline
Just a suggestion but can people please put the code that you put in the source code as well as the one to go into normal scratch because I'm trying to make a mod (using the source code) and when I put some of the blocks from here in, they don't work, even when I've got rid of hashes. Or can someone at least explain all the differences between the source code and normal scratch (as in tabs, hashes and other syntax/grammar changes as opposed to 'you can't upload with the source code'). Any help would be greatly appreciated.
Offline
i am doing the <last said is [hello]?> block.
first goto: Scratch-Objects >> ScratchSpriteMorph >> lookOps >> say:
Then add
Said _ t1.
WARNING: Saying must be a global variable! to do that. Just accept with that, then declare as global variable.
Also add the above code to
say:duration:elapsed:from:
Then goto class, blockspecs, blockspecs.
add
('last said was %s?' #b #lastSaid:'Hello!')
Then goto instance, look ops and add:
lastSaid: t1
t1 = Said ifTrue: [^ true].
^ false
Last edited by SFollis (2013-03-03 16:32:33)
Offline
SFollis wrote:
i am doing the <last said is [hello]?> block.
first goto: Scratch-Objects >> ScratchSpriteMorph >> lookOps >> say:
Then add
Said _ t1.
WARNING: Saying must be a global variable! to do that. Just accept with that, then declare as global variable.
Also add the above code to
say:duration:elapsed:from:
Then goto class, blockspecs, blockspecs.
add
('last said was %s?' #b #lastSaid:'Hello!')
Then goto instance, look ops and add:
lastSaid: t1
t1 = Said ifTrue: [^ true].
^ false
No, NO!! global variables should be avoided if possible!
use an instance variable for ScriptableScratchMorph instead
Offline
Interest wrote:
No, NO!! global variables should be avoided if possible!
Every single metaclass instance for a named class is a global variable. I wouldn't recommend avoiding those!
Offline
Interest wrote:
SFollis wrote:
i am doing the <last said is [hello]?> block.
first goto: Scratch-Objects >> ScratchSpriteMorph >> lookOps >> say:
Then add
Said _ t1.
WARNING: Saying must be a global variable! to do that. Just accept with that, then declare as global variable.
Also add the above code to
say:duration:elapsed:from:
Then goto class, blockspecs, blockspecs.
add
('last said was %s?' #b #lastSaid:'Hello!')
Then goto instance, look ops and add:
lastSaid: t1
t1 = Said ifTrue: [^ true].
^ falseNo, NO!! global variables should be avoided if possible!
use an instance variable for ScriptableScratchMorph instead
It doesn't let me
Offline
Hi, can I have help with a 2 blocks I'm trying to make please? The first is a 'make [sprite 1 v] do' c block. I know it's probably quite simple but I don't understand how c-blocks work. The second is like the reverse, scramble and do blocks, but uses a dropdown menu containing 'reverse' 'scramble' and 'do' because three extra c-blocks take up a lot of room in the control pallette. Thanks!
Offline
i dont really get this its confusing
Offline
and im beginning to think this uses something else,i want to make a block but i dont know what to do,and ive read everything
Offline