Jump to content
Sign in to follow this  
comp_uter15776

Hints, titletext, and string concatenation.

Recommended Posts

Hey all,

Lovely title don't you think?

My issue directly pertains to the Sector Command(s) issue, and arose when I tried to display both teams' tickets remaining. So far I've found both Hints and Titletext to be a problem, and so I have arrived back at the forums for help. This is from an MP aspect.

I would like to show something along the lines of the below:

Blufor Tickets - <tickets>

Opfor Tickets - <tickets>

In either a hint, titletext, or even chat. My issue is also that tickets are stored as a numerical value (data type number) and so obviously I can't concatenate a string and a number. How would I successfully convert it to a string first and then concatenate both strings together? Use of str was problematic for me, perhaps I wasn't using it right.

If anyone could land some examples or even a simple explanation of what to do or where I'm going wrong would be greatly appreciated.

Regards,

Harry

Share this post


Link to post
Share on other sites

hint format["Blufor tickets - %1", _bluforTickets];

// prints:  PlayerName: 3
player sideChat str(_bluforTickets);

Assuming _bluforTickets is a Number.

Share this post


Link to post
Share on other sites

OWTTE :) Easily changed.

Thank you, kylania. How would I prepend a string before that though, it doesn't seem to like something like the following:

player sideChat Blufor tickets at str(_bluforTickets);

Share this post


Link to post
Share on other sites

Format generally.

player sideChat format["Blufor tickets at %1", _bluforTickets];

Str() just returns the string value of a number so str(6) would be "6" instead of 6.

You could also do this:

player sideChat "Blufor tickets are at " + str(_bluforTickets);

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  

×