CityBuilder Release Topic

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

User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: CityBuilder Release Topic

Post by Zuu » 14 Jan 2016 09:18

From the looks of it, you probably got SuperLib 39 installed as dependency. (otherwise it should have had an error about that)

The line that triggers the error looks like this:

Code: Select all

    constructor() {	
        GSLog.Info("Loading Economy ", Log.LVL_WARNING)     // <------------ Line 36 in econ/econ.nut
    }
One problem I see here is that it mix GSLog with Log which is not going to go well. However the error is about LVL_WARNING not existing which is also true.

SuperLib.Log has these levels defined:

Code: Select all

	/* Log levels: */
	static LVL_INFO = 1;           // main info. eg what it is doing
	static LVL_SUB_DECISIONS = 2;  // sub decisions - eg. reasons for not doing certain things etc.
	static LVL_DEBUG = 3;          // debug prints - debug prints during carrying out actions

Users of SuperLib can call SetIsLevelAcceptedFunction to inject a different function to decide if a log message should be outputed or not if they like to introduce more levels. Or create your own constants with value 1, 2 and 3, as I would very unlikely change these values as too much code depend upon the log system.

stinkyfax:As you probably understood, this is an error in the script code. So you'll have to wait for the author to upload a fixed version.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)

Aphid
Traffic Manager
Traffic Manager
Posts: 166
Joined: 16 Dec 2011 17:08

Re: CityBuilder Release Topic

Post by Aphid » 14 Jan 2016 11:56

I believe the correct thing to do would be to replace said line of code with just:

Code: Select all

GSLog.Info("Loading Economy");

stinkyfax
Engineer
Engineer
Posts: 28
Joined: 28 Mar 2013 20:12

Re: CityBuilder Release Topic

Post by stinkyfax » 15 Jan 2016 17:47

Still waiting for the update of a script, thank you.

ST2
Engineer
Engineer
Posts: 63
Joined: 07 Apr 2011 14:17

Re: CityBuilder Release Topic

Post by ST2 » 18 Feb 2016 16:49

noticed that when town still have 0 demands, the Next demand line wasn't shown correctly so, in Towngrowth.nut, line 495
(only change is from "GSTown.SetText(id, GSText(GSText.STR_CITYBUILDER_CONCAT01," to "GSTown.SetText(id, GSText(GSText.STR_CITYBUILDER_CONCAT02,")

Code: Select all

			    if(next != -1) {
					    GSTown.SetText(id, GSText(GSText.STR_CITYBUILDER_CONCAT01, 
						    GSText(GSText.STR_CITYBUILDER_TW_HAMLET), 
						    GSText(GSText.STR_CITYBUILDER_TW_NEXT, 1 << econ.enable_order[next], econ.enable_populations[next])));
				    } else {
must be

Code: Select all

			    if(next != -1) {
					    GSTown.SetText(id, GSText(GSText.STR_CITYBUILDER_CONCAT02, 
						    GSText(GSText.STR_CITYBUILDER_TW_HAMLET), 
						    GSText(GSText.STR_CITYBUILDER_TW_NEXT, 1 << econ.enable_order[next], econ.enable_populations[next])));
				    } else {
Well, at least this way started showing correct values (cargo and population). No idea if there's other cases (only found this ^^), this Concat strings are heavy stuff :D

Aphid
Traffic Manager
Traffic Manager
Posts: 166
Joined: 16 Dec 2011 17:08

Re: CityBuilder Release Topic

Post by Aphid » 19 Feb 2016 23:27

That's a nice observation; I'll push it to the repository. The whole CONCAT_xyz thing is a bit of an ugly workaround to be able to 'build' a custom string in the town window while still having access to nice features such as translation and coloured text, yet one needs to know the exact amount of parameters in each string used in the concatenation to be able to concatenate them this way, it's a bit cumbersome to use.

The script currently also dumps the same information to the story book by the way; that can support larger amounts of information more readily since a page can contain multiple strings. Each town gets its own page, and it just updates monthly like the town windows do.

marhex
Engineer
Engineer
Posts: 9
Joined: 09 Jul 2015 10:44

Re: CityBuilder Release Topic

Post by marhex » 06 Jul 2016 20:31

i have a bug when i load a saved game with version 117:
Attachments
Capture.PNG
Capture.PNG (7.22 KiB) Viewed 2933 times
Last edited by marhex on 07 Jul 2016 16:23, edited 1 time in total.

clausqr
Engineer
Engineer
Posts: 1
Joined: 07 Jul 2016 03:32

Re: CityBuilder Release Topic

Post by clausqr » 07 Jul 2016 03:39

fix:

in Towngrowth.nut line 694 there is a missing + between Assim and GSTown.xxxxx:

Code: Select all

--- Towngrowth.nut	2016-07-07 00:36:56.000000000 -0300
+++ Towngrowth.nut	2016-07-06 19:40:17.000000000 -0300
@@ -691,7 +691,7 @@
 				    if(f2 < 0){f2 = 0;}
 				    local c = f1 + f2; // + sqrt(f1) * sqrt(f2) * 2 << Removed for optimization...
 				    if(GSController.GetSetting("debug_level") > 6) {
-				        GSLog.Info("Assim: " GSTown.GetName(tid) + " and "+ GSTown.GetName(this.id) + "req " + c);
+				        GSLog.Info("Assim: " + GSTown.GetName(tid) + " and "+ GSTown.GetName(this.id) + "req " + c);
 				    }
 	// optimization: reuse f1
 				    f1 = GSTown.GetDistanceSquareToTile(tid,loc);

Nezerin
Engineer
Engineer
Posts: 1
Joined: 05 Aug 2016 04:29

Re: CityBuilder Release Topic

Post by Nezerin » 05 Aug 2016 04:38

I'm likely doing something very wrong as I'm trying to setup a single player game using CityBuilder for fun and practice. In doing so no matter what settings I select I'm ending up with the following error:
Error message received a couple months into every game.
Error message received a couple months into every game.
CityBuilderError.png (24.89 KiB) Viewed 2775 times
Can anyone help me with what I'm doing wrong? It looks like it's running into trouble while trying to calculate a score of some sort for the individual towns.

User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9291
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: CityBuilder Release Topic

Post by planetmaker » 16 Feb 2019 21:28

So... is this still actively maintained? It crashed on me, shortly after start
Attachments
Unnamed, 18th May 1971.png
(526.9 KiB) Not downloaded yet

kryters
Engineer
Engineer
Posts: 1
Joined: 28 Apr 2019 10:39

Re: CityBuilder Release Topic

Post by kryters » 28 Apr 2019 11:12

marhex wrote:i have a bug when i load a saved game with version 117:
I appreciate that it's been almost 3 years since this comment, but I also have this issue with CityBuilder v117 installed through the Online Content interface. Currently running OpenTTD 1.9.1.

Game runs perfectly until I save then load a CityBuilder game. The following error message appears:

Code: Select all

Your script made an error: the index 'num_cargos' does not exist
*FUNCTION [constructor()] citybuilder-117\Towngrowth.nut line [134]
*FUNCTION [Second_Load()] citybuilder-117\main.nut line [218]
*FUNCTION {Start()] citybuilder-117\main.nut line [473]
Image

Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 3 guests