PDA

View Full Version : Illegal localized string reference



Earliboy
13th March 2013, 13:38
Hi,
i get a weird error after testing my script:



******* script runtime error *******
Illegal localized string reference: ^1TEXT must contain only alpha-numeric characters and underscores: (file 'earlmod/_precache.gsc', line 17)
iprintln(msg2);
*


Called thread:
(This is to give out an DEBUG message, iprintln msg + msg2 didnt't worked cause msg2 is an localized string).


msg(msg, msg2)
{
if(!isDefined(msg))
return;

if(!isDefined(level.msgDelay))
level.msgDelay = false;

while(level.msgDelay) //Do not spam the console
wait .2;

level.msgDelay = true;

iprintln(msg);

if(isDefined(msg2))
iprintln(msg2);

wait .1;

level.msgDelay = false;
}


Called from:
(This thread is for precaching strings)


string(string, rows)
{
if(!isDefined(string))
{
if(level.publicDebug)
msg("DEBUG: _precache.gsc::string - Could not recieve a string");
return;
}

if(!rows)
{
precacheString(string);

if(level.publicDebug)
msg("DEBUG: _precache.gsc::string - Precached string ", string);

return;
}

for(i = 0; i < string.size; i++)
{
precacheString(string[i]);

if(level.publicDebug)
msg("DEBUG: _precache.gsc::string - Precached string ", string[i]);
}
}


Any ideas?

kung foo man
13th March 2013, 14:34
This is the C-check for that error message:



if ( isalnum(str[i]) || str[i] == '_')
continue;


The runtime error writes, you want something like: iprintln(&"^1TEXT"), but that fails, because "^" returns 0 from the function isalnum().

Conclusion: no colored precached strings in iprintln(). I dont know if its correct, I only precache for huds. :D

IzNoGoD
13th March 2013, 17:36
Colored precached strings in printlns shouldnt be a problem, just localize them. Without localizing, it indeed fails.

Tally
13th March 2013, 21:45
Colored precached strings in printlns shouldnt be a problem, just localize them. Without localizing, it indeed fails.

Not true:

http://imageshack.us/a/img15/3623/colorediprintln.jpg

Both the iprintlnbold() and the iprintln() are not localized:



if( level.spawnpro_range )
{
if( distance( before_pos, new_pos ) > level.spawnpro_range *40 )
{
self iprintlnBold( "^3Exceeded Painkiller Range" );
break;
}
}



self iprintln( "^3Painkiller Ended" );

kung foo man
13th March 2013, 22:03
I think he meant "real" localizing vs "only scriptside precaching": putting them into .iwd and precache precacheString(&"EXCEEDED_PAINKILLER_RANGE")


Well, I dont know why Earliboy wants to precache it nonetheless.

Tally
13th March 2013, 23:24
I think he meant "real" localizing vs "only scriptside precaching": putting them into .iwd and precache precacheString(&"EXCEEDED_PAINKILLER_RANGE")


Well, I dont know why Earliboy wants to precache it nonetheless.

I don't see that in what he said. He said without precaching - in any shape or form - colored iprintln or iprinlnbold fail. That is not true. iprintlnbold and iprintln are the only functions in COD where you DON'T have to precache in any way in order to get colored text onscreen. You will incur error messages spammed to the console log complaining about non localized strings, but other than that, it works perfectly well.

As for Earliboy's errors, I highly doubt the error is an accurate reflection of the problem. I am sure you must know that software often presents you with errors which are not a "true" reflection of the actual problem. I suspect that is the case here as well. You CAN have colored tags in localized string files. So, the error is not right; it can't be.

IzNoGoD
14th March 2013, 17:26
I indeed meant making a .str file for localization. Should allow colored text in the .str file, referenced to by an alphanumeric string (iprintln(&"FILENAME_STRING");), but earliboy told me he didnt want downloading on this server, so thats a no-go.

Normal text should work, but creates localized warnings in the serverconsole (windows servers). Maybe clientprint (does that even exist?) could help here...

kung foo man
14th March 2013, 18:07
If the localized warnings are the only problem, he can use this patched server: http://killtube.org/showthread.php?935-CoD2-1-2-va%28%29-Bug-Patch

Its also pretty easy to make, if somebody understand C-strings: the character '\0' represents the end of a spam-string, so just search the string with WinHex in the binary and replace the start of the string with 0. Tadaaa, no spam. :D

Earliboy
15th March 2013, 13:37
Well, my problem is not the spam string, i wanna use that strings for an hudelem. (Theres no other reason for me to precache strings if i wanna iprint them).
The error just came from the debug:
DEBUG: Precached string: ^1TEXT
That should be the output, so if something went wrong, i know whats going on.
But i just deleted that, everything is working fine now. But thx for your answers and ideas.