Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
This link[discord.com] works just fine for me. You can also use this invite link[discord.gg] to join the Timberborn Discord server. There, you can find "mod-creators" channel. You can find me by name "@Igor". There is a dedicated sub-thread for Automation mod where all questions are welcome and being answered quick.
I assume, you have already read about the scripting principles[github.com].
To be able to execute action on a building, based on values from another building, you need to first "export" those values. If all buildings were exporting all their values, it would be a mess, so you need to tell explicitly what you need. There is a tool in the "signals" tool group that exports the currently selected good from a building (Tank, in our case). Once you applied it, the water reserve in the tank will be exported as signal "Stockpile.yellow1". You can change the name if you want via the rules editor dialog. Now, you need to add rules on the pump that would react on this signal and do the logic. E.g. rule "IF (gt (sig Signals.Stockpile.yellow1) 10000), THEN (act Pausable.Pause)" will pause the pump when the water reserve in the tank goes above 100. You would need a counterpart rule that will resume the pump when the reserve drops below the lower threshold.
That being said, the values are exported as "signals". They are not written into the log, but the logs may have tracking info for the debugging purpose (if you enable the verbose logging). Keep in mind, that the signals name is globally unique. So, if you want two tanks to export their values, you would need different names, or else there will be a conflict that would introduce undetermined behavior in the conditions.
To summarize, you would need the following setup:
ON THE TANK WITH THE WATER GOOD SELECTED
ON THE PUMP (a medium tank - 300 water units reserve)
This will pause the pump when the reserve reaches 250, and resumes the pump when it drops below 100.
For the better readability, you can rename the signal to something more clear. Like "MainTank.water", or whatever.
a couple more questions: you mention a "rules editor dialog", do you simply mean the interface you get when you're editing in script mode rather than constructor? just want to make sure I'm not missing any tools the mod provides
also, yes I did read the scripting principles page, but for instance I didn't find the line "act Signals.Set 'Stockpile.yellow1'" to allow the script to output a global signal anywhere on that page, did I simply miss it? or have you made a list of possible commands to be used in the scripts?
The Wiki is always behind the trunk. So far I updated it with the very basic stuff only. Eventually, it will cover all supported actions and signals. For now, use Wiki to understand the main idea, and use the rules editor and template tools to learn what signals/actions exist.
If there was a delay function, I could use conditional script to check both the warehouse as well as the gristmill input properly.
Or, you can (and almost always should) add hysteresis to prevent the oscillation. E.g. stop gristmill at 0, but start at, say, 20. The value at which you start should exceed the input of the workshop.
In general, your case matches a pattern when the building must not pause, but temporarily suspend. Pausing causes the ingredients removal, and it's almost never is a good thing. I have a plan to introduce an action that would remove workers without stopping the building.
Loop though all beavers currently assigned to the building, if they're all idle then there's no work to be done. This check could be done every so often (not every frame) to help performance, once per second would still be very responsive, and also only run this check if the building is actually using the condition.
To be more user friendly, instead of "Resources available for gathering", I'd call it "All workers idle". You could even go a step further and add "At least X workers idle" too.
Admittedly, I do use the Configure Workplace with a Max Worker Multiplier of 4, so I can have 4 workers in single worker buildings, like the Gatherer, Forester and Lumberjack. So the requirement of still having a single worker in the building wouldn't hurt so much.
It would still be useful though (even with the default worker limits), because then you could go "If all workers are idle, then pause the workplace" "If Logs below a certain amount resume"... every time you use a log, it'd try to resume the workplace, if there's still no trees to be harvested it'd pause it again.
Based on the understanding that "(sig Inventory.OutputGood.<Item>)" should only be evaluated when inventory count changes, the signal"Need<Item>" should at most transition from 1 -> 0 -> 1 each time a consumer fills up.
However, this seems to trip your circular execution detector:
Which building you attach the rules to? What is its inventory?
Btw, number "100" in the script means value "1" (one). Division by one always gives the original value.
On v2.2.1. The error is reported when you have two storage containers and one reaches maximum capacity while the other still has spare capacity.
Two small water tanks. The goal is that the signal should be 1 if either has spare capacity and 0 if both are full. I'm trying to solve the multi-producer/multi-consumer problem without needing a signal for each producer/consumer.
I started doing this because I saw a script description showing the value in 100x. I can't recall when this happened and can't reproduce it. I'll be sure to report it if I see it again. Thanks.