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

#1176 2011-06-11 12:30:07

TuragaTreeko
Scratcher
Registered: 2011-04-24
Posts: 100+

Re: ITopic: Welcome to your local block library!

I love doing squeak editing, but I am used to using scratch. How do you do blockspecs in panther? I am doing the block with the code

view projects page for user $String$
-
#E6A822
Cursor wait showWhile: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/users/', t1]

My blockspecs is ('open Scratch "my stuff" page for user: %s' #- #doOpen: scimonster)
But, instead of a block reading [open Scratch "my stuff" page for user (space for a user's name with default of scimonster)], I get [open Scratch "my stuff" age for user scimonster%s], with no place for a string.

HOW DO I DO PANTHER BLOCKSPECS?


http://goo.gl/RDqKF

Offline

 

#1177 2011-06-11 13:06:59

Pecola1
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: ITopic: Welcome to your local block library!

scimonster wrote:

New Panther block:
Pecola1
copy $String$ to clipboard
-
#E6A822
ScratchTranslator unicodeClipboardPut: t1
Notes:
Adds the string to your clipboard!

thanks for giving credit.  wink


If you are reading this, please read to the end, because if you don't you won't know what's at the end. Don't just skip to the end though otherwise you won't be able to read the middle, which is most important. Now you must be wondering why you just read all that, the reason is you may have not noticed something, read it again and see if you notice it this time  smile

Offline

 

#1178 2011-06-11 13:13:56

Pecola1
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: ITopic: Welcome to your local block library!

TuragaTreeko wrote:

Hardmath123 wrote:

<password for [] is []> isn't working, because the url needs to be http://..., not contentshttp://...

hmm, i've been trying to get the password block to work, and when i added that it just started saying error to everything.

yes, I believe taking off contents will work. XD Sorry about that, I don't know why I had that... or was that someone els's mistake?


If you are reading this, please read to the end, because if you don't you won't know what's at the end. Don't just skip to the end though otherwise you won't be able to read the middle, which is most important. Now you must be wondering why you just read all that, the reason is you may have not noticed something, read it again and see if you notice it this time  smile

Offline

 

#1179 2011-06-11 14:30:36

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: ITopic: Welcome to your local block library!

sparks wrote:

I have a Panther block :D I don't make blocks often but I really was getting fed up with dragging out all the blocks to make <<(mouse x) < ( )> and <(mouse x > ( )> and <mouse y < ( )> and mouse y > ( )>>. I use this one with the mouse position reporters to make check if the mouse is within a square space on the stage. Great for stamping projects where you can stamp or draw on parts of the stage but not on the toolbars to the side of the "canvas". Will add it to the library in a second!

http://welcometoyourlocalblocklibrary.w … 96.gif?346

Code:

|result|
result_true.

t1 <= t3
ifFalse:
[result_false.].

t1 >= t4
ifFalse:
[result_false.].

t2 <= t5
ifFalse:
[result_false.].

t2 >= t6
ifFalse:
[result_false.].
^result

Shouldn't it be

Code:

| result |
result _ true.

t1 <= t3
ifFalse:
[result _ false].

t1 >= t4
ifFalse:
[result _ false].

t2 <= t5
ifFalse:
[result _ false].

t2 >= t6
ifFalse:
[result _ false].
^result

The extra periods don't mess it up?

Last edited by scimonster (2011-06-11 14:32:41)

Offline

 

#1180 2011-06-11 14:50:36

Pecola1
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: ITopic: Welcome to your local block library!

scimonster wrote:

sparks wrote:

I have a Panther block  big_smile  I don't make blocks often but I really was getting fed up with dragging out all the blocks to make <<(mouse x) < ( )> and <(mouse x > ( )> and <mouse y < ( )> and mouse y > ( )>>. I use this one with the mouse position reporters to make check if the mouse is within a square space on the stage. Great for stamping projects where you can stamp or draw on parts of the stage but not on the toolbars to the side of the "canvas". Will add it to the library in a second!

http://welcometoyourlocalblocklibrary.w … 96.gif?346

Code:

|result|
result_true.

t1 <= t3
ifFalse:
[result_false.].

t1 >= t4
ifFalse:
[result_false.].

t2 <= t5
ifFalse:
[result_false.].

t2 >= t6
ifFalse:
[result_false.].
^result

Shouldn't it be

Code:

| result |
result _ true.

t1 <= t3
ifFalse:
[result _ false].

t1 >= t4
ifFalse:
[result _ false].

t2 <= t5
ifFalse:
[result _ false].

t2 >= t6
ifFalse:
[result _ false].
^result

The extra periods don't mess it up?

Scratch/Panther will remove any not needed periods.  wink


If you are reading this, please read to the end, because if you don't you won't know what's at the end. Don't just skip to the end though otherwise you won't be able to read the middle, which is most important. Now you must be wondering why you just read all that, the reason is you may have not noticed something, read it again and see if you notice it this time  smile

Offline

 

#1181 2011-06-11 14:51:26

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: ITopic: Welcome to your local block library!

Pecola1 wrote:

scimonster wrote:

sparks wrote:

I have a Panther block :D I don't make blocks often but I really was getting fed up with dragging out all the blocks to make <<(mouse x) < ( )> and <(mouse x > ( )> and <mouse y < ( )> and mouse y > ( )>>. I use this one with the mouse position reporters to make check if the mouse is within a square space on the stage. Great for stamping projects where you can stamp or draw on parts of the stage but not on the toolbars to the side of the "canvas". Will add it to the library in a second!

http://welcometoyourlocalblocklibrary.w … 96.gif?346

Code:

|result|
result_true.

t1 <= t3
ifFalse:
[result_false.].

t1 >= t4
ifFalse:
[result_false.].

t2 <= t5
ifFalse:
[result_false.].

t2 >= t6
ifFalse:
[result_false.].
^result

Shouldn't it be

Code:

| result |
result _ true.

t1 <= t3
ifFalse:
[result _ false].

t1 >= t4
ifFalse:
[result _ false].

t2 <= t5
ifFalse:
[result _ false].

t2 >= t6
ifFalse:
[result _ false].
^result

The extra periods don't mess it up?

Scratch/Panther will remove any not needed periods. ;)

Oh.

Offline

 

#1182 2011-06-11 16:17:07

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: ITopic: Welcome to your local block library!

^ Whoops - I hadn't programmed in smalltalk for aaages and forgot where it needed periods. It works so I assumed it was right  tongue

TuragaTreeko wrote:

I love doing squeak editing, but I am used to using scratch. How do you do blockspecs in panther? I am doing the block with the code

view projects page for user $String$
-
#E6A822
Cursor wait showWhile: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/users/', t1]

My blockspecs is ('open Scratch "my stuff" page for user: %s' #- #doOpen: scimonster)
But, instead of a block reading [open Scratch "my stuff" page for user (space for a user's name with default of scimonster)], I get [open Scratch "my stuff" age for user scimonster%s], with no place for a string.

HOW DO I DO PANTHER BLOCKSPECS?

The $String$ is the Panther equivalent to %s. So your blockspec needs to be

Code:

open Scratch "my stuff" page for user: $String$

The parenthesis ( '(' ) in your blockspec aren't needed. Instead of describing the block type in the spec via #- you put the dash in the little box in the top-right corner of the "make a block" window. That path #doOpen: scimonster is also not needed. In Scratch this would connect the blockspec to the block's code but in Panther the code is in the box below so this isn't needed. In the same way, don't start your code in Panther with the address scimonster:

so you're looking at this code:

box 1 (the long one at the top of the window)

Code:

open Scratch "my stuff" page for user: $String$

box 2 (the tiny one in the corner)

Code:

-

Box 3 (the main large one)

Code:

Cursor wait showWhile: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/users/', t1]

Hope this helps!


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#1183 2011-06-11 18:25:06

jslomba
Scratcher
Registered: 2009-09-25
Posts: 1000+

Re: ITopic: Welcome to your local block library!

new block:
http://newblocks.weebly.com/uploads/7/1/5/6/7156046/8459236.gif
if you have the (1/2 of ( ) ) block already, then you don't need to make the uncoloredArgMorph.

blockspec:

(' %z as decimal' #r #decimalOf:)

code:

decimalOf: t1
'1/2' = t1 ifTrue: [^ '.5'].
'1/3' = t1 ifTrue: [^ '.333333333'].
'1/4' = t1 ifTrue: [^ '.25'].
'1/5' = t1 ifTrue: [^ '.2'].
'1/6' = t1 ifTrue: [^ '.666666666'].
'1/7' = t1 ifTrue: [^ '.1428'].
'1/8' = t1 ifTrue: [^ '.125'].
'1/9' = t1 ifTrue: [^ '.111111111'].
'1/10' = t1 ifTrue: [^ '.1'].

Last edited by jslomba (2011-06-11 18:25:27)


the the the the the

Offline

 

#1184 2011-06-12 05:07:30

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: ITopic: Welcome to your local block library!

Image tags are removed and replaced with links when you quote someone, laWIESs  smile  The images looks fine to me in the original post  smile


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#1185 2011-06-12 08:00:04

jslomba
Scratcher
Registered: 2009-09-25
Posts: 1000+

Re: ITopic: Welcome to your local block library!

new scratch blocks i made:http://megamod.weebly.com/uploads/7/1/5/6/7156046/8588685.gif

blockspec:

Code:

('if online then stop' #- #ifOnlineThenStop)

code:

Code:

ifOnlineThenStop
| t1 t2 t3 |
t1_t2

http://newblocks.weebly.com/uploads/7/1/5/6/7156046/1995652.gif

blockspec:

('confirm %s' #b #confirm:)

no code needed

what it does: asks the user a yes/no question and is false if the user selects no, true if he/she selects yes

http://newblocks.weebly.com/uploads/7/1/5/6/7156046/1995652.gif

blockspec:

('alert %s' #- #inform:)

no code needed

http://newblocks.weebly.com/uploads/7/1/5/6/7156046/6600351.gif

Scratch-Blocks->WhenHatBlockMorph->all:

stepTime
^ 0.1

and

step
self evaluateCondition ifTrue: [self start]

blockspec:

('' #W #-)

(you don't give the block a name because the WhenHatBlockMorph class automatically adds the label.)

DROPDOWN VERSION OF: http://www.weebly.com/uploads/4/0/7/6/4076678/1875422.gif

Scratch blocks> commandBlockMorph> all> uncoloredArgMorphFor: add a strip:

$Q = t2 ifTrue: [^ ChoiceOrExpressionArgMorph new getOptionsSelector: #dateTime;
choice: 'date'].

Scratch objects> scriptableScratchMorph> sensingOps:

dateTime
    ^ #('date' 'short date' 'time' 'seconds' 'minutes' 'hours' 'day')

new blockspec:

('get %Q' #r #getTime: 'date')

http://newblocks.weebly.com/uploads/7/1/5/6/7156046/8459236.gif

blockspec:

(' %z as decimal' #r #decimalOf:)

code:

decimalOf: t1
'1/2' = t1 ifTrue: [^ '.5'].
'1/3' = t1 ifTrue: [^ '.333333333'].
'1/4' = t1 ifTrue: [^ '.25'].
'1/5' = t1 ifTrue: [^ '.2'].
'1/6' = t1 ifTrue: [^ '.666666666'].
'1/7' = t1 ifTrue: [^ '.1428'].
'1/8' = t1 ifTrue: [^ '.125'].
'1/9' = t1 ifTrue: [^ '.111111111'].
'1/10' = t1 ifTrue: [^ '.1'].

if you have the (1/2 of ( ) ) block already, then you don't need to make the uncoloredArgMorph.

_____________________________________________________________________________

PLEASE ADD THEM! they're not made with scramble!

Last edited by jslomba (2011-06-12 08:14:27)


the the the the the

Offline

 

#1186 2011-06-12 08:36:49

Rosie906
Scratcher
Registered: 2011-04-09
Posts: 100+

Re: ITopic: Welcome to your local block library!

This is impossible... how do I USE these blocks????


Be happy! Spring is coming! And spring cleaning...
http://i40.tinypic.com/9rrecj.jpg

Offline

 

#1187 2011-06-12 08:44:22

jslomba
Scratcher
Registered: 2009-09-25
Posts: 1000+

Re: ITopic: Welcome to your local block library!

Rosie906 wrote:

This is impossible... how do I USE these blocks????

roll  here we go again. first, watch this

then, for blockspecs, go to
scratch-objects->scriptableScratchMorph->(class)blockSpecs->blockSpecs.
for code, go to
scratch-objects->scriptableScratchMorph->(instance) then the corresponding ops.


the the the the the

Offline

 

#1188 2011-06-12 10:21:11

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: ITopic: Welcome to your local block library!

I queued them for now.

Offline

 

#1189 2011-06-12 11:17:40

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

Re: ITopic: Welcome to your local block library!

http://theblocklibrary.site11.com/include/img/blocks/specparser.php?spec=stop+all+my+scripts&amp;type=cap&amp;color=control

Code:

stopAllMine
    self scripts do: [:t1 | t1 stop]

Last edited by TheSuccessor (2011-06-13 11:23:49)


/* No comment */

Offline

 

#1190 2011-06-12 13:50:47

Pecola1
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: ITopic: Welcome to your local block library!

OMG! TheSuccessor just gave me an idea!
I have a new block...
http://www.weebly.com/uploads/7/1/1/0/7110842/5770768.gif

Blockspec
('stop all scripts for %m' #- #stopAllScriptsFor: 'Stage')

Code:

stopAllScriptsFor: t1 
t1 stopAllMine

You first have to make the code that TheSuccessor made. e.g.

Code:

stopAllMine
    self scripts do: [:t1 | t1 stop]

I don't have time to add it plus it might be better if we just save up blocks for a bigger update than just 1 block.  tongue


If you are reading this, please read to the end, because if you don't you won't know what's at the end. Don't just skip to the end though otherwise you won't be able to read the middle, which is most important. Now you must be wondering why you just read all that, the reason is you may have not noticed something, read it again and see if you notice it this time  smile

Offline

 

#1191 2011-06-12 13:56:32

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

Re: ITopic: Welcome to your local block library!

Pecola1 wrote:

OMG! TheSuccessor just gave me an idea!
I have a new block...
http://www.weebly.com/uploads/7/1/1/0/7 … 770768.gif

Blockspec
('stop all scripts for %m' #- #stopAllScriptsFor: 'Stage')

Code:

stopAllScriptsFor: t1 
t1 stopAllMine

You first have to make the code that TheSuccessor made. e.g.

Code:

stopAllMine
    self scripts do: [:t1 | t1 stop]

I don't have time to add it plus it might be better if we just save up blocks for a bigger update than just 1 block.  tongue

I think you might have to do this instead for the method:

Code:

stopAllScriptsFor: t1
(self coerceSpriteArg: t1) stopAllMine

The sprite name could be a string, so we have to use coerceSpriteArg: to make it a sprite.

Without my block, just do this:

Code:

stopAllScriptsFor: t1
(self coerceSpriteArg: t1) scripts do: [:t1 | t1 stop]

/* No comment */

Offline

 

#1192 2011-06-12 16:50:58

TuragaTreeko
Scratcher
Registered: 2011-04-24
Posts: 100+

Re: ITopic: Welcome to your local block library!

sparks wrote:

^ Whoops - I hadn't programmed in smalltalk for aaages and forgot where it needed periods. It works so I assumed it was right  tongue

TuragaTreeko wrote:

I love doing squeak editing, but I am used to using scratch. How do you do blockspecs in panther? I am doing the block with the code

view projects page for user $String$
-
#E6A822
Cursor wait showWhile: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/users/', t1]

My blockspecs is ('open Scratch "my stuff" page for user: %s' #- #doOpen: scimonster)
But, instead of a block reading [open Scratch "my stuff" page for user (space for a user's name with default of scimonster)], I get [open Scratch "my stuff" age for user scimonster%s], with no place for a string.

HOW DO I DO PANTHER BLOCKSPECS?

The $String$ is the Panther equivalent to %s. So your blockspec needs to be

Code:

open Scratch "my stuff" page for user: $String$

The parenthesis ( '(' ) in your blockspec aren't needed. Instead of describing the block type in the spec via #- you put the dash in the little box in the top-right corner of the "make a block" window. That path #doOpen: scimonster is also not needed. In Scratch this would connect the blockspec to the block's code but in Panther the code is in the box below so this isn't needed. In the same way, don't start your code in Panther with the address scimonster:

so you're looking at this code:

box 1 (the long one at the top of the window)

Code:

open Scratch "my stuff" page for user: $String$

box 2 (the tiny one in the corner)

Code:

-

Box 3 (the main large one)

Code:

Cursor wait showWhile: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/users/', t1]

Hope this helps!

This is awesome. Thanks for the help. Also, any chance you could help me convert panther code (the ops, not the blockspecs) into scratch syntax? Thank you!!!  smile


http://goo.gl/RDqKF

Offline

 

#1193 2011-06-13 06:33:24

Rocker98585
Scratcher
Registered: 2010-12-26
Posts: 39

Re: ITopic: Welcome to your local block library!

Can I request a block? okay i dont know to to make the block  work, but i can do the block spec.

Code:

 ('%n + %n = %n' #b #number+number2')

Offline

 

#1194 2011-06-13 06:42:12

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: ITopic: Welcome to your local block library!

I think the spec should be:

('%n + %n = %n' #b #num:plus:equals: 2 2 4)

Code:

num: t1 plus: t2 equals: t3
^ t1 + t2 = t3

Off the top of my head; untested.

Offline

 

#1195 2011-06-13 06:58:31

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: ITopic: Welcome to your local block library!

TuragaTreeko wrote:

This is awesome. Thanks for the help. Also, any chance you could help me convert panther code (the ops, not the blockspecs) into scratch syntax? Thank you!!!  smile

No problem! There is a list of Scratch arguments with their Panther counterpart and a brief description of their operation on this wiki page! I put this together a while back as a tutorial, the list is under the "Arguments" section  smile

Thanks to nXIII for the original list!

@ProgrammingFreak
You can use "asUTF8" to convert it into a sprite value, can't you?


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#1196 2011-06-13 07:05:04

ssss
Scratcher
Registered: 2007-07-29
Posts: 1000+

Re: ITopic: Welcome to your local block library!

Hi sparks, I was wonderring if you could help me make a random block generator.  What it would do is find a block on the Local block library, and display it.  All credit would be given of course, but is it doable?


Hey.  It's me SSSS, back from the dead!  smile

Offline

 

#1197 2011-06-13 07:05:09

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: ITopic: Welcome to your local block library!

I thought I'd shared this one but I don't see it in the library!

Code:

$Number$ minutes in hours

Code:

|t2 t3 t4|

t2_ t1/60.
t2_ t2 floor.
t3_ t1 \\ 60 .

t3_ t2 asString, '.', t3 asString.

^t3

displays minutes as hours! Very useful for where showing the time in minutes after an hour looks stupid!


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#1198 2011-06-13 07:05:56

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: ITopic: Welcome to your local block library!

sparks wrote:

TuragaTreeko wrote:

This is awesome. Thanks for the help. Also, any chance you could help me convert panther code (the ops, not the blockspecs) into scratch syntax? Thank you!!!  smile

No problem! There is a list of Scratch arguments with their Panther counterpart and a brief description of their operation on this wiki page! I put this together a while back as a tutorial, the list is under the "Arguments" section  smile

Thanks to nXIII for the original list!

@ProgrammingFreak
You can use "asUTF8" to convert it into a sprite value, can't you?

Isn't that backwards? I though "asUTF8" made it a string.  hmm
BTW, I fixed the link.  big_smile

Offline

 

#1199 2011-06-13 07:07:47

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: ITopic: Welcome to your local block library!

scimonster wrote:

sparks wrote:

TuragaTreeko wrote:

This is awesome. Thanks for the help. Also, any chance you could help me convert panther code (the ops, not the blockspecs) into scratch syntax? Thank you!!! :)

No problem! There is a list of Scratch arguments with their Panther counterpart and a brief description of their operation on this wiki page! I put this together a while back as a tutorial, the list is under the "Arguments" section :)

Thanks to nXIII for the original list!

@ProgrammingFreak
You can use "asUTF8" to convert it into a sprite value, can't you?

Isn't that backwards? I though "asUTF8" made it a string. :/
BTW, I fixed the link. :D

You're right, I'm sorry! I used it to make a <touching[ ]> block where the sprite name could be typed as they were clone names and dissapeared from the list when you clicked stop - leaving a black argument!

Last edited by sparks (2011-06-13 07:08:00)


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#1200 2011-06-13 07:09:49

ssss
Scratcher
Registered: 2007-07-29
Posts: 1000+

Re: ITopic: Welcome to your local block library!

Did you even notice my post  tongue

ssss wrote:

Hi sparks, I was wonderring if you could help me make a random block generator (for cyberkidscountry.com/s360.html).  What it would do is find a block on the Local block library, and display it.  All credit would be given of course, but is it doable?


Hey.  It's me SSSS, back from the dead!  smile

Offline

 

Board footer