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?
Offline
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.
Offline
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?
Offline
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?346Code:
|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
| 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
scimonster wrote:
sparks wrote:
I have a Panther block 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?346Code:
|result| result_true. t1 <= t3 ifFalse: [result_false.]. t1 >= t4 ifFalse: [result_false.]. t2 <= t5 ifFalse: [result_false.]. t2 >= t6 ifFalse: [result_false.]. ^resultShouldn'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]. ^resultThe extra periods don't mess it up?
Scratch/Panther will remove any not needed periods.
Offline
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?346Code:
|result| result_true. t1 <= t3 ifFalse: [result_false.]. t1 >= t4 ifFalse: [result_false.]. t2 <= t5 ifFalse: [result_false.]. t2 >= t6 ifFalse: [result_false.]. ^resultShouldn'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]. ^resultThe extra periods don't mess it up?
Scratch/Panther will remove any not needed periods. ;)
Oh.
Offline
^ Whoops - I hadn't programmed in smalltalk for aaages and forgot where it needed periods. It works so I assumed it was right
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
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)
open Scratch "my stuff" page for user: $String$
box 2 (the tiny one in the corner)
-
Box 3 (the main large one)
Cursor wait showWhile: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/users/', t1]
Hope this helps!
Offline
new block:
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)
Offline
new scratch blocks i made:
blockspec:
('if online then stop' #- #ifOnlineThenStop)
code:
ifOnlineThenStop | t1 t2 t3 | t1_t2
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
blockspec:
('alert %s' #- #inform:)
no code needed
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:
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')
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)
Offline
Rosie906 wrote:
This is impossible... how do I USE these blocks????
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.
Offline
I queued them for now.
Offline
stopAllMine self scripts do: [:t1 | t1 stop]
Last edited by TheSuccessor (2011-06-13 11:23:49)
Offline
OMG! TheSuccessor just gave me an idea!
I have a new block...
Blockspec
('stop all scripts for %m' #- #stopAllScriptsFor: 'Stage')
stopAllScriptsFor: t1 t1 stopAllMine
You first have to make the code that TheSuccessor made. e.g.
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.
Offline
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.gifBlockspec
('stop all scripts for %m' #- #stopAllScriptsFor: 'Stage')Code:
stopAllScriptsFor: t1 t1 stopAllMineYou 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.
I think you might have to do this instead for the method:
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:
stopAllScriptsFor: t1 (self coerceSpriteArg: t1) scripts do: [:t1 | t1 stop]
Offline
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
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!!!
Offline
Can I request a block? okay i dont know to to make the block work, but i can do the block spec.
('%n + %n = %n' #b #number+number2')
Offline
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
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?
Offline
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?
Offline
I thought I'd shared this one but I don't see it in the library!
$Number$ minutes in hours
|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!
Offline
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.
Offline
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)
Offline
Did you even notice my post
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?
Offline