I need help on making a scratch word processor for my scratch OS. I have a icon that you click on and a white page like thing to type the words on, but how do you make it possible to right in the white space only??
Offline
I'm no expert on this, but I have an understanding.
you will need the variable "characternum" or something else that makes sense to you for the character number. for each sprite you will need costumes for each letter, number, or punctuation mark you will use.
here's where the programming starts.
[blocks]
each sprite will need this script.
<when green flag clicked>
<forever>
<if><( <{ characternum }> <=> (character's number goes here)>
<if><key[ a ]pressed?>
<switch to costume[ a ]>
<change{ characternum }by( 1
<stop script>
<end>
then you will need that same script for each letter, number, and punctuation mark you need.
more to come. I need a break so i can think a bit.
P.S. I can't wait until it comes out!
Last edited by 16Skittles (2009-11-29 17:05:43)
Offline
true. here's part two.
Spacebar
This is very simple.
[blocks]
put this on the stage.
<when[ space ]key pressed>
<change{ characternum }by( 1 )
[/blocks]
p.s. weird... when the text is in the
[blocks]
blocks, it gets turned [blocks] bold [/blocks]
Edit: or maybe not...
Last edited by 16Skittles (2009-11-29 18:53:01)
Offline
ok listen,
its easier than that! here's the EASY WAY. [blocks]<key[ space ]pressed?>[/blocks] [blocks]<point in direction( 90[/blocks] [blocks]<move( 10 )steps>[/blocks] erase is the same except left arrow and -90. [blocks]<key[ a ]pressed?>[/blocks] [blocks]<switch to costume[a[/blocks] [blocks] <wait( 0.2 )secsc>[/blocks] [blocks]<switch to costume[blank[/blocks]
Offline
I tried those ways and it didn't work. I tried a different way, but it typed each number a few times. Can someone try this and try to fix it?
[blocks]<when green flag clicked>
<forever>
<if><key[ a ]pressed?>
<switch to costume[a]>
<stamp>
<end>
<if>
<( <=> )>
<go to x
)y
(( <+> )))
<end>[/block]
The blank spaces in the operators are x- and y- positions of sprite one (letter key). The second "if" goes to the next line after it reaches a specific point at the end of the screen. I didn't know the exact x- position, so I just left that blank as well. It pretty much worked, but like I said, it would stamp each letter more than once.
Offline
pumacat4000 wrote:
I tried those ways and it didn't work. I tried a different way, but it typed each number a few times. Can someone try this and try to fix it?
[blocks]<when green flag clicked>
<forever>
<if><key[ a ]pressed?>
<switch to costume[a]>
<wait until> << <not><key[ a ]pressed?> >>
<show>
<stamp>
<hide>
<move( 20 )steps>
<end>
<end>[/block]
The blank spaces in the operators are x- and y- positions of sprite one (letter key). The second "if" goes to the next line after it reaches a specific point at the end of the screen. I didn't know the exact x- position, so I just left that blank as well. It pretty much worked, but like I said, it would stamp each letter more than once.
you need that script.
Last edited by 16Skittles (2009-12-30 10:47:43)
Offline
What I would recommend is to store everything in a list.
This way, it is easy append, insert, copy, paste delete, etc text.
Then, you can just update the screen whenever you need.
Offline