Worker settings
Each worker screen reads and writes in one go, through a pair of functions: GetExpeditionsConfigs() returns every setting of the Expeditions page in a table, the script changes what it wants, and SetExpeditionsConfigs(cfg) saves it. This is Ninja's model, and for Expeditions its field names: a copied script that writes configs.Sheets[0].Origin runs. Six screens have their pair on this page: Expeditions, Sleep mode, night fleet save, Repatriation, Distribution, Rewards and booster.
c = GetExpeditionsConfigs()
c.MaxSlots = 6
c.Sheets[0].Duration = 4
err = SetExpeditionsConfigs(c)
if err != nil {
LogWarn("expedition settings refused: " + err.Error())
}
What a Set does
It only changes the fields it is given. SetExpeditionsConfigs({"MaxSlots": 6}) changes the cap and nothing else. A nested table merges the same way: a sheet, a day of the schedule, the Booster tab. A script that reads, waits, then hands back the whole object therefore erases nothing you changed on screen meanwhile: a field handed back as it was read is not written.
It takes the same path as the screen's Save button. The setting applies at once, survives a restart, and follows the same rules: tool exclusivity, normalisation, refusals. Nothing is written when nothing changes.
An unknown field is refused, with the list of known fields; so is a value out of bounds, never brought back silently. The error names the function and the field: SetExpeditionsConfigs: Sheets[0].Duration: 20 refused: the bot would bring it back to 15. One refused field, and nothing is written. The bounds are the screen's; those the bot applies on its own say "the bot would bring it back to".
The switch is not a field. A worker is turned on and off with StartWorker, StopWorker and their Ninja names (see Workers): writing Enabled is refused.
A celestial can be written four ways: the object (GetCachedPlanets()[0]), its ID (planet.GetID(), as in Ninja), its coordinate ("1:105:8", "M:1:105:8" for the moon) or "home" where the field can follow the home planet set under Settings > General. While the bot is connected, it must be a celestial of the account. A read returns the coordinate, or "home".
A worker's slot cap is its MaxSlots field, the worker's line under Settings > Fleet slots, from 0 (no cap) to 100. For the sends of your own scripts, use SetMaxSlotsFor, below.
Expeditions
| Function | Returns | |
|---|---|---|
GetExpeditionsConfigs() | 1: a table | Every setting of the Expeditions page, sheets included (Sheets). |
SetExpeditionsConfigs(cfg) | 1: an error | Saves the fields given. |
NewSheet() | 1: a table | A new sheet, to add to Sheets: configs.Sheets += *sheet. |
SetActiveExpeditionsSheet(name) | 1: an error | Picks the sheet in use, by name or UUID, and unticks the others. "" leaves none. |
| Field | Type and bounds | On screen |
|---|---|---|
Strategy | "majority", "all" or "never" | Strategy |
MajorityThreshold | integer, 0 and up; 0: half the slots | Departure threshold |
MajorityMaxWait | minutes, 0 to 1440 | Max wait |
DelayMin, DelayMax | seconds, 1 and up, the first not greater | Delay between two fleets of a wave |
WaveDelayMin, WaveDelayMax | seconds, 1 and up, the first not greater | Delay before relaunching after a return |
LargeCargoHome, SmallCargoHome, PathfindersHome | integer, 0 and up | Ships to keep |
RecycleDebris | true or false | Recycle the debris at position 16 |
MinimumPathfinders | integer, 1 and up | Minimum pathfinders per field |
RecyclePathfindersHome | integer, 0 and up | Pathfinders kept at home |
MaxSlots | integer, 0 to 100 | Settings > Fleet slots > Expeditions |
Sheets | list of sheets | The sheet tabs |
A sheet:
| Field | Type and bounds | On screen |
|---|---|---|
UUID | text, returned by the read | Names the sheet; missing or "": a new sheet |
Name | text | Name |
Active | true or false, one at a time | Sheet in use |
Multi | true or false | Single or multi planets |
Origin | celestial or "home" | Origin (single) |
SystemFrom, SystemTo | systems of the universe, the first not greater | System range (single) |
Origins | list of celestials, in sending order | Departure positions (multi) |
Range | integer, 0 to 499 | Range (multi) |
ExpeditionsPerOrigin | integer, 1 to 25 | Expeditions per position (multi) |
OwnCountPerOrigin | true or false | Own count (multi) |
CountPerOrigin | table {celestial: integer 1 to 25}; 0 or nil removes | The count of each position (multi) |
ExpeditionSpeed | integer, 1 to 10 | Expedition speed |
Duration | hours, 1 to 15 | Duration |
AutoFleet | true or false | Automatic fleet |
AutoCargo | LARGECARGO, SMALLCARGO or PATHFINDER | Ship that carries |
Growth | true or false | Growth |
AutoCargo2, AutoCargo3 | the same, or 0 for none | Second and third ship that carries |
AutoCombatMax | 0 (the best available) or a combat ship | Combat ship at most |
LightFighter, HeavyFighter, Cruiser, Battleship, Battlecruiser, Bomber, Destroyer, SmallCargo, LargeCargo, EspionageProbe, Reaper, Pathfinder | integer, 0 and up | Per expedition |
LightFighterAuto ... PathfinderAuto | true or false | Split |
Delete | true, write only | Delete the sheet |
Only one sheet is in use at a time, as on screen: ticking one unticks the others, and two ticked in the same call are refused. SetActiveExpeditionsSheet("Night") is the shortcut, to switch sheets by the hour.
A sheet missing from the list is not deleted: you delete by writing {"UUID": "...", "Delete": true}. A new sheet, without UUID, is added at the end and takes the name "Config N" when it gives none, like the screen's "+"; it is not in use until Active says so. Choosing an origin without a range sets five systems on either side, like the screen's menu.
Where it differs from Ninja. Strategy is a word, not a number; DelayMin and DelayMax are the gap between two fleets of a wave, WaveDelayMin and WaveDelayMax the wait after a return before relaunching; Origin reads as a coordinate, not an ID; the ...Auto fields are the "Split" box. What Kepler does not have is accepted at zero and refused otherwise: EarlyPathfinders, EarlyPFSecsMin, EarlyPFSecsMax, MinSpeedEarlyPathfinders, and in a sheet IgnoreMinimumDeuterium, SlotsAllowed, ColonyShip, Recycler, Deathstar and their ...Auto.
configs = GetExpeditionsConfigs()
celestial = GetCachedPlanets()[0]
sheet = NewSheet()
sheet.Name = "Night"
sheet.Origin = celestial.GetID()
sheet.Duration = 8
sheet.LargeCargo = 300
sheet.Pathfinder = 1
configs.Sheets += *sheet
err = SetExpeditionsConfigs(configs)
if err != nil {
LogWarn("sheet refused: " + err.Error())
}
CronExec("0 23 * * *", func() { SetActiveExpeditionsSheet("Night") })
Sleep mode
| Function | Returns | |
|---|---|---|
GetSleepModeConfigs() | 1: a table | The settings of the Sleep mode page: schedule, and what fleets do during sleep. |
SetSleepModeConfigs(cfg) | 1: an error | Saves the fields given. |
SetSleepSchedule(day, from, to, from2, to2) | 1: an error | The two ranges of a day, like a line of the schedule table; from2 and to2 are optional. |
| Field | Type and bounds | On screen |
|---|---|---|
Mode | "manual" or "auto" | Mode |
WakeHour, WakeMinute | 0 to 23, 0 to 59 | Wake up at (manual mode) |
Days | table of one day per name, "monday" to "sunday" | Schedule |
SleepJitter, WakeJitter | minutes: 0, 5, 10, 15, 20, 30, 45, 60, 90 or 120 | Random offset of bedtime, of waking |
BeforeSleep | "skip", "ignore" or "returnwindow" | Fleets that would return during sleep: do not send, send anyway, bring back within the return window |
AnticipateDelays | true or false | Anticipate expedition delays |
HandleNightReturns | true or false | Handle fleet returns during sleep |
StayAwakeIfMainFleetHome | true or false | Do not sleep if the main fleet stayed at home (Fleet save tab) |
Timezone | "machine", "game" or a time zone like "Europe/Paris" | Bot time zone |
A day:
| Field | Type and bounds | On screen |
|---|---|---|
From, To | time, "23:30" | First range |
From2, To2 | time, or "" for none; both together | Second range (optional) |
ReturnFrom, ReturnTo | time, or ""; both together | Fleet back between (sleep range 1), Fleet save tab |
ReturnFrom2, ReturnTo2 | time, or ""; both together | Fleet back between (sleep range 2) |
SetSleepSchedule sets the ranges, not the mode. The day is written in English ("monday"), by its rank from Now().Weekday() (0 for Sunday), or "everyday" for all seven days, like "Same every day": each day's return windows stay as they are. Without a second range, the day no longer has one. The schedule only applies in automatic mode: SetSleepModeConfigs({"Mode": "auto"}).
SetSleepSchedule("everyday", "23:30", "07:00")
SetSleepSchedule("saturday", "01:30", "10:00")
err = SetSleepModeConfigs({"Mode": "auto", "SleepJitter": 15, "BeforeSleep": "returnwindow"})
if err != nil {
LogWarn("sleep refused: " + err.Error())
}
Night fleet save
| Function | Returns | |
|---|---|---|
GetFleetSaveConfigs() | 1: a table | The settings of the night fleet save and its table of celestials. |
SetFleetSaveConfigs(cfg) | 1: an error | Saves the fields given. |
| Field | Type and bounds | On screen |
|---|---|---|
OnSleep | true or false | Send the fleet out at bedtime |
From, To | time, "08:00" | Fixed window, or return time |
From2, To2 | time, or "" for none; both together | Fleet back between (sleep range 2) |
AtWake | true or false | Return at wake-up |
WakeFrom, WakeTo | minutes after waking, 0 to 1440, the first smaller | Between ... and ... minutes after waking |
DeuteriumToLeave | integer, 0 and up; nil: never set, 10,000 | Deuterium to leave behind |
ProductionMinutesMin, ProductionMinutesMax | minutes, 0 to 1440, the first not greater | Minutes of production left on planets |
SplitDelayMin, SplitDelayMax | seconds, 1 to 600; 0 and 0: five to ten | Gap between two departures of a split |
MainFleetAlways | true or false | Fleet save the main fleet in any case |
Celestials | list of lines | Celestials tab |
A line of the celestials table:
| Field | Type and bounds | On screen |
|---|---|---|
Celestial | celestial | Names the line; a celestial without a line gets one |
Active | true or false, with a destination | Send out |
Destination | "park", "emptytomoon", "spy16", "spy16recall", "expedition", "expeditions", "colonize", "debris" or "" | Destination: park, empty the planet onto its moon, spy position 16, the same recalled in flight, expedition, expeditions (all slots), colonise, harvest a debris field |
Target | celestial, or nil: the bot chooses; with "park" | Targeted celestial |
Remainder | "park", "spy16", "spy16recall", "colonize", "debris" or ""; after an expedition | Rest of the fleet |
RemainderTarget | celestial, or nil; with Remainder "park" | Celestial targeted by the rest |
Expeditions | integer, 0 to 25 | Number of expeditions |
ExpeditionSheet | UUID of a sheet, or "" | Expedition sheet |
KeepShips | table {ship: count}; with "emptytomoon" | Kept at home |
Split | true or false | Split |
DeuteriumToLeave keeps its zero: 0 leaves zero behind, nil resets the box to "never set", which reads 10,000. A line of the table is named by its celestial, and lines the list does not name stay as they are. GetFleetSaveReturn and its two neighbours (see Workers) set the same return times.
f = GetFleetSaveConfigs()
for line in f.Celestials {
if line.Destination == "spy16" {
line.Destination = "spy16recall"
}
}
f.DeuteriumToLeave = 0
err = SetFleetSaveConfigs(f)
if err != nil {
LogWarn("night fleet save refused: " + err.Error())
}
Repatriation
| Function | Returns | |
|---|---|---|
GetRepatriateConfigs() | 1: a table | The settings of the Repatriation tab. |
SetRepatriateConfigs(cfg) | 1: an error | Saves the fields given. |
SetRepatriateDestinations(celestials) | 1: an error | The banks, several at once, without touching the celestials to empty. |
| Field | Type and bounds | On screen |
|---|---|---|
Mode | "direct", "moon" or "collect" | Mode: normal, moon, collection |
EveryHours | hours, 1 to 168 | Repatriate every |
SendDelayMin, SendDelayMax | seconds, 2 and up, the first not greater | Delay between two transports |
Destinations | list of celestials | Destinations (the banks) |
Origins | list of celestials | Planets and moons to repatriate |
Resources, Ships | true or false | What to repatriate: resources, ships |
KeepShipsPlanet, KeepShipsMoon | table {ship: count}; 0 removes | Ships to keep on the planet, on the moon |
LeavePlanet, LeaveMoon | table Metal, Crystal, Deuterium, 0 and up | Leave on the planet, on the moon |
Cargo | "LargeCargo", "SmallCargo" or "Pathfinder" | Cargo ship |
Cargo2, Cargo3 | the same, or "" for none | Second and third type |
RoundShips | 0, 10, 100, 1000 or 10000 | Round ships to |
MinResources | integer, 0 and up | Minimum resources to repatriate |
MaxSlots | integer, 0 to 100 | Settings > Fleet slots > Repatriation |
The screen's refusals, worker on: at least one bank, at least one celestial to empty, and resources, ships or both. A ship table merges ship by ship: {LARGECARGO: 100} only changes large cargoes, {LARGECARGO: 0} removes them.
SetRepatriateDestinations(["M:1:105:8", "M:4:220:9"])
err = SetRepatriateConfigs({"Mode": "moon", "KeepShipsPlanet": {LARGECARGO: 100}, "LeaveMoon": {"Deuterium": 2000000}})
if err != nil {
LogWarn("repatriation refused: " + err.Error())
}
Distribution
| Function | Returns | |
|---|---|---|
GetDistributionConfigs() | 1: a table | The settings of the Distribution tab. |
SetDistributionConfigs(cfg) | 1: an error | Saves the fields given. |
| Field | Type and bounds | On screen |
|---|---|---|
Banks | list of celestials | Banks that send |
Destinations | list of celestials | Destinations that receive |
Metal, Crystal, Deuterium | integer, 0 and up, per destination | Allocation |
FillUp | true or false | Fill each destination up to these amounts, instead of sending them |
MinSend | integer, 0 and up | Minimum send |
Cargo | "LargeCargo" or "SmallCargo" | Cargo ship |
ShipsToStation | integer, 0 and up | Ships to station per destination |
Auto | true or false | Fill up automatically |
BelowMetal, BelowCrystal, BelowDeuterium | integer, 0 and up, under its amount when Auto is ticked | Below |
CheckEveryMin, CheckEveryMax | minutes, 10 to 240, the first not greater | Check every |
MaxSlots | integer, 0 to 100 | The Repatriation cap, shared |
The slot cap is the Repatriation's, the same tab: writing it here changes it there.
err = SetDistributionConfigs({"Deuterium": 20000000, "FillUp": true, "Auto": true, "BelowDeuterium": 5000000})
if err != nil {
LogWarn("distribution refused: " + err.Error())
}
Rewards and booster
| Function | Returns | |
|---|---|---|
GetRewardsConfigs() | 1: a table | The settings of the Rewards and booster page, one table per tab. |
SetRewardsConfigs(cfg) | 1: an error | Saves the fields given. |
| Field | Type and bounds | On screen |
|---|---|---|
DailyMissions | true or false | Do the daily missions |
AllowDarkMatter | true or false | Dark matter allowed for missions |
MissionsCelestial | celestial, "home", or nil for all | Where the missions are done |
Messages | list of one-line texts, 20 at most, 100 characters each; empty: the default list | Messages of the "Send an in-game message" mission |
Booster | table, below | Booster tab |
Auction | table, below | Auctioneer tab |
OfferOfTheDay | table: Active, Origin, Resource | Import/export tab |
Asteroid | table, below | Farm event P17 tab |
Booster:
| Field | Type and bounds | On screen |
|---|---|---|
Active | true or false | Keep boosters active |
Buy | true or false | Buy the missing booster with dark matter |
Account | table {kind: tier}: "booster:expedition", "computer:expedition" | Account booster |
Stacks | table {kind: list of tiers}: "slots:expedition" (1, 2, 3), "slots:fleet" (2, 4, 6) | Expedition and fleet slots, stacked tiers |
AllPlanets | table {kind: tier}: "booster:metal", "booster:crystal", "booster:deuterium", "booster:energy", "booster:resources" | "All planets" line |
Planets | list of {"Planet": planet, "Choices": {kind: tier}}; nil sets a kind back to "Same as all" | One line per planet that is an exception |
Days | table {kind: 7, 30 or 90}, what the shop sells | Purchase duration |
A tier is the shop's (40 for +40%), 0 for none, -1 for "Best available" outside slots.
Auction:
| Field | Type and bounds | On screen |
|---|---|---|
Active | true or false, with an origin | Bid at the auctioneer |
Origin | celestial or "home" | Bid from |
Resource | "metal", "crystal" or "deuterium" | Pay in |
MaxBids | table {item: bid}; negative: item unticked, bid kept; 0 or nil removes | Maximum bid per item |
DelayMin, DelayMax | seconds, 1 and up, the first not greater | Delay before answering an outbid |
OnlyAtEnd | true or false | Bid only near the end |
MinutesBeforeEnd | minutes, 1 to 30 | Enter the sale |
LastSecond | true or false | Bid at the last second |
SpareIgnored | true or false | Never outbid a spared player |
The items of MaxBids are the screen's: "booster:metal:40", "booster:energy:80", "kraken:1d", "newtron:6h", "detroid:30m"...
Asteroid:
| Field | Type and bounds | On screen |
|---|---|---|
Active | true or false, with an origin | Attack the event asteroid |
Origin | celestial or "home" | Leave from |
Ship | a ship that flies, except colony ship and deathstar | Ship sent |
Slots | integer, 1 to 20 | Fleet slots assigned |
The two boxes that spend dark matter are written like the others: the bot never spends it on its own, a script may.
err = SetRewardsConfigs({
"Booster": {"Active": true, "Stacks": {"slots:fleet": [2, 4]}, "AllPlanets": {"booster:metal": -1}},
"Auction": {"MaxBids": {"kraken:1d": 9000}},
})
if err != nil {
LogWarn("booster refused: " + err.Error())
}
Slots for script sends
| Function | Returns | |
|---|---|---|
SetMaxSlotsFor(initiator, n) | 1: an error | Caps the flights in the air of an initiator, a name the script chooses: from 0 (no cap of its own) to 100. |
GetSlot(initiator) | 1: a channel | Waits for a free fleet slot for the initiator, the account's reserve counted; the channel delivers a function to call with the fleet sent. |
CreateFleet(fleet, initiator) | 1: an error | Registers a fleet already sent under an initiator: it counts toward its cap until it returns. |
As in Ninja, so that a script that sends on its own does not take all the account's slots. GetSlot waits while the initiator holds as many flights as its cap, or while the account has no free slot beyond the reserve (Settings > Fleet slots); the wait shows on that page, under the script's name. Give the delivered function the fleet sent, or its ID; an empty fleet, from a refused send, gives the slot back. A slot granted whose fleet is never given back is freed after five minutes.
An initiator is not a worker: a worker name is refused, its cap is the MaxSlots field of its settings. Caps live in memory, shared by the account's scripts, and are set again when the script starts.
SetMaxSlotsFor("raids", 3)
for target in ["2:40:6", "2:41:7", "2:43:4"] {
slot = <-GetSlot("raids")
f = NewFleet()
f.SetOrigin("M:1:105:8")
f.SetDestination(target)
f.SetMission(ATTACK)
f.AddShips(LARGECARGO, 200)
fleet, err = f.SendNow()
slot(fleet)
}