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

#1351 2010-12-07 13:55:25

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: Cool custom blocks in Scratch

scimonster wrote:

Code:

menuSelector: #attributeEffectNames].

it doesn't understand this part. But i'm not sure why!

Last edited by ProgrammingFreak (2010-12-07 13:56:59)

Offline

 

#1352 2010-12-08 10:59:34

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

Re: Cool custom blocks in Scratch

ProgrammingFreak wrote:

scimonster wrote:

Code:

menuSelector: #attributeEffectNames].

it doesn't understand this part. But i'm not sure why!

that's what i want to know.  i think it looks almost exactly like the others.

should it be this?

Code:

    $A = t2 ifTrue: [^ AttributeArgMorph new choice: 'color';
         menuSelector: #attributeEffectNames].

Last edited by scimonster (2010-12-08 11:00:01)

Offline

 

#1353 2010-12-10 09:42:11

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

Re: Cool custom blocks in Scratch

me450 wrote:

a new block

bounce

Code:

bounce
    self rotationDegrees: rotationDegrees + 180

blockspec

Code:

('bounce' #- #bounce)

This will not work. It would work for only bouncing left or right. Because if you wanted to bounce when pointing 90 90 + 180 = 270 (or -90) The only thing is the way that will work is using blocks... I can't figure out how to do it in small talk. it is

<turn cw( (( <direction> <*> 2 )) )degrees>

But if you were facing 0 degrease it would not turn. This is a problem.


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

 

#1354 2010-12-10 09:46:54

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

Re: Cool custom blocks in Scratch

me450 wrote:

im working on it

EDIT

just use my block

Code:

bounce
    self rotationDegrees: rotationDegrees + 180

Code:

('bounce' #- #bounce)

and use it in a if block with a <touching []?> block

so [if?<touching []?>]
    [][Bounce]
    [               ]

Maybe we should look at the original

<if on edge, bounce>

block.
EDIT-
no use. They use things like left bottom top right of screen. Instead of self rotation degrease > 30 and things like that. Could someone try to look at the bounce block still? Thanks
EDIT2-
made a simulation at: This place (LOL)

Last edited by Pecola1 (2010-12-10 10:32:18)


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

 

#1355 2010-12-10 12:52:07

ryan49ryan
New Scratcher
Registered: 2010-12-09
Posts: 3

Re: Cool custom blocks in Scratch

Is there a code to make a sensor block that senses clockwise and counter clockwise motion?

Offline

 

#1356 2010-12-10 15:22:59

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

Re: Cool custom blocks in Scratch

ryan49ryan wrote:

Is there a code to make a sensor block that senses clockwise and counter clockwise motion?

you could try, using scratch blocks, making your project broadcast 'ccw' or cw' whenever you use the block [turn () clockwise].

Offline

 

#1357 2010-12-10 19:56:43

GP1
Scratcher
Registered: 2009-07-06
Posts: 1000+

Re: Cool custom blocks in Scratch

SeptimusHeap wrote:

OK. May we use it for our mod, Panther (I guess you've heard of it?)

what is panther


I am currently http://blocks.scratchr.org/API.php?user=GP1&amp;action=onlineStatus&amp;type=imagehttp://blocks.scratchr.org/API.php?user=GP1&amp;action=onlineStatus&amp;type=text and I finally got over 1000 posts.

Offline

 

#1358 2010-12-10 20:45:26

ESN
New Scratcher
Registered: 2010-12-03
Posts: 100+

Re: Cool custom blocks in Scratch

GP1 wrote:

SeptimusHeap wrote:

OK. May we use it for our mod, Panther (I guess you've heard of it?)

what is panther

http://pantherprogramming.weebly.com/


http://is.gd/jZ5chhttp://is.gd/jZhXDhttp://is.gd/jZhU7

Offline

 

#1359 2010-12-12 17:45:33

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

Re: Cool custom blocks in Scratch

zorket wrote:

I am trying to make a [Draw square] block. Here my current code:

Code:

drawSquare
    self putPenUp.
    self referencePosition: -100 @ 100.
    self penDown.
    self referencePosition: 100 @ 100.
    self referencePosition: 100 @ -100.
    self referencePosition: -100 @ -100.
    self referencePosition: -100 @ 100.
    self putPenUp

This code doesn't seem to work. Maybe try and stretch it's activation out a little?


Marzipan11 must learn to not spoil

Offline

 

#1360 2010-12-12 18:05:28

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

Re: Cool custom blocks in Scratch

Maybe this would work for the bounce block:

Code:

bounce
|t1|
t1_ self rotationDegrees.

self rotationDegrees: t2 * 2

I just tried that from the back of my head, i don't know if it works.


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

Offline

 

#1361 2010-12-13 13:19:52

ryan49ryan
New Scratcher
Registered: 2010-12-09
Posts: 3

Re: Cool custom blocks in Scratch

ryan49ryan wrote:

Is there a code to make a sensor block that senses clockwise and counter clockwise motion?

Have a dial in an etch-a-sketch game that if grabbed and turned clockwise or counter-clockwise it should make the line go up or down depending on rotational direction.

Offline

 

#1362 2010-12-18 14:14:00

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

Re: Cool custom blocks in Scratch

you know, i wish we could keep this on topic more.  i had to go through about 15 pages of non related - i wont say junk - stuff to get here.
move bingo somewhere else, panther somewhere else.  and those

lots of people wrote:

i got the %n post

are- junk.

thank you

Offline

 

#1363 2010-12-23 14:44:29

pen13
Scratcher
Registered: 2010-08-27
Posts: 100+

Re: Cool custom blocks in Scratch

zorket wrote:

pen13 wrote:

a log off  block

log off what

log off ( )


http://womrealms.com/char.php?nomimg1:3ri855a
pen13 http://blocks.scratchr.org/API.php?user=pen13&amp;action=onlineStatus green= online gray=offline

Offline

 

#1364 2010-12-26 18:32:25

shadowfan54
Scratcher
Registered: 2010-05-23
Posts: 27

Re: Cool custom blocks in Scratch

zorket wrote:

zorket wrote:

I am trying to make a [Draw square] block. Here my current code:

Code:

drawSquare
    self putPenUp.
    self referencePosition: -100 @ 100.
    self penDown.
    self referencePosition: 100 @ 100.
    self referencePosition: 100 @ -100.
    self referencePosition: -100 @ -100.
    self referencePosition: -100 @ 100.
    self putPenUp

This code doesn't seem to work. Maybe try and stretch it's activation out a little?

i have BYOB and made 1 block!

Offline

 

#1365 2010-12-30 10:27:05

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

Re: Cool custom blocks in Scratch

LS97 wrote:

the %n in the block is the input box, where the user can put the number. in fact, %n produces that round textbox where only numbers can be inserted. here's the full list:

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 billyedward for this list.

i is the 1/last/any of a list
I is the midi drums

Offline

 

#1366 2010-12-30 11:05:45

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

Re: Cool custom blocks in Scratch

zorket wrote:

zorket wrote:

I am trying to make a [Draw square] block. Here my current code:

Code:

drawSquare
    self putPenUp.
    self referencePosition: -100 @ 100.
    self penDown.
    self referencePosition: 100 @ 100.
    self referencePosition: 100 @ -100.
    self referencePosition: -100 @ -100.
    self referencePosition: -100 @ 100.
    self putPenUp

This code doesn't seem to work. Maybe try and stretch it's activation out a little?

The problem is that this method is all executed in one block execution, but the stage only updates the pen trails between block executions. You would need these to be activated one each block execution. This requires a special form block. I'm too busy to code one at the moment, and anyway, 75% of my special form blocks crash Scratch. I expect rubiks_cube_guy238 could make one for you.


/* No comment */

Offline

 

#1367 2011-01-02 04:53:29

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

Re: Cool custom blocks in Scratch

scimonster wrote:

can someone make the method for this.  blockspecs:

Code:

('%Y list %L' #- #orderList)

with %Y being a new dropdown menu:

Code:

    $Y = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #listOrdering; choice: 'alphabetize'].

and the choices:

Code:

listOrdering
    ^ #('alphabetize' 'reverse' 'shuffle' )

all i need is it to work.  it does the dropdown menu for alphabetize, the list menu, just not doing anything when clicked.


EDIT: i'm trying this code:

Code:

orderList: t1 list: t2 
    | t3 |
    t3 _ t1 t3 = 'alphabetize' ifTrue: [t2 alphabeticalMorphMenu].
    t3 = 'reverse' ifTrue: [t2 reversed].
    t3 = 'shuffle' ifTrue: [t2 shuffled].
    ^ 'Error!'

its not coming out quite right...

is this the right method?

Code:

orderList: t1 list: t2 
    t1 = 'alphabetize' ifTrue: [t2 _ t2 alphabetized].
    t1 = 'reverse' ifTrue: [t2 _ t2 reversed].
    t1 = 'shuffle' ifTrue: [t2 _ t2 shuffled].

when i do this it says

Code:

    t1 = 'alphabetize' ifTrue: [ Cannot store into ->t2 _ t2 alphabetized].

how should i fix it?

Offline

 

#1368 2011-01-02 10:36:39

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: Cool custom blocks in Scratch

scimonster wrote:

is this the right method?

Code:

orderList: t1 list: [b][color=red]t2[/color][/b] 
    t1 = 'alphabetize' ifTrue: [t2 _ t2 alphabetized].
    t1 = 'reverse' ifTrue: [t2 _ t2 reversed].
    t1 = 'shuffle' ifTrue: [t2 _ t2 shuffled].

when i do this it says

Code:

    t1 = 'alphabetize' ifTrue: [ Cannot store into ->t2 _ t2 alphabetized].

how should i fix it?

You can't store into an argument. Just return the values right there.

Code:

orderList: t1 list: [b][color=red]t2[/color][/b] 
    t1 = 'alphabetize' ifTrue: [ ^ t2 alphabetized].
    t1 = 'reverse' ifTrue: [ ^ t2 reversed].
    t1 = 'shuffle' ifTrue: [ ^ t2 shuffled].

At least 60 seconds have to pass between posts. Please wait a little while and try posting again.


http://block.site90.net/scratch.mit/text.php?size=30&amp;text=%20A%20signature!&amp;color=333333

Offline

 

#1369 2011-01-02 11:12:02

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

Re: Cool custom blocks in Scratch

MathWizz wrote:

scimonster wrote:

is this the right method?

Code:

orderList: t1 list: [b][color=red]t2[/color][/b] 
    t1 = 'alphabetize' ifTrue: [t2 _ t2 alphabetized].
    t1 = 'reverse' ifTrue: [t2 _ t2 reversed].
    t1 = 'shuffle' ifTrue: [t2 _ t2 shuffled].

when i do this it says

Code:

    t1 = 'alphabetize' ifTrue: [ Cannot store into ->t2 _ t2 alphabetized].

how should i fix it?

You can't store into an argument. Just return the values right there.

Code:

orderList: t1 list: [b][color=red]t2[/color][/b] 
    t1 = 'alphabetize' ifTrue: [ ^ t2 alphabetized].
    t1 = 'reverse' ifTrue: [ ^ t2 reversed].
    t1 = 'shuffle' ifTrue: [ ^ t2 shuffled].

At least 60 seconds have to pass between posts. Please wait a little while and try posting again.

it's not working.
it doesn't do the operations, but it doesn't give an error message

Offline

 

#1370 2011-01-02 11:14:50

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: Cool custom blocks in Scratch

scimonster wrote:

MathWizz wrote:

scimonster wrote:

is this the right method?

Code:

orderList: t1 list: [b][color=red]t2[/color][/b] 
    t1 = 'alphabetize' ifTrue: [t2 _ t2 alphabetized].
    t1 = 'reverse' ifTrue: [t2 _ t2 reversed].
    t1 = 'shuffle' ifTrue: [t2 _ t2 shuffled].

when i do this it says

Code:

    t1 = 'alphabetize' ifTrue: [ Cannot store into ->t2 _ t2 alphabetized].

how should i fix it?

You can't store into an argument. Just return the values right there.

Code:

orderList: t1 list: [b][color=red]t2[/color][/b] 
    t1 = 'alphabetize' ifTrue: [ ^ t2 alphabetized].
    t1 = 'reverse' ifTrue: [ ^ t2 reversed].
    t1 = 'shuffle' ifTrue: [ ^ t2 shuffled].

At least 60 seconds have to pass between posts. Please wait a little while and try posting again.

it's not working.
it doesn't do the operations, but it doesn't give an error message

Well, what does the error message say?


http://block.site90.net/scratch.mit/text.php?size=30&amp;text=%20A%20signature!&amp;color=333333

Offline

 

#1371 2011-01-02 12:36:16

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

Re: Cool custom blocks in Scratch

MathWizz wrote:

scimonster wrote:

MathWizz wrote:


You can't store into an argument. Just return the values right there.

Code:

orderList: t1 list: [b][color=red]t2[/color][/b] 
    t1 = 'alphabetize' ifTrue: [ ^ t2 alphabetized].
    t1 = 'reverse' ifTrue: [ ^ t2 reversed].
    t1 = 'shuffle' ifTrue: [ ^ t2 shuffled].

At least 60 seconds have to pass between posts. Please wait a little while and try posting again.

it's not working.
it doesn't do the operations, but it doesn't give an error message

Well, what does the error message say?

it DOESN'T have an error message.

Offline

 

#1372 2011-01-08 12:14:55

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

Re: Cool custom blocks in Scratch

I have a pile of untested theory here.
Explaining instance variables.

Open squeak, and go to scratch-objects, scriptaleScratchMorph, [but stop there!]

There is a code below. See where it says instanceVariableNames? Those are all the variables. Replace the full code with:

Code:

Morph subclass: #ScriptableScratchMorph
    instanceVariableNames: 'objName vars lists blocksBin isClone media costume costumeChangeMSecs filterPack visibility volume tempoBPM sceneStates variableIsTrue '
    classVariableNames: 'BlockColorDict BlockSpecDict DefaultBackgroundForm DefaultSpriteForm DoubleSize Experimental ListBlockColor MeowSound OldMeowPrefixReversed PopSound RandomGen Recorder ScratchOrigin TimerStartMSecs '
    poolDictionaries: ''
    category: 'Scratch-Objects'

Now, add the three blockspecs:

('turn variable on' #- #turnVariableOn) ('turn variable off' #- #turnVariableOff) ('variable turned on?' #b #variableTurnedOn)

The three codes [in one code box]:

Code:

turnVariableOn
variableIsTrue _ 'true'


turnVariableOff
variableIsTrue _ 'false'


variableTurnedOn
variableIsTrue = 'true' ifTrue: [^ true].
^ false

This shows how to create an instance variable [I think]

Last edited by zorket (2011-01-08 12:18:28)


Marzipan11 must learn to not spoil

Offline

 

#1373 2011-01-08 14:27:09

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

Re: Cool custom blocks in Scratch

it came up with a syntax error

Offline

 

#1374 2011-01-08 16:24:07

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

Re: Cool custom blocks in Scratch

scimonster wrote:

it came up with a syntax error

Help fix it please!

Last edited by zorket (2011-01-08 16:25:02)


Marzipan11 must learn to not spoil

Offline

 

#1375 2011-01-08 19:04:05

Robot_Maniac
Scratcher
Registered: 2010-11-22
Posts: 56

Re: Cool custom blocks in Scratch

I can't find the "block specs" section...


Math Trick of the Week: Choose any three digit number that's one digit is at least 2 less that the tens digit and the tens digit at least 2 less than the hundreds. Then, reverse the digits and subtract. Then, reverse the digits in the answer and add. You should get 1089.

Offline

 

Board footer