[GS] Simple City Builder game script

Discuss the new AI features ("NoAI") introduced into OpenTTD 0.7, allowing you to implement custom AIs, and the new Game Scripts available in OpenTTD 1.2 and higher.

Moderator: OpenTTD Developers

Honza_
Engineer
Engineer
Posts: 126
Joined: 29 Aug 2010 10:29

Re: [GS] Simple City Builder game script

Post by Honza_ »

McBorer wrote: 13 Mar 2024 18:08 Crashed every time on OpenTTD v. 14.
I tried it with 14.0-RC3, and yes, there are some log evenst with strings, but otherwise the script works (and even all gui is displayed properly). But I am not really sure, why it would show such errors in log, probably some new feature in v14.
Tabloid
Engineer
Engineer
Posts: 2
Joined: 13 Jan 2025 15:02

Re: [GS] Simple City Builder game script

Post by Tabloid »

Cheers Honza_,

do you intend to change from plain numeric cargo IDs to cargo tags? From my understanding, most overhaul nGRFs like FIRS have been changing their cargo scheme to a tag-based variant, which makes compatibility with Simple City Builder a problem. At least that's what, I think, has been causing me some headaches the past few days, since cargo requests never seem to be right like in the config.
The_Dude
Engineer
Engineer
Posts: 11
Joined: 11 Oct 2013 19:07
Contact:

Re: [GS] Simple City Builder game script

Post by The_Dude »

Not really sure what do you mean by cargo tag or what the exact suggestion is supposed to be.
Tabloid
Engineer
Engineer
Posts: 2
Joined: 13 Jan 2025 15:02

Re: [GS] Simple City Builder game script

Post by Tabloid »

Sorry, I might have misunderstood my problem.
Anyway, I can't seem to get the SCB script running properly with the newer FIRS 5.0. Somehow the orders from the towns never confirm to the orders put down in the config menu, or even the config table in the info.nut of SCB. I thought it might be an issue regarding the cargo translation tables, but tbh my understanding of nGRFs is not good enough to diagnose what's actually causing it.
Lucas79
Engineer
Engineer
Posts: 8
Joined: 17 Nov 2012 15:26

Re: [GS] Simple City Builder game script

Post by Lucas79 »

Hi Honza,

Some time ago you fixed a bug that I reported when working with a scenario and a duplicate name. Still very happy you fixed that, since my small group of 4 players still play every Tuesday evening on a large map of The Netherlands with the SCB and some other GRF's like FIRS4, ISR and the Dutch Train Set. The map now has around 300 Dutch cities in their actual location and when we start a new round (player must reach 30.000 citizens with quite a lot of resources) I let the players choose their starting location and place 1 town just under 800 citizens (around 725-750) on that location, so the player can start there. Since some time, I think update 14.1, but not entirely sure, I notice that at least 1, but sometimes more, players can actually let their town grow with only passengers being transported locally. One bus seems to be enough. As soon as you remove the bus, you need to deliver all supplies again to get the town growing. I tested with the "Town Growth Mechanism" in both Normal and Expand, but that does not seem to change anything. Just to give all information, we also see an error message in the City Info screen of a players town after "See more details in:" Goal Gui(invalid parameter)(invalid parameter)(invalid parameter) I don't thing it is related, it started after update 14.0 of 14.1 and is visible on all player cities, not just the players that can 'cheat' with local passengers.

It would be awesome if you could take a look at what might cause this strange behavior. Thanks in Advance,

Lucas
There is no spoon...
Honza_
Engineer
Engineer
Posts: 126
Joined: 29 Aug 2010 10:29

Re: [GS] Simple City Builder game script

Post by Honza_ »

Tabloid wrote: 14 Jan 2025 11:54 Sorry, I might have misunderstood my problem.
Anyway, I can't seem to get the SCB script running properly with the newer FIRS 5.0. Somehow the orders from the towns never confirm to the orders put down in the config menu, or even the config table in the info.nut of SCB. I thought it might be an issue regarding the cargo translation tables, but tbh my understanding of nGRFs is not good enough to diagnose what's actually causing it.
Game scripts cannot read NewGRF cargo definitions and with all those industry sets it's too complicated to involve all the cargo names at the corresponding internal cargo numbers, so it is left onto user to found out.

If you don't wont to delve into NewGRFs itself one thing you can to is set script's logging to "MORE" and then in AI/GS debug window read the corresponding cargo numbers for each cargo.

This example is for FIRS5 Steel Town
firts5.png
firts5.png (92.81 KiB) Viewed 8369 times
Honza_
Engineer
Engineer
Posts: 126
Joined: 29 Aug 2010 10:29

Re: [GS] Simple City Builder game script

Post by Honza_ »

Lucas79 wrote: 12 Feb 2025 16:32 Hi Honza,

Some time ago you fixed a bug that I reported when ...
Hi Lucas,
very strange indeed. No idea on that. Could you provide more details, settings, savegame, etc.?
Lucas79
Engineer
Engineer
Posts: 8
Joined: 17 Nov 2012 15:26

Re: [GS] Simple City Builder game script

Post by Lucas79 »

Hi Honza,

Thanks for taking the time to investigate this. Attached is a screenshot of 4 towns, all have 1 local bus. 2 towns are growing and 2 towns are not. The Save game and Scenario file are also attached.
Screenshot Town Growing.jpg
(425.86 KiB) Not downloaded yet
Kind regards,

Lucas
Attachments
Test1.sav
(404.66 KiB) Downloaded 39 times
Test.scn
(392.79 KiB) Downloaded 33 times
There is no spoon...
Honza_
Engineer
Engineer
Posts: 126
Joined: 29 Aug 2010 10:29

Re: [GS] Simple City Builder game script

Post by Honza_ »

Lucas79 wrote: 03 Mar 2025 09:26 Hi Honza,

Thanks for taking the time to investigate this. Attached is a screenshot of 4 towns, all have 1 local bus. 2 towns are growing and 2 towns are not. The Save game and Scenario file are also attached.

Screenshot Town Growing.jpg

Kind regards,

Lucas
The text problem is caused because OpenTTD string management became more strict. That is easy fix.

I have no idea about the growth thing. From the screenshot it would seem the script thinks town is not supplied and growing but the town still thinks it is growing. I guess that could happen with EXPAND mechanic where town falsely thinks it is growing while in fact it is not. It's actually just GUI bug which cannot be fixed with current API.

The save was not that useful, because it loaded strangely without any info in goal gui and I was not able to reproduce it.

What version of OpenTTD and script are you using?

If it happens often and you are able to reproduce it maybe send me PM and you can show it to me in actual game.
Lucas79
Engineer
Engineer
Posts: 8
Joined: 17 Nov 2012 15:26

Re: [GS] Simple City Builder game script

Post by Lucas79 »

Honza_ wrote: 03 Mar 2025 18:06
The text problem is caused because OpenTTD string management became more strict. That is easy fix.

I have no idea about the growth thing. From the screenshot it would seem the script thinks town is not supplied and growing but the town still thinks it is growing. I guess that could happen with EXPAND mechanic where town falsely thinks it is growing while in fact it is not. It's actually just GUI bug which cannot be fixed with current API.

The save was not that useful, because it loaded strangely without any info in goal gui and I was not able to reproduce it.

What version of OpenTTD and script are you using?

If it happens often and you are able to reproduce it maybe send me PM and you can show it to me in actual game.

Hi Honza,

The Towns don't just 'think' they are growing, they are actually growing. I took a second screenshot after keeping the game running for about 2 in-game years, without doing anything. You can see Town #2 and #4 have a larger population. I have tested with both Expand and Normal setting, with the same result.
Screenshot Town Growing2.jpg
(428 KiB) Not downloaded yet

I'm using OpenTTD version 14.1 and Simple City Builder Version 2024.04.13. (when I click in Game on the 'Select Script' it reads Simpleton's City Builder Version 14)

If this extra info doesn't help I'll PM you so I can share my screen with you.

Kind Regards,

Lucas
There is no spoon...
Honza_
Engineer
Engineer
Posts: 126
Joined: 29 Aug 2010 10:29

Re: [GS] Simple City Builder game script

Post by Honza_ »

New version released, it should fix both the string and growth issue.
Lucas79
Engineer
Engineer
Posts: 8
Joined: 17 Nov 2012 15:26

Re: [GS] Simple City Builder game script

Post by Lucas79 »

Honza_ wrote: 07 Mar 2025 13:30 New version released, it should fix both the string and growth issue.
That is awesome, Thank you very much! :bow:

Kind regards,

Lucas and OpenTTD Friends,
There is no spoon...
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: Baidu [Spider] and 4 guests