Page 1 of 1

Using LANGUAGE...

Posted: Wed Sep 13, 2017 11:11 am
by ramon.dexter
Hi all, I returned here and have a brand new question:

How do I use LANGAUGE defined messages in string array?

Here's the sample script:

Code: Select all

script "cornMessage" (void)
{
	int messCornNr;
	messCornNr = random(1,5);

	str messCorn[6] = {	"",
						"$SCN_CORN01", <- this display what is defined -> "$SCN_CORN01", not the string in LANGUAGE
						"$SCN_CORN02",
						"$SCN_CORN03",
						"$SCN_CORN04",
						"$SCN_CORN05"
						};

	if (messCornNr == messCornNr)
	{
		Print(s:messCorn[messCornNr]);
	}

}
It's intended to display scenery messages. Think something like in fallout 1&2. I want to use LANGUAGE lump to ease use of translations. But I don't know how to use it in array - the array is required to make the messages random. But I don't know how to define the LANGUAGE variables into an array. Can anyone help me?

The example here displays only "$SCN_CORN01 - 5".

Re: Using LANGUAGE...

Posted: Wed Sep 13, 2017 1:08 pm
by GiveOneMoreChance
Try use l: instead s:
Print(l:messCorn[messCornNr]);

Re: Using LANGUAGE...

Posted: Thu Sep 14, 2017 10:07 am
by ramon.dexter
Yep, it works. Many thanks!! :wub: