Page 1 of 1

text input as command

PostPosted: Fri Mar 12, 2010 6:56 pm
by Superbeni
I want to make something like a command line, the user can write in a command, presses enter (or a button) and if the command ist right, something happens.

But my actor for the text ignores the key down event. :(
I wrote the command, pressed enter, but nothing happend.

What could be my mistake?

Re: text input as command

PostPosted: Tue Mar 16, 2010 3:07 pm
by thunderios
That must be a very big game, if you really want to do something with that!
But if you could give us a .ged, we could take a look at it.

I have to make something similar, because we had to make an educational game for school, but I'm only halfway with the function.

Re: text input as command

PostPosted: Wed Mar 17, 2010 6:18 am
by Superbeni
It´s only a small part of the game, so I will make a new ged.
Will be here soon.

Re: text input as command

PostPosted: Wed Mar 17, 2010 4:06 pm
by Superbeni
very easy demo to show the problem.

Any Ideas? :?

Re: text input as command

PostPosted: Wed Mar 17, 2010 10:50 pm
by skydereign
You can't compare strings that way, only chars. To do what you want, you need to use strcmp, this ged shows a working example. strcmp takes two strings, and if they are the same, like you want, it gives back a zero. So put that into an if statement, and it will work how you want it to.

Re: text input as command

PostPosted: Thu Mar 18, 2010 6:06 pm
by Superbeni
Works, thanks! :D