-
Notifications
You must be signed in to change notification settings - Fork 5
Automation (scripting) ru RU
Igor Zavoychinskiy edited this page Mar 9, 2025
·
7 revisions
Starting from version 2.0.0, the mod supports a new format of the rules: scripted rules. That is, you can set up conditions and actions via a simple scripting language. And these actions can be changed during the game!
- There are "signals" that provide string or numeric values. They are primarily used in conditions but can also be used as value parameters in actions. When something happens in the Timberborn universe, a signal can trigger. If there is a condition for this signal, it will be handled, and the action will execute (if the condition evaluates to
true). - Signals can be global (e.g., the current weather season change) or bound to a specific building (e.g., inventory changes).
- Actions are always bound to a specific building. They execute only on the same building to which the rule belongs.
The script follows the Lisp syntax convention. Both the condition and action are operators:
- The condition must be a binary condition operator.
- The action must be an operator
act.
-
eq- "is equal to". -
ne- "is not equal to". -
gt- "is greater than". -
ge- "is greater then or eqaul to". -
lt- "is less than". -
le- "is less than and equal to".
-
Weather.Season- returns the current wather season as a string. The possible values are: "drought", "badtide", and "temperate". -
Inventory.InputGood.<good_id>- returns the good amount stored as the buildings inventory input. -
Inventory.OutputGood.<good_id>- returns the good amount stored as the buildings inventory output (the product, if it's a workshop). In the stockpiles, all goods are terated as "output". -
District.Bots- returns the number of bots in the district to which the building is connected. If the buildig is not connected to any district, then thenr the result is0. -
District.Beavers- returns the number of beavers, adaults and kittens, in the district to which the building is connected. If the buildig is not connected to any district, then then the result is0.
