Development Know How

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
Tenebrae00
Engineer
Engineer
Posts: 4
Joined: 12 Jun 2017 19:49

Development Know How

Post by Tenebrae00 »

Hello, maybe im posting into wrong topic, if so i'm sorry for that and please move it into right one.

I would like to ask how to start with script coding in OTTD. i found on WIKI that there is needed NOGO gamescripting framework. Except those 4 rows of text i could not find anything more. https://wiki.openttd.org/Game_script#Wr ... ame_script
Can someone help me giving short introduction (for noobs) into game scripting know how and how to start simple write your first gamescript (i'm thinking about some automation on server like every month, year and so on) i see there is huge documentation for NOGO gamescript so i think later this will be my A & Z for scripting.

Anyway in short ... now i need to know how to write your gamescript, where to post it and best of all some example codes.

Thanks a lot for time anyone who read this and much more for those who reply !
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Development Know How

Post by Alberth »

Tenebrae00 wrote:I would like to ask how to start with script coding in OTTD. i found on WIKI that there is needed NOGO gamescripting framework. Except those 4 rows of text i could not find anything more. https://wiki.openttd.org/Game_script#Wr ... ame_script
NoGo is a variation on NoAI, the scripting framework for making an AI.

The latter was first, and thus has a lot more information how to make them, so I'd suggest you start by making an AI, even if it doesn't actually build anything in the end, what a normal company would do.

NoGo and NoAI share
- The Squirrel scripting language
- Many of the NoAI / NoGo interface functions to the game
- How they are programmed (a loop where you wait for time or events, and then do something).

This basically means if you know how to program one, you also know how to do the other one.

The differences between NoGo and NoAI are
- NoAI is always a company, while NoGo is a Diety (and has the power to go into company mode)
- There is a lot more information about how to program a NoAI.
Being a retired OpenTTD developer does not mean I know what I am doing.
Tenebrae00
Engineer
Engineer
Posts: 4
Joined: 12 Jun 2017 19:49

Re: Development Know How

Post by Tenebrae00 »

Thank you very much both of you ! this were information i was missing.
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: Development Know How

Post by Zuu »

In the forum section #65 linked above I have published a template for a gs (pinned thread). It is called minimal but it has som small opiniated additions related to how I usually structure my GS scripts.

This said, starting with AI and then working your way to GS is a good way to learn from ground up. There are a few articles on the wiki directed for AIs that are useful also when you write GSes.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Google [Bot] and 11 guests