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
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?
$A = t2 ifTrue: [^ AttributeArgMorph new choice: 'color'; menuSelector: #attributeEffectNames].
Last edited by scimonster (2010-12-08 11:00:01)
Offline
me450 wrote:
a new block
bounceCode:
bounce self rotationDegrees: rotationDegrees + 180blockspec
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.
Offline
me450 wrote:
im working on it
EDIT
just use my blockCode:
bounce self rotationDegrees: rotationDegrees + 180Code:
('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)
Offline
Is there a code to make a sensor block that senses clockwise and counter clockwise motion?
Offline
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
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 putPenUpThis code doesn't seem to work. Maybe try and stretch it's activation out a little?
Offline
Maybe this would work for the bounce block:
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.
Offline
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
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
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 putPenUpThis code doesn't seem to work. Maybe try and stretch it's activation out a little?
i have BYOB and made 1 block!
Offline
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
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 putPenUpThis 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.
Offline
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?
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
t1 = 'alphabetize' ifTrue: [ Cannot store into ->t2 _ t2 alphabetized].
how should i fix it?
Offline
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.
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.
Offline
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
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?
Offline
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 messageWell, what does the error message say?
it DOESN'T have an error message.
Offline
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:
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]:
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)
Offline
it came up with a syntax error
Offline
I can't find the "block specs" section...
Offline