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

#1 2012-07-26 13:26:14

jvvg
Scratcher
Registered: 2008-03-26
Posts: 1000+

Extracting ScratchSkin from a mod

I am writing Insanity 1.1 on a different computer than I wrote Insanity 1.0, and it would take a while to find the ScratchSkin folder I used.

Does anyone know how I can extract the folder from the mod?


http://tiny.cc/zwgbewhttp://tiny.cc/e1gbewhttp://tiny.cc/zygbewhttp://tiny.cc/izgbew
Goodbye, Scratch 1.4  sad                                                        Hello Scratch 2.0!  smile

Offline

 

#2 2012-07-26 16:57:32

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

Re: Extracting ScratchSkin from a mod

Look at the ScratchFrameMorph class, there's the method that gets the skin from a folder. You can copy it a rewrite it to do the inverse, it's not hard  smile

Offline

 

#3 2012-07-26 17:03:24

jvvg
Scratcher
Registered: 2008-03-26
Posts: 1000+

Re: Extracting ScratchSkin from a mod

I found the method, but I don't understand it much.  hmm


http://tiny.cc/zwgbewhttp://tiny.cc/e1gbewhttp://tiny.cc/zygbewhttp://tiny.cc/izgbew
Goodbye, Scratch 1.4  sad                                                        Hello Scratch 2.0!  smile

Offline

 

#4 2012-07-26 17:05:08

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

Re: Extracting ScratchSkin from a mod

jvvg wrote:

I found the method, but I don't understand it much.  hmm

Oh, I see. Could you post it here so I don't have to open Bingo to find it to help?

Offline

 

#5 2012-07-26 17:08:57

jvvg
Scratcher
Registered: 2008-03-26
Posts: 1000+

Re: Extracting ScratchSkin from a mod

Code:

readSkinFrom: t1 
    | t2 t3 t4 t5 |
    t2 _ Dictionary new.
    t5 _ Dictionary new.
    t1 fileNames do: 
        [:t6 | 
        Cursor read showWhile: [t3 _ [Form fromFileNamed: (t1 fullNameFor: t6)]
                        ifError: []].
        t3
            ifNotNil: 
                [t4 _ t6 findLast: [:t7 | t7 = $.].
                t4 = 0 ifFalse: [t6 _ t6 copyFrom: 1 to: t4 - 1].
                (t6 asLowercase endsWith: '_xo')
                    ifTrue: [t5 at: (t6 copyFrom: 1 to: t6 size - 3) asSymbol put: t3]
                    ifFalse: [t2 at: t6 asSymbol put: t3]]].
    ScratchSkin _ t2.
    ScratchSkinXO _ t5.
    t3 _ ScratchSkin at: #scriptsPaneTexture ifAbsent: [].
    (t3 notNil and: [t3 depth ~= 32])
        ifTrue: [ScratchSkin at: #scriptsPaneTexture put: (t3 asFormOfDepth: 32)]

http://tiny.cc/zwgbewhttp://tiny.cc/e1gbewhttp://tiny.cc/zygbewhttp://tiny.cc/izgbew
Goodbye, Scratch 1.4  sad                                                        Hello Scratch 2.0!  smile

Offline

 

#6 2012-07-26 17:24:49

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

Re: Extracting ScratchSkin from a mod

OK, maybe rewriting that could be a bit confusing. Why don't you just try a...
ScratchSkin do [thatForm write to png at path t1 , 'png']
ScratchSkinXO do [thatForm write to png at path t1 , 'XO.png']

Or something  tongue

Offline

 

#7 2012-10-06 03:00:15

Jonathan50
Scratcher
Registered: 2011-07-06
Posts: 100+

Re: Extracting ScratchSkin from a mod

jvvg wrote:

Code:

readSkinFrom: t1 
    | t2 t3 t4 t5 |
    t2 _ Dictionary new.
    t5 _ Dictionary new.
    t1 fileNames do: 
        [:t6 | 
        Cursor read showWhile: [t3 _ [Form fromFileNamed: (t1 fullNameFor: t6)]
                        ifError: []].
        t3
            ifNotNil: 
                [t4 _ t6 findLast: [:t7 | t7 = $.].
                t4 = 0 ifFalse: [t6 _ t6 copyFrom: 1 to: t4 - 1].
                (t6 asLowercase endsWith: '_xo')
                    ifTrue: [t5 at: (t6 copyFrom: 1 to: t6 size - 3) asSymbol put: t3]
                    ifFalse: [t2 at: t6 asSymbol put: t3]]].
    ScratchSkin _ t2.
    ScratchSkinXO _ t5.
    t3 _ ScratchSkin at: #scriptsPaneTexture ifAbsent: [].
    (t3 notNil and: [t3 depth ~= 32])
        ifTrue: [ScratchSkin at: #scriptsPaneTexture put: (t3 asFormOfDepth: 32)]

t1 is a Folder


Jonathan50
big_smile  http://scratch.mit.edu/img/pages/credits/cat-face-bullet.gif http://blocks.scratchr.org/API.php?user=Jonathan50&action=onlineStatus&type=square         http://blocks.scratchr.org/API.php?user=Jonathan50&action=projects&type=newest&return=image&num=1

Offline

 

Board footer