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

#1 2009-12-21 09:07:00

BWOG
Scratcher
Registered: 2008-09-19
Posts: 1000+

The And block - more than 2 spaces

I think that you should be able to right click an and block and there would be an option called "Change # of options" or something like that. Then you wouldn't have to but an and block into another and block over and over again.

Sorry if that doesn't make sense, because when I do stuff when I just woke up I can't think straight  tongue

Offline

 

#2 2009-12-21 15:31:53

Midlandman
Scratcher
Registered: 2007-06-28
Posts: 4

Re: The And block - more than 2 spaces

Absolutely!  Fully agree. And the same for the OR block too!

Offline

 

#3 2009-12-21 16:42:09

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: The And block - more than 2 spaces

Took me a second to understand, but I like the idea!


http://i.imgur.com/WBkM2QQ.png

Offline

 

#4 2009-12-21 17:04:45

rubiks_cube_guy238
Scratcher
Registered: 2009-07-02
Posts: 100+

Re: The And block - more than 2 spaces

Hmm... I think I might know how to implement that!


The glass is never half full nor half empty; it is twice as large as it needs to be.

Offline

 

#5 2009-12-21 22:34:25

greenflash
Scratcher
Registered: 2009-05-27
Posts: 1000+

Re: The And block - more than 2 spaces

That would be extremely helpful! How many spaces would it have at max though?


http://i48.tinypic.com/2wrkirk.pnghttp://i46.tinypic.com/6r5zk7.pnghttp://i45.tinypic.com/2vtxr1t.png

Offline

 

#6 2009-12-22 00:14:00

keikij
Scratcher
Registered: 2009-02-22
Posts: 1000+

Re: The And block - more than 2 spaces

All you have to do is stack and/or blocks like this...


<<  <and> <<  <and>  >> >>

Last edited by keikij (2009-12-22 00:14:28)


Back from the Dead (And Stuff)

Offline

 

#7 2009-12-22 00:17:00

martianshark
Scratcher
Registered: 2008-03-24
Posts: 1000+

Re: The And block - more than 2 spaces

He knows that, he wants it to be easier by selecting how many times it should reapeat automaticly. And I like this idea. I agree.


http://img.geocaching.com/stats/img.aspx?txt=martianshark&amp;uid=e6cdc2c8-2476-4abd-9994-27f857396579&amp;bg=1

Offline

 

#8 2009-12-31 17:51:42

rubiks_cube_guy238
Scratcher
Registered: 2009-07-02
Posts: 100+

Re: The And block - more than 2 spaces

rubiks_cube_guy238 wrote:

Hmm... I think I might know how to implement that!

Well, now I'm done!

To enable your version of Scratch to do this, file in this code:

Code:

 'From MIT Squeak 0.9.4 (June 1, 2003) [No updates present.] on 31 December 2009 at 5:42:38 pm'!

!CommandBlockMorph methodsFor: 'evaluation'!
argumentAt: t1 
    (#(#totalArgsAnd #totalArgsOr ) includes: selector)
        ifTrue: [^ argMorphs at: t1].
    argPermutation ifNil: [^ argMorphs at: t1].
    ^ argMorphs at: (argPermutation at: t1)! !

!CommandBlockMorph methodsFor: 'evaluation'!
evaluateWithArgs: t1 
    | t2 |
    selector isInfix ifTrue: [^ self evaluateInfixWithArgs: t1].
    t2 _ self coerceArgs: t1.
    (#(#totalArgsAnd #totalArgsOr ) includes: selector)
        ifTrue: [^ self perform: selector].
    (#(#abs #not #rounded #sqrt #truncated ) includes: selector)
        ifTrue: [^ t2 first perform: selector].
    ^ receiver perform: selector withArguments: t2! !

!CommandBlockMorph methodsFor: 'menus'!
rightButtonMenu
    | t1 t2 t3 t4 |
    t2 _ CustomMenu new.
    t2 add: 'help' action: #presentHelpScreen.
    (owner isKindOf: ScratchBlockPaletteMorph)
        ifFalse: 
            [t2 addLine.
            (#(#+ #- #* #/ #\\ ) includes: selector)
                ifTrue: [#(#+ #- #* #/ #mod ) with: #(#+ #- #* #/ #\\ ) do: [:t5 :t6 | t2 add: t5 action: t6]].
            (#(#< #= #> ) includes: selector)
                ifTrue: [#(#< #= #> ) do: [:t6 | t2 add: t6 action: t6]].
            (#(#& #| ) includes: selector)
                ifTrue: [#(#and #or ) with: #(#& #| ) do: [:t5 :t6 | t2 add: t5 action: t6]].
            t2 addLine.
            t2 add: 'duplicate' action: #duplicate.
            (self owner isKindOf: BlockMorph)
                ifFalse: [t2 add: 'delete' action: #delete].
            (#(#& #| #totalArgsOr #totalArgsAnd ) includes: selector)
                ifTrue: 
                    [t2 addLine.
                    (#(#& #totalArgsAnd ) includes: selector)
                        ifTrue: [t2 add: 'add argument' action: #addAnd]
                        ifFalse: [t2 add: 'add argument' action: #addOr]]].
    t3 _ self ownerThatIsA: ScratchFrameMorph.
    (t3 notNil and: [#(#sensor: #sensorPressed: ) includes: selector])
        ifTrue: 
            [t2 addLine.
            t2 add: 'show ScratchBoard watcher' action: #showSensorBoard].
    DebugMenu
        ifTrue: 
            [t2 addLine.
            t2 add: 'show tuples' action: #showTuples].
    (t4 _ t2 localize; startUp) ifNil: [^ self].
    (#(#presentHelpScreen #duplicate #delete ) includes: t4)
        ifTrue: [^ self perform: t4].
    t4 = #showSensorBoard
        ifTrue: 
            [t3 showSensorBoard.
            ^ self].
    t4 = #showTuples ifTrue: [^ self showTuples].
    t1 _ '%n ' , t4 , ' %n'.
    '\\' = t4 ifTrue: [t1 _ '%n mod %n'].
    '&' = t4 ifTrue: [t1 _ '%b and %b'].
    '|' = t4 ifTrue: [t1 _ '%b or %b'].
    #addAnd = t4
        ifTrue: 
            [t1 _ self commandSpec , ' and %b'.
            t4 _ #totalArgsAnd.
            self argPermutation: argPermutation , {argMorphs size + 1}].
    #addOr = t4
        ifTrue: 
            [t1 _ self commandSpec , ' or %b'.
            t4 _ #totalArgsOr.
            self argPermutation: argPermutation , {argMorphs size + 1}].
    self commandSpec: t1.
    self selector: t4! !

!CommandBlockMorph methodsFor: 'as yet unclassified'!
totalArgsAnd
    | t1 |
    t1 _ OrderedCollection new.
    1 to: argMorphs size do: [:t2 | t1 add: (self argumentAt: t2) evaluate].
    ^ (t1 includes: false) not! !

!CommandBlockMorph methodsFor: 'as yet unclassified'!
totalArgsOr
    | t1 |
    t1 _ OrderedCollection new.
    1 to: argMorphs size do: [:t2 | t1 add: (self argumentAt: t2) evaluate].
    ^ t1 includes: true! !

(To learn how to file in, Jens's project xml. To save the .image when you're done, shift-click on the 'R' in the Scratch logo and select 'save image for end user' and confirm everything with 'yes'.)

Once you've filed it in, you will be able to add a space to the
http://scratch.mit.edu/forums/img/sb_no_nums/_and_.png and the http://scratch.mit.edu/forums/img/sb_no_nums/_or_.pngblock by right-clicking on it (this only works if the block is in the scripts area) and selecting 'add argument'. Best of all, there is no limit to how many spaces you can add!

Enjoy your improved Scratch!

Last edited by rubiks_cube_guy238 (2010-01-01 12:39:40)


The glass is never half full nor half empty; it is twice as large as it needs to be.

Offline

 

#9 2009-12-31 18:19:59

Greatdane
Scratcher
Registered: 2007-06-05
Posts: 1000+

Re: The And block - more than 2 spaces

I had an idea you may have something like this:

http://i46.tinypic.com/jtqe4l.gif
There are minus and plus signs on both.

If something can't be completed(minus) then it is dark green, if it can be done, it is light green.


The future belongs to those who believe in the beauty of their dreams.
        ~ Eleanor Roosevelt

Offline

 

#10 2009-12-31 20:54:44

technoguyx
Scratcher
Registered: 2008-10-18
Posts: 1000+

Re: The And block - more than 2 spaces

I like Greatdane's version of the idea, simpler than a right-click menu  smile

But this isn't really necessary because of what keikij said.


http://getgnulinux.org/links/en/linuxliberated_4_78x116.png

Offline

 

#11 2010-01-01 09:43:23

funkymonkey
Scratcher
Registered: 2007-06-03
Posts: 1000+

Re: The And block - more than 2 spaces

agreed


http://i243.photobucket.com/albums/ff67/hprules_photos/banner2.jpg
Kuzimu: Dawn of a New Age                                                                                                  Coming May 2010

Offline

 

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

rubiks_cube_guy238
Scratcher
Registered: 2009-07-02
Posts: 100+

Re: The And block - more than 2 spaces

technoguyx wrote:

But this isn't really necessary because of what keikij said.

But when you stack the blocks, it can get slow, and it takes up WAY more space. So by adding an argument, the block takes up less space, and it is a little faster.


The glass is never half full nor half empty; it is twice as large as it needs to be.

Offline

 

#13 2010-01-01 12:47:23

rubiks_cube_guy238
Scratcher
Registered: 2009-07-02
Posts: 100+

Re: The And block - more than 2 spaces

Greatdane wrote:

I had an idea you may have something like this:

http://i46.tinypic.com/jtqe4l.gif
There are minus and plus signs on both.

If something can't be completed(minus) then it is dark green, if it can be done, it is light green.

I don't understand, can you explain that a little more?


The glass is never half full nor half empty; it is twice as large as it needs to be.

Offline

 

#14 2010-01-01 13:24:54

Greatdane
Scratcher
Registered: 2007-06-05
Posts: 1000+

Re: The And block - more than 2 spaces

Well, you can use the signs on both sides to expand and keep smaller.

Because you can't make an AND block to 1 space, the minus is shaded green, indicating you can't do that. Because you can expand the AND block, though, the plus is light green, signifying you can expand the block. If it has three spaces, the minus turns light green because you can decrease it to two spaces.


The future belongs to those who believe in the beauty of their dreams.
        ~ Eleanor Roosevelt

Offline

 

#15 2010-01-01 14:29:27

shamrocker
Scratcher
Registered: 2009-03-19
Posts: 1000+

Re: The And block - more than 2 spaces

Cool idea. Very, very cool.


http://i46.tinypic.com/2s1b32e.png
respect the oxford comma

Offline

 

#16 2010-01-01 18:59:55

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: The And block - more than 2 spaces

One problem - how would you remove one of the spaces? You can't just drag it off...


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#17 2010-01-02 00:49:49

Vista4563
Scratcher
Registered: 2009-07-20
Posts: 500+

Re: The And block - more than 2 spaces

Jonathanpb wrote:

One problem - how would you remove one of the spaces? You can't just drag it off...

I'm sure there would be an option labeled "remove argument"...


Team Vista | TBG Moderator | #stopKony #Kony2012 | http://ls.gd/icgrin http://is.gd/78GWUZ
http://is.gd/jEY5Ihttp://is.gd/Vl19zR http://i.imgur.com/L4HIs.png

Offline

 

#18 2010-01-02 13:17:24

Greatdane
Scratcher
Registered: 2007-06-05
Posts: 1000+

Re: The And block - more than 2 spaces

Jonathanpb wrote:

One problem - how would you remove one of the spaces? You can't just drag it off...

Greatdane wrote:

I had an idea you may have something like this:

http://i46.tinypic.com/jtqe4l.gif
There are minus and plus signs on both.

If something can't be completed(minus) then it is dark green, if it can be done, it is light green.

Last edited by Greatdane (2010-01-02 13:17:42)


The future belongs to those who believe in the beauty of their dreams.
        ~ Eleanor Roosevelt

Offline

 

#19 2010-01-02 16:16:26

PyrosTheStickman
Scratcher
Registered: 2009-09-19
Posts: 53

Re: The And block - more than 2 spaces

BWOG wrote:

I think that you should be able to right click an and block and there would be an option called "Change # of options" or something like that. Then you wouldn't have to but an and block into another and block over and over again.

Sorry if that doesn't make sense, because when I do stuff when I just woke up I can't think straight  tongue

No.You can insert an and or or block into an and or or block.

Offline

 

#20 2010-01-02 16:31:00

Greatdane
Scratcher
Registered: 2007-06-05
Posts: 1000+

Re: The And block - more than 2 spaces

PyrosTheStickman wrote:

BWOG wrote:

I think that you should be able to right click an and block and there would be an option called "Change # of options" or something like that. Then you wouldn't have to but an and block into another and block over and over again.

Sorry if that doesn't make sense, because when I do stuff when I just woke up I can't think straight  tongue

No.You can insert an and or or block into an and or or block.

It takes too much space! Do you read it? Someone else suggested that.


The future belongs to those who believe in the beauty of their dreams.
        ~ Eleanor Roosevelt

Offline

 

#21 2010-01-07 19:28:37

rubiks_cube_guy238
Scratcher
Registered: 2009-07-02
Posts: 100+

Re: The And block - more than 2 spaces

Vista4563 wrote:

Jonathanpb wrote:

One problem - how would you remove one of the spaces? You can't just drag it off...

I'm sure there would be an option labeled "remove argument"...

I'm sorry, there is no 'remove argument' option... I am working on that but for now you just have to deal with it or not use it


The glass is never half full nor half empty; it is twice as large as it needs to be.

Offline

 

Board footer