Outpost Universe Forums

Projects & Development => Outpost 2 Programming & Development => Topic started by: Mcshay on April 23, 2006, 06:34:43 PM

Title: Displaying An Variable In Tethysgame::addmessage
Post by: Mcshay on April 23, 2006, 06:34:43 PM
I've been wondering how to take for example, "int TheInt = 1;" and place that in this function "TethysGame::AddMessage(int pixelX, int pixelY, char *message, int recipientPlayerNum, int soundID);". Is there a way to do it?
Title: Displaying An Variable In Tethysgame::addmessage
Post by: BlackBox on April 23, 2006, 09:10:05 PM
Something like this would work:

Code: [Select]
int var=30;
char buffer[200];

// format a string in buffer. %i is a placeholder that means 'integer', the next argument will be used to replace it
scr_snprintf(buffer, 200, "var = %i", var);

// should read "var = 30"
TethysGame::AddMessage(-1, -1, buffer, 0, 0);
Title: Displaying An Variable In Tethysgame::addmessage
Post by: Mcshay on April 25, 2006, 08:51:12 PM
Thanks.