First of all, arrays are pretty well explained on the forum. Though gE itself assumes you know C (so there wouldn't be formal documentation on it).
1. Strings in C are either char*s or char arrays. If you don't know dynamic memory allocation, I suggest using char arrays.
Global Code
- Code: Select all
char string[50]; // declares a 50 character long string named string
char other_string[30]; // declares a 30 character long string named other_string
2. To display text on screen, you have to use a text actor. To make a text actor, use a normal actor, and in the actor control panel, click font. From there add a ttf file, and some text in the window. Then use string manipulation functions on that actor's text. For instance...
actor -> Create Actor -> Script Editor
- Code: Select all
strcpy(text, "Here is some text");
I suggest you search and/or look into sprintf. But, since these are actors, you can move them around like you would any other actor.
3. To compare strings you have to use strcmp. strcmp(char* s1, char* s2), it will return 0 if the two strings are the same. Also note that char arrays are technically char*s so you can use char* and char arrays interchangeably. To concatenate you use strcat.
4. You can use gE's built in text input, which is accessed when you click font in the actor control panel. You should be able to enable it from there.
Lastly you can use point 4's system which alters the actor's text variable. That way you can grab the text variable to check or otherwise manipulate.