Jump to content
Sign in to follow this  
Hinny

Number to string?

Recommended Posts

Okay I have a variable, _x, which is a number value.

I want that number to be displayed on screen.

I've tried unit sidechat _x but as it rightly says _x isn't a string.

Is there any way to convert _x into a string, and if not anyway to get it on screen?

Share this post


Link to post
Share on other sites

Unit sidechat format ["%1",_x]

RED

Share this post


Link to post
Share on other sites

Try this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_str = format ["%1",_x]

_soldier sidechat _str

This works for me.

If you want there to be text in front/behind the number you can do:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_str = format ["Enemy spotted %1 m to North West",_x]

_soldier sidechat _str

If _x is 75 then the chat message will be:

"Enemy spotted 75 m to North West"

Share this post


Link to post
Share on other sites

There is little point making the string then having the unit say a sidechat. The shorter you make a script, the faster it will be.

RED

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×