Controlling the quantity of logged keystrokes

I’m trying to figure a simple way to limit the number of keystrokes that are logged into a ‘text’ string property (using the keyboard sensor) by the player. Right now the player can enter a seemingly limitless number of characters - not good. I’d like to limit the player’s text entry to approx 15 characters. I’m thinking that I may need to use a script and do a string slice (not a good option in this case). Is there a simpler way using logic bricks?


each time a key is pressed (key-sensor) you could increase a property by one (using property actuator with “add” option). then using aproperty sensor just check if equals to fifteen or whatever you need. after that… well whatever you need to do.


Good idea solmax - will try.