waveOSBeta wrote:
Anybody have teh code?
I hope this comes out in Scratch 2.0...
Offline
stamp text $String$ at x:$Number$ y:$Number$ font $String$ size $Number$ color $Color$
(stage := self ownerThatIsA: ScratchStageMorph) ifNotNil: [stage createOrResizeTrailsForm. form := stage penTrailsForm] ifNil: [^ self]. canvas := FormCanvas on: form. canvas text: t1 at: t2+240@(t3 negated + 180) font: (StrikeFont fontName: t4 size: t5) color: t6. stage changed.
All credit to MathWizz, he made this and I use it all the time! One of the most useful blocks Scratch never made!
A few notes: if you don't enter a standard font size it wont make it that size, it will jump to around size 10 and if you leave the font space blank then a default font is used which I find the safest option as if the font you enter isn't on the viewers computer it can cause layout problems.
enjoy
Offline
This is actually already online in the Panther > Pen section of the block library along with rectangle and oval drawing blocks to compliment it!
Offline
sparks wrote:
This is actually already online in the Panther > Pen section of the block library along with rectangle and oval drawing blocks to compliment it!
Oh, great! I was wondering where it is; I saw it in your block lib stats project.
Offline
Yes, I used the text stamping and the rectangle drawing blocks to get my stats project to display quickly
Very useful indeed. Using the rectangle drawing tool you can do some pretty nice things!
Offline
sparks wrote:
stamp text $String$ at x:$Number$ y:$Number$ font $String$ size $Number$ color $Color$
Code:
(stage := self ownerThatIsA: ScratchStageMorph) ifNotNil: [stage createOrResizeTrailsForm. form := stage penTrailsForm] ifNil: [^ self]. canvas := FormCanvas on: form. canvas text: t1 at: t2+240@(t3 negated + 180) font: (StrikeFont fontName: t4 size: t5) color: t6. stage changed.All credit to MathWizz, he made this and I use it all the time! One of the most useful blocks Scratch never made!
A few notes: if you don't enter a standard font size it wont make it that size, it will jump to around size 10 and if you leave the font space blank then a default font is used which I find the safest option as if the font you enter isn't on the viewers computer it can cause layout problems.
enjoy![]()
Wow, thanks! Is it possible to use this in scratch by changing the $something$ things?
Offline
waveOSBeta wrote:
sparks wrote:
stamp text $String$ at x:$Number$ y:$Number$ font $String$ size $Number$ color $Color$
Code:
(stage := self ownerThatIsA: ScratchStageMorph) ifNotNil: [stage createOrResizeTrailsForm. form := stage penTrailsForm] ifNil: [^ self]. canvas := FormCanvas on: form. canvas text: t1 at: t2+240@(t3 negated + 180) font: (StrikeFont fontName: t4 size: t5) color: t6. stage changed.All credit to MathWizz, he made this and I use it all the time! One of the most useful blocks Scratch never made!
A few notes: if you don't enter a standard font size it wont make it that size, it will jump to around size 10 and if you leave the font space blank then a default font is used which I find the safest option as if the font you enter isn't on the viewers computer it can cause layout problems.
enjoy![]()
Wow, thanks! Is it possible to use this in scratch by changing the $something$ things?
('stamp text %s at x:%n y:%n' #- #stampText:atX:y: 'text' 0 0)
stampText: t1 atX: t2 y: t3
(stage := self ownerThatIsA: ScratchStageMorph) ifNotNil: [stage createOrResizeTrailsForm. form := stage penTrailsForm] ifNil: [^ self].
canvas := FormCanvas on: form.
canvas text: t1 at: t2+240@(t3 negated + 180) font: (StrikeFont fontName: t4 size: t5) color: t6.
stage changed.
Offline
waveOSBeta wrote:
Stage is an unknown variable...
![]()
add it to the variables of that method, it will work I think... IDK why... that's what I did.
Last edited by Pecola1 (2011-06-23 13:55:20)
Offline
Mmmm...
*opens Scratch*
EDIT:
Try this:
('stamp text %s with font %s' #- #stampText:font: 'Hello, World' 'Arail')stampText: text font: font
| stage form canvas |
(stage _ self ownerThatIsA: ScratchStageMorph) ifNil: [^ self].
stage createOrResizeTrailsForm.
form _ stage penTrailsForm.
canvas _ FormCanvas on: form.
canvas
text: text
at: self xpos + 240 @ (self ypos negated + 180)
font: (StrikeFont fontName: font size: penSize)
color: penColor.
stage changedLast edited by MathWizz (2011-06-23 16:22:33)
Offline
MathWizz wrote:
Mmmm...
*opens Scratch*
EDIT:
Try this:Code:
('stamp text %s with font %s' #- #stampText:font: 'Hello, World' 'Arail')Code:
stampText: text font: font | stage form canvas | (stage _ self ownerThatIsA: ScratchStageMorph) ifNil: [^ self]. stage createOrResizeTrailsForm. form _ stage penTrailsForm. canvas _ FormCanvas on: form. canvas text: text at: self xpos + 240 @ (self ypos negated + 180) font: (StrikeFont fontName: font size: penSize) color: penColor. stage changed
penSize ain't a variable, all that jazz. Any other ideas?
Offline
The block stays highlighted, it doesn't work.
Offline
MathWizz wrote:
If it stays highlighted, click the stop button and run it again.
Nope.
Offline
Bumpmubmpub Mphinhihiknknikjjdsihisk
^^'
Offline
I was going to do this in a mod a was going to make a year ago. 0_e
Offline
waveOSBeta wrote:
Bumpmubmpub Mphinhihiknknikjjdsihisk
^^'
Offline