Hi guys !
Must be really simple, but I cant find a way to make some specifics characters forbiden when players typing.
No + and - for exampe.
Thanks a lot.
Hi guys !
Must be really simple, but I cant find a way to make some specifics characters forbiden when players typing.
No + and - for exampe.
Thanks a lot.
I vaguely remember someone doing this before by setting up some events that turn on/off the text entry only when there are valid keys.
One event would be
Or
NumPadAdd key is pressed | Disable text entry (Object name here)
NumPadSubtract key is pressed |
The other event would be
Any Key is pressed | Enable text entry (Object name here)
NumPadAdd key is pressed (inverted) |
NUmPadSubtract key is pressed (inverted) |
That way it turns off when they hit keys you don’t allow, then so long as they hit any other key, it turns back on?
I can’t remember if there were any other events involved, but I’d say give that a shot.
Thanks for your answer !
Just tried, it doesnt work exactly like I would.
When I press the + or -, it actually disable the input for the next + or -, but it still gets this first + or - input in the text entry.
Anyway I can get rid of the last char in the text input ?
Same issue when I am going back and enable the text entry. Since pressing A for example, enable the text entry back, this A pressing is not taking into account. Dont know how to deal with this.
Thanks a lot
Hmmmmmm… you’re going to need to do some advanced string manipulation expressions.
You’ll likely will need to use a combination of StrLength() (to get the current length of the Text Entry data), SubStr() (to subtract the last character), the LastKeyPressed() expression (once you re-enable the entry) and the “Modify data in Text Entry” action.
So something like “Modify Data in Text Entry “MyEntry”: set to SubStr(MyEntry.String(),0,StrLength(MyEntry.String()-1)” when disabling it. In theory, this should take the current string of your text entry, subtract 1 character (the invalid character), and set your text entry string to that.
Then on re-enabling it, you could probably just do “Modify Data in Text Entry “MyEntry”: Add LastKeyPressed()”
Maybe. You’ll need to play around with it some.