I wanted this to, sorry I found no solution.
Offline
Form fromDisplay: returns a form from the section of the display that the rectangle passed as an argument specifies.
Offline
I recommend asking your Panther Teammates. XD
I think you could do it with modification of the "grab screen region for new costume".
Offline
bbbeb wrote:
I recommend asking your Panther Teammates. XD
I think you could do it with modification of the "grab screen region for new costume".
Definitely. That's what I've been thinking all along while reading this thread!
Offline
LS97 wrote:
bbbeb wrote:
I recommend asking your Panther Teammates. XD
I think you could do it with modification of the "grab screen region for new costume".Definitely. That's what I've been thinking all along while reading this thread!
Yay!
I'll go look at it, and see what I can do...
Offline
This is the menu
grabSpriteFromScreen
| t1 t2 t3 |
(t1 _ self ownerThatIsA: ScratchFrameMorph) ifNil: [^ self].
t2 _ ScratchSpriteMorph new.
(t3 _ t2 grabFormFromScreen) ifNil: [^ self].
t2 onlyCostume: t3.
t1 addAndView: t2.I don't think that will help.
The grabFormFromScreen is what needs to be modified, not the actual code..
EDIT:
form: t1
costume _ ImageMedia new form: t1.
costume mediaName: (self unusedMediaNameFromBaseName: 'costume').
media addLast: costume.
self costumeChanged.
self updateMediaCategoryThat updates the costumes.
The 1st line needs to be modified, but how could we set a form to a certain part of the screen?
Last edited by bbbeb (2011-01-16 16:11:25)
Offline
sparks wrote:
so
self fromDisplay: (t1@t2)
?
EDIT: Does not work![]()
t1 @ t2 is a point. A rectangle is made like this: Rectangle origin:corner: The code would be:
| screenshot |
screenshot _ Form fromDisplay: (Rectangle origin: (t1@t2) corner: (t3@t4)).
Offline
bbbeb wrote:
This is the menu
Code:
grabSpriteFromScreen | t1 t2 t3 | (t1 _ self ownerThatIsA: ScratchFrameMorph) ifNil: [^ self]. t2 _ ScratchSpriteMorph new. (t3 _ t2 grabFormFromScreen) ifNil: [^ self]. t2 onlyCostume: t3. t1 addAndView: t2.I don't think that will help.
The grabFormFromScreen is what needs to be modified, not the actual code..
EDIT:Code:
form: t1 costume _ ImageMedia new form: t1. costume mediaName: (self unusedMediaNameFromBaseName: 'costume'). media addLast: costume. self costumeChanged. self updateMediaCategoryThat updates the costumes.
The 1st line needs to be modified, but how could we set a form to a certain part of the screen?
TheSuccessor wrote:
sparks wrote:
so
self fromDisplay: (t1@t2)
?
EDIT: Does not work![]()
t1 @ t2 is a point. A rectangle is made like this: Rectangle origin:corner: The code would be:
| screenshot |
screenshot _ Form fromDisplay: (Rectangle origin: (t1@t2) corner: (t3@t4)).
So it would be this:
newCostume from x1: t1 y1: t2 to x2: t4 y2: t4
costume _ Form fromDisplay: (Rectangle origin: (t1@t2) corner: (t3@t4)).
costume mediaName: (self unusedMediaNameFromBaseName: 'costume').
media addLast: costume.
self costumeChanged.
self updateMediaCategory?
Offline
It's looking good, but your above block returns the following syntax error:
| t1 t2 t3 t4 |
t1 _ 10.
t2 _ 10.
t3 _ -10.
t4 _ -10.
newCostume from x1: t1 y1: t2 to x2: t4 y2: t4
costume Nothing more expected ->_ Form fromDisplay: (Rectangle origin: (t1@t2) corner: (t3@t4)).
costume mediaName: (self unusedMediaNameFromBaseName: 'costume').
media addLast: costume.
self costumeChanged.
self updateMediaCategory
Offline
sparks wrote:
It's looking good, but your above block returns the following syntax error:
newCostume from x1: t1 y1: t2 to x2: t4 y2: t4
t1 _ 10.
t2 _ 10.
t3 _ -10.
t4 _ -10.
costume_ Form fromDisplay: (Rectangle origin: (t1@t2) corner: (t3@t4)).
costume mediaName: (self unusedMediaNameFromBaseName: 'costume').
media addLast: costume.
self costumeChanged.
self updateMediaCategory.
Kill the space, and see what happens.
Try that code.
EDIT: And i don't think you need the top parts.
Those should be below the definition(the newCostume from:, right?)
Last edited by bbbeb (2011-01-17 15:58:28)
Offline
sparks wrote:
It's looking good, but your above block returns the following syntax error:
| t1 t2 t3 t4 |
t1 _ 10.
t2 _ 10.
t3 _ -10.
t4 _ -10.
newCostume from x1: t1 y1: t2 to x2: t4 y2: t4
costume Nothing more expected ->_ Form fromDisplay: (Rectangle origin: (t1@t2) corner: (t3@t4)).
costume mediaName: (self unusedMediaNameFromBaseName: 'costume').
media addLast: costume.
self costumeChanged.
self updateMediaCategory
is costume a variable? Because it doesn't look like it's created anywhere...
Last edited by ScratchReallyROCKS (2011-01-17 15:58:30)
Offline
removing the space from the code like so:
newCostume from x1: t1 y1: t2 to x2: t4 y2: t4
costume_ Form fromDisplay: (Rectangle origin: (t1@t2) corner: (t3@t4)).
costume mediaName: (self unusedMediaNameFromBaseName: 'costume').
media addLast: costume.
self costumeChanged.
self updateMediaCategoryreturns the same syntax error
Offline
sparks wrote:
removing the space from the code like so:
Code:
newCostume from x1: t1 y1: t2 to x2: t4 y2: t4 costume_ Form fromDisplay: (Rectangle origin: (t1@t2) corner: (t3@t4)). costume mediaName: (self unusedMediaNameFromBaseName: 'costume'). media addLast: costume. self costumeChanged. self updateMediaCategoryreturns the same syntax error
let me think.....
let me test it and see...
Offline
it's the method name; it has spaces in it.
I tried this:
newCostume from x1: t1 y1: t2 to x2: t4 y2: t4
costume _ Form fromDisplay: (Rectangle origin: (t1@t2) corner: (t3@t4)).
costume mediaName: (self unusedMediaNameFromBaseName: 'costume').
media addLast: costume.
self costumeChanged.
self updateMediaCategory
but it got me a mediaStep error.
Offline
ScratchReallyROCKS wrote:
it's the method name; it has spaces in it.
I tried this:newCostume from x1: t1 y1: t2 to x2: t4 y2: t4
costume _ Form fromDisplay: (Rectangle origin: (t1@t2) corner: (t3@t4)).
costume mediaName: (self unusedMediaNameFromBaseName: 'costume').
media addLast: costume.
self costumeChanged.
self updateMediaCategorybut it got me a mediaStep error.
You're right!
Try this:
newCostume x1: t1 y1: t2 to x2: t4 y2: t4
costume _ Form fromDisplay: (Rectangle origin: (t1@t2) corner: (t3@t4)).
costume mediaName: (self unusedMediaNameFromBaseName: 'costume').
media addLast: costume.
self costumeChanged.
self updateMediaCategory
Offline
bbbeb wrote:
ScratchReallyROCKS wrote:
it's the method name; it has spaces in it.
I tried this:newCostume from x1: t1 y1: t2 to x2: t4 y2: t4
costume _ Form fromDisplay: (Rectangle origin: (t1@t2) corner: (t3@t4)).
costume mediaName: (self unusedMediaNameFromBaseName: 'costume').
media addLast: costume.
self costumeChanged.
self updateMediaCategorybut it got me a mediaStep error.
You're right!
Try this:newCostume x1: t1 y1: t2 to x2: t4 y2: t4
costume _ Form fromDisplay: (Rectangle origin: (t1@t2) corner: (t3@t4)).
costume mediaName: (self unusedMediaNameFromBaseName: 'costume').
media addLast: costume.
self costumeChanged.
self updateMediaCategory
Sorry, I pasted the wrong thing up there. it should have been this:
newCostumeFromX1: t1 y1: t2 toX2: t3 y2: t4
costume _ Form fromDisplay: (Rectangle origin: t1 @ t2 corner: t3 @ t4).
costume mediaName: (self unusedMediaNameFromBaseName: 'costume').
media addLast: costume.
self costumeChanged.
self updateMediaCategory
your's still had spaces in it, this doesn't. But it got me a mediaStep error.
Offline
bbbeb wrote:
ScratchReallyROCKS wrote:
it's the method name; it has spaces in it.
I tried this:newCostume from x1: t1 y1: t2 to x2: t4 y2: t4
costume _ Form fromDisplay: (Rectangle origin: (t1@t2) corner: (t3@t4)).
costume mediaName: (self unusedMediaNameFromBaseName: 'costume').
media addLast: costume.
self costumeChanged.
self updateMediaCategorybut it got me a mediaStep error.
You're right!
Try this:newCostume x1: t1 y1: t2 to x2: t4 y2: t4
costume _ Form fromDisplay: (Rectangle origin: (t1@t2) corner: (t3@t4)).
costume mediaName: (self unusedMediaNameFromBaseName: 'costume').
media addLast: costume.
self costumeChanged.
self updateMediaCategory
I GOT IT TO WORK WITHOUT AN ERROR (FOR NOW!!!)
getCostumeFromx1: t1 y1: t2 x2: t3 y2: t4
costume _ Form fromDisplay: (Rectangle origin: (t1@t2) corner: (t3@t4)).
costume mediaName: (self unusedMediaNameFromBaseName: 'costume').
media addLast: costume.
self costumeChanged.
self updateMediaCategoryTesting it now...
Offline
It just highlights the block like it's running, but doesn't do anything
I did something that gets me an error every time I press the stop button
Offline
bbbeb wrote:
bbbeb wrote:
ScratchReallyROCKS wrote:
it's the method name; it has spaces in it.
I tried this:
but it got me a mediaStep error.You're right!
Try this:newCostume x1: t1 y1: t2 to x2: t4 y2: t4
costume _ Form fromDisplay: (Rectangle origin: (t1@t2) corner: (t3@t4)).
costume mediaName: (self unusedMediaNameFromBaseName: 'costume').
media addLast: costume.
self costumeChanged.
self updateMediaCategoryI GOT IT TO WORK WITHOUT AN ERROR (FOR NOW!!!)
Code:
getCostumeFromx1: t1 y1: t2 x2: t3 y2: t4 costume _ Form fromDisplay: (Rectangle origin: (t1@t2) corner: (t3@t4)). costume mediaName: (self unusedMediaNameFromBaseName: 'costume'). media addLast: costume. self costumeChanged. self updateMediaCategoryTesting it now...
I'm gonna bash my head into a wall. I have to go for ~15 minutes, I'll see what i can do when i get back.
Offline