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

#1 2010-07-08 18:31:06

brantsmith
Scratcher
Registered: 2010-04-01
Posts: 21

How to make new scratch sections

Does anyone know how to create new scratch sections (example. command,numbers,sensing). Thanks,


http://gbryouth.webstarts.com/uploads/event2.jpg

Offline

 

#2 2010-07-08 18:56:51

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: How to make new scratch sections

I don't want to sound mean, but please search the forums for your question before posting a new topic, as this has been answered multiple times before.


nXIII

Offline

 

#3 2010-07-08 19:27:46

brantsmith
Scratcher
Registered: 2010-04-01
Posts: 21

Re: How to make new scratch sections

nXIII wrote:

I don't want to sound mean, but please search the forums for your question before posting a new topic, as this has been answered multiple times before.

Sorry! i will go look


http://gbryouth.webstarts.com/uploads/event2.jpg

Offline

 

#4 2010-07-08 19:32:46

brantsmith
Scratcher
Registered: 2010-04-01
Posts: 21

Re: How to make new scratch sections

oh, i found it

Okay. Here's how you do it. Unfortunately, I can't help you at the moment with giving the category a new color. But anyways, here it is:

First, hack Scratch. (duh).
Now, middle-click on the Scratch, and press the little red button that shows a menu. A menu should pop up. Now, select 'debug...' and then 'inspect morph'. In the window that pops up, copy the following code into the pane at the bottom. Replace all (category) with the new category you want to add.


Code:
ScratchSkin at: #(category) put: (ScratchFrameMorph skinAt: #control).
ScratchSkin at: #(category)Over put: (ScratchFrameMorph skinAt: #controlOver).
ScratchSkin at: #(category)Pressed put: (ScratchFrameMorph skinAt: #controlPressed).Now highlight it, right-click on the text, and select 'do it'.
Step 1 done. What you just did allows you to add a new category without getting an error.
Now, click the gray, select 'open...' on the menu, and select 'workspace'. Then copy the following code into the text area. Again, replace the (category) with the new category name.


Code:
!ScratchViewerMorph methodsFor: 'initialization'!
rebuildCategorySelectors
    | t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 |
    t1 _ #(#motion #control #looks #sensing #sound #operators #pen #variables #(new category)).
    submorphs do: [:t14 | (t14 isKindOf: ResizableToggleButton2)
            ifTrue: [t14 delete]].
    t2 _ 75 @ 0.
    t3 _ t1
                collect:
                    [:t15 |
                    t4 _ (ScratchTranslator translationFor: t15 asString) capitalized.
                    t5 _ ScratchFrameMorph skinAt: t15.
                    t6 _ ScratchFrameMorph skinAt: t15 , 'Pressed'.
                    t7 _ ScratchFrameMorph skinAt: t15 , 'Over'.
                    ScratchTranslator isRTL
                        ifTrue: [t8 _ ResizableToggleButton2 new
                                        offForm: (t5 flipBy: #horizontal centerAt: t5 center)
                                        onForm: (t6 flipBy: #horizontal centerAt: t6 center)
                                        overForm: (t7 flipBy: #horizontal centerAt: t7 center)]
                        ifFalse: [t8 _ ResizableToggleButton2 new
                                        offForm: t5
                                        onForm: t6
                                        overForm: t7].
                    t8 label: t4 font: (ScratchFrameMorph getFont: #Category);
                     setLabelColor: Color white;
                     target: self;
                     actionSelector: #currentCategory:;
                     arguments: (Array with: t15);
                     toggleButtonMode: true;
                     toggleMode: false.
                    ScratchTranslator isRTL
                        ifTrue: [t8 rightJustifyInset: 10]
                        ifFalse: [t8 leftJustifyInset: 10].
                    t2 _ t2 max: t8 extent + (3 @ -6).
                    t8].
    t9 _ 15.
    catButtonsExtent _ 2 * t2 x + (3 * t9) @ (t1 size // 2 * (t2 y + 6) + 25).
    t10 _ self left + 12 + t9.
    t11 _ t10 + t2 x + t9.
    t12 _ t10.
    t13 _ self top + 17.
    1 to: t3 size do:
        [:t16 |
        t8 _ t3 at: t16.
        t8 extent: t2.
        self addMorph: (t8 position: t12 @ t13).
        t16 even
            ifTrue:
                [t12 _ t10.
                t13 _ t13 + t8 height + 6]
            ifFalse: [t12 _ t11]].
    self width: catButtonsExtent x.
    pageViewer position: self position + (0 @ catButtonsExtent y).
    topSectionHeight _ catButtonsExtent y - 4! !

!ScratchViewerMorph methodsFor: 'accessing'!
currentCategory: t1
    World activeHand newKeyboardFocus: nil.
    currentCategory _ t1.
    self lightUpSelectorForCurrentCategory.
    self updateContents.
    World restoreDisplay! !Highlight all the text, right-click on the text, select 'more...' and then 'file it in'.
Step 2 done. Now you have added a new category.
Done! Now all you have to do is save the Scratch image. Open Scratch back up, and you will see a new category! It is the same color as the 'Control' category, but I can't fix that right now. I'll ask one of the Panther devs about that (Panther has 2 new categories: Files and Colors, which have their own colors.). Also, you need to have an even number of categories, so be sure to do this an even number of times.


http://gbryouth.webstarts.com/uploads/event2.jpg

Offline

 

#5 2010-07-08 19:37:52

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: How to make new scratch sections

A few notes: if you use "( ... / 2) rounded" instead of "... // 2" you can have an odd number. You also don't need the second method, simply add the symbol to the first method.


nXIII

Offline

 

#6 2010-07-09 10:25:32

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: How to make new scratch sections

brantsmith wrote:

Does anyone know how to create new scratch sections (example. command,numbers,sensing). Thanks,

wait a minute, what version of Scratch do you have, because there isn't a category called 'numbers' anymore, now it's called operators. (the version number of your Scratch should be on the top bar of the window)


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

Board footer