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

#1 2012-08-30 20:14:53

elfin8er
Scratcher
Registered: 2012-01-15
Posts: 1000+

Input Box Script

I am trying to make a text based adventure game in Panther. How would I make an input box, that would save the answer to a variable?


http://i1340.photobucket.com/albums/o723/stevetheipad/goldlittlesig.png

Offline

 

#2 2012-08-30 21:14:55

MrFlash67
Scratcher
Registered: 2012-08-08
Posts: 500+

Re: Input Box Script

Simple. use

ask [Are you well?] and wait
and use
set [response v] to (answer) 
for the recording.


Who would win, SOPA or PIPA?

Offline

 

#3 2012-08-30 21:18:36

elfin8er
Scratcher
Registered: 2012-01-15
Posts: 1000+

Re: Input Box Script

I was wondering for something more of a text box, that I can position on the screen.


http://i1340.photobucket.com/albums/o723/stevetheipad/goldlittlesig.png

Offline

 

#4 2012-08-30 21:21:19

MrFlash67
Scratcher
Registered: 2012-08-08
Posts: 500+

Re: Input Box Script

elfin8er wrote:

I was wondering for something more of a text box, that I can position on the screen.

Um....could someone knowledgeable please help me? (That may not be the right word.)


Who would win, SOPA or PIPA?

Offline

 

#5 2012-08-30 21:30:26

elfin8er
Scratcher
Registered: 2012-01-15
Posts: 1000+

Re: Input Box Script

MrFlash67 wrote:

elfin8er wrote:

I was wondering for something more of a text box, that I can position on the screen.

Um....could someone knowledgeable please help me? (That may not be the right word.)

*That can be placed ANYWHERE on the screen* Sorry about that.


http://i1340.photobucket.com/albums/o723/stevetheipad/goldlittlesig.png

Offline

 

#6 2012-08-31 01:08:35

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: Input Box Script

There's no built-in text-box object that can be moved around.  Most people use stamping to draw text with sprites, based on keyboard input.

Offline

 

#7 2012-08-31 09:32:14

elfin8er
Scratcher
Registered: 2012-01-15
Posts: 1000+

Re: Input Box Script

amcerbu wrote:

There's no built-in text-box object that can be moved around.  Most people use stamping to draw text with sprites, based on keyboard input.

*face palm* nvm guys.


http://i1340.photobucket.com/albums/o723/stevetheipad/goldlittlesig.png

Offline

 

#8 2012-08-31 13:29:01

tree-hugger
Scratcher
Registered: 2011-11-19
Posts: 38

Re: Input Box Script

elfin8er wrote:

amcerbu wrote:

There's no built-in text-box object that can be moved around.  Most people use stamping to draw text with sprites, based on keyboard input.

*face palm* nvm guys.

Ya there isn't a built in text box, but there are ways to make your own. It's pretty complicated... and I probably couldn't explain it properly myself. I suggest looking for games or simulators that allow you to type. I don't think you should give up... it's difficult but not impossible. I'll try to find a game that uses typing so you can see what I mean  smile


http://oi48.tinypic.com/1y7tjr.jpghttp://oi50.tinypic.com/28tb34j.jpg                     http://oi50.tinypic.com/21c6v74.jpg                    ...ya, I'm weird... REAL weird...
BITBOT ALL THE WAY!!!     Only the WEIRDEST games!     (that's just  a Tree-Hugger thing)

Offline

 

#9 2012-08-31 13:42:10

pizza22
Scratcher
Registered: 2012-04-30
Posts: 500+

Re: Input Box Script

when gf clicked
forever
     if <key [a v] pressed>
          switch to costume [a v]
          stamp
          change x by (10)
          add [b] to [anwer list v]
          end
     if <key [b v] pressed>
          switch to costume [b v]
          stamp
          change x by (10)
          add [b] to [anwer list v]
          end
     if <(x postion) = (100)>
          set x to (-100)
          change y by (10)
          end
     end
end

then this to put list into a varible

when I recieve [put word together v]
repeat <length of [answer list v]>
set [number v] to (1)
set [answer v] to <<position (number) of [answer list v]> join <position <(number) + [1]> of [answer list v]>> 
change [number] by [1]

Last edited by pizza22 (2012-08-31 14:00:32)

Offline

 

#10 2012-08-31 13:55:07

Wes64
Scratcher
Registered: 2011-08-19
Posts: 1000+

Re: Input Box Script

pizza22, your script won't sense key inputs correctly due to the linear processing. you'll need something like this for every key

when [a v] key pressed
add [a] to [queue v]
and then

when gf clicked
forever if <(length of [queue v]) > [0]>
switch to costume (item (1 v) of [queue v])
stamp
change x by (8)
add (item (1 v) of [queue v]) to [answer v]
delete (1 v) of [queue v]
(example)

Last edited by Wes64 (2012-08-31 13:56:12)


Experienced 2.0 Tester: Ask me questions!
Using Firefox 13.0, Flash plugin version 11.4.402.287, and Windows XP Professional.

Offline

 

#11 2012-08-31 13:58:55

pizza22
Scratcher
Registered: 2012-04-30
Posts: 500+

Re: Input Box Script

However, if you use my recieve above, you can get the whol list into a varible

Offline

 

#12 2012-08-31 14:00:23

tree-hugger
Scratcher
Registered: 2011-11-19
Posts: 38

Re: Input Box Script

Ok! I wasn't quite sure what you wanted exactly but here are a few projects that use typing in a few different ways. Maybe you can play around with these scripts to make the text box you wanted.
http://scratch.mit.edu/projects/Mick/1069#
http://scratch.mit.edu/projects/xt449/1916460#
http://scratch.mit.edu/projects/fofofo/261927#
Hope these are helpful  smile


http://oi48.tinypic.com/1y7tjr.jpghttp://oi50.tinypic.com/28tb34j.jpg                     http://oi50.tinypic.com/21c6v74.jpg                    ...ya, I'm weird... REAL weird...
BITBOT ALL THE WAY!!!     Only the WEIRDEST games!     (that's just  a Tree-Hugger thing)

Offline

 

#13 2012-08-31 14:17:08

Wes64
Scratcher
Registered: 2011-08-19
Posts: 1000+

Re: Input Box Script

pizza22 wrote:

However, if you use my recieve above, you can get the whol list into a varible

that doesnt work either, it will only join 2 letters together, and it does not grow.

when I receive [join v]
set [c v] to [1]
set [clump v] to []
repeat (length of [answer v])
set [clump v] to (join (clump) (item (c) of [answer v]) )
change [c v] by (1)
end


Experienced 2.0 Tester: Ask me questions!
Using Firefox 13.0, Flash plugin version 11.4.402.287, and Windows XP Professional.

Offline

 

#14 2012-08-31 17:45:48

sparky5000
Scratcher
Registered: 2011-01-31
Posts: 7

Re: Input Box Script

you could always use ready made sentaces in a box

Offline

 

Board footer