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

#1 2012-08-18 22:50:56

ZombieHappines
Scratcher
Registered: 2012-01-19
Posts: 100+

typing

i have a sort of typing script but it is not working to well sometimes it adds extra letters moves the letters to close or to far this is my script

when gf clicked
set wordsx to -220
set wordsx to -100
clear
wait 0.1 secs
set toprint to No Accounts Detected
broadcast type and wait
When i Recieve type
go to x wordsx y wordsy
set reader to 1
repeat <length of (toprint)>
   if <letter 1 of (toprint)=2>
   else 
    switch to costume letter reader of toprint
    stamp
    wait 0.1 sec
     change x by 15
     change reader by 1

Last edited by ZombieHappines (2012-08-18 22:51:24)


http://i47.tinypic.com/10wr3bq.jpg
http://i50.tinypic.com/2w7onpy.png

Offline

 

#2 2012-08-19 09:26:11

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: typing

ZombieHappines wrote:

i have a sort of typing script but it is not working to well sometimes it adds extra letters moves the letters to close or to far this is my script

when gf clicked
set [wordsx v] to (-220)
set [wordsx v] to (-100)
clear
wait (0.1) secs
set [toprint v] to [No Accounts Detected]
broadcast [type v] and wait
When I receive [type v]
go to x: (wordsx) y: (wordsy)
set [reader v] to (1)
repeat <length of (toprint)>
if <(letter (1) of (toprint))=(2)>
else
switch to costume (letter (reader) of (toprint))
stamp
wait (0.1) secs
change x by (15)
change [reader v] by (1)

fixed scripts, but I don't understand what you're trying to do.


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#3 2012-08-19 11:43:12

ZombieHappines
Scratcher
Registered: 2012-01-19
Posts: 100+

Re: typing

MoreGamesNow wrote:

ZombieHappines wrote:

i have a sort of typing script but it is not working to well sometimes it adds extra letters moves the letters to close or to far this is my script

when gf clicked
set [wordsx v] to (-220)
set [wordsx v] to (-100)
clear
wait (0.1) secs
set [toprint v] to [No Accounts Detected]
broadcast [type v] and wait
When I receive [type v]
go to x: (wordsx) y: (wordsy)
set [reader v] to (1)
repeat <length of (toprint)>
if <(letter (1) of (toprint))=(2)>
else
switch to costume (letter (reader) of (toprint))
stamp
wait (0.1) secs
change x by (15)
change [reader v] by (1)

fixed scripts, but I don't understand what you're trying to do.

here is an example of what im trying to do but it doesnt come out right for some reason http://scratch.mit.edu/projects/ZombieHappines/2736800


http://i47.tinypic.com/10wr3bq.jpg
http://i50.tinypic.com/2w7onpy.png

Offline

 

#4 2012-08-19 11:56:11

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: typing

The main problem seems to be spaces.  I tried out this script and it seemed to work.

when I receive [type v]
go to x:(wordsx) y:(wordsy)
repeat (length of (to print))
if<not<(letter (reader) of (to print)) = [ ]>>
switch to costume (letter (reader) of (to print))
stamp
wait (0.1) secs
end
change x by (15)
change [reader v] by (1)
end

Last edited by MoreGamesNow (2012-08-19 11:56:25)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#5 2012-08-19 12:30:56

ZombieHappines
Scratcher
Registered: 2012-01-19
Posts: 100+

Re: typing

MoreGamesNow wrote:

The main problem seems to be spaces.  I tried out this script and it seemed to work.

when I receive [type v]
go to x:(wordsx) y:(wordsy)
repeat (length of (to print))
if<not<(letter (reader) of (to print)) = [ ]>>
switch to costume (letter (reader) of (to print))
stamp
wait (0.1) secs
end
change x by (15)
change [reader v] by (1)
end

this still isn't working for me i don't understand why


http://i47.tinypic.com/10wr3bq.jpg
http://i50.tinypic.com/2w7onpy.png

Offline

 

#6 2012-08-19 12:46:24

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: typing

ZombieHappines wrote:

this still isn't working for me i don't understand why

Do you have a space in the conditional?
(letter (reader) of (to print)) == SPACE


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#7 2012-08-19 12:48:46

ZombieHappines
Scratcher
Registered: 2012-01-19
Posts: 100+

Re: typing

MoreGamesNow wrote:

ZombieHappines wrote:

this still isn't working for me i don't understand why

Do you have a space in the conditional?
(letter (reader) of (to print)) == SPACE

thanks it is still a little glitchy but great


http://i47.tinypic.com/10wr3bq.jpg
http://i50.tinypic.com/2w7onpy.png

Offline

 

#8 2012-08-19 15:37:51

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: typing

ZombieHappines wrote:

MoreGamesNow wrote:

ZombieHappines wrote:

this still isn't working for me i don't understand why

Do you have a space in the conditional?
(letter (reader) of (to print)) == SPACE

thanks it is still a little glitchy but great

You mean an "inconsistent spacing" kind of glitchy or still "printing wrong characters" kind of glitchy?


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#9 2012-08-19 16:39:31

zammer990
Scratcher
Registered: 2012-01-22
Posts: 500+

Re: typing

MoreGamesNow wrote:

ZombieHappines wrote:

MoreGamesNow wrote:


Do you have a space in the conditional?
(letter (reader) of (to print)) == SPACE

thanks it is still a little glitchy but great

You mean an "inconsistent spacing" kind of glitchy or still "printing wrong characters" kind of glitchy?

If it's the former, use a list of the width of letters plus your spacing (some letters are different sizes), if its the latter it's probably costume naming or the iterating variable is changing too much/not enough/at the wrong time


http://i45.tinypic.com/2ynq7nn.jpg Play now!

Offline

 

#10 2012-08-19 19:15:32

ZombieHappines
Scratcher
Registered: 2012-01-19
Posts: 100+

Re: typing

MoreGamesNow wrote:

ZombieHappines wrote:

MoreGamesNow wrote:


Do you have a space in the conditional?
(letter (reader) of (to print)) == SPACE

thanks it is still a little glitchy but great

You mean an "inconsistent spacing" kind of glitchy or still "printing wrong characters" kind of glitchy?

a little inconsistent


http://i47.tinypic.com/10wr3bq.jpg
http://i50.tinypic.com/2w7onpy.png

Offline

 

#11 2012-08-21 11:14:58

plemon11
New Scratcher
Registered: 2012-07-16
Posts: 9

Re: typing

I've made my own take on this (wrapped in a text-based adventure for testing) 

http://scratch.mit.edu/projects/plemon11/2734933

I solved the space problem by adding a list lookup for kerning, and using center offsets in the sprites to ensure that capitals, punctuations, and unusual cases (f,q,y) etc all sit on the correct horizontal plane.  It works quite nicely (if I do say so myself!)

I plan on extending this to allow text on any arbitrary angle (even reverse) and with any scaling factor.  One day!

PL

Offline

 

#12 2012-08-21 17:23:15

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: typing

Yep, I used a list of spacings last time I had to do this too (I don't think I posted the project though)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

Board footer