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

#1 2011-03-15 14:02:56

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Calling With an Insert?

I want to have a block:
[save image of scripts as [PNG^]].
The options will be PNG, GIF, and BMP (the ones scratch can write).
I have several codes ready:
spec:

Code:

('save scripts to image as %F' #- #saveScriptImageAs:)

Dropdown menu:

Code:

    $F = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #fileTypes;
         choice: 'PNG'].

Dropdown options:

Code:

fileTypes
    ^ #('PNG' 'GIF' 'BMP' )

Current method:

Code:

saveScriptImageAs: t1 
    | t2 |
    t2 _ self ownerThatIsA: ScratchScriptEditorMorph.
    t2 saveScriptsToImage: t1

Then in Scratch-UI-Panes -> ScratchScriptEditorMorph -> menu/button ops

Code:

saveScriptsToImage: t3 
    | t1 t2 |
    t2 _ pageViewerMorph contents screenshot.
    t1 _ ScratchFileChooserDialog
                chooseNewFileDefault: ''
                title: 'Save Scripts Snapshot'
                type: #scriptsSnapshot.
    t1 = #cancelled ifTrue: [^ self].
    t1 size = 0 ifTrue: [^ self].
    (t1 asLowercase endsWith: '.' , t3 asLowercase)
        ifFalse: [t1 _ t1 , '.' , t3 asLowercase].
    t3 = 'PNG' ifTrue: [t2 writePNGFileNamed: t1].
    t3 = 'GIF' ifTrue: [t2 writeGIFFileNamed: t1].
    t3 = 'BMP' ifTrue: [t2 writeBMPFileNamed: t1]

How will it call it with the insert "t1" in the block?

Last edited by scimonster (2011-03-15 14:06:37)

Offline

 

#2 2011-03-15 17:49:31

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

Re: Calling With an Insert?

The resulting block will tell the sprite to find its owner which is a ScratchScriptEditorMorph, which doesn't exist!

I'm not sure what you're asking...


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

Offline

 

#3 2011-03-15 19:00:08

Pecola1
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: Calling With an Insert?

Nice, could you tell me exactly what you are asking though.

Last edited by Pecola1 (2011-03-15 19:00:30)


If you are reading this, please read to the end, because if you don't you won't know what's at the end. Don't just skip to the end though otherwise you won't be able to read the middle, which is most important. Now you must be wondering why you just read all that, the reason is you may have not noticed something, read it again and see if you notice it this time  smile

Offline

 

#4 2011-03-16 05:26:02

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Calling With an Insert?

All I want is to call a method with the insert t1.

Offline

 

#5 2011-03-16 05:57:16

shanemiller
New Scratcher
Registered: 2011-03-01
Posts: 5

Re: Calling With an Insert?

Try and do it again.

Offline

 

#6 2011-03-16 06:08:18

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Calling With an Insert?

shanemiller wrote:

Try and do it again.

I don't know how.  roll

Offline

 

Board footer