Page 1 of 1

text response

PostPosted: Wed Aug 11, 2010 1:00 am
by ESL
Are there any tutorials on using the text functions?

For example, the actor comes to a gate where a question is posed "What your name?"

and the user fills in the missing word "What is your name?" in order to proceed.

Re: text response

PostPosted: Wed Aug 11, 2010 2:52 am
by ESL
Here is what I have so far.

Re: text response

PostPosted: Wed Aug 11, 2010 12:10 pm
by DST
Create a text actor. In the text options dialogue, choose 'allow input - yes'.

You can choose more options in the config of the text - like get input focus - no - means that the player has to click on the actor before he can input text. Then, on this actor>keydown>enter, you can copy the text to another string, whether global string, or simply another actor's text:

strcpy(otheractor.text, text);

the variable 'text' will hold the text of whatever your text actor has in it, so the player can enter text and then retrieve it using strcpy or sprintf.

strcpy(password, text);

if you are using a string variable named password.

On mousebuttondown, you could:

strcpy(text, "");

to clear the text when the player clicks on the actor.....there's a lot you can do with it.

Re: text response

PostPosted: Thu Aug 12, 2010 1:06 am
by ESL
cool. I will try that. Actually, I had already solved the problem by creating a text character and then assiging it a keydown action to spell the word and then destroy the wall.

Your method is what I was trying to do but I could not figure out the code. :x

All mountains lead to the top.

Thanks!!

Re: text response

PostPosted: Sun Aug 15, 2010 8:31 am
by ESL
I have it working so that when the user inputs the correct text, it destroys the wall but the keyboard focus resets itself so that the letters overlap.

Re: text response

PostPosted: Sun Aug 15, 2010 10:45 am
by Bee-Ant
ESL wrote:I have it working so that when the user inputs the correct text, it destroys the wall but the keyboard focus resets itself so that the letters overlap.

Set the ZDepth?

Re: text response

PostPosted: Sun Aug 15, 2010 12:45 pm
by ESL
No, that is not it. The letters type over each other.

Here is the game. You use the right arrow key to move the character and type in the missing parts of the sentence.

The answers are

is, are, do, old, you.

Re: text response

PostPosted: Mon Aug 16, 2010 4:22 am
by Bee-Ant
ESL wrote:No, that is not it. The letters type over each other.

Here is the game. You use the right arrow key to move the character and type in the missing parts of the sentence.

The answers are

is, are, do, old, you.

Can't open it correctly...
Make sure you have included the "data" folder

Re: text response

PostPosted: Mon Aug 16, 2010 2:19 pm
by ESL
OK. I think this one will work.

Re: text response

PostPosted: Mon Aug 16, 2010 3:55 pm
by Bee-Ant
Ohhh...
It's because you mix the question and the answer text...
You should separate them into different actor like this http://dl.dropbox.com/u/3997355/TextInput.zip

Re: text response

PostPosted: Tue Aug 17, 2010 1:00 am
by ESL
Thanks for your reply. It is still doing the same thing. What is strange is that it changes and only does it sometimes.
I think it has something to do with the key input selection being "Keys must be typed in the same order" but this is important to the game.

Re: text response

PostPosted: Wed Aug 18, 2010 2:54 am
by ESL
I fixed the problem by making the man collide with the wall, then create the text1 actor, and a script that said if(text1,text,text == "is");
{DestroyActor("wall");}