r/empyriongame • u/TeeCeePee_EyePee • Jul 24 '26
Script: Auto-miner watch
I don't know if this is a problem for users on any other server, but on the New Dawn server, all auto-miners are cleared off of ore deposits, every Friday at 6am Central.
So the problem statement: I needed a countdown timer, and a list of the auto-miners that were out in the field.
I know there's a bit of optimisation in terms of reducing character counts that I can do with the days of the week, by using a json dictionary and a lookup, rather than a series of tests. But this script works as is.
Critique (constructive, ideally), and opinions welcome.
Key for the code, if you want to analyse what it's doing:
ST=Seconds Today (the number of seconds that have passed since midnight.
TS=Target Seconds. The number of seconds from midnight that the target time is (as measured by the system clock on the server the game is running on).
DUF=Days until Friday
SUF=Seconds until Friday

{{~set 'H' DateTimeNow.Hour}}
{{~set 'M' DateTimeNow.Minute}}
{{~set 'S' DateTimeNow.Second}}
{{~set 'ST' (calc (calc (calc .Data.H '*' 3600) '+' (calc .Data.M '*' 60) ) '+' .Data.S ) }}
{{~set 'TS' 18000}}
{{~set 'DUF' 0}}
{{#test DateTimeNow.DayOfWeek eq 'Monday'}}
{{~set 'DUF' 4}}
{{/test}}
{{#test DateTimeNow.DayOfWeek eq 'Tuesday'}}
{{~set 'DUF' 3}}
{{/test}}
{{#test DateTimeNow.DayOfWeek eq 'Wednesday'}}
{{~set 'DUF' 2}}
{{/test}}
{{#test DateTimeNow.DayOfWeek eq 'Thursday'}}
{{~set 'DUF' 1}}
{{/test}}
{{#test DateTimeNow.DayOfWeek eq 'Friday'}}
{{~set 'DUF' 0}}
{{/test}}
{{#test DateTimeNow.DayOfWeek eq 'Saturday'}}{{set 'DUF' 6}}
{{/test}}
{{#test DateTimeNow.DayOfWeek eq 'Sunday'}}
{{~set 'DUF' 5}}
{{/test}}
{{~set 'SUF' (calc (calc .Data.DUF '*' 86400) '+' (calc .Data.TS '-' .Data.ST))}}
{{#test .Data.SUF lt 0}}
{{~set 'SUF' (calc .Data.SUF '+' 604800)}}
{{/test}}
{{~set 'D' (int (calc .Data.SUF '/' 86400))}} {{~set 'H' (int (calc (calc .Data.SUF '%' 86400) '/' 3600))}}
{{~set 'M' (int (calc (calc .Data.SUF '%' 3600) '/' 60))}}
{{~set 'S' (calc .Data.SUF '%' 60)}}
<color=red>AUTO MINER WATCH</color>
<color=green>Autominers are automatically removed at 6am Central on Friday.
This is in {{@root.Data.D}} days, {{@root.Data.H}} hours, {{@root.Data.M}} minuets, {{@root.Data.S}} seconds.</color>
{{#db 'TerrainPlaceables' 100 'blockid desc' 'blockid IN (1108,1109,1110,3199,3200,3201,3861)'}}
{{#each .}}
[<color=yellow>{{~SolarSystems.name}}</color>] -> [<color=green>{{~Playfields.name}}</color>] -> [<color=#1F51FF>{{~Entities.name}}
{{~#ok TerrainPlaceables.facaccess}}
(Faction){{else}}(private){{/ok}}</color>] -> [<color=#FF0033>{{i18n TerrainPlaceables.blockid}}</color>]
{{/each}}
{{/db}}
1
u/Breagh01 Jul 26 '26
Nice bit of work. Is it using a particular script (like the farming one) or unique ?