Limiting characters in Display Text?
Tiny_Ideas
Member Posts: 326
Hello all,
Was wondering if there are any advance or cool features you can do with the display text behaviour.
- if you have a keyboard input , is it possible to limit the amount of characters entered into a display text, or even a attribute? I looked at some of the rules and conditions, and there is stuff like if it contains, or begins with etc. but I want to count the cumber of characters it has so I can limit it. Otherwise when some types a name for a character, or their profile , a long name just starts going off screen and looks ugly as anything when the player is walking around in the game.
Thoughts?
Comments
You can use the new textSubStr function to only display a number of characters of a string.
For example textSubStr(game.string,0,9) would only return the first 10 letters of the game.string attribute.
Here's an example with keyboard input.
Download
@Manto1 very insightful, thanks.
That can help in limiting the input which is good,
But going back to an example where a heros name is displayed. If I limit the input to 10 I cans till get different sizes. For example.
Aaaaaaaaaa
Mmmmmmmmmmm
The above have 10 letters each but one is way longer. Is there a way to limit the length of the text? I tried making an actor to wrap inside, but it just starts going below the actor once it' has been filled up. Any thoughts.
Only one of the built-in fonts is monospaced and you'll need to use it: Courier New.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@tatiang that helpful thanks. Doesn't look good but it's better than nothing. Is there away I can detect if text is not being wrapped within an actor because it's too big? Is it really impossible to limit the amount of text a player can I put without using Courrier New without having such a length different issue?
You'd need to use a custom keyboard. Either search for it on the forums/Google or check out my demo here: http://forums.gamesalad.com/discussion/comment/451764/#Comment_451764.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@Tatiang - Could you upload the file using the latest version of gamesalad instead of nightly build. Thanks
@tatiang just had a nice read of the progress. Would be nice to see how it turned out, I can't imagine the amount of time went into something like that.
@Jeromy just rename it so that the filename extension is .gameproj.
@CodeCell Yeah, it was a lot of work. What I posted is the current version. I haven't had time to do anything further.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@tatiang It didn't work, when i download i get a folder with everything in it but no file to actually open it. There is a file with a size of 0kb that says .gsproj and i changed that but it didn't work?
Am i missing something
Thanks