How to make the console accessible to GS / AI programs?

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

Post Reply
agentw4b
Traffic Manager
Traffic Manager
Posts: 216
Joined: 14 Apr 2017 15:51
Location: Czech Republic

How to make the console accessible to GS / AI programs?

Post by agentw4b »

Since it is possible to use buttons in game scripts in the Story book by Openttd 1.11.0, I try to invent an administrative tool in the game. Unfortunately, GS / AI cannot call console commands. Although he can control some parameters of the game, he cannot access commands like Kick, Ban, Newgame. Is there any way a game script could use a game console? I have encountered similar problems before and someone has always referred me to use the Admin port. There is very little documentation and live examples for using the Admin port. It usually refers to decades of dead projects used the Admin port, which are also poorly documented.But I don't want to send game data out to an external program, I want to communicate inside the game.

It seems absurd to me that the two ways to control the game using "GS / AI scripts" and "Console / Console scripts" cannot communicate with each other. Everyone lacks some options.

I need to somehow call the RCON command from Gamescript. And I don't know how. Although I can write something on the console, but only with extra characters (script), which makes it not executable command.
Owner and admin of servers with names "Experimental games" .
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS
User avatar
jfs
Tycoon
Tycoon
Posts: 1750
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: How to make the console accessible to GS / AI programs?

Post by jfs »

Not directly, but you can make a GS that sends things out on the admin port when the user presses buttons in the story book. You then need a program that listens on the admin port and sends actual admin commands back.
agentw4b
Traffic Manager
Traffic Manager
Posts: 216
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: How to make the console accessible to GS / AI programs?

Post by agentw4b »

Yes, this method also occurred to me, but I can't write such a program and the various tools I saw for the adminport service are for sending messages to the admin port, but I can't use them for listening and processing data. Unfortunately I can't program C, Python, Javascript.
Owner and admin of servers with names "Experimental games" .
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS
agentw4b
Traffic Manager
Traffic Manager
Posts: 216
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: How to make the console accessible to GS / AI programs?

Post by agentw4b »

if it were possible to somehow connect the two Openttd servers using admin ports. One for sending and the other for receiving.

GSAdmin.Send () solves only sending, but it is not possible to pass some parameters to which server and port to send data.
Owner and admin of servers with names "Experimental games" .
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 3 guests