NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.1.3
Moderator: OpenTTD Developers
- NekoMaster
- Tycoon
- Posts: 4001
- Joined: 16 Aug 2008 22:26
- Skype: neko-master
- Location: Oshawa, Ontario, CANADA
Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.5
I dunno why, but Admiral AI works in nightlies, but NoCAB doesnt, even though I have both 0.0.7 and 1.0.0


Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.5
Could you maybe try this version? I've updated NoCAB to the 1.0 API version. Hopefully this will work better... somehowNekoMaster wrote:I dunno why, but Admiral AI works in nightlies, but NoCAB doesnt, even though I have both 0.0.7 and 1.0.0

- Attachments
-
- NoCAB.tar
- NoCAB 2.0.6 (preview)
- (420 KiB) Downloaded 92 times
Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.5
Maybe it finds "old" compatability scripts first for whatever reason? Somewhere in your home directory or so?
- NekoMaster
- Tycoon
- Posts: 4001
- Joined: 16 Aug 2008 22:26
- Skype: neko-master
- Location: Oshawa, Ontario, CANADA
Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.5
No, since i need to keep openttd portable everything is in my openttd directory on my flash drive. There is no OpenTTD directory in my home folder.Rubidium wrote:Maybe it finds "old" compatability scripts first for whatever reason? Somewhere in your home directory or so?


Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
- NekoMaster
- Tycoon
- Posts: 4001
- Joined: 16 Aug 2008 22:26
- Skype: neko-master
- Location: Oshawa, Ontario, CANADA
Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.5
Im very sorry to say, the 2.0.6 Preview build also failed, crashing with a HasNext does not exist error.


Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.5
This makes less and less sense... Like I said before the HasNext is in the core API and hasn't changed (as far as I know...). It seems like something is really messed up with your build. Could you test it with any other AI like AdmiralAI, as I'm sure you should experience similar kinds of problems. This is just very weird :/NekoMaster wrote:Im very sorry to say, the 2.0.6 Preview build also failed, crashing with a HasNext does not exist error.
- NekoMaster
- Tycoon
- Posts: 4001
- Joined: 16 Aug 2008 22:26
- Skype: neko-master
- Location: Oshawa, Ontario, CANADA
Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.5
Admiral AI works in Nightlies, but NoCAB doesn't work. Im using builds downloaded form the website, i rarely compile regular nightlies from source.Morloth wrote:This makes less and less sense... Like I said before the HasNext is in the core API and hasn't changed (as far as I know...). It seems like something is really messed up with your build. Could you test it with any other AI like AdmiralAI, as I'm sure you should experience similar kinds of problems. This is just very weird :/NekoMaster wrote:Im very sorry to say, the 2.0.6 Preview build also failed, crashing with a HasNext does not exist error.


Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.5
Just a thought (didn't look at the source) - are you invoking HasNext() on a different kind of object than you were expecting? Maybe a single object, or a Squirrel array, instead of an AIList?
Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.5
Well... The piece of code the error is founds is the following. It is the same as the code of Rondje to construct a HQ. If someone can find a flaw I'd very happy to fix itMichiel wrote:Just a thought (didn't look at the source) - are you invoking HasNext() on a different kind of object than you were expecting? Maybe a single object, or a Squirrel array, instead of an AIList?

Code: Select all
function NoCAB::BuildHQ()
{
// Check if we have an HQ.
if (AICompany.GetCompanyHQ(AICompany.COMPANY_SELF) != AIMap.TILE_INVALID) {
Log.logDebug("We already have an HQ, continue!");
return;
}
Log.logInfo("Build HQ!");
// Find biggest town for HQ
local towns = AITownList();
towns.Valuate(AITown.GetPopulation);
towns.Sort(AIAbstractList.SORT_BY_VALUE, true);
local town = towns.Begin();
// Find empty 2x2 square as close to town centre as possible
local maxRange = Sqrt(AITown.GetPopulation(town)/100) + 5; //TODO check value correctness
local HQArea = AITileList();
HQArea.AddRectangle(AITown.GetLocation(town) - AIMap.GetTileIndex(maxRange, maxRange), AITown.GetLocation(town) + AIMap.GetTileIndex(maxRange, maxRange));
HQArea.Valuate(AITile.IsBuildableRectangle, 2, 2);
HQArea.KeepValue(1);
HQArea.Valuate(AIMap.DistanceManhattan, AITown.GetLocation(town));
HQArea.Sort(AIList.SORT_BY_VALUE, true);
for (local tile = HQArea.Begin(); HQArea.HasNext(); tile = HQArea.Next()) {
if (AICompany.BuildCompanyHQ(tile)) {
return;
}
}
}
- NekoMaster
- Tycoon
- Posts: 4001
- Joined: 16 Aug 2008 22:26
- Skype: neko-master
- Location: Oshawa, Ontario, CANADA
Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.5
If the hasnext is related to build a HQ, why not just remove the code for HQ building? I could go for years and forget to build a HQ untill after 10 to 50 years of game play


Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.5
With that attitude, high quality code is not created. I can see workarounds for his code to not use HasNext() that would probably make his AI invulnerable to this error, but that does not solve the root problem.NekoMaster wrote:If the hasnext is related to build a HQ, why not just remove the code for HQ building? I could go for years and forget to build a HQ untill after 10 to 50 years of game play
Edit: This would probably work regardless of API version:
Code: Select all
foreach (tile in HQArea) {
if (AICompany.BuildCompanyHQ(tile)) {
return;
}
}
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
- TheDarkGiganotosaur
- Engineer
- Posts: 33
- Joined: 24 Mar 2010 15:49
- Location: Portugal
Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.5
I, for one, prefer the HQ (Headquarters.) to be built. Even though the HQ has no purpose whatsoever, that building is still essential and important for the companies as it is their center of operations.
As for the HasNext() code problem, if there is no solution, why not check the other AI scripts for different HQ building method codes? But permission must be asked first before copying the code, of course.
As for the HasNext() code problem, if there is no solution, why not check the other AI scripts for different HQ building method codes? But permission must be asked first before copying the code, of course.
The Dark Giganotosaur, the ghastly dinosaur (currently in human form)
"My favorite type of transport vehicles? Trains and streetcars/trams." | My Music | My Arts (TBA)
Windows 10 x64 (NEVER USED) | Knoppix 8.1+ x64 | Linux Mint 20.3 Xfce x64
"My favorite type of transport vehicles? Trains and streetcars/trams." | My Music | My Arts (TBA)
Windows 10 x64 (NEVER USED) | Knoppix 8.1+ x64 | Linux Mint 20.3 Xfce x64
Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.5
I agree, also this isn't the only place in the code where HasNext() appears. Since it is part of the core API for NoAI one can only guess what other features are not working on your platform. So I could try to revamp my code to work around this, but the bottom line is that the code should work and in all tests I've done it does work... Unless someone else turns up with the same problem the only thing I can conclude is that the problem is somehow at your end. I find if quite weird AdmiralAI does work for you at it contains the same HasNext function so it should crash on that as well when that piece of code is hit upon.
However, in NoCAB 2.0.6 I've made the construction of the HQ optional. So if you turn it off it won't execute that piece of code, but I won't be too surprised if a couple of lines down another problem will pop up :/. But have a look and hopefully it will work
.
- Bram
However, in NoCAB 2.0.6 I've made the construction of the HQ optional. So if you turn it off it won't execute that piece of code, but I won't be too surprised if a couple of lines down another problem will pop up :/. But have a look and hopefully it will work

- Bram
- TheDarkGiganotosaur
- Engineer
- Posts: 33
- Joined: 24 Mar 2010 15:49
- Location: Portugal
Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.6
Well, I guess that each time a new version of OpenTTD is out, the AI scripts whose codes worked before will no longer work...
I could be wrong but what if this is the case?
I could be wrong but what if this is the case?
The Dark Giganotosaur, the ghastly dinosaur (currently in human form)
"My favorite type of transport vehicles? Trains and streetcars/trams." | My Music | My Arts (TBA)
Windows 10 x64 (NEVER USED) | Knoppix 8.1+ x64 | Linux Mint 20.3 Xfce x64
"My favorite type of transport vehicles? Trains and streetcars/trams." | My Music | My Arts (TBA)
Windows 10 x64 (NEVER USED) | Knoppix 8.1+ x64 | Linux Mint 20.3 Xfce x64
Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.6
Luckily this is not the case. The API is more or less stabilized which means that most changes between new versions of OpenTTD will be the inclusion of new functions which allow the AI to gain more information of the game world (like the option to get the maximum speed trains can travel over rails). Besides Yexo included compatibility scripts which will guarantee that even if the AI uses an API which is out of date it will continue the function correctly. The above issue is, as far as I know, quite unique and not related to newer versions of OpenTTD.TheDarkGiganotosaur wrote:Well, I guess that each time a new version of OpenTTD is out, the AI scripts whose codes worked before will no longer work...
I could be wrong but what if this is the case?
But the API 1.0 which is the one in use by OpenTTD 1.0.x will be supported for quite a while so for the next couple of years(?) AIs build on top of that should continue to function with no problems.
Hope this answers your question, otherwise Yexo will be able to give a better answer as he is actually the developer of NoAI.
- TheDarkGiganotosaur
- Engineer
- Posts: 33
- Joined: 24 Mar 2010 15:49
- Location: Portugal
Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.6
Ah, okay.
I only thought like that because the HasNext() code appeared to be obsolete, but thanks for answering.
I only thought like that because the HasNext() code appeared to be obsolete, but thanks for answering.
The Dark Giganotosaur, the ghastly dinosaur (currently in human form)
"My favorite type of transport vehicles? Trains and streetcars/trams." | My Music | My Arts (TBA)
Windows 10 x64 (NEVER USED) | Knoppix 8.1+ x64 | Linux Mint 20.3 Xfce x64
"My favorite type of transport vehicles? Trains and streetcars/trams." | My Music | My Arts (TBA)
Windows 10 x64 (NEVER USED) | Knoppix 8.1+ x64 | Linux Mint 20.3 Xfce x64
Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.6
Morloth - please mend the ship depot building fashion - mostly they are built with one end to the dock or the coast, however, very quickly they wind up being trapped from one side by the other depot, from another by the coast or the dock. The most part of the 100 ships I allow in my games get trapped in such depots till the point they are sent back to the same depot, yet can't quite reach it by not being able to peek out of it even one yard. 

NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.6
Good point, fixed in the newest versionSirkoZ wrote:Morloth - please mend the ship depot building fashion - mostly they are built with one end to the dock or the coast, however, very quickly they wind up being trapped from one side by the other depot, from another by the coast or the dock. The most part of the 100 ships I allow in my games get trapped in such depots till the point they are sent back to the same depot, yet can't quite reach it by not being able to peek out of it even one yard.

Version update:
* Better depot placement of ships (thx SirkoZ).
* Vehicles are build quicker.
Cheers,
Bram
Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.7
Thank you. 

NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.7
While running a test game I noticed your vehicles do not use non-stop orders.
If you use the order flag AIOrder.AIOF_NON_STOP_INTERMEDIATE it will enable go non-stop. Using this flag your vehicles will not stop at stations they pass on the way to their next destination. With drive through bus/truck stops and if you build drive-through rail stations that some trains will just pass by, using this flag the vehicles will no longer stop shortly at the intermediate stations.
If you use the order flag AIOrder.AIOF_NON_STOP_INTERMEDIATE it will enable go non-stop. Using this flag your vehicles will not stop at stations they pass on the way to their next destination. With drive through bus/truck stops and if you build drive-through rail stations that some trains will just pass by, using this flag the vehicles will no longer stop shortly at the intermediate stations.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Who is online
Users browsing this forum: No registered users and 9 guests