text input as command

You must understand the Game Editor concepts, before post here.

text input as command

Postby Superbeni » Fri Mar 12, 2010 6:56 pm

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?
User avatar
Superbeni
 
Posts: 130
Joined: Sun Aug 02, 2009 1:23 pm
Location: Vienna, Austria
Score: 31 Give a positive score

Re: text input as command

Postby thunderios » Tue Mar 16, 2010 3:07 pm

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.
thunderios
 
Posts: 87
Joined: Thu Jan 31, 2008 1:18 pm
Score: 1 Give a positive score

Re: text input as command

Postby Superbeni » Wed Mar 17, 2010 6:18 am

It´s only a small part of the game, so I will make a new ged.
Will be here soon.
User avatar
Superbeni
 
Posts: 130
Joined: Sun Aug 02, 2009 1:23 pm
Location: Vienna, Austria
Score: 31 Give a positive score

Re: text input as command

Postby Superbeni » Wed Mar 17, 2010 4:06 pm

very easy demo to show the problem.

Any Ideas? :?
Attachments
text_input.zip
(199.71 KiB) Downloaded 141 times
User avatar
Superbeni
 
Posts: 130
Joined: Sun Aug 02, 2009 1:23 pm
Location: Vienna, Austria
Score: 31 Give a positive score

Re: text input as command

Postby skydereign » Wed Mar 17, 2010 10:50 pm

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.
Attachments
text_input.zip
(192.72 KiB) Downloaded 136 times
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: text input as command

Postby Superbeni » Thu Mar 18, 2010 6:06 pm

Works, thanks! :D
User avatar
Superbeni
 
Posts: 130
Joined: Sun Aug 02, 2009 1:23 pm
Location: Vienna, Austria
Score: 31 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest