Sorry, I knew I should of briefed a bit more on those
Anyway,
The difference between sprintf and strcpy is, the sprintf function can insert other variables into the string (text). Strcpy just copies one string value into annother string.
For instance:
- Code: Select all
strcpy(text, "This is a whole bunch of useless text");
Text would be the variable that displays the text in the text actor, and the stuff in the quotes is the stuff we're coping into it. If you had 2 string variables that you simply wanted to copy from one to the other, you'd leave off the quotes. It is a little simpler, but not nearly as versatile as sprintf.
The sprintf has a lot of neat escape sequences that you can use to drop an actual variable into the string.
For instance:
- Code: Select all
sprintf(text, "Score: %d", scorevariable);
that would display the score and the "Score:" in the same line of text. The %d is the integer escape sequence, the others are listed on the ge wiki page.
Another thing you might need would be "\n" which, when inserted, makes a new line. there are others that use the forward slash like that, but I forgot what they are, and not all of them worked in ge (I think like \t for tab or something like that).
I've had problems with text going out of the 255 character limit before, so watch out. I think I was passing the text through a string variable though, not sure it was a while ago.
I'll double check to see if that's an issue.