Page 1 of 1

Pathfinder Rail cannot be included

Posted: 14 Jan 2019 13:56
by Vasco
Hi Sifu

I'm currently exploring an Idea for a AI I like to program but I get stuck at the path finding.

In short my first 2 lines of code:
import("graph.aystar", "", 6);
import("Pathfinder.Rail", "", 1);

the graph.aystar works as expected but the pathfinder.Rail kicks following error:
Your script made an error: couldn't find library 'Pathfinder.Rail' with version 1
Screenshot (2).png
(136.65 KiB) Not downloaded yet
in long:
my AI supposed to find the outermost Powerstation and connect all Coal mines to it by train. It supposed to to that by gradually extending the existing network. My idea was to get a pretty average train network done by the AI which I'll buy over at some point to have a challenge of optimizing it .
I managed to get the above concept running to the point of defining the path of the rail track. To come up with it manually is above my current skills therefore I thought of starting with the existing libraries. But even that is not rewarded with success and I'm ending up with multiple stations all over the map without being connected. Not a very useful AI so far :)
What am I missing to get the pathfinder imported? compared to aystar the folder structure looks right, the naming looks right, the revision is matching, classname is not used so far, ... I just can't find anything wrong with it!

Re: Pathfinder Rail cannot be included

Posted: 14 Jan 2019 14:07
by planetmaker
Do you actually have the libraries in your OpenTTD's AI/GS search path?

You can test the detected AI and libraries by calling "openttd --help" in the command line. And possibly by calling it in debug mode: "openttd -d script=X" where X is a number 1...9. The higher the more spammy it will get.

Re: Pathfinder Rail cannot be included

Posted: 15 Jan 2019 13:09
by Vasco
Hi Planetmaker

thanks for your quick response and sorry for my delay. Only now I had the chance to get back to my PC.

For the --help: it does not seem to list libraries. At least nothing for me recognizable. My AI is properly listed there

Moving on to the debug mode: oh boy that's a list and it points to some issues. However after cleanup it's now coming up blank. Starting the script shows some missing libraries. Well that's a change and obviously I cleaned up too much :)

After slowly adding a couple of needed ones it appears now working fine.

Still a bit puzzled why a duplicate of libraries causes this issue as it seems to ignore the second/third duplicate (according error message given). But anyway it solved my problem, that's the main point

Thanks a lot!

Re: Pathfinder Rail cannot be included

Posted: 15 Jan 2019 16:07
by planetmaker
Glad it helped!

There used to be problems for OpenTTD to detect identically-named items ... IIRC when they reside inside tars. Though I recall that it had been solved. But maybe just sth very similar