GSText : "too many parameters"
Posted: 17 Aug 2014 13:53
Hi,
I have an issue when using GSText. I (try to) use it to set a (monthly renewed) text in the townboxes. The text in townboxes are correct for the first part, but the text is cut and at the end it complains about: "too many parameters". As there:
Now. I know that the GSText documentation indicates that 20 parameters at most can be given in the GSText() call and this could be the cause of the problem. But I have a doubt about that, for two reasons:
- it is unclear to me whether the max 20 parameters rule applies only to the parameters which are directly in the GSText() call, or also to the parameters "nested" in sub-strings, themselves called by GSText.
- another GS (RealGrowth) also uses a some nested string, which in total has 23 parameters, which leads me to think that this is not the problem.
Here is my the code:
The relevant function in strings.nut (the function GoalTown::TownBoxText is called from another file, using GSTown.SetText(this.id, this.TownBoxText))
Note that the problem only appears in switch's case(5), not in case(3).
here the related english.txt
Hints ?
I have an issue when using GSText. I (try to) use it to set a (monthly renewed) text in the townboxes. The text in townboxes are correct for the first part, but the text is cut and at the end it complains about: "too many parameters". As there:
Now. I know that the GSText documentation indicates that 20 parameters at most can be given in the GSText() call and this could be the cause of the problem. But I have a doubt about that, for two reasons:
- it is unclear to me whether the max 20 parameters rule applies only to the parameters which are directly in the GSText() call, or also to the parameters "nested" in sub-strings, themselves called by GSText.
- another GS (RealGrowth) also uses a some nested string, which in total has 23 parameters, which leads me to think that this is not the problem.
Here is my the code:
The relevant function in strings.nut (the function GoalTown::TownBoxText is called from another file, using GSTown.SetText(this.id, this.TownBoxText))
Code: Select all
function GoalTown::TownBoxText() {
local text_townbox_title = GSText(GSText.STR_TOWNBOX_TITLE);
local text_townbox_cargocat = [];
local text_townbox;
switch (::CargoCatNum) {
case(3):
text_townbox_cargocat.append(GSText(GSText.STR_CARGOCAT_PAXMAIL));
text_townbox_cargocat.append(GSText(GSText.STR_CARGOCAT_GGOODS));
text_townbox_cargocat.append(GSText(GSText.STR_CARGOCAT_GIND));
text_townbox = GSText(GSText.STR_TOWNBOX_3CAT, text_townbox_title);
break;
case(5):
text_townbox_cargocat.append(GSText(GSText.STR_CARGOCAT_PAXMAIL));
text_townbox_cargocat.append(GSText(GSText.STR_CARGOCAT_GFOOD));
text_townbox_cargocat.append(GSText(GSText.STR_CARGOCAT_GGOODS));
text_townbox_cargocat.append(GSText(GSText.STR_CARGOCAT_RAWIND));
text_townbox_cargocat.append(GSText(GSText.STR_CARGOCAT_TRANIND));
text_townbox = GSText(GSText.STR_TOWNBOX_5CAT, text_townbox_title);
break;
}
for (local i = 0; i < ::CargoCatNum; i++) {
text_townbox_cargocat[i].AddParam(this.TownGoalsCat[i]);
text_townbox_cargocat[i].AddParam(this.TownSuppliedCat[i]);
text_townbox_cargocat[i].AddParam(this.TownStockPiledCat[i]);
text_townbox.AddParam(text_townbox_cargocat[i]);
}
return text_townbox;
}
here the related english.txt
Code: Select all
STR_CARGOCAT_PAXMAIL :{}Passengers & Mail: {NUM}/{NUM}/{NUM}
STR_CARGOCAT_GFOOD :{}General food: {NUM}/{NUM}/{NUM}
STR_CARGOCAT_GGOODS :{}General goods: {NUM}/{NUM}/{NUM}
STR_CARGOCAT_GIND :{}Industrial goods: {NUM}/{NUM}/{NUM}
STR_CARGOCAT_RAWIND :{}Raw industrial goods: {NUM}/{NUM}/{NUM}
STR_CARGOCAT_TRANIND :{}Tr. industrial goods: {NUM}/{NUM}/{NUM}
STR_TOWNBOX_TITLE :Cargo information (Required/Supplied/Stockpil.)
STR_TOWNBOX_3CAT :{STRING}{STRING3}{STRING3}{STRING3}
STR_TOWNBOX_5CAT :{STRING}{STRING3}{STRING3}{STRING3}{STRING3}{STRING3}