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

#1 2011-07-08 06:58:30

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

text as costume?

I'm really in need for a way that a custom block could add a string as a costume - I'm currently using Mathwizz's text stamping block but it means that I have to reload the entire screen once the text has displayed due to stamping etc so what I really need is a way to display the text without stamping it :S Anyone have any idea how this could be done? Thanks!


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

Offline

 

#2 2011-07-08 17:24:25

owetre18
Scratcher
Registered: 2009-07-01
Posts: 1000+

Re: text as costume?

Just to bump this, I don't know.

Offline

 

#3 2011-07-12 10:43:09

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

Re: text as costume?

Bump  hmm


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

Offline

 

#4 2011-07-12 11:33:01

Pecola1
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: text as costume?

LOL, at first I saw text as costume and I was like. 0.o Then I saw what you meant. I may look for this after my vacation... but then again it will be school time by then...


If you are reading this, please read to the end, because if you don't you won't know what's at the end. Don't just skip to the end though otherwise you won't be able to read the middle, which is most important. Now you must be wondering why you just read all that, the reason is you may have not noticed something, read it again and see if you notice it this time  smile

Offline

 

#5 2011-07-12 11:45:44

sci_test
Scratcher
Registered: 2011-06-22
Posts: 100+

Re: text as costume?

Well, maybe you should look at the code for having text in the Paint Editor.  smile

    At least 180 seconds have to pass between posts. Please wait a little while and try posting again.
Now is when I would be happy with the sixty second rule.  neutral


[signature removed - please be respectful]
Last edited by scimonster (1970-01-01 00:00:00)

Offline

 

#6 2011-09-09 17:14:24

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

Re: text as costume?

Bump. I'm wondering if anyone has any idea?


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

Offline

 

#7 2011-09-09 17:27:58

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: text as costume?

Not sure... I justed squashed an annoying fly. (Sorry I'm not much help  tongue )


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#8 2011-10-31 12:23:53

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

Re: text as costume?

Bump


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

Offline

 

#9 2011-10-31 14:24:04

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

Re: text as costume?

Umm... Mind doing me a favor and giving me the code to the text stamping block?  tongue


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

Offline

 

#10 2011-10-31 14:44:52

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

Re: text as costume?

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.

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

Offline

 

#11 2011-10-31 14:57:03

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

Re: text as costume?

This is all I have. You'll have to play around with it yourself because I don't have much time.

Code:

| canvas |
canvas _ FormCanvas on: Form new extent: 100@100.
canvas text: 'SFDgfdsGFDSgfdSGFDsgd' at: 2@2 font: (StrikeFont fontName: 'Arial' size: 30) color: Color red.
costume _ ImageMedia new form: canvas form.
self changed.

Mind helping me with thistongue

Last edited by MathWizz (2011-10-31 15:00:51)


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

Offline

 

#12 2011-10-31 15:14:56

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

Re: text as costume?

Well looks like you have someone answering now, and I'm afraid I don't know, sorry, but Thanks for that code, I'll play around and see what I get  big_smile

MESSAGE NOT UNDERSTOOD: on:extent:

replacing line 2 with
canvas := FormCanvas on: form new extent:
gives me
MESSAGE NOT UNDERSTOOD: new

Last edited by sparks (2011-10-31 15:20:12)


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

Offline

 

#13 2011-11-02 06:24:49

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

Re: text as costume?

Math?


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

Offline

 

#14 2011-11-03 12:52:45

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

Re: text as costume?

Code:

| canvas |
canvas _ FormCanvas on: (Form new extent: 100@100).
canvas text: 'SFDgfdsGFDSgfdSGFDsgd' at: 2@2 font: (StrikeFont fontName: 'Arial' size: 30) color: Color red.
costume _ ImageMedia new form: canvas form.
self changed.

?


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

Offline

 

#15 2011-11-03 14:34:52

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

Re: text as costume?

Message not understood: extent.  sad

Last edited by sparks (2011-11-03 14:35:18)


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

Offline

 

#16 2011-11-03 18:21:56

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

Re: text as costume?

This should work:

Code:

| canvas |
canvas _ FormCanvas on: (Form new setExtent: 100@100 depth: 32).
canvas text: 'SFDgfdsGFDSgfdSGFDsgd' at: 2@2 font: (StrikeFont fontName: 'Arial' size: 30) color: Color red.
costume _ ImageMedia new form: canvas form.
self changed.

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

Offline

 

#17 2011-11-03 18:41:02

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

Re: text as costume?

Brilliant! It works really well, though the block needs to run twice for a change to appear, is there some sort of refresh-stage line needed?

EDIT: not be run twice, the project needs to be physically stopped and started with the flags, it would seem... The block also cannot be run by double-clicking it which suggests something inherently wrong somewhere...

text $String$ color $Color$ size $Number$ font $String$

Code:

| canvas |
canvas _ FormCanvas on: (Form new setExtent: 100@100 depth: 32).
canvas text:t1 at: 2@2 font: (StrikeFont fontName: t4 size: t3) color: t2.
costume _ ImageMedia new form: canvas form.
self changed.

Very cool that it technically works, though  big_smile  I have plans. So many plans ^_^

Last edited by sparks (2011-11-03 19:00:48)


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

Offline

 

#18 2011-11-03 19:27:00

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

Re: text as costume?

I don't know if this will work because I don't have Scratch on this computer:

Code:

| canvas stage |
canvas _ FormCanvas on: (Form new setExtent: 100@100 depth: 32).
canvas text:t1 at: 2@2 font: (StrikeFont fontName: t4 size: t3) color: t2.
costume _ ImageMedia new form: canvas form.
stage _ self ownerThatIsA: ScratchStageMorph.
stage ifNotNil: [stage changed].
self changed.

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

Offline

 

#19 2011-11-04 03:09:33

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

Re: text as costume?

Nope, still needs two runs to make a change  hmm


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

Offline

 

#20 2011-11-04 03:37:37

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: text as costume?

sparks wrote:

Nope, still needs two runs to make a change  hmm

well at least we've got somewhere!


http://i.imgur.com/zeIZW.png

Offline

 

#21 2011-11-04 12:04:14

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

Re: text as costume?

I know! This will revolutionise so much! The text-stamping is fine for most applications, but there are times when using it means refreshing the text or removing the text means re-stamping a lot of things on the screen!


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

Offline

 

#22 2011-11-04 12:48:21

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: text as costume?

text $String$ color $Color$ size $Number$ font $String$
| font csize cnv cst |
font := StrikeFont fontName: t4 size: t3.
csize := (font widthOfString: t1)@(font height).
cnv := FormCanvas on: (Form extent: csize depth: 8).
cnv text: t1 at: 0@0 font: font color: t2.
cst := ImageMedia new form: cnv form; mediaName: (self unusedMediaNameFromBaseName: costume mediaName).
media add: cst.
self lookLike: cst mediaName


nXIII

Offline

 

#23 2011-11-04 12:54:29

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

Re: text as costume?

nXIII wrote:

text $String$ color $Color$ size $Number$ font $String$
| font csize cnv cst |
font := StrikeFont fontName: t4 size: t3.
csize := (font widthOfString: t1)@(font height).
cnv := FormCanvas on: (Form extent: csize depth: 8).
cnv text: t1 at: 0@0 font: font color: t2.
cst := ImageMedia new form: cnv form; mediaName: (self unusedMediaNameFromBaseName: costume mediaName).
media add: cst.
self lookLike: cst mediaName

lol. It's funny how we've been trying to figure this out for ages, and now you just come online and post the code.  smile

Offline

 

#24 2011-11-04 13:17:41

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: text as costume?

ProgrammingFreak wrote:

nXIII wrote:

text $String$ color $Color$ size $Number$ font $String$
| font csize cnv cst |
font := StrikeFont fontName: t4 size: t3.
csize := (font widthOfString: t1)@(font height).
cnv := FormCanvas on: (Form extent: csize depth: 8).
cnv text: t1 at: 0@0 font: font color: t2.
cst := ImageMedia new form: cnv form; mediaName: (self unusedMediaNameFromBaseName: costume mediaName).
media add: cst.
self lookLike: cst mediaName

lol. It's funny how we've been trying to figure this out for ages, and now you just come online and post the code.  smile

well, from what I can see, his code is quite similar to mathwizz's and then again, nXIII is pretty good when it comes to smalltalk  smile


http://i.imgur.com/zeIZW.png

Offline

 

#25 2011-11-04 13:29:02

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: text as costume?

http://yourimg.in/m/d6u258l.png
Edit: There is some way to delete it right? and also change it's position.

Last edited by rookwood101 (2011-11-04 13:29:44)


http://i.imgur.com/zeIZW.png

Offline

 

Board footer