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

#1251 2010-11-01 09:46:19

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Cool custom blocks in Scratch

zorket wrote:

thesuccessor wrote:

self randomFrom: 1 to: 6, I think but I haven't got Scratch open so I can't be sure.

We can gain more codes by opening squeak. In the pick random code where I just checked, contains something else.

what do you mean by that??

Offline

 

#1252 2010-11-01 10:12:43

gog1
Scratcher
Registered: 2010-10-22
Posts: 17

Re: Cool custom blocks in Scratch

LS97 wrote:

randalpik wrote:

I can't figure out how to make the Graphic effect reporter block... can someone help?

Here it is just quickly. i've got hw to do now!

Code:

getEffect: t1 
    filterPack ifNil: [^ 0].
    'blur' = t1 ifTrue: [^ filterPack blur].
    'brightness' = t1 ifTrue: [^ filterPack brightnessShift].
    'fisheye' = t1 ifTrue: [^ filterPack fisheye].
    'color' = t1 ifTrue: [^ filterPack hueShift].
    'colour' = t1 ifTrue: [^ filterPack hueShift].
    'mosaic' = t1 ifTrue: [^ filterPack mosaicCount].
    'pixelate' = t1 ifTrue: [^ filterPack pixelateCount].
    'pointillize' = t1 ifTrue: [^ filterPack pointillizeSize].
    'saturation' = t1 ifTrue: [^ filterPack saturationShift].
    'transparency' = t1 | ('ghost' = t1) ifTrue: [^ self transparency].
    'whirl' = t1 ifTrue: [^ filterPack whirl]

Hope it helps.

where do you put it?


Hi!

Offline

 

#1253 2010-11-01 10:16:23

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Cool custom blocks in Scratch

gog1 wrote:

LS97 wrote:

randalpik wrote:

I can't figure out how to make the Graphic effect reporter block... can someone help?

Here it is just quickly. i've got hw to do now!

Code:

getEffect: t1 
    filterPack ifNil: [^ 0].
    'blur' = t1 ifTrue: [^ filterPack blur].
    'brightness' = t1 ifTrue: [^ filterPack brightnessShift].
    'fisheye' = t1 ifTrue: [^ filterPack fisheye].
    'color' = t1 ifTrue: [^ filterPack hueShift].
    'colour' = t1 ifTrue: [^ filterPack hueShift].
    'mosaic' = t1 ifTrue: [^ filterPack mosaicCount].
    'pixelate' = t1 ifTrue: [^ filterPack pixelateCount].
    'pointillize' = t1 ifTrue: [^ filterPack pointillizeSize].
    'saturation' = t1 ifTrue: [^ filterPack saturationShift].
    'transparency' = t1 | ('ghost' = t1) ifTrue: [^ self transparency].
    'whirl' = t1 ifTrue: [^ filterPack whirl]

Hope it helps.

where do you put it?

i would suggest ScriptableScratchMorph -> looks ops

Offline

 

#1254 2010-11-01 17:22:04

zorket
Scratcher
Registered: 2010-05-25
Posts: 500+

Re: Cool custom blocks in Scratch

(e) another block like pi.
blockspec:

('e' #r #giveCircleSecondThing)

Code:

giveCircleSecondThing
^  2.71828183

Last edited by zorket (2010-11-02 08:58:12)


Marzipan11 must learn to not spoil

Offline

 

#1255 2010-11-01 18:00:20

bbbeb
Scratcher
Registered: 2009-06-11
Posts: 1000+

Re: Cool custom blocks in Scratch

OK change giveCircleSecondThing to this:

Code:

giveCircleSecondThing
^ 

 2.718281828459045235360287471352662497757247093699959574966
967627724076630353547594571382178525166427427466391932003059
921817413596629043572900334295260595630738132328627943490763
233829880753195251019011573834187930702154089149934884167509
244761460668082264800168477411853742345442437107539077744992
069551702761838606261331384583000752044933826560297606737113
200709328709127443747047230696977209310141692836819025515108
657463772111252389784425056953696770785449969967946864454905
987931636889230098793127736178215424999229576351482208269895
193668033182528869398496465105820939239829488793320362509443
117301238197068416140397019837679320683282376464804295311802
328782509819455815301756717361332069811250996181881593041690
351598888519345807273866738589422879228499892086805825749279
610484198444363463244968487560233624827041978623209002160990
235304369941849146314093431738143640546253152096183690888707
016768396424378140592714563549061303107208510383750510115747
704171898610687396965521267154688957035035402123407849819334
321068170121005627880235193033224745015853904730419957777093
503660416997329725088687696640355570716226844716256079882651
787134195124665201030592123667719432527867539855894489697096
409754591856956380236370162112047742722836489613422516445078
182442352948636372141740238893441247963574370263755294448337
998016125492278509257782562092622648326277933386566481627725
164019105900491644998289315056604725802778631864155195653244
258698294695930801915298721172556347546396447910145904090586
298496791287406870504895858671747985466775757320568128845920
541334053922000113786300945560688166740016984205580403363795
376452030402432256613527836951177883863874439662532249850654
995886234281899707733276171783928034946501434558897071942586
398772754710962953741521115136835062752602326484728703920764

Last edited by bbbeb (2010-11-01 18:00:48)


Back in my day.... there were no laws that censored the internet... now, there are.... nah.

Offline

 

#1256 2010-11-01 20:13:22

zorket
Scratcher
Registered: 2010-05-25
Posts: 500+

Re: Cool custom blocks in Scratch

bbbeb wrote:

OK change giveCircleSecondThing to this:

Code:

giveCircleSecondThing
^ 

 2.718281828459045235360287471352662497757247093699959574966
967627724076630353547594571382178525166427427466391932003059
921817413596629043572900334295260595630738132328627943490763
233829880753195251019011573834187930702154089149934884167509
244761460668082264800168477411853742345442437107539077744992
069551702761838606261331384583000752044933826560297606737113
200709328709127443747047230696977209310141692836819025515108
657463772111252389784425056953696770785449969967946864454905
987931636889230098793127736178215424999229576351482208269895
193668033182528869398496465105820939239829488793320362509443
117301238197068416140397019837679320683282376464804295311802
328782509819455815301756717361332069811250996181881593041690
351598888519345807273866738589422879228499892086805825749279
610484198444363463244968487560233624827041978623209002160990
235304369941849146314093431738143640546253152096183690888707
016768396424378140592714563549061303107208510383750510115747
704171898610687396965521267154688957035035402123407849819334
321068170121005627880235193033224745015853904730419957777093
503660416997329725088687696640355570716226844716256079882651
787134195124665201030592123667719432527867539855894489697096
409754591856956380236370162112047742722836489613422516445078
182442352948636372141740238893441247963574370263755294448337
998016125492278509257782562092622648326277933386566481627725
164019105900491644998289315056604725802778631864155195653244
258698294695930801915298721172556347546396447910145904090586
298496791287406870504895858671747985466775757320568128845920
541334053922000113786300945560688166740016984205580403363795
376452030402432256613527836951177883863874439662532249850654
995886234281899707733276171783928034946501434558897071942586
398772754710962953741521115136835062752602326484728703920764

Too long for it to process.  sad


Marzipan11 must learn to not spoil

Offline

 

#1257 2010-11-02 14:20:46

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Cool custom blocks in Scratch

zorket wrote:

bbbeb wrote:

OK change giveCircleSecondThing to this:

Code:

giveCircleSecondThing
^ 

 2.718281828459045235360287471352662497757247093699959574966
967627724076630353547594571382178525166427427466391932003059
921817413596629043572900334295260595630738132328627943490763
233829880753195251019011573834187930702154089149934884167509
244761460668082264800168477411853742345442437107539077744992
069551702761838606261331384583000752044933826560297606737113
200709328709127443747047230696977209310141692836819025515108
657463772111252389784425056953696770785449969967946864454905
987931636889230098793127736178215424999229576351482208269895
193668033182528869398496465105820939239829488793320362509443
117301238197068416140397019837679320683282376464804295311802
328782509819455815301756717361332069811250996181881593041690
351598888519345807273866738589422879228499892086805825749279
610484198444363463244968487560233624827041978623209002160990
235304369941849146314093431738143640546253152096183690888707
016768396424378140592714563549061303107208510383750510115747
704171898610687396965521267154688957035035402123407849819334
321068170121005627880235193033224745015853904730419957777093
503660416997329725088687696640355570716226844716256079882651
787134195124665201030592123667719432527867539855894489697096
409754591856956380236370162112047742722836489613422516445078
182442352948636372141740238893441247963574370263755294448337
998016125492278509257782562092622648326277933386566481627725
164019105900491644998289315056604725802778631864155195653244
258698294695930801915298721172556347546396447910145904090586
298496791287406870504895858671747985466775757320568128845920
541334053922000113786300945560688166740016984205580403363795
376452030402432256613527836951177883863874439662532249850654
995886234281899707733276171783928034946501434558897071942586
398772754710962953741521115136835062752602326484728703920764

Too long for it to process.  sad

well, in fact, the program will only process it to about 20 decimal places (i think its about that) then round it. so no use in making it longer!

(that's why you dont use it for math)

Offline

 

#1258 2010-11-02 14:30:42

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: Cool custom blocks in Scratch

If you return it as a string you can get the entire thing. And e has (almost) nothing to do with circles. Random fact: e^(iπ) = -1. I found a proof in Professor Stewart's Cabinet of Mathematical Curiosities. (Or maybe Hoard of Mathematical Treasures.) They're both good books. I recommend them.

Last edited by TheSuccessor (2010-11-02 14:31:23)


/* No comment */

Offline

 

#1259 2010-11-02 14:44:49

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: Cool custom blocks in Scratch

TheSuccessor wrote:

If you return it as a string you can get the entire thing. And e has (almost) nothing to do with circles. Random fact: e^(iπ) = -1. I found a proof in Professor Stewart's Cabinet of Mathematical Curiosities. (Or maybe Hoard of Mathematical Treasures.) They're both good books. I recommend them.

Oh yea, what is it... e^iθ = i cos θ - sin θ? I forget....


nXIII

Offline

 

#1260 2010-11-02 14:59:33

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: Cool custom blocks in Scratch

I used to think math was no fun,
'Cause I couldn't see how it was done.
Now Euler's my hero,
For I see why zero
Equals e to the iπ plus one.


/* No comment */

Offline

 

#1261 2010-11-03 02:33:07

me450
Scratcher
Registered: 2009-03-31
Posts: 56

Re: Cool custom blocks in Scratch

a new block

bounce

Code:

bounce
    self rotationDegrees: rotationDegrees + 180

blockspec

Code:

('bounce' #- #bounce)

Last edited by me450 (2010-11-03 02:33:44)

Offline

 

#1262 2010-11-03 04:43:44

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Cool custom blocks in Scratch

me450 wrote:

a new block

bounce

Code:

bounce
    self rotationDegrees: rotationDegrees + 180

blockspec

Code:

('bounce' #- #bounce)

unfortunately, the bounce script you're looking for is a bit more complicated than that. many good projects already use the proper version, you might want to try and look for it for then translating it into squeak!

Offline

 

#1263 2010-11-03 17:38:18

zorket
Scratcher
Registered: 2010-05-25
Posts: 500+

Re: Cool custom blocks in Scratch

a new block

offline error

Code:

offlineError
^ 5 // 0

blockspec

Code:

('offline error' #r #offlineError)

but untested  sad

Last edited by zorket (2010-11-04 19:04:59)


Marzipan11 must learn to not spoil

Offline

 

#1264 2010-11-04 17:36:27

fudgepop
Scratcher
Registered: 2010-05-29
Posts: 7

Re: Cool custom blocks in Scratch

how do you make a <i recive []> Block? i need it to finish a LOT of projects

Offline

 

#1265 2010-11-04 19:02:55

zorket
Scratcher
Registered: 2010-05-25
Posts: 500+

Re: Cool custom blocks in Scratch

fudgepop wrote:

how do you make a <i recive []> Block? i need it to finish a LOT of projects

Place it in control.

Blockspec:

('I receive %e' #b #seesBroadcast:)

Code under other ops:

Code:

seesBroadcast: t1 
    | t2 |
    t2 _ ScratchEvent allInstances.
    t2
        reverseDo:     
            [:t3 | 
            t3 name = t1 ifTrue: [^ true].
            nil].
    ^ false

Credit to rubics cube guy238 for the code.
Do not upload, for 2 reasons:
1. It becomes obsolete!
2. It doesn't work online (really.)

Last edited by zorket (2010-11-04 19:03:40)


Marzipan11 must learn to not spoil

Offline

 

#1266 2010-11-06 12:19:31

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

Re: Cool custom blocks in Scratch

[blocks]<<goto URL(  )in a new browser>[/blocks]
would be awesome!


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

 

#1267 2010-11-06 14:04:21

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: Cool custom blocks in Scratch

ScratchPlugin primOpenUrl: 'http://web.address/'


/* No comment */

Offline

 

#1268 2010-11-08 02:24:42

me450
Scratcher
Registered: 2009-03-31
Posts: 56

Re: Cool custom blocks in Scratch

[REQUEST]

could someone please make a import and export list block

Thanks

Last edited by me450 (2010-11-08 02:26:11)

Offline

 

#1269 2010-11-08 02:28:50

me450
Scratcher
Registered: 2009-03-31
Posts: 56

Re: Cool custom blocks in Scratch

[Tutorial - Compile to exe with custom blocks]
1. Download latest BYOB
2. go to BYOB folder
3. Look for BYOB Development.BAT
4. change shortcut to open that file
5. open BYOB via shortcut of batch file
6. Shift click edit
7. turn fill screen off
8. add all your custom blocks and use BYOBS compiler to compile your projects

Offline

 

#1270 2010-11-11 11:24:29

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Cool custom blocks in Scratch

me450 wrote:

[REQUEST]

could someone please make a import and export list block

Thanks

just use the write to file and join list blocks in bingo 1.3 and combine them!  smile

Last edited by LS97 (2010-11-11 11:25:17)

Offline

 

#1271 2010-11-11 12:03:44

zorket
Scratcher
Registered: 2010-05-25
Posts: 500+

Re: Cool custom blocks in Scratch

Here's my tutorial:

1.) Open scratch, shift click in the loop in R:
http://t1.gstatic.com/images?q=tbn:2LXlcbdIgjwJsM:http://www.media.mit.edu/research/Display/scratch-logo.gif?ID=2695
Open the editor.
Then click on the white space that appears, go to open-browser.
2.) The browser should look like:
http://www.gershmer.net/runtimeimage/runtime4.jpeg You really should be working on 1.4.
Go above, and click scratch objects.
[Scratch sprite morph for sprite only blocks, Scratch stage morph for stage blocks only, and ScriptableScratchMorph for both, go to ScriptableScratchMorph in the example, please]
Then you go LOW and press class. then go to the third pane, click blockspecs//scratch. In the 4th pane, blockspecs.
3.) Here's a really hard step. You have to locate yourself where the blockspec goes!
Alright. If you are following the tutorial, you should be in ScriptableScratchMorph.
Find 'control'. look across the line, and you will see a #-. Use a #- when you want to put a space in. And you will find a ('repeat %n' #c #doRepeat 10).

Code:

The block contents is first in the brackets. There have to be brackets for strings, always. example: 'repeat %n'
________________________
The #c tells what type of block this is. Here is a list:
#-   no arguments (command or 'stack' block)
#r   Reporter block (the round ones)
#b   boolean block (diamond shaped)
#c   C shaped block (like the forever block)
#t   Time block (like wait X secs)
#W   'when' hat block (obsolete)
#S   start button click hat block
#K   key-activated hat block
#E   event hat block (broadcast)
#s   special form (hard to code)
Credit to ls97 for this list.
______________________
The #doRepeat 10 is the command. It has to be exact to the name of the code.

You also might be wondering what the %n is doing there.
This indicates a numberical inserter. Here is a list of them:

Code:

a:  attribute of another sprite, such as X position or size.
b:  a boolean inserter
c:  a colour picker that shows the menu.
C:  a colour picker that doesn't
d:  the sprite direction menu/numerical inserter.
D:  the menu for midi drums
e:  The broadcast message menu
f:  math function menu (with sin, abs, etc.)
g:  menu for the different graphic effects.
h:  numerical sensor board selector menu
H:  boolean sensor board selector menu
i:  midi instrument menu/numerical inserter
k:  menu for the names of the different keys, used in the key sensor blocks.
l:  menu with the costume names of the given sprite.
L:  list name menu.
m:  sprite list
n:  numerical inserter
N:  note name menu/inserter
s:  string inserter
S:  sound selector menu
v:  variable labels menu
y:  menu used to delete either a number of the last value or all of a list.

Credit to ls97 and billyedward for this list.
Alright, for the tutorial, were gonna make the ( report (hello) ) block. Add the blockspec: ('report %s' #r #report: 'hello') Place it in control or operators.


4.) Now were going to move on to codes. Some blocks already have the code installed.
For the ( report (hello) ) block were doing, there is a place were gonna put this code.
Click on instance in the 2nd pane low. In the third pane, other ops, and the 4th, add new code or replace any code. Use the code for the ( report (hello) ) block:

Code:

report: t1
^ t1

this is the short code. Accept.
I'm gonna help you figure out more stuff. Here's an extra-long helpers code:

Code:

report: t1
| t2 t3 |
t1 _ t2
t2 _ t3
t3 = t1 ifTrue: [^ t1]

The | t2 t3| adds the variables t2 and t3 to the code.
t1 _ t2 makes t2 equal t1.
t2 _ t3 makes t3 equal t2.
t3 = t1 ifTrue: [^ t1] checks if t3 = t1, if it does, it does the command inside [], and ^ makes it report t1 (the string)
There you go! With a little practice, you can make your own blocks! Oh, I almost forgot. Close the green code, and turn fill screen on with the first in step 1. If you are positive you want this block permonant, use the shift-click methood and click save-image.

With this tutorial, there are no bondaries for blocks.
You can even make a [if touching (a sprite), die] block!!!


Marzipan11 must learn to not spoil

Offline

 

#1272 2010-11-11 17:06:12

bbbeb
Scratcher
Registered: 2009-06-11
Posts: 1000+

Re: Cool custom blocks in Scratch

zorket wrote:

really long tutorial

Zorket, you use a lot of space for every tutorial. Makybe you could make a thread for these?  big_smile


Back in my day.... there were no laws that censored the internet... now, there are.... nah.

Offline

 

#1273 2010-11-11 20:20:26

me450
Scratcher
Registered: 2009-03-31
Posts: 56

Re: Cool custom blocks in Scratch

LS97 wrote:

me450 wrote:

[REQUEST]

could someone please make a import and export list block

Thanks

just use the write to file and join list blocks in bingo 1.3 and combine them!  smile

ok

ill try that

EDIT:

i need a password to open bingo's image

EDIT:

found a thread NXIII posted it

its sunny

Last edited by me450 (2010-11-12 00:46:44)

Offline

 

#1274 2010-11-12 07:43:47

bbbeb
Scratcher
Registered: 2009-06-11
Posts: 1000+

Re: Cool custom blocks in Scratch

....


Back in my day.... there were no laws that censored the internet... now, there are.... nah.

Offline

 

#1275 2010-11-12 11:00:01

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Cool custom blocks in Scratch

me450 wrote:

LS97 wrote:

me450 wrote:

[REQUEST]

could someone please make a import and export list block

Thanks

just use the write to file and join list blocks in bingo 1.3 and combine them!  smile

ok

ill try that

EDIT:

i need a password to open bingo's image

you dont need a password to combine blocks... Squeak isnt always the simplest answer to everything!

what a nice 1000th post  tongue

Last edited by LS97 (2010-11-12 11:32:43)

Offline

 

Board footer