Read GS global params from an AI 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

Post Reply
tyrins_kush
Engineer
Engineer
Posts: 2
Joined: 18 May 2021 09:35

Read GS global params from an AI script

Post by tyrins_kush »

Hi, I mod a GS for city builder and running well, now I want to mod another AI script to make it build the city.

Problem is I don't know how to read the params storing inside the GS itself from the AI code or if it is possible ?

Exp : like I would like to read the saved town stocked cargo value storing in a (static global ? ) variable in side the main class of the GS itself. Should I import the GS as a library ?
User avatar
Firrel
Engineer
Engineer
Posts: 118
Joined: 13 Aug 2019 17:06

Re: Read GS global params from an AI script

Post by Firrel »

What you need is Script Communication Protocol. It provides a way of communication between AIs and GS by using signs in top corner of the map. In that topic you will find a guide on how to set it up.
tyrins_kush
Engineer
Engineer
Posts: 2
Joined: 18 May 2021 09:35

Re: Read GS global params from an AI script

Post by tyrins_kush »

Firrel wrote: 18 May 2021 20:42 What you need is Script Communication Protocol. It provides a way of communication between AIs and GS by using signs in top corner of the map. In that topic you will find a guide on how to set it up.
Thanks for the quick and correct answer :D !
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 3 guests