How would I do this in AngelScript?
(C++ snippet)
cout << "Your score is " << playerScore << ". Thanks for playing!";
Is there some easy way to achieve this?
Code: [Select]
void Main()
{
int PRINT = OBJ_0;
int COUNTER = OBJ_22;
int playerScore = 20;
string S=playerScore; //convert to string so it can be printed
//Method 1
iObjectTextSet(PRINT,"Your score is "+S+". Thanks for playing");
//Method 3
iPrint("Your score is "+S+". Thanks for playing", -6,3,PRINT);
//Method 3
S = IN_22;
iPrint("Your score is "+S+". Thanks for playing", -6,4,PRINT);
}
See attached project for use. See also default project "iPrint.3dr"
Also refer to Script Reference
iPrint(string,float,float,OBJ_X)
Print the specified string by using the font and character settings as configured in the specified
TextPrint object
string = text (255 characters max). Multi-line text is supported (use '\r' to specify a new line character).
float,float = screen position. Note that resulting text location depends on source TextPrint object settings.
OBJ_X = TextPrint object handle.
NOTE: this function will only print the text once. In order to display a permanet text it must be executed
at every script loop.
(iPrint coordinates x go from -16 to +16, y go from -12 to +12 {36x24 layout}
You can use decimals eg 1.02 for more precise placement. 0,0 is center of screen.)
iObjectTextSet(OBJ_X,string)
Set the specified text for the specified object (for example the TextPrint object)
OBJ_X = object handle.
string = text