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

#26 2011-01-17 16:36:58

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: smalltalk command?

now I'm getting mediaName errors!


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#27 2011-01-17 16:47:33

bbbeb
Scratcher
Registered: 2009-06-11
Posts: 1000+

Re: smalltalk command?

ScratchReallyROCKS wrote:

now I'm getting mediaName errors!

I got:
Message not understood: stopPlaying
a mediaName error
AND a form error!


Back in my day.... there were no laws that censored the internet... now, there are.... nah.

Offline

 

#28 2011-01-17 16:53:34

bbbeb
Scratcher
Registered: 2009-06-11
Posts: 1000+

Re: smalltalk command?

I think i feel stupid.
We didn't define a new form, duh...


Back in my day.... there were no laws that censored the internet... now, there are.... nah.

Offline

 

#29 2011-01-17 17:00:33

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: smalltalk command?

ohhh!


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#30 2011-01-17 17:09:54

bbbeb
Scratcher
Registered: 2009-06-11
Posts: 1000+

Re: smalltalk command?

...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.


Back in my day.... there were no laws that censored the internet... now, there are.... nah.

Offline

 

#31 2011-01-17 17:14:56

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: smalltalk command?

mrrrrr  sad


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#32 2011-01-17 21:36:22

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: smalltalk command?

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

lol


http://block.site90.net/scratch.mit/text.php?size=30&text=%20A%20signature!&color=333333

Offline

 

#33 2011-01-17 23:13:12

bbbeb
Scratcher
Registered: 2009-06-11
Posts: 1000+

Re: smalltalk command?

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

lol

Aww! Dang we were too close!


Back in my day.... there were no laws that censored the internet... now, there are.... nah.

Offline

 

#34 2011-01-18 04:13:02

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: smalltalk command?

still get a syntax error  sad

| 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


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#35 2011-01-18 10:44:15

bbbeb
Scratcher
Registered: 2009-06-11
Posts: 1000+

Re: smalltalk command?

sparks wrote:

still get a syntax error  sad

| 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.


Back in my day.... there were no laws that censored the internet... now, there are.... nah.

Offline

 

#36 2011-01-18 11:48:12

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: smalltalk command?

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!


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#37 2011-01-18 12:21:26

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

Re: smalltalk command?

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

 

#38 2011-01-18 12:25:45

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: smalltalk command?

Here's the syntax error that appears if the missing self is added (oops  smile  )

| 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


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#39 2011-01-18 12:44:39

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: smalltalk command?

sparks wrote:

Here's the syntax error that appears if the missing self is added (oops  smile  )

| 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


http://block.site90.net/scratch.mit/text.php?size=30&amp;text=%20A%20signature!&amp;color=333333

Offline

 

#40 2011-01-18 12:50:32

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: smalltalk command?

| 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)


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#41 2011-01-18 12:58:08

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

Re: smalltalk command?

sparks wrote:

Here's the syntax error that appears if the missing self is added (oops  smile  )

| 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

 

#42 2011-01-18 13:13:03

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: smalltalk command?

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.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#43 2011-01-18 13:40:44

bbbeb
Scratcher
Registered: 2009-06-11
Posts: 1000+

Re: smalltalk command?

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)


Back in my day.... there were no laws that censored the internet... now, there are.... nah.

Offline

 

#44 2011-01-18 13:44:55

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: smalltalk command?

... a block. Sorry.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#45 2011-01-18 14:48:25

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: smalltalk command?

what are you trying to do?

Offline

 

#46 2011-01-18 14:52:38

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: smalltalk command?

If you read the first post, you'll see!


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#47 2011-01-18 14:58:09

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: smalltalk command?

oh....um.....idk  lol
you don't really need it though....

Offline

 

#48 2011-01-18 15:02:38

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: smalltalk command?

Why don't I need a "create costume from screen region x sad  ) y sad  ) to x sad  ) y sad  )" block?! It wound be Very useful with a capital V!


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#49 2011-01-18 15:08:35

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: smalltalk command?

I'm not saying its not useful. I'm just saying you could use this:

<go to x sad   )y sad

Offline

 

#50 2011-01-18 15:12:45

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: smalltalk command?

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"


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

Board footer