This is vexing, I'm running into problems every step of the way on what should be simple things.
I want to display the mouse coordinates so I have tried to put them in a string using:
message=("coordinates %d , %d",mouse.x,mouse.y);
However that gets a parse error saying it doesnt like the %d 's, what am I doing wrong?
EDIT:
Nevermind I found out that String.Format is what you need to use to get this to work. Seems weird though that the other way doesnt work as well, I mean what would you do if you already had a string and wanted to add numbers into it without getting rid of the information?
You'd need to use a 'buffer' string, and the String.Append function, e.g.:
message = "coordinates";
String Temp = String.Format ("%d , %d",mouse.x,mouse.y);
message = message.Append(Temp);
message = String.Format("coordinates %d, %d", mouse.x, mouse.y);
Would work, and so would:
message = "coordinates ";
message = message.Append(String.Format("%d, %d", mouse.x, mouse.y));
And:
message = "coordinates ";
message = String.Format("%s %d, %d", message, mouse.x, mouse.y);
And just to keep your possibilities open:
message = String.Format("%s %d, %d", "coordinates", mouse.x, mouse.y);
[EDIT:]
I didn't read all of the edit, d'oh!
However, the message = String.Format("%s %d, %d", message, mouse.x, mouse.y); line would still work. For the exact same results as Ashen's code. ;)