Where is the code that is used to change sprites (E.G from sprite 1 to sprite 2)? The bit that changes the scripting pane.
Also can I use to to change to a sprite of my choice?
E.G Make a new block
[focus on sprite %s]
And finally how can I get a list of all sprites (inc. stage)?
E.G
t1_ self allSpriteNames.
Offline
nextInstanceName has sumthin ta do with it. I can look for the actual code.
Offline
I think all you need is next instance name. You could be able to edit it so it could say dog 1 dog 2 or anything from there, it depends on what you are doing.
Its ScriptableScratchMorph private/all nextInstanceName
Last edited by Pecola1 (2011-05-29 12:09:01)
Offline
Can you give the location of the method?
Offline
johnnydean1 wrote:
Can you give the location of the method?
Pecola1 wrote:
Its ScriptableScratchMorph private/all nextInstanceName
Offline
When you say list of all sprites, you mean for the dropdown right? You have to go to ScratchBlocks -> SpriteArgMorph -> event handling -> presentMenu
add somwhere after the t4 _ CustomMenu new.
t2 = #yourBlocksSelector
ifTrue: [t4 add: 'Stage' localized asUTF8 action: t1 workPane]
Last edited by Pecola1 (2011-05-29 12:21:49)
Offline
I want a block that is:
[change scripting pane to %sprite ]
nextInstanceName is the name of a default sprite...
Offline
johnnydean1 wrote:
I want a block that is:
[change scripting pane to %sprite ]
nextInstanceName is the name of a default sprite...
Oh.... thats a little different isn't it. LOL I can get that i think let me see...
Offline
Hmmm... I can get it to change what block category it focuses on but not the sprite I can keep looking.
Offline
Try this. It goes in ScriptableScratchMorph.
switchTo: sprite
| scratchFrame |
scratchFrame _ (self ownerThatIsA: ScratchFrameMorph)
ifNil: [self ownerThatIsA: OffscreenWorldMorph frame].
scratchFrame viewerPane target: sprite.
sprite viewBlocksAndScriptsOffline
TheSuccessor wrote:
Try this. It goes in ScriptableScratchMorph.
Code:
switchTo: sprite | scratchFrame | scratchFrame _ (self ownerThatIsA: ScratchFrameMorph) ifNil: [self ownerThatIsA: OffscreenWorldMorph frame]. scratchFrame viewerPane target: sprite. sprite viewBlocksAndScripts
Nope...
Offline
Maybe this?
switchTo: t1
| t2 t3 |
t2 _ (self ownerThatIsA: ScratchFrameMorph)
ifNil: [(self ownerThatIsA: OffscreenWorldMorph) frame].
t3 _ self coerceSpriteArg: t1.
t2 viewerPane target: t3.
t3 viewBlocksAndScriptsBlockspec:
('change scripting pane to %m' #- #switchTo:) (take out # symbols if using source).
Last edited by TheSuccessor (2011-05-30 06:08:24)
Offline
TheSuccessor wrote:
Maybe this?
Code:
switchTo: t1 | t2 t3 | t2 _ (self ownerThatIsA: ScratchFrameMorph) ifNil: [(self ownerThatIsA: OffscreenWorldMorph) frame]. t3 _ self coerceSpriteArg: t1. t2 viewerPane target: t3. t3 viewBlocksAndScriptsBlockspec:
('change scripting pane to %m' #- #switchTo:) (take out # symbols if using source).
What about the stage, that does not work...
Offline