ScratchReallyROCKS wrote:
now I'm getting mediaName errors!
I got:
Message not understood: stopPlaying
a mediaName error
AND a form error!
Offline
...but the stop all glitch still occurs.
Great. Just great.
It seems the super stopPlaying (tells everything to stop playing)in ScratchSpriteMorph isn't working correctly.
Offline
You were close:
getCostumeFromX1: t1 y1: t2 x2: t3 y2: t4
costume _ ImageMedia new form: (Form fromDisplay: (t1 @ t2 corner: t3 @ t4)).
costume mediaName: (self unusedMediaNameFromBaseName: 'costume').
media addLast: costume.
self costumeChanged.
self updateMediaCategory
Offline
MathWizz wrote:
You were close:
Code:
getCostumeFromX1: t1 y1: t2 x2: t3 y2: t4 costume _ ImageMedia new form: (Form fromDisplay: (t1 @ t2 corner: t3 @ t4)). costume mediaName: (self unusedMediaNameFromBaseName: 'costume'). media addLast: costume. self costumeChanged. self updateMediaCategory
![]()
Aww! Dang we were too close!
Offline
still get a syntax error
| t1 t2 t3 t4 |
t1 _ 10.
t2 _ 10.
t3 _ -10.
t4 _ -10.
Nothing more expected ->getCostumeFromX1: t1 y1: t2 x2: t3 y2: t4
costume _ ImageMedia new form: (Form fromDisplay: (t1 @ t2 corner: t3 @ t4)).
costume mediaName: (self unusedMediaNameFromBaseName: 'costume').
media addLast: costume.
self costumeChanged.
self updateMediaCategory
Offline
sparks wrote:
still get a syntax error
![]()
| t1 t2 t3 t4 |
t1 _ 10.
t2 _ 10.
t3 _ -10.
t4 _ -10.
Nothing more expected ->getCostumeFromX1: t1 y1: t2 x2: t3 y2: t4
costume _ ImageMedia new form: (Form fromDisplay: (t1 @ t2 corner: t3 @ t4)).
costume mediaName: (self unusedMediaNameFromBaseName: 'costume').
media addLast: costume.
self costumeChanged.
self updateMediaCategory
AHEM you did the following wrong:
1. the | t1 t2 t3 t4 | is already defined.
2. It should be below the getCostumeFrom... opening.
Offline
sparks wrote:
It's a syntax error! I didn't define the variables in my code, I copied MathWizz's code directly> once the block is run, a window with that code appears. There the variables are declared and set!
Are you missing the 'self'?
EDIT
If you did that logically, you're missing the self.
If not, declare the selector in the first line and put the var declarations after!
Last edited by LS97 (2011-01-18 12:22:45)
Offline
Here's the syntax error that appears if the missing self is added (oops
)
| t1 t2 t3 t4 |
t1 _ 10.
t2 _ 10.
t3 _ -10.
t4 _ -10.
self getCostumeFromX1: t1 y1: t2 x2: t3 y2: t4
costume Nothing more expected ->_ ImageMedia new form: (Form fromDisplay: (t1 @ t2 corner: t3 @ t4)).
costume mediaName: (self unusedMediaNameFromBaseName: 'costume').
media addLast: costume.
self costumeChanged.
self updateMediaCategory
Offline
sparks wrote:
Here's the syntax error that appears if the missing self is added (oops
)
| t1 t2 t3 t4 |
t1 _ 10.
t2 _ 10.
t3 _ -10.
t4 _ -10.
self getCostumeFromX1: t1 y1: t2 x2: t3 y2: t4 <- remove this line
costume _ ImageMedia new form: (Form fromDisplay: (t1 @ t2 corner: t3 @ t4)).
costume mediaName: (self unusedMediaNameFromBaseName: 'costume').
media addLast: costume.
self costumeChanged.
self updateMediaCategory
Offline
| t1 t2 t3 t4 |
t1 _ 10.
t2 _ 10.
t3 _ -10.
t4 _ -10.
self costume Nothing more expected ->_ ImageMedia new form: (Form fromDisplay: (t1 @ t2 corner: t3 @ t4)).
costume mediaName: (self unusedMediaNameFromBaseName: 'costume').
media addLast: costume.
self costumeChanged.
self updateMediaCategory
EDIT: removing the self does something, but then you can't open the costumes tab!
ERROR: divison by 0
SmallInteger(Object)>>error:
SmallInteger>>/
ImageMedia>>thumbnailFormExtent:
MediaItemMorph>>buildSubmorphs
MediaItemMorph>>scratchObj:media:
[] in ScratchSpriteMorph(ScriptableScratchMorph)>>costumesPage:
OrderedCollection>>do:
ScratchSpriteMorph(ScriptableScratchMorph)>>costumesPage:
ScratchScriptEditorMorph>>currentCategory:
ScratchTabPaneMorph>>currentTab:
Last edited by sparks (2011-01-18 12:52:01)
Offline
sparks wrote:
Here's the syntax error that appears if the missing self is added (oops
)
| t1 t2 t3 t4 |
t1 _ 10.
t2 _ 10.
t3 _ -10.
t4 _ -10.
self getCostumeFromX1: t1 y1: t2 x2: t3 y2: t4.
costume Nothing more expected ->_ ImageMedia new form: (Form fromDisplay: (t1 @ t2 corner: t3 @ t4)).
costume mediaName: (self unusedMediaNameFromBaseName: 'costume').
media addLast: costume.
self costumeChanged.
self updateMediaCategory
Add a dot after the self getCostumeFrom etc... i put a red bold blob where but i don't know if you can see it.
Last edited by LS97 (2011-01-18 12:59:10)
Offline
sparks wrote:
no, the line self getCostumeFromX1: t1 y1: t2 x2: t3 y2: t4. shouldn't be included, I think.
Adding it gives an error saying message not understood: self getCostumeFromX1: t1 y1: t2 x2: t3 y2: t4.
because it was supposed to be a block definition, smart one.
It goes on the top, and then you put everything under.
You put that at the TOP!
You should have said if you wanted a block or a command.
Last edited by bbbeb (2011-01-18 13:41:59)
Offline
what are you trying to do?
Offline
oh....um.....idk
you don't really need it though....
Offline
I'm not saying its not useful. I'm just saying you could use this:
<go to x
)y
Offline
That moves the sprite to a specified screen region. This one will make a copy of part of the stage and add it as a costume. The same as right-clicking on a sprite and selecting "grab screen region for new costume"
Offline