• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Code Convert to String?

Acreo Aeneas

Grizzled Veteran
Sep 16, 2010
72
0
So I'm having a problem with some conversion to String...

My SASPerk has this function near the bottom:

Code:
static function string GetCustomLevelInfo (byte Level)
{
	local string S;
	S = Default.CustomLevelInfo;
	
	// %L = Current "Bonus" Level
	ReplaceText (S, "%L", string (GetClientVeteranSkillLevel (KFPRI)));

...

When I try to compile it I get this error:

Code:
Error, 'String' conversion: Bad or missing expression

I had thought typecasting would work. I thought it was a perhaps a syntax issue in placement of the cast, so I put (string) after the thing I wanted to cast. Same error.

I'm fairly sure GetClientVeteranSkillLevel (KFPRI) returns a integer and according to the Legacy Wiki, int to string is supported, but it gives no sample code on usage (aka useless as documentation).

What am I doing wrong here?
 
why dont you just take string(KFPRI.ClientVeteranSkillLevel)

KFPRI is undeclared in that function. I can't seem to declare KFPRI as KFPlayerReplicationInfo at the beginning of that function, because then UCC throws another error saying "unexpected KFPlayerReplicationInfo". Therefore I can't use KFPRI to call ClientVeteranSkillLevel.

So in the end, I'm back to me wanting to get a Player's veteran level so I can use that number for a bunch of if conditionals in the function.
 
Upvote 0
*smacks head* Doh!

Here's something I don't see and thus don't understand.

How is GetCustomLevelInfo () called? I can see that my stats display further down in "defaultproperties" somehow calls this function and passes it my current Perk level. How is that happening?

I apologize if I seem rather noobish at this, but usually in the languages I work (Java, C++, etc) with I can usually find when a function is called so I can trace around various files. I just know that the function is called and thus the functions statements are executed, I just don't know from where and how.
 
Last edited:
Upvote 0