Timberborn

Timberborn

Automation
 This topic has been pinned, so it's probably important
ihsoft  [developer] 13 May @ 12:38pm
HELP! Automation scripting questions and answers
If you have troubles setting up automation rules, you can ask questions here.
< >
Showing 16-30 of 30 comments
ihsoft  [developer] 25 May @ 9:52pm 
Originally posted by Psayne:
Would it be possible to implement an action of "set recipe to {recipe}" for buildings that have more than one? I was thinking about setting up the grill to switch when output is full or input is empty, and pause if all three are full, resume if sufficiently low. the latter two scripts are possible, but recipe changes is outside the scope of this mod at the moment and would be an amazing addition
Good suggestion. I added it to the features list.
ihsoft  [developer] 2 Jun @ 10:03pm 
Question from OldGamer:

if ((or (eq (sig.Weather.Season) 'badtide') (ge (sig Signals.Gauge.red1) 1))
then (act Floodgate.SetHeight 0)
if ((eq (sig Signals.Gauge.red1) 0))
then (act Floodgate.SetHeight 200)


This one is for the bad water gate.

The only question I have is what happens when you have more than one Gauge on the same map. How does the MOD know which Gauge it should read?

Gauges produce signals for themselves, as all other buildings. However, you can use "custom signals" broadcast needed signals to the whole settlement. It's what one of the signals templates does (the one with gauge on the image). You will give different custom signal name for every gauge, and this is how you can set rules on different gauges.
Ryamuni 3 Jun @ 1:40pm 
Is there a way to automate so that certain building that have multiple employees can always maintain at least one, but have a priority set of low or lowest?
ihsoft  [developer] 3 Jun @ 3:27pm 
Originally posted by Ryamuni:
Is there a way to automate so that certain building that have multiple employees can always maintain at least one, but have a priority set of low or lowest?
There is action`Workplace.SetWorkers`. By using it, you can set any number of workers you want. You just need to make the right conditions to execute it. Obviously, there are cases when you just can't have workers in each building. And you need to somehow deal with it.

I would suggest you to make a very limited set of critical buildings where you need to keep at least one worker. And then make rules, based on the district population. E.g. "if > 40, then set workers 4", or "if < 20, then setworkers 1". Workplace priority is not yet supported, so this you need to set manually.
Mate, you are missing the most vital operator/signal that will determine your mod to prove "a must";the operator that checks the global storage and determine the future of a building (for e.g: if less than 1000 wood in the district, pause "engine", or if district water more than % 50 of the district's total water storage capacity, set large water pump workers to 1)

After reading your github wiki, with the disapopintment regarding the shortness of the signals/actions that can be utilised in the manual scripting and basiclly %80 of the operations can be configured via the constructor (plus the easiness of the usage), + EVEN USING CHATGPT to
check every one and each file in the github library where there might be very well be an operator that does such operations however not introduced in wiki section, as you have explained wiki is not always up-to-date:

MY JAW literally dropped when there was no operator that calls the sum of a good ,n that particular district, where u had bots, beavers , even beds, a building's input/output storage, but nothing that even resembles the global goods in the stocks...

Now u would suggest using signals for gathering the real-time stock value, but imagine having 56 (yes FiftySix) different sized water storage elements (plus additional that default storage types introduced thru mods where i definately lack the name-index of those storage items), imagine setting signals in each and every water related storage ONE-BY-ONE, than finally heading to the building that u would utilise this info to actions finally, yet again using AT LEAST 4-5 lines to manage your goal's introduction thru script names..... (meanwhile the FPS falling to half of its original simply panning thru all those buildings with INDIVIDUAL SIGNALS)

I would purely say & suggest:

NO THANK YOU VERY MUCH I WOULD RATHER KISS H*TLER'S FINGER THAT HE POKED HIS NOSE

Long story short:

We lack ".... District.Storage.<GoodID>..." that either sums up all storage regarding that good in that district automaticly OR simply calls the value on the top of the screen...

I am still amazed how you have missed such a great a brutally important function in the mod..

Notwithstanding; this is a monumentally significant mod that literally allows you to worry with the real-stuff in the game, rathewr than literally micromanaging stuff (especially when you forget to close floodgates right before a bad-tide, good luck withn rescuing the colony without cheatingv in the dev mod...)

Hence; THANK YOU AND PLEASE ENHANCE THE SCRIPT FUNCTIONS!

All The Best, a MSc Civil Engineer with utmost automation desire regarding ANYTHING in his life.... (hate redundant and time-wasting mini tasks)
ihsoft  [developer] 22 Jun @ 9:18pm 
Originally posted by YemCilmaz:
Mate, you are missing the most vital operator/signal that will determine your mod to prove "a must";the operator that checks the global storage and determine the future of a building (for e.g: if less than 1000 wood in the district, pause "engine", or if district water more than % 50 of the district's total water storage capacity, set large water pump workers to 1)

After reading your github wiki, with the disapopintment regarding the shortness of the signals/actions that can be utilised in the manual scripting and basiclly %80 of the operations can be configured via the constructor (plus the easiness of the usage), + EVEN USING CHATGPT to
check every one and each file in the github library where there might be very well be an operator that does such operations however not introduced in wiki section, as you have explained wiki is not always up-to-date:

MY JAW literally dropped when there was no operator that calls the sum of a good ,n that particular district, where u had bots, beavers , even beds, a building's input/output storage, but nothing that even resembles the global goods in the stocks...

Now u would suggest using signals for gathering the real-time stock value, but imagine having 56 (yes FiftySix) different sized water storage elements (plus additional that default storage types introduced thru mods where i definately lack the name-index of those storage items), imagine setting signals in each and every water related storage ONE-BY-ONE, than finally heading to the building that u would utilise this info to actions finally, yet again using AT LEAST 4-5 lines to manage your goal's introduction thru script names..... (meanwhile the FPS falling to half of its original simply panning thru all those buildings with INDIVIDUAL SIGNALS)

I would purely say & suggest:

NO THANK YOU VERY MUCH I WOULD RATHER KISS H*TLER'S FINGER THAT HE POKED HIS NOSE

Long story short:

We lack ".... District.Storage.<GoodID>..." that either sums up all storage regarding that good in that district automaticly OR simply calls the value on the top of the screen...

I am still amazed how you have missed such a great a brutally important function in the mod..

Notwithstanding; this is a monumentally significant mod that literally allows you to worry with the real-stuff in the game, rathewr than literally micromanaging stuff (especially when you forget to close floodgates right before a bad-tide, good luck withn rescuing the colony without cheatingv in the dev mod...)

Hence; THANK YOU AND PLEASE ENHANCE THE SCRIPT FUNCTIONS!

All The Best, a MSc Civil Engineer with utmost automation desire regarding ANYTHING in his life.... (hate redundant and time-wasting mini tasks)

The district level stock signals feature is tracked here: https://github.com/ihsoft/TimberbornMods/issues/80. This world has more than one smart person, you're not the only one who "figured it out". When I have time to start working on this feature, it will be done. I work on this project in my free time, so no promises on any dates or features.
Vecchi02_ 10 Jul @ 11:00am 
Hi, I tried to automate the water pump with the following four rules:
- If (ne (sig Weather.Season) 'TemperateWeather') --> Then (act Pausable.Pause)
- If (eq (sig Weather.Season) 'TemperateWeather') --> Then (act Pausable.Unpause)
- If (eq (sig Inventory.OutputGood.Water) 1500) --> Then (act Pausable.Pause)
- If (le (sig Inventory.OutputGood.Water) 1400) --> Then (act Pausable.Unpause)
The problem is that if I'm out of a good season, and the storage of the pump is not full the building unpauses, even though I'm telling it to stay paused in that season.
Is there a way I've yet to find to put:
- an AND/& to these rules,
- the 3rd and 4th rules inside of the 2nd rule,
- give priority based on the order of these rules?
Thanks!
ihsoft  [developer] 12 Jul @ 3:25pm 
Originally posted by Vecchi02_:
Hi, I tried to automate the water pump with the following four rules:
- If (ne (sig Weather.Season) 'TemperateWeather') --> Then (act Pausable.Pause)
- If (eq (sig Weather.Season) 'TemperateWeather') --> Then (act Pausable.Unpause)
- If (eq (sig Inventory.OutputGood.Water) 1500) --> Then (act Pausable.Pause)
- If (le (sig Inventory.OutputGood.Water) 1400) --> Then (act Pausable.Unpause)
The problem is that if I'm out of a good season, and the storage of the pump is not full the building unpauses, even though I'm telling it to stay paused in that season.
Is there a way I've yet to find to put:
- an AND/& to these rules,
- the 3rd and 4th rules inside of the 2nd rule,
- give priority based on the order of these rules?
Thanks!
All rules are executed always (when the change triggers). So one rule can override action from another. If you wish to avoid it, use and/or terms. Those cannot be edited via the constructor though. E.g.

If: (and (eq (sig Weather.Season) 'TemperateWeather') (le (sig Inventory.OutputGood.Water) 1400)) Then: (act Pausable.Unpause)
Last edited by ihsoft; 12 Jul @ 3:26pm
I see, Thanks!!
Serena 29 Aug @ 9:41am 
I have a number cruncher I want to run at night when the beavers aren't using the power grid. I didn't see any day/night triggers. Is this something that's possible?

Edit: I could also do what I want if I could trigger off an amount of energy in storage. IE: Turn off if battery is empty.
Last edited by Serena; 29 Aug @ 11:09am
ihsoft  [developer] 29 Aug @ 9:35pm 
Originally posted by Serena:
I have a number cruncher I want to run at night when the beavers aren't using the power grid. I didn't see any day/night triggers. Is this something that's possible?

Edit: I could also do what I want if I could trigger off an amount of energy in storage. IE: Turn off if battery is empty.
When I was trying to implement this automation, I ended up with creating a completely separate mod. It's called SmartPower. Trust me, there are so many edge cases that you just can't handle them with scripts. Try SmartPower, I've spent many weeks of work to make it doing what I need. There, you can tell your buildings to shutdown if the batteries level is too low. Or of there is a power shortage in the network. Or if there are more important buildings that need power and you can't feed all of them!

The idea of running number cruncher at night is obvious, but in reality your main goal is different. You want to run number cruncher as long as possible, given there is unused power. Right? :)
Last edited by ihsoft; 29 Aug @ 9:36pm
Serena 31 Aug @ 5:38am 
Originally posted by ihsoft:
Originally posted by Serena:
I have a number cruncher I want to run at night when the beavers aren't using the power grid. I didn't see any day/night triggers. Is this something that's possible?

Edit: I could also do what I want if I could trigger off an amount of energy in storage. IE: Turn off if battery is empty.
When I was trying to implement this automation, I ended up with creating a completely separate mod. It's called SmartPower. Trust me, there are so many edge cases that you just can't handle them with scripts. Try SmartPower, I've spent many weeks of work to make it doing what I need. There, you can tell your buildings to shutdown if the batteries level is too low. Or of there is a power shortage in the network. Or if there are more important buildings that need power and you can't feed all of them!

The idea of running number cruncher at night is obvious, but in reality your main goal is different. You want to run number cruncher as long as possible, given there is unused power. Right? :)

Totally correct. I'll go check it out. Thanks for the prompt response!
Azrael 28 Sep @ 1:07am 
Is it possible to differentiate between different Collectables in sig Collectable.Ready ?

For example, I would like to check on a Gatherer Flag if Dandelions in Range are ready to collect or if Berries in Range are ready to collect.
Or is it only possible to check for all Collectables?
ihsoft  [developer] 1 Oct @ 12:47am 
Originally posted by Azrael:
Is it possible to differentiate between different Collectables in sig Collectable.Ready ?

For example, I would like to check on a Gatherer Flag if Dandelions in Range are ready to collect or if Berries in Range are ready to collect.
Or is it only possible to check for all Collectables?
At this point, no way to know it. It may seem logical to make this signal resources based, but there are edge cases. I cut them all :) For now, it's all or none, sorry.
Azrael 1 Oct @ 12:53am 
Originally posted by ihsoft:
At this point, no way to know it. It may seem logical to make this signal resources based, but there are edge cases. I cut them all :) For now, it's all or none, sorry.

Okay, thanks for clarifying.
Awesome Mod nonetheless =)
< >
Showing 16-30 of 30 comments
Per page: 1530 50