Make the limit text for Text Input?

Talk about making games.

Make the limit text for Text Input?

Postby Wertyboy » Fri May 13, 2011 2:29 am

Example: Player can only type 5 words,...
is it hard?
User avatar
Wertyboy
 
Posts: 543
Joined: Tue Jun 15, 2010 12:38 pm
Location: HCM City, Vietnam
Score: 44 Give a positive score

Re: Make the limit text for Text Input?

Postby skydereign » Fri May 13, 2011 3:01 am

No it's not too hard, although it is easier to limit the number of characters they can type. If you want to limit the number of characters a text actor has, just do this.
text -> Draw Actor -> Script Editor
Code: Select all
char buffer[11];
strncpy(buffer, text, 10)
strcpy(text, buffer);


Changing the numbers in that will change how many characters are allowed. If you want to do actual words, you'd have to search the array for spaces in the array to know when to limit it. Does the above method work for whatever it is you are doing? Or would you like to limit by number of words?
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Make the limit text for Text Input?

Postby Wertyboy » Fri May 13, 2011 3:42 am

thx!! 1+ point for you
User avatar
Wertyboy
 
Posts: 543
Joined: Tue Jun 15, 2010 12:38 pm
Location: HCM City, Vietnam
Score: 44 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest