2
$\begingroup$

I know how to dynamically set the value of a text property in game using logic bricks, a log prop, a string and all that jaz, but how can I restrict when typing will edit it?

Like if I had a first person shooter, I wouldn't want the string to say something like:

wwwwwwwwasdaaaaaaaaaaaaawwwwwwwwwwwwwwwwwwwwwwww

every time I moved around. How can I make it so it only types one character after I press a button?

EDIT: just to clear up any misunderstandings, this will ultimately be used for the game hangman. Each letter will be it's own text object, that way I can check for letter matches easily. But this also means that if the guys who types the word to begin with, all the letters will change to it at the same time. say he was trying to type "GHOST" the second he hit "G" the word would look like "GGGGG". now obviously,this makes hangman winnable in one turn, but that's not really why it's bad. It's bad because you're no longer guessing a word, only a letter. And that's not how the game goes. So to solve this, I need to make a system that will only make the letter that is active (or has the property "Active" set to TRUE) be the one that gets typed in.

So I can have a system, starts with one empty that controls all of the text objects. All it has is a property called "numbers" that increases one when you hit anything but leftArrow, and decreases when you hit leftArrow. now, my six (6) text objects, each representing a single letter, will always-and-copyProperty from "Numbers".

For the first letter, if the value is one, you are active

For the second letter, if the value is two, you are active...

ect.ect.

only when a object is active will typing change it's value.

$\endgroup$
8
  • $\begingroup$ how do i do it with logic bricks? that will work fine, but i don't think it's possible. $\endgroup$
    – ruckus
    Commented Oct 12, 2015 at 21:08
  • 1
    $\begingroup$ uhhh. no. then i would just get "wasdaw" but i don't want any w's or anything else even typing unless that option is active. ever played any games? if you want to chat, you have to hit enter, or ~ or insert in order for it to type anything. $\endgroup$
    – ruckus
    Commented Oct 12, 2015 at 21:12
  • $\begingroup$ I think I understand now . . . You want to save the entered character, then upon confirmation fire a script? Store it in a var if that is what you want $\endgroup$
    – J Sargent
    Commented Oct 12, 2015 at 21:14
  • $\begingroup$ ?thats way to complicated. i just want it only to type when its like, in a certain state, but the logic for setting a text prop only takes the sensor. no controllers or actuators, so it's not state friendly. $\endgroup$
    – ruckus
    Commented Oct 12, 2015 at 21:16
  • $\begingroup$ well . . . that is the simplest way I know of :/ $\endgroup$
    – J Sargent
    Commented Oct 12, 2015 at 21:21

1 Answer 1

2
$\begingroup$

Okay! so I figured it out, and now I can start making my game. The "log" property, which I always thought was somehow logging the letters I entered, really doesn't. (misleading name :P)

I read it's description, it said:

Property that indicates whether to log keystrokes as a string.

and I was like "OH! hey! I got this!"

so it turns out that if you make the log property a boolean, the text only gets typed if it's true.

$\endgroup$
1
  • 1
    $\begingroup$ Ah perfect. Glad this got resolved $\endgroup$
    – J Sargent
    Commented Oct 12, 2015 at 23:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .