PDA

View Full Version : Localized string not precached.



EvoloZz
25th March 2013, 16:03
Hey, I was making a hud elem and then got this error:

localized string "RANK_RANK" not precached: (file 'maps/mp/gametypes/_tdm.gsc', line 579)
self.hud.label = &"RANK_RANK";


It is supposed to read from localized string file, but it doesn't seem to work, I have been using that method already, but now it doesn't work anymore, the file is like this:

rank.str

REFERENCE RANK
LANG_ENGLISH "Rank:"

ENDMARKER

Ofc I am not going to precache it, because it will otherwise read it as a string.
If somebody can help, I will appreciate that

-EvoloZz

Ni3ls
25th March 2013, 16:37
Why don't you use Precache the "Rank: " and use it as label and use the Value with SetValue(rank)

EvoloZz
25th March 2013, 16:45
Of course I could use that, but I want to fix that one also

Ni3ls
25th March 2013, 17:12
And what if u rename ur str file to RANK? Maybe its case-sensitive

Tally
25th March 2013, 18:12
And what if u rename ur str file to RANK? Maybe its case-sensitive

It's not case sensitive.

Tally
25th March 2013, 18:14
Hey, I was making a hud elem and then got this error:

localized string "RANK_RANK" not precached: (file 'maps/mp/gametypes/_tdm.gsc', line 579)
self.hud.label = &"RANK_RANK";


It is supposed to read from localized string file, but it doesn't seem to work, I have been using that method already, but now it doesn't work anymore, the file is like this:

rank.str

REFERENCE RANK
LANG_ENGLISH "Rank:"

ENDMARKER

Ofc I am not going to precache it, because it will otherwise read it as a string.
If somebody can help, I will appreciate that

-EvoloZz

what do you mean you are not going to precache it because it will read it as a string? It is a string. No two ways about it.

It's very simple - either you precache it, like the game is telling you to do. Or, you will have to put up with the error.

EvoloZz
25th March 2013, 18:21
Yeah but if I precache it, the hud will show this ingame: RANK_RANK, and that's not what I want, I want it to read it from the string file.

IzNoGoD
25th March 2013, 18:56
Rename it to something NOT the filename. (like RANK_RANKLABEL)

Tally
25th March 2013, 19:08
Yeah but if I precache it, the hud will show this ingame: RANK_RANK, and that's not what I want, I want it to read it from the string file.

the eXtreme+ mod has been doing it that way for years without any problems:

extreme/_ex_varcache.gsc


[[level.ex_PrecacheString]](&"RANK_RANK");

extreme/_ex_ranksystem.gsc:


if(level.ex_rankhud == 2)
{
rankstring = self getRankstring(self.pers["rank"]);

if(!isDefined(self.ex_rankhud1))
{
self.ex_rankhud1 = newClientHudElem(self);
self.ex_rankhud1.horzAlign = "fullscreen";
self.ex_rankhud1.vertAlign = "fullscreen";
self.ex_rankhud1.alignX = "left";
self.ex_rankhud1.alignY = "middle";
self.ex_rankhud1.x = 10;
self.ex_rankhud1.y = 474;
self.ex_rankhud1.alpha = 1;
self.ex_rankhud1.fontScale = 0.8;
self.ex_rankhud1.label = &"RANK_RANK";
}

if(isDefined(self.ex_rankhud1)) self.ex_rankhud1 setText(rankstring);
}


localizedstrings/rank.str:


REFERENCE RANK
LANG_ENGLISH "RANK: "

It works fine.

BTW- I wrote the ranksystem for the eXtreme+ mod back in 2006. I have never had any problems precaching a label and getting it to show correctly. As long as you do everything right, it should show correctly. The only thing I can see that is different about your label is that there isn't a space after the colon, but I suspect that wouldn't make a difference anyway.