Gamescript {SKIP} GSText not working anymore ?

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
hpfx
Engineer
Engineer
Posts: 56
Joined: 09 Nov 2013 00:19

Gamescript {SKIP} GSText not working anymore ?

Post by hpfx »

Hello,

I'm back after a while and a game script that worked fine on openttd 12 now shows some warning.
script is still working, and it makes a long time I didn't open the debug screen, hence I was surprise I got warnings now.
I'm very sorry but I forgot a lot of things about squirrel, and I am not sure about everything,
But it looks the {SKIP} does not work anymore as it used to be in the past.
I have probably missed new guideline about {SKIP}
So I need to help to modify my script toward new way of working maybe.

I do have this definition in english.txt

Code: Select all

STR_NOBONUS	 :{SKIP}
to tell "please skip this parameter" and it's used as follow in nut script :

Code: Select all

bonusMsg=GSText(GSText.STR_NOBONUS,0);
on openttd 14.1 I now have a warning that complain STR_NOBONUS does not consume parameter.
openttd-skip-warning.png
openttd-skip-warning.png (18.59 KiB) Viewed 3965 times
I could silent this by changing STR_NOBONUS to make using the parameter as a number.

Code: Select all

STR_NOBONUS	 :{COMMA}
But that's not what I want to do, I don't want to display "0", I want to skip this value.

if you need context of what STR_TOWN_L1 is, here is the string definition, in english.txt:

Code: Select all

STR_TOWN_L1     :{STRING}{}{STRING1}{}{STRING1}{}{STRING1}
and it's used as follow in nut script :

Code: Select all

txt=GSText(GSText.STR_TOWN_L1,head,levelinfo[0],bonusMsg,totalhab);
#head is a single text, no parameter
#levelinfo[0] is a text with one parameter
#bonusMsg is a text with one parameter, that shoud be skip in that case
#totalhab is a text with one parameter.
as you can guess bonusMsg sometime do have a useful parameter, and sometime not. in this case when it's filled with STR_NOBONUS, it should skip the parameter.

Please advise.
you help will be greatly appreciated, I would like this old script to continue his live, I will udpate on bananas as soon it's fixed.
Thank you.
note : by the way,

I cannot found api documentation for GSText anymore (https://docs.openttd.org/gs-api/classGSText ?)
I found such comment "many Game Scripts are not using GSText properly." on a bug report (https://github.com/OpenTTD/OpenTTD/issues/12494)
Well... I am willing to use it properly but I we need documentation for that.
User avatar
glx
OpenTTD Developer
OpenTTD Developer
Posts: 623
Joined: 02 Dec 2005 15:43
Location: Drancy(93) - France
Contact:

Re: Gamescript {SKIP} GSText not working anymore ?

Post by glx »

Well {SKIP} has been removed in 2009 (1.0.0-RC1), and as you can see we improved validation in openttd 14.

Regarding GSText not being on gs-api pages, it's a bug. Will be fixed on next nighty build.
hpfx
Engineer
Engineer
Posts: 56
Joined: 09 Nov 2013 00:19

Re: Gamescript {SKIP} GSText not working anymore ?

Post by hpfx »

glx wrote: 28 Dec 2024 17:57 Well {SKIP} has been removed in 2009 (1.0.0-RC1), and as you can see we improved validation in openttd 14.

Regarding GSText not being on gs-api pages, it's a bug. Will be fixed on next nighty build.
Hello glx, api documentation for GSText is back, thank,
I was expecting to find somewhere list of defined tags, like {COMPANY} or {BLACK}...

I guess there is nothing that replace {SKIP} exactly,
But I read somewhere about {RAW_STRING}.... and I have an idea I could be helpful in my case to replace SKIP.
Does {RAW_STRING} long term reliable ? or are you going to drop its support, like {SKIP} ?

More generally, If I knew the place I could find reliable tags it would be great.
Thank you very much.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 4 guests