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

#1 2010-05-09 16:47:50

waveOSBeta
Scratcher
Registered: 2009-12-08
Posts: 1000+

How do I add new categories?

I tried, but it won't work.


http://internetometer.com/image/10202.png]
New signature coming soon!  smile

Offline

 

#2 2010-05-09 17:33:10

TheGameMaster1231
Scratcher
Registered: 2009-07-24
Posts: 1000+

Re: How do I add new categories?

Sorry, Can't Help Here.  sad

Offline

 

#3 2010-05-10 14:28:20

waveOSBeta
Scratcher
Registered: 2009-12-08
Posts: 1000+

Re: How do I add new categories?

bump.


http://internetometer.com/image/10202.png]
New signature coming soon!  smile

Offline

 

#4 2010-05-10 14:42:49

DaGamez
Scratcher
Registered: 2010-04-18
Posts: 1000+

Re: How do I add new categories?

Categories in what?


http://scratchhtmlviewer.net23.net/image.php?project=1229757&user=DaGamez

Offline

 

#5 2010-05-10 15:00:09

waveOSBeta
Scratcher
Registered: 2009-12-08
Posts: 1000+

Re: How do I add new categories?

pen, operators, looks, variables, etc...


http://internetometer.com/image/10202.png]
New signature coming soon!  smile

Offline

 

#6 2010-07-02 18:42:47

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

Re: How do I add new categories?

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.

Last edited by rubiks_cube_guy238 (2010-07-02 18:47:21)


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

Offline

 

#7 2010-07-10 13:16:35

scratchycat625625
Scratcher
Registered: 2009-06-05
Posts: 17

Re: How do I add new categories?

any result on colours yet?


Plug 'n' play... How do they know my street name?

Offline

 

#8 2010-09-29 17:49:19

celloguy123
Scratcher
Registered: 2009-01-15
Posts: 100+

Re: How do I add new categories?

rubiks_cube_guy238 wrote:

Code:

ScratchSkin at: #(category) put: (ScratchFrameMorph skinAt: #control).
ScratchSkin at: #(category)Over put: (ScratchFrameMorph skinAt: #controlOver).
ScratchSkin at: #(category)Pressed put: (ScratchFrameMorph skinAt: #controlPressed).

If you change control to (for example) operators, then the new category's color changes to green, motion to blue, etc.


http://internetometer.com/image/33068.png

Offline

 

Board footer