Results 1 to 9 of 9

Thread: Illegal localized string reference

  1. #1
    Private First Class Earliboy's Avatar
    Join Date
    Nov 2012
    Location
    Germany
    Posts
    130
    Thanks
    5
    Thanked 88 Times in 61 Posts

    Illegal localized string reference

    Hi,
    i get a weird error after testing my script:

    Code:
    ******* 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).
    Code:
    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)
    Code:
    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?
    No ... No ... this is not possible .......

  2. #2
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    This is the C-check for that error message:

    PHP Code:
        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.
    timescale 0.01

  3. #3
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Colored precached strings in printlns shouldnt be a problem, just localize them. Without localizing, it indeed fails.

  4. The Following User Says Thank You to IzNoGoD For This Useful Post:

    kung foo man (13th March 2013)

  5. #4
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by IzNoGoD View Post
    Colored precached strings in printlns shouldnt be a problem, just localize them. Without localizing, it indeed fails.
    Not true:



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


    PHP Code:
                if( level.spawnpro_range )
                {
                    if( 
    distancebefore_posnew_pos ) > level.spawnpro_range *40 )
                    {
                        
    self iprintlnBold"^3Exceeded Painkiller Range" );
                        break;
                    }
                } 
    PHP Code:
    self iprintln"^3Painkiller Ended" ); 

  6. The Following User Says Thank You to Tally For This Useful Post:

    kung foo man (13th March 2013)

  7. #5
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    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.
    timescale 0.01

  8. #6
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by kung foo man View Post
    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.
    Last edited by Tally; 13th March 2013 at 23:02.

  9. #7
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    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...

  10. #8
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    If the localized warnings are the only problem, he can use this patched server: http://killtube.org/showthread.php?9...8%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.
    timescale 0.01

  11. #9
    Private First Class Earliboy's Avatar
    Join Date
    Nov 2012
    Location
    Germany
    Posts
    130
    Thanks
    5
    Thanked 88 Times in 61 Posts
    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.
    No ... No ... this is not possible .......

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •