Hey Everyone!
I need help with one of the lines of code, How do you change the text of a text Actor?
Iv'e been experimenting but I can't seem to find out how to do it could you please help?
Hblade wrote:yeah
sprintf(text, "Your text here");
You can also display numbers of variables too, like this for example:
sprintf(text, "Yo Your age is %d, your name is %s", AGE, TEXT_VARIABLE);
where AGE and TEXT_VARIABLE are variables
%d tells integer like values and %s does string
if(Universe_ = 0);
{
sprintf("Then the universe was created.");
Universe_ = 1;
}
if(Universe_ == 0);
{
sprintf(text, "Then the universe was created.");
Universe_ = 1;
}
DarkParadox wrote:Using the = sign means assigning a value to a variable. When comparing values we need to use ==, not =.
Along with that, sprintf needs a variable to assign the text to, I assume we're using the current actors text, so we use the variable text.
So, when it's all fixed up, it ends up like this
- Code: Select all
if(Universe_ == 0);
{
sprintf(text, "Then the universe was created.");
Universe_ = 1;
}
Hope this helps
Users browsing this forum: No registered users and 1 guest