This must have a simple solution, but I’ve been trying for a couple hours now and haven’t figured it out. Bear with me, as I know there are many existing topics already covering character limit, but I haven’t found any that discuss a solution I’m after.
I have a text box that appears when the player types a command. I also have it set up so that when 35 characters are reached, the text entry is disabled and any keys pressed–other than backspace–result in the text turning red, shaking, and an error noise playing. Works pretty nicely!
However, the way I have it set up, the text is turning red, shaking and playing the error noise when 35 characters are met, and I’d like it to only activate those events if the player tries to continue typing after 35 characters are met. In other words, it’s yelling at the player for reaching the text limit rather than yelling at the player for exceeding the text limit. I feel silly that I can’t figure it out.
I’m including a screenshot of my current set up. A couple notes, because it may seem a little odd at first glance: I have the text appearing with a Form Control: Text Input (Experimental) object, because the characters seem to stay sharp and I can avoid the hassle of bitmap fonts. However, the “Shake Object” extension I’m using doesn’t seem to work with this element (which I think has to do something with it staying on top of all other objects and keeping text crisp, etc), so when the text shake effect occurs, I briefly have the Text Input object replaced with an ordinary text object.
From what I can gather, the condition any key is pressed (outlined in blue) is being read while the user enters the 35th character. If I change it to greater than 35, it still allows the 36th character to be typed while yelling at my player. Essentially, I want the text entry to hit 35, stop allowing text to be entered, and then doing the buzzy red text if additional keys are pressed.
Thank you for reading and for your advice!
After that, a new query is required.
If var is greater than then…
Hi Markus and thank you for the reply! I’ve tried >35 but the issue persists. I’ll try to explain my issue in a simpler hypothetical example:
Goal: I want a 5 character limit. So, a player can enter the word “apple” with no alert from the game. However, if the player tries to type “apples”, the ‘s’ is not registered and instead an alert sound is played.
What’s currently happening with my set up: Player types “apples”: when StrLength = 5, the system plays the alert when the ‘e’ in “apple” is typed–but I don’t want it to play an alert at this point, as the player has not exceeded the limit. When StrLength >5, the player is able to type “apples” and the system plays the alert when the ‘s’ in “apples” is typed (the text box shows the ‘s’). In both cases, the alert plays when either 5 characters are met or when 6 characters are met. I want it to play the alert only after additional input is entered past the limit.
It looks like the Any Key is Pressed condition that I’ve outlined in blue is read instantaneously upon 35 characters being met, so it’s triggering while the player is finishing typing the word. I’d like it to trigger only after the limit is reached, and not during.
Does that make sense?
Hoping this works! Here are gif animations of what I’m experiencing. You can see the alert is triggered prematurely in both instances.
Note: Ignore the “Player Input Field” on the right; just a leftover object from something else and not relevant to my issue.
Ich hatte mal für eine Android folgendes benutzt:
I once used the following for an Android:
Sorry App is in germany. I am waiting for an update to Play store.
To try with the text, you must click on ABC Button
Thank you! I will try this out! A lot of what I’m seeing here is stuff I was using myself to figure it out, but I do not yet have the “programmer’s” mind to problem-solve. I didn’t know there was a ‘subtract’ function!
I’ll let you know if I’m able to get this working! Thank you again.
Hey there, I don’t think I quite nailed down the same system you have, but using your screenshot as reference, I was able to get it to only show the last character (over the limit) before deleting it and font returning to normal. It also does not buzz when the limit is reached! This solution will work for me! Thank you for your help.