Kepler. Documentation · Scripts 508 functions available right now Français

Every function, in one list

Each function with its signature, what it returns and one call, then the constants. Nothing else: the why, the pitfalls and the cost in game requests are in the guide pages, which every heading links to. Your browser search finds any name here.

Output and storage

Print

Writes a line. Arguments are joined with a space.

Print(...)
// returns: nothing

Print("target", coord, "loot", loot)       // target [P:1:64:6] loot 75

print

The same, under its other name.

print(...)
// returns: nothing

Printf

Writes a formatted line, the way fmt.Printf does.

Printf(format, ...)
// returns: nothing

Printf("%d planets, %d moons", np, nm)

LogDebug

The detail that interests you alone, on a debugging day.

LogDebug(...)
// level: Info

LogDebugf

The detail that interests you alone, on a debugging day.

LogDebugf(format, ...)
// level: Info

LogInfo

The normal run: "campaign started", "twelve targets kept".

LogInfo(...)
// level: Info

LogInfo(m.SenderName, "writes:", m.Text)

LogInfof

The normal run: "campaign started", "twelve targets kept".

LogInfof(format, ...)
// level: Info

LogInfof("%d targets kept out of %d", kept, seen)

LogWarn

What deserves a look without being serious: a lost target, an unreadable page.

LogWarn(...)
// level: Warn

LogWarn("attack from", a.AttackerName, "on", a.DestinationName)

LogWarnf

What deserves a look without being serious: a lost target, an unreadable page.

LogWarnf(format, ...)
// level: Warn

LogError

What failed.

LogError(...)
// level: Error

if err != nil { LogError("reading failed:", err) }

LogErrorf

What failed.

LogErrorf(format, ...)
// level: Error

Put

Stores a value.

Put(key, value)
// returns: 1: an error

Put("last.system", 128)

Get

Reads it back. A missing key returns the empty string, without an error.

Get(key)
// returns: 2: the value and an error

sys, err = Get("last.system")         // ← TWO targets, see pitfall no. 1

Has

Says whether the key exists.

Has(key)
// returns: 1: a boolean

if Has("blacklist") {
    blacklist, err = Get("blacklist")
}

Delete

Erases.

Delete(key)
// returns: 1: a boolean

StorageKeys

Every key stored by this script.

StorageKeys()
// returns: 1: a list

for key in StorageKeys() {
    Print(key)
}

PutShared

Stores a value, readable by every bot.

PutShared(key, value)
// returns: 1: an error

PutShared("fs.target", "4:120:8")

GetShared

Reads it back. A missing key returns the empty string, without an error.

GetShared(key)
// returns: 2: the value and an error

target, err = GetShared("fs.target")    // ← TWO targets, like Get

HasShared

Says whether the key exists.

HasShared(key)
// returns: 1: a boolean

if HasShared("fs.done") {
    DeleteShared("fs.done")
}

DeleteShared

Erases.

DeleteShared(key)
// returns: 1: a boolean

DeleteShared("fs.done")

SharedKeys

Every shared key.

SharedKeys()
// returns: 1: a list

for key in SharedKeys() {
    Print(key)
}

SendDiscord

Posts to a Discord webhook.

SendDiscord(webhook, message)
// returns: 1: an error

err = SendDiscord("https://discord.com/api/webhooks/…", "debris at " + coord)

SendDiscordFile

Posts a text file as an attachment.

SendDiscordFile(webhook, name, content)
// returns: 1: an error

err = SendDiscordFile(DISCORD_WEBHOOK, "inactives.csv", rows)

SendTelegram

Writes into a Telegram conversation.

SendTelegram(chatID, message)
// returns: 1: an error

SendTelegram(0, "debris at " + coord)     // 0: the conversation from settings

Exit

Stops the script cleanly.

Exit()
// returns: nothing

Exit()

Terminate

The same.

Terminate()
// returns: nothing

IsPaused

Says whether the player has paused the script.

IsPaused()
// returns: 1: a boolean

if IsPaused() { SleepSec(30); continue }

Shuffle

Shuffles a list in place.

Shuffle(list)
// returns: nothing

Shuffle(targets)         // the order changes, the list stays the same

Bytes2Str

Converts bytes to text. Anko cannot write a []byte literal, hence this function.

Bytes2Str(bytes)
// returns: 1: a string

Notify

Writes to the account's journal, at Warn level.

Notify(title, message)
// returns: nothing

Time and waiting

Sleep

Sleep(n)
// unit: milliseconds

Sleep(500)

SleepMs

SleepMs(n)
// unit: milliseconds

SleepMs(Random(500, 1000))

SleepSec

SleepSec(n)
// unit: seconds

SleepSec(30)

SleepMin

SleepMin(n)
// unit: minutes

SleepMin(5)

SleepDur

SleepDur(d)
// unit: a duration

SleepDur(90 * time.Second)

SleepRandMs

SleepRandMs(min, max)
// unit: milliseconds

SleepRandMs(200, 800)    // ✓ you wait from 200 to 800 milliseconds

SleepRandSec

SleepRandSec(min, max)
// unit: seconds

SleepRandSec(20, 40)

SleepRandMin

SleepRandMin(min, max)
// unit: minutes

SleepRandMin(3, 8)

SleepRandHour

SleepRandHour(min, max)
// unit: hours

SleepRandHour(1, 3)

SleepUntil

SleepUntil(when)
// unit: until a given time

SleepUntil("03:30:00")           // the next time it is 3:30

Now

The present moment.

Now()
// returns: 1: a date

if end != nil && end.Sub(Now()).Minutes() < 10 {
    LogInfo("the account sleeps soon, not starting the campaign")
    return
}

GetTimestamp

The present moment in seconds since 1970.

GetTimestamp()
// returns: 1: an integer

NowTimeString

The current time, 15:04:05.

NowTimeString()
// returns: 1: a string

Clock

Clock()
// returns: 3: hour, minute, second

h, m, s = Clock()             // three targets, not one

Date

Date()
// returns: 3: year, month, day

y, mo, d = Date()

Weekday

The day of the week, Sunday being zero.

Weekday()
// returns: 1: an integer

if Weekday() == 0 { Print("Sunday") }

Unix

Rebuilds a date from a timestamp.

Unix(sec, nsec)
// returns: 1: a date

NowInTimeRange

Tells you whether the current time is in the range.

NowInTimeRange(start, end)
// returns: 1: a boolean

if NowInTimeRange("23:00:00", "07:00:00") {
    Print("it is night")            // the range crosses midnight, that is intended
}

DurationBetweenTimeStrings

The gap between two clock times.

DurationBetweenTimeStrings(a, b)
// returns: 1: a duration

MillisecondsBetweenTimeStrings

The same, in milliseconds.

MillisecondsBetweenTimeStrings(a, b)
// returns: 1: an integer

ShortDur

Writes a duration readably, 2h15m.

ShortDur(d)
// returns: 1: a string

Print(target, ShortDur(secs), "deut", fuel)

GetNextDatetimeAt

The next time it is that time of day.

GetNextDatetimeAt(h, m, s)
// returns: 2: the date and an error

when, err = GetNextDatetimeAt(3, 30, 0)    // returns TWO values

ParseNextDatetimeAt

The same, from "03:30:00".

ParseNextDatetimeAt(s)
// returns: 2: the date and an error

Scheduling

ExecIn

Calls f once, in ms milliseconds.

ExecIn(ms, f)
// returns: 1: a cancel function

cancel = ExecIn(60000, func() { Print("one minute later") })

ExecAt

Calls f once, at the stated time.

ExecAt(when, f)
// returns: 1: a cancel function

IntervalExec

Calls f every ms milliseconds, forever.

IntervalExec(ms, f)
// returns: 1: a cancel function

IntervalExec(600000, func() { Print("every ten minutes") })

CronExec

Calls f on a schedule.

CronExec(schedule, f)
// returns: 2: a number and an error

id, err = CronExec("@03h30", f)

RangeCronExec

Calls f once a day, at a time drawn at random inside the window.

RangeCronExec(start, end, label, f)
// returns: 2: a number and an error

id, err = RangeCronExec("03:00:00", "03:45:00", "night return", func() {
    Print("the fleet comes home")
})

RemoveCron

Removes a task placed by the two above.

RemoveCron(number)
// returns: 1: a boolean

if RemoveCron(id) {
    Print("unhooked")
} else {
    Print("that number no longer points at anything")
}

ExecInCh

Like ExecIn, but the channel closes after f.

ExecInCh(ms, f)
// returns: 1: a channel

<-ExecInCh(60000, func() { Print("one minute later") })

ExecAtCh

Like ExecAt, but the channel closes after f.

ExecAtCh(when, f)
// returns: 1: a channel

<-ExecAtCh(departure, func() {
    LogInfo("time to leave")
})

ExecInSync

Waits, then calls f, without handing back.

ExecInSync(ms, f)
// returns: 1: a cancel function

ExecAtSync

Waits for the stated time, then calls f.

ExecAtSync(when, f)
// returns: nothing

ExecAtSync("03:17:00", func() { BringTheFleetHome() })

WaitAttack

Waits for an attack. The boolean says whether one came.

WaitAttack(seconds)
// returns: 2: the attack and a boolean

a, seen = WaitAttack(0)

WaitAttackGone

Waits for an attack to leave the game's list, recalled or arrived.

WaitAttackGone(seconds)
// returns: 2: the attack and a boolean

WaitChatMessage

Waits for a player to write.

WaitChatMessage(seconds)
// returns: 2: the message and a boolean

m, seen = WaitChatMessage(0)

WaitFleet

Waits for a worker to send a fleet.

WaitFleet(seconds)
// returns: 2: the fleet and a boolean

f, seen = WaitFleet(0)

WaitHunterTargetActive

Waits for a target to come back to their screen.

WaitHunterTargetActive(seconds)
// returns: 2: the change and a boolean

e, seen = WaitHunterTargetActive(0)

WaitHunterTargetIdle

Waits for a target to leave it.

WaitHunterTargetIdle(seconds)
// returns: 2: the change and a boolean

e, seen = WaitHunterTargetIdle(0)

Celestials

GetUniverseName

The universe name.

GetUniverseName()
// returns: 1: a string

Printf("%s s%d-%s", GetUniverseName(), GetServerNumber(), GetLang())

GetServerNumber

The server number: s152-en gives 152.

GetServerNumber()
// returns: 1: an integer

Printf("%s s%d-%s", GetUniverseName(), GetServerNumber(), GetLang())

GetLang

The server language code, fr, en…

GetLang()
// returns: 1: a string

Printf("%s s%d-%s", GetUniverseName(), GetServerNumber(), GetLang())

IsLoggedIn

Says whether the session is open.

IsLoggedIn()
// returns: 1: a boolean

CharacterClass

The class: NO_CLASS, COLLECTOR, GENERAL or DISCOVERER.

CharacterClass()
// returns: 1: an integer

"Params": {"Plunder": report.PlunderRatio(CharacterClass()) * 100},

IsCollector

Shortcut on the class.

IsCollector()
// returns: 1: a boolean

if IsCollector() {
    Print("higher cargo capacity, faster transporters")
}

IsGeneral

The same.

IsGeneral()
// returns: 1: a boolean

IsDiscoverer

The same.

IsDiscoverer()
// returns: 1: a boolean

HasCommander

Is the officer hired.

HasCommander()
// returns: 1: a boolean

HasAdmiral

The same.

HasAdmiral()
// returns: 1: a boolean

if !HasAdmiral() {
    Print("fewer fleet slots than you think")
}

HasEngineer

The same.

HasEngineer()
// returns: 1: a boolean

HasGeologist

The same.

HasGeologist()
// returns: 1: a boolean

HasTechnocrat

The same.

HasTechnocrat()
// returns: 1: a boolean

IsVacationModeEnabled

Is the account in vacation mode.

IsVacationModeEnabled()
// returns: 1: a boolean

if IsVacationModeEnabled() {
    LogWarn("vacation mode: nothing will leave, this is not a script failure")
    return
}

IsPioneers

Does the account use the "pioneers" lobby.

IsPioneers()
// returns: 1: a boolean

SetVacationMode

Freezes the account. Forty-eight hours minimum.

SetVacationMode()
// returns: 1: an error

err = SetVacationMode()

GetPlanets

All your planets.

GetPlanets()
// returns: 1: a list

planets = GetPlanets()                // ONE target: the list

GetMoons

All your moons.

GetMoons()
// returns: 1: a list

GetPlanet

One given planet.

GetPlanet(what)
// returns: 2: the planet and an error

p, err = GetPlanet("1:2:3")           // TWO targets, the doc announces the error

GetMoon

One given moon.

GetMoon(what)
// returns: 2: the moon and an error

GetCelestial

One given planet or moon, either one.

GetCelestial(what)
// returns: 2: the celestial and an error

GetCelestials

All your planets and moons together.

GetCelestials()
// returns: 2: the list and an error

c, err = GetCelestials()   // ✓ c holds the list, err holds nil

GetCachedCelestial

The celestial as the bot already knows it.

GetCachedCelestial(what)
// returns: 1: a celestial

c = GetCachedCelestial("1:2:3")

GetCachedCelestials

All your planets and moons, as the bot already knows them.

GetCachedCelestials()
// returns: 1: a list

origin = GetCachedCelestials()[0]

GetCachedPlanets

Your planets, taken from the same cache.

GetCachedPlanets()
// returns: 1: a list

c = GetCachedPlanets()[0]

GetCachedMoons

Your moons, taken from the same cache.

GetCachedMoons()
// returns: 1: a list

origin = GetCachedMoons()[0]

GetSortedCelestials

Your celestials, from nearest to farthest.

GetSortedCelestials(destination)
// returns: 1: a list

GetSortedPlanets

Your planets alone.

GetSortedPlanets(destination)
// returns: 1: a list

base = GetSortedPlanets("4:212:9")[0]     // the nearest to the target

GetSortedMoons

Your moons alone.

GetSortedMoons(destination)
// returns: 1: a list

GetResources

Metal, crystal, deuterium, energy, dark matter, population, food.

GetResources(celestial)
// returns: 2: the resources and an error

r, err = GetResources("1:2:3")

GetResourcesDetails

The same, with storage capacity and production.

GetResourcesDetails(celestial)
// returns: 2: the detail and an error

d, err = GetResourcesDetails("1:2:3")

GetAllResources

The resources of every celestial at once.

GetAllResources()
// returns: 2: a table and an error

all, err = GetAllResources()

GetEmpire

Everything about one kind of celestial: resources, mines, facilities, defences, ships.

GetEmpire(type)
// returns: 2: a list and an error

empire, err = GetEmpire(PLANET_TYPE)

GetResourcesBuildings

The nine: mines, solar plant, fusion reactor, satellites, storages.

GetResourcesBuildings(celestial)
// returns: 2: the levels and an error

bld, err = GetResourcesBuildings("1:2:3")

GetFacilities

The eleven: factories, shipyard, lab, depot, silo, terraformer, dock, lunar base, phalanx, jump gate.

GetFacilities(celestial)
// returns: 2: the levels and an error

fac, err = GetFacilities(celestial)

GetShips

What is parked there, not what is flying.

GetShips(celestial)
// returns: 2: the ships and an error

ships, err = GetShips(planet)

GetDefense

Missiles included.

GetDefense(celestial)
// returns: 2: the defences and an error

GetTechs

The whole reading at once.

GetTechs(celestial)
// returns: 6: buildings, facilities, ships, defences, researches, an error

bld, fac, shp, def, rch, err = GetTechs("1:2:3")

GetTechs2

The entire reading of a celestial.

GetTechs2(celestial)
// returns: 8: the six above, plus the lifeform buildings and researches

bld, fac, shp, def, rch, lfBld, lfRch, err = GetTechs2("1:2:3")

GetResearch

They belong to the account, not to the celestial: no argument.

GetResearch()
// returns: 1: your researches

IsAvailable

Is this building, research, ship or defence available there, from its requirements? A calculation on the levels you pass, no request.

IsAvailable(id, celestial, buildings, lfBuildings, lfResearches, facilities, researches, energy)
// returns: 1: a boolean

GetProduction

Ships and defences at the shipyard.

GetProduction(celestial)
// returns: 3: the queue, the seconds left, an error

queue, left, err = GetProduction("1:2:3")

ConstructionsBeingBuilt

The building and the research under way.

ConstructionsBeingBuilt(celestial)
// returns: 4: building, seconds, research, seconds

bID, bSec, rID, rSec = ConstructionsBeingBuilt("1:2:3")

GetResourceSettings

The seven output sliders.

GetResourceSettings(planet)
// returns: 2: the settings and an error

settings, err = GetResourceSettings("1:2:3")

GetFields

GetFields(celestial)
// returns: 1: the fields, `Built` and `Total`

f = GetFields("1:2:3")

GetDiameter

The diameter, in kilometres.

GetDiameter(celestial)
// returns: 1: an integer

Print("radius:", GetDiameter("1:2:3") / 2)

Build

Building, technology, ship or defence.

Build(celestial, what, count)
// returns: 1: an error

err = Build(c.GetID(), LIGHTFIGHTER, 5)

BuildBuilding

Refuses anything that is not a building.

BuildBuilding(celestial, building)
// returns: 1: an error

BuildBuilding(c.GetID(), METALMINE)

BuildTechnology

Refuses anything that is not a technology.

BuildTechnology(celestial, technology)
// returns: 1: an error

BuildTechnology(c.GetID(), ENERGYTECHNOLOGY)

TearDown

Tears one level down.

TearDown(celestial, building)
// returns: 1: an error

TearDown(c.GetID(), SOLARPLANT)

CancelBuilding

Cancels the construction under way.

CancelBuilding(celestial)
// returns: 1: an error

CancelBuilding(c.GetID())

CancelResearch

Cancels the research under way.

CancelResearch(celestial)
// returns: 1: an error

CancelResearch(c.GetID())

GetLfBuildings

One request per call.

GetLfBuildings(celestial)
// returns: 2: the buildings and an error

b, err = GetLfBuildings(c.GetID())

GetLfResearch

One request per call.

GetLfResearch(celestial)
// returns: 2: the researches and an error

res, err = GetLfResearch(c.GetID())

GetLfBonuses

Reads the bonuses from the game.

GetLfBonuses()
// returns: 2: the bonuses and an error

fresh, err = GetLfBonuses()

GetCachedLfBonuses

What the bot already knows. No request.

GetCachedLfBonuses()
// returns: 2: the bonuses and an error

bonus, err = GetCachedLfBonuses()

GetPlanetLifeformType

One request. No error: see below.

GetPlanetLifeformType(planet)
// returns: 1: the lifeform

if GetPlanetLifeformType(p) != KAELESH {
    return                                    // this script only handles Kaelesh
}

CancelLfBuilding

Cancels the lifeform building under way.

CancelLfBuilding(celestial)
// returns: 1: an error

GetLfResearchDetails

Costs, durations and what is unlocked.

GetLfResearchDetails(celestial)
// returns: 2: the details and an error

GetChapter

Its tasks, and the state of each.

GetChapter(chapter)
// returns: 2: the chapter and an error

ChapterCollectReward

Collects the reward of one task.

ChapterCollectReward(task)
// returns: 1: an error

ChapterClaimAll

Collects everything collectable.

ChapterClaimAll(chapter)
// returns: 1: an error

err = ChapterClaimAll(4006)               // ← yours: the chapter id

SelectLfResearchSelect

Accepts the research on offer.

SelectLfResearchSelect(planet, slot)
// returns: 1: an error

SelectLfResearchRandom

Draws another one at random.

SelectLfResearchRandom(planet, slot)
// returns: 1: an error

SelectLfResearchArtifacts

Trades artifacts for it.

SelectLfResearchArtifacts(planet, slot, tech)
// returns: 1: an error

FreeResetTree

Wipes a whole tier. Free, but limited in number.

FreeResetTree(planet, tier)
// returns: 1: an error

err = FreeResetTree(p, 1)                     // tier 1, blank again

BuyResetTree

The same, paid in dark matter.

BuyResetTree(planet, tier)
// returns: 1: an error

NewResourceSettings

Composes the seven sliders.

NewResourceSettings(metal, crystal, deuterium, solar, fusion, satellite, crawler)
// returns: 1: settings

after = NewResourceSettings(before.MetalMine, before.CrystalMine, 100,
    before.SolarPlant, before.FusionReactor, before.SolarSatellite, before.Crawler)

SetResourceSettings

Applies them.

SetResourceSettings(planet, settings)
// returns: 1: an error

err = SetResourceSettings(c.GetID(), after)

TechnologyDetails

Price, duration and level, on that celestial.

TechnologyDetails(celestial, what)
// returns: 2: the details and an error

Fleets

GetFleets

Your fleets in the air, not the ones aimed at you.

GetFleets()
// returns: 2: the flights and the slots

fleets, slots = GetFleets()          // TWO targets

GetAttacks

The hostile fleets on their way to your account.

GetAttacks()
// returns: 1: a list

for a in GetAttacks() {
    Print(a.AttackerName, "arriving at", a.DestinationName, "in", a.ArriveIn, "s")
    if a.Ships == nil { Print("  composition unknown") }
}

IsUnderAttack

True if there is at least one.

IsUnderAttack()
// returns: 1: a boolean

Distance

The distance in the game's unit. No request.

Distance(origin, target)
// returns: 1: an integer

Print(Distance(origin, "1:2:4"))       // the celestial is enough, no need for .GetCoordinate()

FlightTime

At most one request per route, see above.

FlightTime(origin, target, speed, fleet, mission, [holdingTime])
// returns: 2: the seconds and the deuterium

secs, fuel = FlightTime(origin, target, HUNDRED_PERCENT, fleet, TRANSPORT)

FindDebrisFieldWithMinimumTravelTime

A debris field.

FindDebrisFieldWithMinimumTravelTime(origin, fleet, minimum)
// returns: 4

dest, secs, deut, err = FindDebrisFieldWithMinimumTravelTime(p.GetCoordinate(),
    fleet, 7 * time.Hour)

FindEmptyPlanetWithMinimumTravelTime

An empty slot.

FindEmptyPlanetWithMinimumTravelTime(origin, fleet, minimum)
// returns: 4

dest, secs, deut, err = FindEmptyPlanetWithMinimumTravelTime(c.GetCoordinate(),
        fleet, HOURS * 3600)

FindInactivePlanetWithMinimumTravelTime

An inactive player.

FindInactivePlanetWithMinimumTravelTime(origin, fleet, minimum, withMoon)
// returns: 4

FindAbandonedPlanetWithMinimumTravelTime

An abandoned colony.

FindAbandonedPlanetWithMinimumTravelTime(origin, fleet, minimum, withMoon)
// returns: 4

Speed

The speed of the slowest ship, the one that dictates the flight.

Speed(fleet)
// returns: 1: an integer

Print(Speed(f), Cargo(f))

Cargo

The total cargo capacity, all resources together.

Cargo(fleet)
// returns: 1: an integer

Print(Speed(f), Cargo(f))

ShipSpeed

Its speed.

ShipSpeed(id)
// returns: 1: an integer

ShipFuel

Its reference consumption, the one that enters the fuel calculation. Never less than 1.

ShipFuel(id)
// returns: 1: an integer

ShipCargo

Its hold.

ShipCargo(id)
// returns: 1: an integer

Print(ShipCargo(LARGECARGO))     // 25000 at base, more with hyperspace

CalcCargo

Two separate solutions, not the two halves of one fleet.

CalcCargo(total)
// returns: 2: large cargos, OR small ones

lc, sc = CalcCargo(res.Total())

CalcFastCargo

The composition your ships allow.

CalcFastCargo(lcAvail, scAvail, total)
// returns: 3: large ones, small ones, and the cargo obtained

lc, sc, capacity = CalcFastCargo(10, 8, res.Total())

AttackStrength

Firepower, plus 10% of the base value per weapons level.

AttackStrength(id, researches)
// returns: 1: an integer

Print(AttackStrength(LIGHTFIGHTER, nil))               // with your researches

ShieldPower

Shield, plus 10% per shielding level.

ShieldPower(id, researches)
// returns: 1: an integer

StructuralIntegrity

Structure, plus 10% per armour level.

StructuralIntegrity(id, researches)
// returns: 1: an integer

Simulator

Plays the battle several times and returns the averages: win rate, losses, debris, loot, trip. No request.

Simulator(payload)
// returns: 2: the result and an error

res, err = Simulator(payload)

GetPrice

n is a level for a building or a research, a number of units for a ship or a defence.

GetPrice(id, n)
// returns: 1: resources

p = GetPrice(METALMINE, 20)

ConstructionTime

Construction time, from the facilities supplied.

ConstructionTime(id, n, facilities)
// returns: 1: a duration

Print(ShortDur(ConstructionTime(LARGECARGO, 20, fac)))

TechnologyConstructionTime

Time for a research, with the lab level given plainly.

TechnologyConstructionTime(id, level, lab)
// returns: 1: a duration

Print(ShortDur(TechnologyConstructionTime(ESPIONAGETECHNOLOGY, 10, fac.ResearchLab)))

NewFleet

To be chained. nil with no session open.

NewFleet()
// returns: 1: a builder

f = NewFleet()

SendSpy

The galaxy's "espionage" button: leaves at once.

SendSpy(origin, target, probes)
// returns: 2: the probes sent, an error

sent, err = SendSpy("M:2:21:7", moon, 20)

Phalanx

Reads what flies around a position.

Phalanx(moon, target)
// returns: 2: the flights and an error

flights, err = Phalanx(moon.GetID(), "1:2:8")

CancelFleet

Turns a flight in progress around.

CancelFleet(fleet)
// returns: 1: an error

err = CancelFleet(flight.ID)

JumpGate

Jumps ships from one moon to another.

JumpGate(origin, destination, ships)
// returns: 1: an error

err = JumpGate(moon.GetID(), destinations[0], ships)

JumpGateDestinations

What can be reached, and in how long.

JumpGateDestinations(origin)
// returns: 3: the moons, the recharge, an error

destinations, recharge, err = JumpGateDestinations(moon.GetID())

JumpGate2

The same jump, with the delay as a number.

JumpGate2(origin, destination, ships)
// returns: 3: success, the recharge, an error

sent, recharge, err = JumpGate2(moon.GetID(), destinations[0], ships)

SendDiscoveryFleet

One expedition to ONE position.

SendDiscoveryFleet(origin, destination)
// returns: 1: an error

err = SendDiscoveryFleet("1:64:8", "1:64:12")

SendSystemDiscoveryFleet

The system's "Discovery" button, like the worker.

SendSystemDiscoveryFleet(origin, galaxy, system)
// returns: 2: the positions reached, an error

coords, err = SendSystemDiscoveryFleet(origin, 1, 64)

GetDepartureTime

When to leave to arrive at the stated time.

GetDepartureTime(arrival, origin, destination, ships, speed, mission)
// returns: 1: a time

departure = GetDepartureTime("08:00:00", "1:64:8", "1:64:12", ships, TEN_PERCENT, TRANSPORT)

LowestSpeed

The cheapest speed that can still leave.

LowestSpeed(arrival, origin, destination, ships)
// returns: 4: the speed, the fuel, the departure time, an error

speed, deut, departure, err = LowestSpeed("08:00:00", "1:64:8", "1:64:12", ships)

StartPhalanxSession

Sets up the watch on a position and turns it on.

StartPhalanxSession(moon, target, interval)
// returns: 2: an id and an error

id, err = StartPhalanxSession(moon.GetID(), "1:2:8", 300)   // every 5 min

StopPhalanxSession

Turns it off.

StopPhalanxSession(id)
// returns: 1: an error

StopPhalanxSession(id)

CalcPreferredCargo

Composes a transport serving the wanted type first.

CalcPreferredCargo(preferred, probes, pathfinders, large, small, total, roundUp)
// returns: 5: probes, pathfinders, large, small, the cargo

probes, pathfinders, lc, sc, cargo = CalcPreferredCargo(LARGECARGO, 0, 0, 50, 20, 5000000, true)

CreateUnion

Opens a joint attack around a fleet.

CreateUnion(fleet, players)
// returns: 2: the union number and an error

Workers

StartBrain

Brain. Build queues and research.

StartBrain()
// returns: 1: an error

StartBrain()

StopBrain

Brain. Build queues and research.

StopBrain()
// returns: 1: an error

StopBrain()

StartScanner

The scanner. System sweeps.

StartScanner()
// returns: 1: an error

StartScanner()

StopScanner

The scanner. System sweeps.

StopScanner()
// returns: 1: an error

StopScanner()

StartHunter

The hunter. Target tracking.

StartHunter()
// returns: 1: an error

StartHunter()

StopHunter

The hunter. Target tracking.

StopHunter()
// returns: 1: an error

StopHunter()

StartSleepMode

Sleep mode. See the warning below.

StartSleepMode()
// returns: 1: an error

StopSleepMode

Sleep mode. See the warning below.

StopSleepMode()
// returns: 1: an error

StartFarmingBot

Farming. StartFarmingBot() gives the farmer a session when it has none.

StartFarmingBot()
// returns: 1: an error

StartFarmingBot()

StopFarmingBot

Farming. StartFarmingBot() gives the farmer a session when it has none.

StopFarmingBot()
// returns: 1: an error

err = StopFarmingBot()

StartFarmSession

Starts one named session, like the ▶ on its row.

StartFarmSession(session)
// returns: 1: an error

StartFarmSession(session.ID)

StartExpeditionsBot

Expeditions.

StartExpeditionsBot()
// returns: 1: an error

StartExpeditionsBot()

StopExpeditionsBot

Expeditions.

StopExpeditionsBot()
// returns: 1: an error

StopExpeditionsBot()

StartColonizerBot

The colonizer.

StartColonizerBot()
// returns: 1: an error

StartColonizerBot()

StopColonizerBot

The colonizer.

StopColonizerBot()
// returns: 1: an error

StopColonizerBot()

StartDiscoveryBot

Discovery.

StartDiscoveryBot()
// returns: 1: an error

StartDiscoveryBot()

StopDiscoveryBot

Discovery.

StopDiscoveryBot()
// returns: 1: an error

StopDiscoveryBot()

StartDefenderBot

The defender.

StartDefenderBot()
// returns: 1: an error

StartDefenderBot()

StopDefenderBot

The defender.

StopDefenderBot()
// returns: 1: an error

StopDefenderBot()

RunWorkerNow

Runs a pass of the worker without waiting for it to wake up: the Brain's « Check now », the defense's « Check for attacks », the scanner's « Scan the universe now ».

RunWorkerNow(name)
// returns: 1: an error

err = RunWorkerNow("brain")

IsRunningBrainBot

True if Brain is running.

IsRunningBrainBot()
// returns: 1: a boolean

Print(IsRunningBrainBot(), IsRunningExpeditionsBot(), IsRunningColonizerBot())

IsRunningFarmingBot

True if farming is running.

IsRunningFarmingBot()
// returns: 1: a boolean

if IsRunningFarmingBot() {
  Print("farming is running")
}

IsRunningExpeditionsBot

IsRunningExpeditionsBot()
// returns: 1: a boolean

Print(IsRunningBrainBot(), IsRunningExpeditionsBot(), IsRunningColonizerBot())

IsRunningColonizerBot

IsRunningColonizerBot()
// returns: 1: a boolean

Print(IsRunningBrainBot(), IsRunningExpeditionsBot(), IsRunningColonizerBot())

IsRunningDiscoveryBot

IsRunningDiscoveryBot()
// returns: 1: a boolean

Print(IsRunningDiscoveryBot(), IsRunningDefenderBot())

IsRunningDefenderBot

IsRunningDefenderBot()
// returns: 1: a boolean

Print(IsRunningDiscoveryBot(), IsRunningDefenderBot())

StartWorker

Switches the named worker on.

StartWorker(name)
// returns: 1: an error

err = StartWorker("timer")

StopWorker

Switches it off.

StopWorker(name)
// returns: 1: an error

StopWorker("expeditions")

IsWorkerRunning

Says whether it is running right now. See above.

IsWorkerRunning(name)
// returns: 1: a boolean

Print(name, "running:", IsWorkerRunning(name), "on:", IsWorkerEnabled(name))

IsWorkerEnabled

Says whether its switch is on.

IsWorkerEnabled(name)
// returns: 1: a boolean

before = IsWorkerEnabled("expeditions")

ListWorkers

The names you can switch on here, in English.

ListWorkers()
// returns: 1: a list

for name in ListWorkers() {
  Print(name, "running:", IsWorkerRunning(name), "on:", IsWorkerEnabled(name))
}

PauseBot

Cuts all communication with the game.

PauseBot()
// returns: 1: an error

PauseBot()

ResumeBot

Gives it back.

ResumeBot()
// returns: 1: an error

ResumeBot()

IsBotPaused

Says where things stand.

IsBotPaused()
// returns: 1: a boolean

LogOut

Alias of PauseBot, for scripts coming from Ninja.

LogOut()
// returns: 1: an error

Logout

The same, with the spelling of Ninja's documentation.

Logout()
// returns: 1: an error

Login

Alias of ResumeBot.

Login()
// returns: 1: an error

NewFarmSession

To chain, then BuildFarmSession().

NewFarmSession()
// returns: 1: a builder

f = NewFarmSession()

GetSpySettings

Every setting below, in one go.

GetSpySettings()
// returns: 1: the settings

Print(GetSpySettings().PlayerList)

SetSpyTargets

"all", "planets" or "moons": the "Targets" menu.

SetSpyTargets(targets)
// returns: 1: an error

SetSpyTargets("planets")

SetSpyPlayers

"all", "active", "inactive", "hunter" or "list": the "Players" menu.

SetSpyPlayers(players)
// returns: 1: an error

SetSpyPlayers("list")

SetSpyPlayerList

The text box of the "List" choice: a list of player names, written as in the highscore.

SetSpyPlayerList(names)
// returns: 1: an error

err = SetSpyPlayerList(["Alpha", "Beta"])

SetSpyRoute

"systems" or "players": the "Route" menu, system by system or player by player.

SetSpyRoute(route)
// returns: 1: an error

SetSpyRoute("players")

SetSpyStrongPlayers

"Spy on stronger players too".

SetSpyStrongPlayers(yes)
// returns: 1: an error

SetSpyStrongPlayers(false)

SetSpySkipHomeworlds

"Skip home planets"; their moon is still spied on.

SetSpySkipHomeworlds(yes)
// returns: 1: an error

SetSpySkipHomeworlds(true)

SetSpyActivityStar

The "Active players only" box: the red star, under 16 min.

SetSpyActivityStar(yes)
// returns: 1: an error

SetSpyActivityStar(false)

SetSpyActivityTimer

The "Timer players only" box: 16 to 59 min.

SetSpyActivityTimer(yes)
// returns: 1: an error

SetSpyActivityTimer(true)

SetSpyActivityNone

The "Players with no activity" box: nothing shown, over an hour.

SetSpyActivityNone(yes)
// returns: 1: an error

err = SetSpyActivityNone(true)

SetSpyProbeDelay

Delay between two probes, in milliseconds.

SetSpyProbeDelay(min, max)
// returns: 1: an error

SetSpyProbeDelay(300, 450)

SetSpySystemDelay

Delay between two systems, in milliseconds.

SetSpySystemDelay(min, max)
// returns: 1: an error

SetSpySystemDelay(300, 500)

SetSpyPlayerDelay

Delay between two players, when the campaign goes player by player, in milliseconds.

SetSpyPlayerDelay(min, max)
// returns: 1: an error

SetSpyPlayerDelay(2000, 5000)

SetSpyMaxSlots

The Spyer's slot cap, from 0 (no cap) to 100.

SetSpyMaxSlots(n)
// returns: 1: an error

SetSpyMaxSlots(4)

SetSpyCheckInterval

Wait between two passes of the worker, in seconds.

SetSpyCheckInterval(min, max)
// returns: 1: an error

err = SetSpyCheckInterval(900, 1800)

NewSpySession

A new campaign, to chain and then BuildSpySession().

NewSpySession()
// returns: 1: a builder

s = NewSpySession()

EditSpySession

The "Edit" button: the saved campaign, to rework.

EditSpySession(campaign)
// returns: 1: a builder

e = EditSpySession(campaign.ID)

GetSpySessions

The table of campaigns.

GetSpySessions()
// returns: 1: a list

for c in GetSpySessions() {
    if c.Paused {
        ResumeSpySession()
    }
}

StartSpySession

"Start", or resuming the paused campaign.

StartSpySession(campaign)
// returns: 1: an error

err = StartSpySession(campaign.ID)

PauseSpySession

"Pause": the progress is kept.

PauseSpySession()
// returns: 1: an error

PauseSpySession()

ResumeSpySession

"Resume": the paused campaign carries on from the system it reached.

ResumeSpySession()
// returns: 1: an error

ResumeSpySession()

StopSpySession

"Stop": the progress is thrown away.

StopSpySession()
// returns: 1: an error

StopSpySession()

RemoveSpySession

"Delete"; the chosen campaign stops with it.

RemoveSpySession(campaign)
// returns: 1: an error

RemoveSpySession(campaign.ID)

GetExpeditionsStrategy

"majority", "all" or "never".

GetExpeditionsStrategy()
// returns: 1: a string

if GetExpeditionsStrategy() != "all" {
    err = SetExpeditionsStrategy("all")
    if err != nil { LogError("strategy:", err) }
}

SetExpeditionsStrategy

Changes it, setting saved.

SetExpeditionsStrategy(name)
// returns: 1: an error

err = SetExpeditionsStrategy("all")

GetFleetSlotsReserved

How many slots are kept free.

GetFleetSlotsReserved()
// returns: 1: an integer

kept = GetFleetSlotsReserved()

SetFleetSlotsReserved

Changes that number, setting saved.

SetFleetSlotsReserved(n)
// returns: 1: an error

IgnorePlayer

Spares a player. Name or id.

IgnorePlayer(player)
// returns: 1: an error

IgnorePlayer("Xylo")          // by name, as on screen

IgnorePlanet

Spares a position, moon included.

IgnorePlanet(coord)
// returns: 1: an error

IgnorePlanet("1:42:8")        // the planet AND its moon

IgnoreAlliance

Spares every known member of an alliance.

IgnoreAlliance(tag)
// returns: 1: an error

IgnoreAlliance("SLD")         // every member the Scanner has seen

UnignorePlayer

Removes it from the list.

UnignorePlayer(player)
// returns: 1: an error

UnignorePlanet

UnignorePlanet(coord)
// returns: 1: an error

UnignoreAlliance

UnignoreAlliance(tag)
// returns: 1: an error

IsPlayerIgnored

Whether it is on the list.

IsPlayerIgnored(player)
// returns: 1: a boolean

if IsPlayerIgnored("Xylo") {
    Print("left alone")
}

IsPlanetIgnored

IsPlanetIgnored(coord)
// returns: 1: a boolean

IsAllianceIgnored

IsAllianceIgnored(tag)
// returns: 1: a boolean

GetIgnored

The whole list, all three kinds together.

GetIgnored()
// returns: 2: the list and an error

list, err = GetIgnored()

GetFarmBlacklist

The whole list, players and positions together.

GetFarmBlacklist()
// returns: 2: the list and an error

entries, err = GetFarmBlacklist()

AddToFarmBlacklist

A player, by name or id, or a position.

AddToFarmBlacklist(target)
// returns: 1: an error

AddToFarmBlacklist("1:42:8")      // by hand: the planet AND its moon

RemoveFromFarmBlacklist

Removing what is not there is not an error; a name nothing knows is one.

RemoveFromFarmBlacklist(target)
// returns: 1: an error

RemoveFromFarmBlacklist(e.Key)   // give back only the automatic entries

ClearFarmBlacklist

Empties it, automatic entries included.

ClearFarmBlacklist()
// returns: 1: an error

ClearFarmBlacklist()

GetHunterTargets

The players under watch.

GetHunterTargets()
// returns: 2: the list and an error

targets, err = GetHunterTargets()

AddHunterTarget

Puts a player under watch.

AddHunterTarget(player)
// returns: 1: an error

AddHunterTarget("Xylo")          // by name, as on screen

RemoveHunterTarget

Removes them, history included.

RemoveHunterTarget(player)
// returns: 1: an error

PauseHunterTarget

Suspends them without losing their history.

PauseHunterTarget(player, paused)
// returns: 1: an error

GetHunterHistory

The player's activity readings, newest first.

GetHunterHistory(player, n)
// returns: 2: the series and an error

series, err = GetHunterHistory("Xylo", 200)

GetScripts

Every script on the account.

GetScripts()
// returns: 1: a list of names

GetRunningScripts

Those running right now.

GetRunningScripts()
// returns: 1: a list of names

IsScriptRunning

Is that one running.

IsScriptRunning(name)
// returns: 1: a boolean

if IsScriptRunning(WATCH) {
        LogInfo("the watch is already running")
        return
    }

IsPausedScript

Is that one paused.

IsPausedScript(name)
// returns: 1: a boolean

if IsPausedScript(WATCH) {
        ResumeScript(WATCH)
    }

StartScript

Starts it and returns at once. The table of parameters is optional.

StartScript(name, [params])
// returns: 1: an error

StartScript("night-watch")

ScriptParams

The parameters of the current run, empty when there are none.

ScriptParams()
// returns: 1: a table

p = ScriptParams()

StopScript

Stops it.

StopScript(name)
// returns: 1: an error

StopScript("night-watch")

PauseScript

Suspends it.

PauseScript(name)
// returns: 1: an error

ResumeScript

Resumes it where it was.

ResumeScript(name)
// returns: 1: an error

ResumeScript(WATCH)

IsScriptRunAtStart

Is its "run at startup" box ticked.

IsScriptRunAtStart(name)
// returns: 1: a boolean

SetScriptRunAtStart

Ticks it (true) or unticks it (false).

SetScriptRunAtStart(name, on)
// returns: 1: an error

IsScriptRemoteStart

Is its "remote start" box ticked.

IsScriptRemoteStart(name)
// returns: 1: a boolean

SetScriptRemoteStart

Ticks or unticks it.

SetScriptRemoteStart(name, on)
// returns: 1: an error

IsRemoteStartEnabled

Is remote start switched on in My account.

IsRemoteStartEnabled()
// returns: 1: a boolean

BotsCount

The number of bots in the installation, those beyond the licence included.

BotsCount()
// returns: 1: an integer

OwnBots

All of them, the script's own included, in the order of the home page.

OwnBots()
// returns: 1: a list of bots

AllBots

The same list: Kepler does not share bots between installations.

AllBots()
// returns: 1: a list of bots

GetBotByID

The bot with that number, nil when there is none.

GetBotByID(number)
// returns: 1: a bot, or `nil`

StartRemoteScript

Starts a script of that bot. The address and the key stay empty.

StartRemoteScript(address, number, key, script)
// returns: 1: an error

StopRemoteScript

Stops it.

StopRemoteScript(address, number, key, script)
// returns: 1: an error

ApplyAddonsToAllBots

"Apply this choice to all bots" of the browser add-ons: this bot's choice becomes everyone's.

ApplyAddonsToAllBots()
// returns: 1: an error

CopyNotificationsToAllBots

This bot's Notifications channels, webhooks and token included, set on all the others.

CopyNotificationsToAllBots()
// returns: 1: an error

SetFarmProbesEverywhere

The number of espionage probes of every farm campaign of every bot.

SetFarmProbesEverywhere(probes)
// returns: 1: an error

SetFarmProbesEverywhere(6)

CopyHunterTargets

This bot's Hunter list, copied to the bot with that number.

CopyHunterTargets(number)
// returns: 1: an error

err = CopyHunterTargets(2)

GetBotLanguage

The language of the interface and of the notifications, fr or en for instance. GetLang gives the game server's.

GetBotLanguage()
// returns: 1: a string

SetBotLanguage

Changes it for the whole installation.

SetBotLanguage(code)
// returns: 1: an error

GetStartBotsOnLaunch

Does Kepler start the active bots when it opens.

GetStartBotsOnLaunch()
// returns: 1: a boolean

SetStartBotsOnLaunch

Ticks or unticks it, without starting anything right away.

SetStartBotsOnLaunch(on)
// returns: 1: an error

GetSameEmailBotsDelay

The gap, in seconds, between the actions of two bots of the same e-mail address.

GetSameEmailBotsDelay()
// returns: 2: the low and the high

low, high = GetSameEmailBotsDelay()      // TWO targets

SetSameEmailBotsDelay

From 0 to 30 seconds, the high never below the low.

SetSameEmailBotsDelay(low, high)
// returns: 1: an error

err = SetSameEmailBotsDelay(3, 8)

GetManualModeTimeout

The minutes after which the bot takes the built-in browser back.

GetManualModeTimeout()
// returns: 1: an integer

SetManualModeTimeout

From 1 to 120 minutes. A session in progress keeps the delay it started with.

SetManualModeTimeout(minutes)
// returns: 1: an error

IsFarmSessionOngoing

Is a campaign working right now.

IsFarmSessionOngoing()
// returns: 1: a boolean

if IsFarmSessionOngoing() {
    PauseFarmingBot()          // giving the slots back to the Defender
    SleepMin(30)
    ResumeFarmingBot()         // and back to where we left off
}

IsPausedFarmingBot

Is a campaign paused.

IsPausedFarmingBot()
// returns: 1: a boolean

FarmingBotSessionsCount

How many campaigns are running.

FarmingBotSessionsCount()
// returns: 1: an integer

GetFarmSessions

The saved campaigns, those from the screen included, with their state and settings.

GetFarmSessions()
// returns: 1: a list

for s in GetFarmSessions() {
    if s.Name == "night" && s.State == "idle" {
        StartFarmSession(s.ID)
    }
}

PauseFarmingBot

Suspends the running campaign.

PauseFarmingBot()
// returns: 1: an error

PauseFarmingBot()          // giving the slots back to the Defender

ResumeFarmingBot

Resumes it where it stopped.

ResumeFarmingBot()
// returns: 1: an error

ResumeFarmingBot()         // and back to where we left off

AbortAllFarmingSessions

Stops everything and removes every campaign, the running one and those from the Farmer tab included.

AbortAllFarmingSessions()
// returns: 1: an error

AbortAllFarmingSessions()   // in the evening: nothing runs, nothing from yesterday

StopFarmSession

The ■: stops that campaign, "" for the running one; the next one in the queue takes over.

StopFarmSession(campaign)
// returns: 1: an error

err = StopFarmSession("")   // the running one stops, "night" leaves

QueueFarmSession

The +: puts it behind the ones waiting their turn.

QueueFarmSession(campaign)
// returns: 1: an error

err = QueueFarmSession(night.ID)

EditFarmSession

The ✎: the saved campaign, to edit then BuildFarmSession().

EditFarmSession(campaign)
// returns: 1: a builder

e = EditFarmSession(s.ID)

DeleteFarmSession

The ✕: removes it from the list.

DeleteFarmSession(campaign)
// returns: 1: an error

GetFarmMaxSlots

The farmer's slot cap, 0 for MAX.

GetFarmMaxSlots()
// returns: 1: an integer

SetFarmMaxSlots

Changes it, from 0 (MAX, no cap) to 100.

SetFarmMaxSlots(n)
// returns: 1: an error

SetFarmMaxSlots(8)

StopAllFarmSessions

The "⏹ Stop everything": stops every campaign and empties the queue; they stay in the list.

StopAllFarmSessions()
// returns: 1: an error

RepatriateNow

Runs a repatriation pass without waiting.

RepatriateNow()
// returns: 1: an error

RepatriateNow()

RepatriateSetAllDestinations

That celestial receives, all the others feed it.

RepatriateSetAllDestinations(celestial)
// returns: 1: an error

RepatriateSetAllDestinations("1:64:8")

ClearAllConstructionQueues

Empties the queue of every celestial in Queue mode.

ClearAllConstructionQueues()
// returns: 1: an error

ClearAllConstructionQueues()

AddItemToQueue

Adds a line at the end of a celestial's queue.

AddItemToQueue(celestial, what, number)
// returns: 1: an error

err = AddItemToQueue(c.GetID(), METALMINE, 0)

GetSupplyFinishDeliveries

Whether « Finish deliveries in flight before the Planning switches Brain off » is ticked.

GetSupplyFinishDeliveries()
// returns: 1: a boolean

if !GetSupplyFinishDeliveries() {
    err = SetSupplyFinishDeliveries(true)
    if err != nil {
        LogWarn("supply box refused: " + err.Error())
    }
}

SetSupplyFinishDeliveries

Ticks or unticks it, like on the Brain page, Supply panel.

SetSupplyFinishDeliveries(on)
// returns: 1: an error

err = SetSupplyFinishDeliveries(true)

IsStarted

Is the bot running for this account.

IsStarted()
// returns: 1: a boolean

IsActive

Will it start it again next launch.

IsActive()
// returns: 1: a boolean

GetNextSleepTime

The next time it goes to sleep.

GetNextSleepTime()
// returns: 1: a time, or `nil`

end = GetNextSleepTime()

GetNextWakeTime

The next time it wakes.

GetNextWakeTime()
// returns: 1: a time, or `nil`

SetDefenderCheckInterval

The round's interval, in seconds.

SetDefenderCheckInterval(min, max)
// returns: 1: an error

SetDefenderCheckOrigin

Where the round looks from: 1 a random celestial, 2 the home planet, 3 the last celestial visited, 4 a random moon.

SetDefenderCheckOrigin(n)
// returns: 1: an error

TriggerFleetSave

Sends the fleet out now, using the sleep-mode settings.

TriggerFleetSave()
// returns: 1: an error

err = TriggerFleetSave()

GetFleetSaveReturn

The night fleet save's return time: AtWake, WakeFrom, WakeTo, From, To, From2, To2.

GetFleetSaveReturn()
// returns: 1: a structure

r = GetFleetSaveReturn()

SetFleetSaveReturnAtWake

Ticks or unticks « Return at wake-up » and sets its minutes after waking up.

SetFleetSaveReturnAtWake(on, from, to)
// returns: 1: an error

err = SetFleetSaveReturnAtWake(true, 2, 10)

SetFleetSaveReturnWindow

The clock window of a sleep window, 1 or 2: "08:00", "08:30".

SetFleetSaveReturnWindow(window, from, to)
// returns: 1: an error

GetColonizerSettings

Every setting of the Colonizer page: Origin, OriginIsHome, Galaxy, SystemFrom, SystemTo, Positions, MinFieldsOn, MinFields, MinTempOn, MinTemp, MaxTempOn, MaxTemp, SystemDelayMin, SystemDelayMax, ArrivalGapMin, ArrivalGapMax, MaxSlots.

GetColonizerSettings()
// returns: 1: a structure

s = GetColonizerSettings()

SetColonizerOrigin

The planet the colony ships leave from, or "home" to follow the home planet.

SetColonizerOrigin(celestial)
// returns: 1: an error

SetColonizerOrigin("home")

SetColonizerRange

The galaxy and the range of systems to search.

SetColonizerRange(galaxy, from, to)
// returns: 1: an error

SetColonizerPositions

The positions to colonize in each system: [4, 5, 6].

SetColonizerPositions(positions)
// returns: 1: an error

SetColonizerPositions([4, 5, 6, 10, 11, 12])

SetColonizerMinFields

The « Minimum fields » box and its number.

SetColonizerMinFields(on, fields)
// returns: 1: an error

SetColonizerMinTemperature

The « Minimum temperature » box and its value.

SetColonizerMinTemperature(on, t)
// returns: 1: an error

SetColonizerMaxTemperature

The « Maximum temperature » box and its value.

SetColonizerMaxTemperature(on, t)
// returns: 1: an error

SetColonizerSystemDelay

Delay between two systems, in milliseconds.

SetColonizerSystemDelay(min, max)
// returns: 1: an error

SetColonizerArrivalGap

Delay between two arrivals, in seconds.

SetColonizerArrivalGap(min, max)
// returns: 1: an error

err = SetColonizerArrivalGap(60, 90)

SetColonizerMaxSlots

The Colonizer's slot cap, from 0 (no cap) to 100.

SetColonizerMaxSlots(n)
// returns: 1: an error

GetDefenderConfigs

The settings of the Defence page. With a celestial, its « Evacuation per planet » line.

GetDefenderConfigs(celestial)
// returns: 1: a table

SetDefenderConfigs

Sets the given fields. Without a celestial, those of the page: SetDefenderConfigs(table).

SetDefenderConfigs(celestial, table)
// returns: 1: an error

GetColonizerConfigs

The Colonizer page.

GetColonizerConfigs()
// returns: 1: a table

SetColonizerConfigs

Sets the given fields.

SetColonizerConfigs(table)
// returns: 1: an error

GetDiscoveryConfigs

The Discovery page.

GetDiscoveryConfigs()
// returns: 1: a table

SetDiscoveryConfigs

Sets the given fields.

SetDiscoveryConfigs(table)
// returns: 1: an error

GetBrainConfigs

The general settings of the Brain page. With a celestial, its card: mode, queue, targets, boxes.

GetBrainConfigs(celestial)
// returns: 1: a table

for l in GetBrainConfigs(p).Queue {
    Print(l.ID, l.Level, l.Mode, l.Done)
}

SetBrainConfigs

Sets the given fields. Without a celestial, those at the top of the page: SetBrainConfigs(table).

SetBrainConfigs(celestial, table)
// returns: 1: an error

err = SetBrainConfigs(p, {"Mode": "queue", "Queue": [
    {"ID": METALMINE, "Level": 20},
    {"ID": ROCKETLAUNCHER, "Level": 200, "Mode": "reach"},
]})

GetSupplyConfigs

The Supply panel of the Brain page.

GetSupplyConfigs()
// returns: 1: a table

SetSupplyConfigs

Sets the given fields.

SetSupplyConfigs(table)
// returns: 1: an error

GetSupplyBanks

The Supply banks, like GetSupplyConfigs().Banks.

GetSupplyBanks()
// returns: 1: a list

SetSupplyBanks

Replaces them, like SetSupplyConfigs({"Banks": celestials}).

SetSupplyBanks(celestials)
// returns: 1: an error

GetScannerConfigs

The Scanner page.

GetScannerConfigs()
// returns: 1: a table

SetScannerConfigs

Sets the given fields.

SetScannerConfigs(table)
// returns: 1: an error

GetTimerConfigs

The Timer watch page.

GetTimerConfigs()
// returns: 1: a table

SetTimerConfigs

Sets the given fields.

SetTimerConfigs(table)
// returns: 1: an error

GetColonyWatchConfigs

The New colony detection page.

GetColonyWatchConfigs()
// returns: 1: a table

SetColonyWatchConfigs

Sets the given fields.

SetColonyWatchConfigs(table)
// returns: 1: an error

GetMilitaryDebrisConfigs

The DF detection page.

GetMilitaryDebrisConfigs()
// returns: 1: a table

SetMilitaryDebrisConfigs

Sets the given fields.

SetMilitaryDebrisConfigs(table)
// returns: 1: an error

GetHunterConfigs

The Hunter settings: rate and « Espionage on demand ».

GetHunterConfigs()
// returns: 1: a table

cfg = GetHunterConfigs()

SetHunterConfigs

Sets the given fields.

SetHunterConfigs(table)
// returns: 1: an error

err = SetHunterConfigs(cfg)

GetFarmingBotConfigs

The "Farmer pace" panel of the Farmer tab, and its slot cap.

GetFarmingBotConfigs()
// returns: 1: a table

SetFarmingBotConfigs

Sets the given fields.

SetFarmingBotConfigs(table)
// returns: 1: an error

GetTimerTargets

The watched players, like GetTimerConfigs().Players.

GetTimerTargets()
// returns: 1: a list

AddTimerTarget

Adds a player, by name or by id.

AddTimerTarget(player)
// returns: 1: an error

AddTimerTarget("Kcwin")

RemoveTimerTarget

Removes them from the list.

RemoveTimerTarget(player)
// returns: 1: an error

GetRewardsMessages

The texts the bot draws at random for the Rewards mission « Send an in-game message ».

GetRewardsMessages()
// returns: 1: a list

Print(GetRewardsMessages())

SetRewardsMessages

Replaces the list, one message per element: ["sry for event", "event"]. An empty list brings back the default one.

SetRewardsMessages(messages)
// returns: 1: an error

err = SetRewardsMessages(["sry for event", "event", "rewards"])

Worker settings

GetExpeditionsConfigs

Every setting of the Expeditions page, sheets included (Sheets).

GetExpeditionsConfigs()
// returns: 1: a table

configs = GetExpeditionsConfigs()

SetExpeditionsConfigs

Saves the fields given.

SetExpeditionsConfigs(cfg)
// returns: 1: an error

err = SetExpeditionsConfigs(configs)

NewSheet

A new sheet, to add to Sheets: configs.Sheets += *sheet.

NewSheet()
// returns: 1: a table

sheet = NewSheet()

SetActiveExpeditionsSheet

Picks the sheet in use, by name or UUID, and unticks the others. "" leaves none.

SetActiveExpeditionsSheet(name)
// returns: 1: an error

CronExec("0 23 * * *", func() { SetActiveExpeditionsSheet("Night") })

GetSleepModeConfigs

The settings of the Sleep mode page: schedule, and what fleets do during sleep.

GetSleepModeConfigs()
// returns: 1: a table

SetSleepModeConfigs

Saves the fields given.

SetSleepModeConfigs(cfg)
// returns: 1: an error

err = SetSleepModeConfigs({"Mode": "auto", "SleepJitter": 15, "BeforeSleep": "returnwindow"})

SetSleepSchedule

The two ranges of a day, like a line of the schedule table; from2 and to2 are optional.

SetSleepSchedule(day, from, to, from2, to2)
// returns: 1: an error

SetSleepSchedule("everyday", "23:30", "07:00")

GetFleetSaveConfigs

The settings of the night fleet save and its table of celestials.

GetFleetSaveConfigs()
// returns: 1: a table

f = GetFleetSaveConfigs()

SetFleetSaveConfigs

Saves the fields given.

SetFleetSaveConfigs(cfg)
// returns: 1: an error

err = SetFleetSaveConfigs(f)

GetRepatriateConfigs

The settings of the Repatriation tab.

GetRepatriateConfigs()
// returns: 1: a table

SetRepatriateConfigs

Saves the fields given.

SetRepatriateConfigs(cfg)
// returns: 1: an error

err = SetRepatriateConfigs({"Mode": "moon", "KeepShipsPlanet": {LARGECARGO: 100}, "LeaveMoon": {"Deuterium": 2000000}})

SetRepatriateDestinations

The banks, several at once, without touching the celestials to empty.

SetRepatriateDestinations(celestials)
// returns: 1: an error

SetRepatriateDestinations(["M:1:105:8", "M:4:220:9"])

GetDistributionConfigs

The settings of the Distribution tab.

GetDistributionConfigs()
// returns: 1: a table

SetDistributionConfigs

Saves the fields given.

SetDistributionConfigs(cfg)
// returns: 1: an error

err = SetDistributionConfigs({"Deuterium": 20000000, "FillUp": true, "Auto": true, "BelowDeuterium": 5000000})

GetRewardsConfigs

The settings of the Rewards and booster page, one table per tab.

GetRewardsConfigs()
// returns: 1: a table

SetRewardsConfigs

Saves the fields given.

SetRewardsConfigs(cfg)
// returns: 1: an error

err = SetRewardsConfigs({
    "Booster": {"Active": true, "Stacks": {"slots:fleet": [2, 4]}, "AllPlanets": {"booster:metal": -1}},
    "Auction": {"MaxBids": {"kraken:1d": 9000}},
})

SetMaxSlotsFor

Caps the flights in the air of an initiator, a name the script chooses: from 0 (no cap of its own) to 100.

SetMaxSlotsFor(initiator, n)
// returns: 1: an error

SetMaxSlotsFor("raids", 3)

GetSlot

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.

GetSlot(initiator)
// returns: 1: a channel

slot = <-GetSlot("raids")

CreateFleet

Registers a fleet already sent under an initiator: it counts toward its cap until it returns.

CreateFleet(fleet, initiator)
// returns: 1: an error

Orion

StartOrion

The "Orion active" box, saved. StartWorker("orion") and StopWorker("orion") do the same. StartOrion returns an error on a universe without Orion, and saves nothing.

StartOrion()
// returns: 1: an error

StopOrion

The "Orion active" box, saved. StartWorker("orion") and StopWorker("orion") do the same. StartOrion returns an error on a universe without Orion, and saves nothing.

StopOrion()
// returns: 1: an error

GetOrion

The module's last report, with no request.

GetOrion()
// returns: 1: a structure

o = GetOrion()

RefreshOrion

Reads the game right now, like the "Refresh" button: four requests, worker off included, no gesture. When the session has not seen Orion (scanner at zero), one more Facilities page, which reopens the gestures if the universe has it. When refused, it returns the previous report with the error. If a module pass is running, it reads nothing and says so in its error: the report returned then predates that pass.

RefreshOrion()
// returns: 2: the structure and an error

GetOrionSettings

All the settings as the module applies them: Enabled, IntervalMinutes, AutoClaim, Conversions (Planet, Resource, Load), Deliveries, ScanLevel, ScanRange, Transporter, MissionPlanet.

GetOrionSettings()
// returns: 1: a structure

SetOrionInterval

The gap between two readings, from 10 to 180 minutes.

SetOrionInterval(minutes)
// returns: 1: an error

SetOrionAutoClaim

The "Claim the rewards of finished missions" box.

SetOrionAutoClaim(on)
// returns: 1: an error

SetOrionConversion

The conversion to hold on a planet. Resource: "metal", "crystal", "deuterium" or "food". Load: from 10 to 100, in steps of 10.

SetOrionConversion(planet, resource, load)
// returns: 1: an error

ClearOrionConversion

"Leave it to the game": the module no longer holds this planet. Its running conversion carries on.

ClearOrionConversion(planet)
// returns: 1: an error

SetOrionDeliveries

The "Run anomaly deliveries" box.

SetOrionDeliveries(on)
// returns: 1: an error

SetOrionScanLevel

The level of the module's scans, 1 or more. Beyond what the scanners allow, the module scans at the highest allowed.

SetOrionScanLevel(level)
// returns: 1: an error

SetOrionScanRange

The range of the module's scans: 10, 50 or 150 systems.

SetOrionScanRange(range)
// returns: 1: an error

SetOrionTransporter

The ships of the deliveries: "auto" (large first, small to complete), "small" or "large".

SetOrionTransporter(kind)
// returns: 1: an error

SetOrionMissionPlanet

The planet the module aims at: its report, its gestures and those of this page. 0 to let it take the one with the highest scanner, which it also does when this one has none.

SetOrionMissionPlanet(planet)
// returns: 1: an error

OrionScanCost

The cost of a scan: Cost, Lithium, LithiumPerHour, NextStopSeconds. Nothing is spent.

OrionScanCost(level, range)
// returns: 2: a structure and an error

OrionScan

Runs a scan and returns Cards, like the cards of the report. It spends lithium and replaces the cards of the previous scan. When refused for lack of room, FreeInRange says how many are left, and force at true accepts a scan reduced to those.

OrionScan(level, range, [force])
// returns: 2: a structure and an error

OrionInvestigate

Takes the mission of a card, or of its Mission. Returns MissionsWithoutFleet and Discoveries. Its clock starts at that moment, and sending a fleet there is up to you.

OrionInvestigate(card)
// returns: 2: a structure and an error

p, err = OrionInvestigate(c)

OrionClaim

Claims the rewards of a finished mission, or of its Object, with the gestures of the "Claim" button: the cost and the stock read again from the game, then the report after the claim, about eight requests. Under the cost, on an unreadable cost, or on a mission that is Lost, already claimed or still running, it returns its refusal and nothing leaves. Never dark matter. If a module pass is running, it says so too: try again a moment later.

OrionClaim(mission)
// returns: 1: an error

OrionStartConversion

Starts or replaces the conversion of a planet, once. To have it held, use SetOrionConversion.

OrionStartConversion(planet, resource, load)
// returns: 1: an error

OrionStopConversion

Stops the conversion of a planet. If the module holds it, it restarts at its next pass: remove it first with ClearOrionConversion.

OrionStopConversion(planet)
// returns: 1: an error

GetOrionFleetSettings

The settings below: MaxSlots, CleanMessages, DeliveryCelestials. No request.

GetOrionFleetSettings()
// returns: 1: a structure

SetOrionMaxSlots

The "Orion" line of Settings > Fleet slots: the number of anomaly flights, returns included, from 0 (no cap, the default) to 100. Outside these bounds, refused. The reserve and the slots kept for expeditions and the main fleet come first.

SetOrionMaxSlots(n)
// returns: 1: an error

SetOrionDeliveryCelestials

The celestials a delivery can leave from: ["[P:4:273:12]"]. An empty list: all of them, the default. The transporters of the next expeditions stay docked either way.

SetOrionDeliveryCelestials(list)
// returns: 1: an error

SetOrionCleanMessages

The "Delete Fleet Command messages of finished missions" box, unticked by default.

SetOrionCleanMessages(yes)
// returns: 1: an error

WaitOrionAlert

Waits for an alert of the module, zero to wait forever. The boolean says whether it came.

WaitOrionAlert(seconds)
// returns: 2: the alert and a boolean

a, seen = WaitOrionAlert(600)

OrionControlCenter

Reads the Control Centre tab of a planet that has a scanner: one request, no token used.

OrionControlCenter(celestial)
// returns: 2: a list and an error

OrionSlotPrices

The price of the next slot of each kind, read from this planet's scanner tab: AnomalyDiscovery and ScanResult, each with Metal, Crystal, Deuterium, Maxed (the game sells no more) and Unreadable.

OrionSlotPrices(celestial)
// returns: 2: a structure and an error

OrionBuySlot

Buys a slot, paid by this planet: "anomalyDiscovery" (one more anomaly investigated at a time) or "scanResult" (one more result per scan).

OrionBuySlot(kind, celestial)
// returns: 1: an error

OrionProfitableScannerLevel

The highest scanner level whose credited lithium is worth more than converting the same price, on this universe: 16 at speed 8, 17 at speed 10. No request.

OrionProfitableScannerLevel()
// returns: 1: an integer

OrionEqualizeScanners

Spreads a sum of levels across scanners at the lowest cost, lowest first: [5, 1, 3] towards a sum of 12 returns [5, 4, 3]. A calculation, no request, ignoring the planets' fields.

OrionEqualizeScanners(levels, sum)
// returns: 2: a list and an error

Orion: value

GetOrionValueSettings

All the settings below: MinValueOn, MinValue, CardOrder, MaxDurationMinutes, ScanAtMax, ReplaceCards, ProfitableClaim.

GetOrionValueSettings()
// returns: 1: a structure

SetOrionMinValue

Only take cards worth threshold, from 0 to 1000, in metal equivalent per lithium of the claim: 3 metal = 2 crystal = 1 deuterium, ships not counted. Zero means 6, the suggested threshold. With no card above it, nothing is taken.

SetOrionMinValue(on, threshold)
// returns: 1: an error

SetOrionMinValue(true, 6)

SetOrionCardOrder

The order in which cards are tried: "distance" (the nearest, the default), "value" (the most profitable per lithium), "hour" (the most profitable per hour of mission).

SetOrionCardOrder(order)
// returns: 1: an error

SetOrionCardOrder("value")

SetOrionMaxDuration

Set aside a longer card, up to 10,080 minutes. Zero: no limit.

SetOrionMaxDuration(minutes)
// returns: 1: an error

SetOrionScanAtMax

Scan at the highest level the game allows, the sum of the scanners, instead of the level of SetOrionScanLevel. The level stays within reach of the cargo at the dock.

SetOrionScanAtMax(on)
// returns: 1: an error

SetOrionScanAtMax(true)

SetOrionReplaceCards

A scan erases all earlier cards, and the module only erases its own: it stops scanning while others remain. true lets it replace them. It is the way out for cards scanned by hand, or before this memory: none of them expires.

SetOrionReplaceCards(on)
// returns: 1: an error

SetOrionAutoConversion

The line of this planet becomes "Automatic": surplus food first, then the resource whose stock exceeds six hours of income, at the load its income covers, never negative. If lithium is short for a claim, the stock is no longer kept.

SetOrionAutoConversion(planet)
// returns: 1: an error

SetOrionAutoConversion(planet)

SetOrionStoppedConversion

The line of this planet becomes "Stop": the module keeps it stopped.

SetOrionStoppedConversion(planet)
// returns: 1: an error

SetOrionProfitableClaim

Leave in the game a reward worth less than the price of its lithium, 3 metal equivalents per lithium. What cannot be valued (ships, experience, artefacts, items) is always claimed.

SetOrionProfitableClaim(on)
// returns: 1: an error

Orion: combats

GetOrionCombatSettings

The applied settings, with no request: Enabled, MaxShare, Margin, MaxLevel, Celestials.

GetOrionCombatSettings()
// returns: 1: a structure

SetOrionCombats

The "Run PvE combats" box, unticked by default.

SetOrionCombats(yes)
// returns: 1: an error

SetOrionCombatMaxShare

The share of each ship type of a celestial that combats can commit, anomaly flights already out included, from 1 to 100; 0 for the default, 25.

SetOrionCombatMaxShare(percent)
// returns: 1: an error

SetOrionCombatMargin

How many more ships each simulated wave counts on top of the worst case, from 1 to 300; 0 for the default, 20.

SetOrionCombatMargin(percent)
// returns: 1: an error

SetOrionCombatMaxLevel

The card level above which the module takes nothing; 0 for no limit.

SetOrionCombatMaxLevel(level)
// returns: 1: an error

SetOrionCombatCelestials

The celestials a combat can leave from, written "4:273:12" or "M:4:273:12"; an empty list for all.

SetOrionCombatCelestials(list)
// returns: 1: an error

Galaxy

GetCachedPlayer

PlayerID, PlayerName, Points, Rank, Total, HonourPoints.

GetCachedPlayer()
// returns: 1: your own record

me = GetCachedPlayer()           // ONE target: this is a struct

GetSlots

InUse, Total, ExpInUse, ExpTotal.

GetSlots()
// returns: 1: your fleet slots

slots = GetSlots()               // ONE target as well

ServerURL

Your server's address, with no trailing slash. A Kepler addition.

ServerURL()
// returns: 2: an address and an error

addr, err = ServerURL()          // TWO targets

RedeemCode

Redeems a code in the Gameforge lobby for the bot's account, a gift or a sitting code for instance: the « Redeem a Gameforge code » field of the Settings. A Kepler addition.

RedeemCode(code)
// returns: 1: an error

err = RedeemCode("XXXX-XXXX-XXXX")

GetFingerprintNames

The entries of the fingerprint library that this bot's fingerprint setting describes. Empty when none matches.

GetFingerprintNames()
// returns: 1: a list of names

names = GetFingerprintNames()

NewFingerprint

"+ New fingerprint" on the Fingerprints page: a machine drawn at random, then saved in the library.

NewFingerprint(name, system, region)
// returns: 2: the fingerprint and an error

f, err = NewFingerprint("Living room phone", "Android", "FR")

GetFingerprint

The sheet of a library entry, to read or to edit.

GetFingerprint(name)
// returns: 1: the fingerprint, `nil` when there is none

f = GetFingerprint("Living room")

SaveFingerprint

"Save" on the sheet of an entry you have edited.

SaveFingerprint(fingerprint)
// returns: 1: an error

err = SaveFingerprint(f)

ApplyFingerprint

"Apply" in the Browser fingerprint panel: this bot will present that entry to the game.

ApplyFingerprint(name)
// returns: 1: an error

err = ApplyFingerprint(f.Name)

DeleteFingerprint

✕ in the library: the entry of that name is removed from it, unless a bot carries it.

DeleteFingerprint(name)
// returns: 1: an error

err = DeleteFingerprint(name)

GalaxyInfos

The fifteen positions of a system.

GalaxyInfos(galaxy, system)
// returns: 2: the reading and an error

sys, err = GalaxyInfos(1, 224)         // TWO targets

GalaxyInfosUsing

The same, standing on a celestial.

GalaxyInfosUsing(galaxy, system, celestial)
// returns: 2: the reading and an error

sys, err = GalaxyInfosUsing(4, 116, c.GetID())

GetPlanetInfo

A single position.

GetPlanetInfo(coordinate)
// returns: 2: the position and an error

p, err = GetPlanetInfo("4:116:6")

GetPlanetInfoUsing

The same, standing on a celestial.

GetPlanetInfoUsing(coordinate, celestial)
// returns: 2: the position and an error

CoordinatesAvailableForDiscoveryFleet

The positions a lifeform expedition can be sent to, empty ones included. Empty list when there is none.

CoordinatesAvailableForDiscoveryFleet(origin, galaxy, system)
// returns: 2: the list and an error

coords, err = CoordinatesAvailableForDiscoveryFleet(origin, 1, 64)

GetSystemsInRange

In order of number.

GetSystemsInRange(origin, radius)
// returns: 1: a list of systems

Print(GetSystemsInRange(3, 2))       // [1 2 3 4 5]

GetSystemsInRangeAsc

Nearest to farthest.

GetSystemsInRangeAsc(origin, radius)
// returns: 1: a list of systems

Print(GetSystemsInRangeAsc(3, 2))    // [3 2 4 1 5]

GetSystemsInRangeDesc

Farthest to nearest.

GetSystemsInRangeDesc(origin, radius)
// returns: 1: a list of systems

Print(GetSystemsInRangeDesc(3, 2))   // [5 1 4 2 3]

PlayersData

Every player in the universe.

PlayersData()
// returns: 2: the list and an error

players, err = PlayersData()          // TWO targets

PlayerDataByID

Clean error if the ID is unknown.

PlayerDataByID(id)
// returns: 2: a player and an error

p, err = PlayerDataByID(id)

PlayerDataByName

Whole nickname, case is ignored.

PlayerDataByName(name)
// returns: 2: a player and an error

target, err = PlayerDataByName("Xylo")

HighscoreData

Through the game's API. IDs, not names.

HighscoreData(category, typ)
// returns: 2: the whole highscore and an error

ranks, err = HighscoreData(1, 0)      // players, general highscore

GetHighscore

The game's highscore page, a hundred players, with their home planet.

GetHighscore(category, typ, page)
// returns: 2: a page and an error

PageContent

A game page, through the account's session.

PageContent(query)
// returns: 2: the text and an error

html, err = PageContent("page=ingame&component=overview")

FetchURL

Any address, through the same session.

FetchURL(url)
// returns: 2: the text and an error

body, err = FetchURL("https://example.net/api")

HttpRequest

A full request, through the same session.

HttpRequest(method, url, headers, body)
// returns: 3: the text, the code and an error

body, code, err = HttpRequest("POST", "https://example.net/api", headers, payload)

SendMessage

A private message, through the game's chat.

SendMessage(playerID, message)
// returns: 1: an error

err = SendMessage(target.ID, "Hello, I come in peace.")

GetEspionageReportMessages

The summary of each report on the first page.

GetEspionageReportMessages()
// returns: 2: the list and an error

summaries, err = GetEspionageReportMessages()

GetEspionageReportMessagesPages

The same, across several pages.

GetEspionageReportMessagesPages(pages)
// returns: 2: the list and an error

older, err = GetEspionageReportMessagesPages(3)

GetEspionageReport

The detailed report of a message.

GetEspionageReport(msgID)
// returns: 2: the report and an error

detail, err = GetEspionageReport(summaries[0].ID)

GetEspionageReportFor

The latest report on that position.

GetEspionageReportFor(coordinate)
// returns: 2: the report and an error

report, err = GetEspionageReportFor("1:2:3")

GetCombatReportSummaryFor

The latest fight at that position.

GetCombatReportSummaryFor(coordinate)
// returns: 2: the summary and an error

fight, err = GetCombatReportSummaryFor("1:2:3")

DeleteMessage

Deletes one message for good, trash included.

DeleteMessage(msgID)
// returns: 1: an error

DeleteMessage(summaries[0].ID)

DeleteAllMessagesFromTab

Moves a whole tab to the trash.

DeleteAllMessagesFromTab(tab)
// returns: 1: an error

DeleteAllMessagesFromTab(20)

CountColonies

What you have, what you may have.

CountColonies()
// returns: 2: the count and the maximum

count, possible = CountColonies()

Toolbox

Min

The smaller of the two.

Min(x, y)
// returns: 1: a number

Printf("%d", Min(3, 5))      // ✓ 3: the result is an integer

Max

The larger of the two.

Max(x, y)
// returns: 1: a number

Abs

The absolute value.

Abs(x)
// returns: 1: a number

Ceil

The integer above.

Ceil(x)
// returns: 1: a number

Floor

The integer below.

Floor(x)
// returns: 1: a number

Floor(o["planet_id"] / 2) == 16814034   // true

Round

The nearest integer.

Round(x)
// returns: 1: a number

Itoa(Round(2.7))   // "3"

Pow

x to the power y.

Pow(x, y)
// returns: 1: a number

Print(Pow(10, 7))            // ✓ 10000000

Sqrt

The square root.

Sqrt(x)
// returns: 1: a number

Printf("%v", Sqrt(2))        // ✓ 1.4142135623730951

Random

A random integer, bounds included.

Random(min, max)
// returns: 1: an integer

SleepMs(Random(500, 1000))

Atoi

Reads an integer from text.

Atoi(text)
// returns: 1: an integer

Atoi("42")                    // 42

Itoa

Writes an integer as text.

Itoa(n)
// returns: 1: a string

Itoa(2.7)          // "2"

Dotify

Formats a large number the way the game does: 1000000 gives 1.000.000.

Dotify(n)
// returns: 1: a string

Base64

Encodes.

Base64(text)
// returns: 1: a string

code = Base64("hello")

Base64Decode

Decodes.

Base64Decode(text)
// returns: 2: the text and an error

plain, err = Base64Decode(code)      // ← TWO targets

JsonDecode

Decodes JSON.

JsonDecode(data)
// returns: 2: the value and an error

o, err = JsonDecode(body)             // ← TWO targets, again

JsonEncode

Writes JSON.

JsonEncode(value)
// returns: 2: the text and an error

text, err = JsonEncode(payload)       // ← TWO targets

JsonEncodeIndent

The same, laid out.

JsonEncodeIndent(value, indent)
// returns: 2: the text and an error

MapKeys

Sorted.

MapKeys(table)
// returns: 1: the list of keys

Print(MapKeys(cache)[i], MapValues(cache)[i])

MapValues

In key order.

MapValues(table)
// returns: 1: the list of values

Print(MapKeys(cache)[i], MapValues(cache)[i])

NewShipsInfos

To be filled with .Set(id, count), then passed to FlightTime, Speed or Cargo.

NewShipsInfos()
// returns: 1: an empty fleet

fleet = NewShipsInfos()

NewResources

The three quantities in one go.

NewResources(metal, crystal, deut)
// returns: 1: resources

Print(DoAuction({c.GetID(): NewResources(auction.MinimumBid - auction.AlreadyBid, 0, 0)}))

NewCoordinate

The type is PLANET_TYPE, MOON_TYPE or DEBRIS_TYPE.

NewCoordinate(galaxy, system, position, type)
// returns: 1: a coordinate

ParseCoord

Reads "1:2:3" or "M:1:2:3".

ParseCoord(string)
// returns: 2: the coordinate and an error

coord, err = ParseCoord("M:1:2:3")     // TWO targets

ID2Str

The readable name of a ship, a defence, a building or a technology.

ID2Str(id)
// returns: 1: a string

Print(ID2Str(204))            // LightFighter

ShortShipsInfos

Sums up a fleet: LightFighter: 120, SmallCargo: 40.

ShortShipsInfos(fleet)
// returns: 1: a string

LogInfof("%s : %s", planet.Coordinate, ShortShipsInfos(ships))

VersionCompare

-1 if a is older, 0 if they are equal, 1 if a is newer.

VersionCompare(a, b)
// returns: 1: an integer

Print(VersionCompare("1.2", "1.2.0"))     // 0: absent segments count as zero

GetItems

Every item on the celestial.

GetItems(celestial)
// returns: 2: the items and an error

items, err = GetItems(c.GetID())

GetActiveItems

Only those currently in effect.

GetActiveItems(celestial)
// returns: 2: the items and an error

active, err = GetActiveItems(c.GetID())

ActivateItem

Switches on an item from the inventory.

ActivateItem(reference, celestial)
// returns: 1: an error

err = ActivateItem(o.Ref, c.GetID())

RecruitOfficer

Hires an officer. 2 commander, 3 admiral, 4 engineer, 5 geologist, 6 technocrat; 7 or 90 days.

RecruitOfficer(officer, days)
// returns: 1: an error

Print(RecruitOfficer(5, 7)) // a geologist for seven days

GetAuction

The auction under way.

GetAuction()
// returns: 2: the auction and an error

auction, err = GetAuction()

DoAuction

Adds to your bid on the auction under way: { celestial: NewResources(metal, crystal, deuterium) }.

DoAuction(bid)
// returns: 1: an error

Print(DoAuction({c.GetID(): NewResources(auction.MinimumBid - auction.AlreadyBid, 0, 0)}))

BuyOfferOfTheDay

Buys the merchant's offer.

BuyOfferOfTheDay()
// returns: 1: an error

Print(BuyOfferOfTheDay())

GetDMCosts

What finishing the production under way costs in dark matter: building, research, shipyard. Spends nothing.

GetDMCosts(celestial)
// returns: 2: the costs and an error

UseDM

Presses "Reduce" or "Finish" on a production: "buildings", "research" or "shipyard". Spends dark matter.

UseDM(what, celestial)
// returns: 1: an error

Abandon

Abandons a planet. Cannot be undone.

Abandon(planet)
// returns: 1: an error

SendIPM

Fires missiles.

SendIPM(planet, target, count, defence)
// returns: 2: the missiles sent and an error

sent, err = SendIPM(c.GetID(), "1:1:1", 10, 0)

DestroyRockets

Destroys missiles in your silo.

DestroyRockets(planet, abm, ipm)
// returns: 1: an error

ShipsAttackStrength

The firepower of a whole fleet.

ShipsAttackStrength(ships, researches)
// returns: 1: an integer

ShipsAttackStrengthUsingOwnResearches

The same, with your own researches.

ShipsAttackStrengthUsingOwnResearches(ships)
// returns: 1: an integer

Print("firepower:", ShipsAttackStrengthUsingOwnResearches(ships))

NewTemperature

Both bounds, as the game shows them.

NewTemperature(min, max)
// returns: 1: a temperature

temp = NewTemperature(-12, 40)

SolarSatelliteProduction

The energy satellites produce.

SolarSatelliteProduction(temperature, count)
// returns: 1: an integer

Print("energy:", SolarSatelliteProduction(temp, 123))

GetRequirements

The direct requirements of a build.

GetRequirements(id)
// returns: 1: a map

Print(GetRequirements(LIGHTLASER))   // shipyard 2, laser technology 3

ConvertIntoCoordinate

Normalises anything naming a position.

ConvertIntoCoordinate(what)
// returns: 2: the coordinate and an error

GetPlayerCoordinates

The scanned planets and moons of a player.

GetPlayerCoordinates(player)
// returns: 1: a list of coordinates

SetHomeWorld

Sets the account's home planet.

SetHomeWorld(celestial)
// returns: 1: an error

GetHomeWorld

The home planet: the one set, otherwise the game's.

GetHomeWorld()
// returns: 1: a celestial

Constants and values

Reacting to an event

OnAttackCha channel of attacks
OnAttackGoneCha channel of attacks
OnAttackDoneCha channel of attacks
OnAttackCancelledCha channel of attacks
OnStateChangeCha channel of states
OnChatMessageReceivedCha channel of messages
OnFleetCha channel of fleets
OnGalaxyScanDonean empty channel
OnHunterTargetActiveCha channel of changes
OnHunterTargetIdleCha channel of changes
OnCaptchaCha channel of challenges

The Timer watch, player by player

OnTimerTargetIdleCha channel of changes

The alerts

OnOrionAlertCha channel

The id arrays

ShipsArr16 ids
DefencesArr10 ids
TechnologiesArr16 ids
BuildingsArr23 ids
PlanetBuildingsArr20 ids
MoonBuildingsArr9 ids
OrionBuildingsArr8 ids
LfBuildingsHumansArr12 ids each
LfBuildingsRocktalArr12 ids each
LfBuildingsMechasArr12 ids each
LfBuildingsKaeleshArr12 ids each
LfTechnologiesHumansArr18 ids each
LfTechnologiesRocktalArr18 ids each
LfTechnologiesMechasArr18 ids each
LfTechnologiesKaeleshArr18 ids each
LfTechnologiesArr72 ids

The id names

SMALLCARGO
LARGECARGO
LIGHTFIGHTER
HEAVYFIGHTER
CRUISER
BATTLESHIP
COLONYSHIP
RECYCLER
ESPIONAGEPROBE
BOMBER
DESTROYER
DEATHSTAR
BATTLECRUISER
CRAWLER
REAPER
PATHFINDER
ROCKETLAUNCHER
LIGHTLASER
HEAVYLASER
GAUSSCANNON
IONCANNON
PLASMATURRET
SMALLSHIELDDOME
LARGESHIELDDOME
ANTIBALLISTICMISSILES
INTERPLANETARYMISSILES
ESPIONAGETECHNOLOGY
COMPUTERTECHNOLOGY
WEAPONSTECHNOLOGY
SHIELDINGTECHNOLOGY
ARMOURTECHNOLOGY
ENERGYTECHNOLOGY
HYPERSPACETECHNOLOGY
COMBUSTIONDRIVE
IMPULSEDRIVE
HYPERSPACEDRIVE
LASERTECHNOLOGY
IONTECHNOLOGY
PLASMATECHNOLOGY
INTERGALACTICRESEARCHNETWORK
ASTROPHYSICS
GRAVITONTECHNOLOGY
METALMINE
CRYSTALMINE
DEUTERIUMSYNTHESIZER
SOLARPLANT
FUSIONREACTOR
SOLARSATELLITE
METALSTORAGE
CRYSTALSTORAGE
DEUTERIUMTANK
SHIELDEDMETALDEN
UNDERGROUNDCRYSTALDEN
SEABEDDEUTERIUMDEN
ALLIANCEDEPOT
ROBOTICSFACTORY
SHIPYARD
RESEARCHLAB
MISSILESILO
NANITEFACTORY
TERRAFORMER
SPACEDOCK
LUNARBASE
SENSORPHALANX
JUMPGATE
INTERSTELLARANOMALYSCANNER
INTERGALACTICRECOVERYCENTRE
LITHIUMELECTROLYSISLAB
METALRECYCLINGUNIT
CRYSTALFINISHINGSTATION
ANOMALYANALYSISCENTRE
HIGHPRESSUREDEUTERIUMTANKS
CATALYTICCONVERTOR
RESIDENTIALSECTOR
BIOSPHEREFARM
RESEARCHCENTRE
ACADEMYOFSCIENCES
NEUROCALIBRATIONCENTRE
HIGHENERGYSMELTING
FOODSILO
FUSIONPOWEREDPRODUCTION
SKYSCRAPER
BIOTECHLAB
METROPOLIS
PLANETARYSHIELD
INTERGALACTICENVOYS
HIGHPERFORMANCEEXTRACTORS
FUSIONDRIVES
STEALTHFIELDGENERATOR
ORBITALDEN
RESEARCHAI
HIGHPERFORMANCETERRAFORMER
ENHANCEDPRODUCTIONTECHNOLOGIES
LIGHTFIGHTERMKII
CRUISERMKII
IMPROVEDLABTECHNOLOGY
PLASMATERRAFORMER
LOWTEMPERATUREDRIVES
BOMBERMKII
DESTROYERMKII
BATTLECRUISERMKII
ROBOTASSISTANTS
SUPERCOMPUTER
MEDITATIONENCLAVE
CRYSTALFARM
RUNETECHNOLOGIUM
RUNEFORGE
ORIKTORIUM
MAGMAFORGE
DISRUPTIONCHAMBER
MEGALITH
CRYSTALREFINERY
DEUTERIUMSYNTHESISER
MINERALRESEARCHCENTRE
ADVANCEDRECYCLINGPLANT
VOLCANICBATTERIES
ACOUSTICSCANNING
HIGHENERGYPUMPSYSTEMS
CARGOHOLDEXPANSIONCIVILIANSHIPS
MAGMAPOWEREDPRODUCTION
GEOTHERMALPOWERPLANTS
DEPTHSOUNDING
IONCRYSTALENHANCEMENTHEAVYFIGHTER
IMPROVEDSTELLARATOR
HARDENEDDIAMONDDRILLHEADS
SEISMICMININGTECHNOLOGY
MAGMAPOWEREDPUMPSYSTEMS
IONCRYSTALMODULES
OPTIMISEDSILOCONSTRUCTIONMETHOD
DIAMONDENERGYTRANSMITTER
OBSIDIANSHIELDREINFORCEMENT
RUNESHIELDS
ROCKTALCOLLECTORENHANCEMENT
ASSEMBLYLINE
FUSIONCELLFACTORY
ROBOTICSRESEARCHCENTRE
UPDATENETWORK
QUANTUMCOMPUTERCENTRE
AUTOMATISEDASSEMBLYCENTRE
HIGHPERFORMANCETRANSFORMER
MICROCHIPASSEMBLYLINE
PRODUCTIONASSEMBLYHALL
HIGHPERFORMANCESYNTHESISER
CHIPMASSPRODUCTION
NANOREPAIRBOTS
CATALYSERTECHNOLOGY
PLASMADRIVE
EFFICIENCYMODULE
DEPOTAI
GENERALOVERHAULLIGHTFIGHTER
AUTOMATEDTRANSPORTLINES
IMPROVEDDRONEAI
EXPERIMENTALRECYCLINGTECHNOLOGY
GENERALOVERHAULCRUISER
SLINGSHOTAUTOPILOT
HIGHTEMPERATURESUPERCONDUCTORS
GENERALOVERHAULBATTLESHIP
ARTIFICIALSWARMINTELLIGENCE
GENERALOVERHAULBATTLECRUISER
GENERALOVERHAULBOMBER
GENERALOVERHAULDESTROYER
EXPERIMENTALWEAPONSTECHNOLOGY
MECHANGENERALENHANCEMENT
SANCTUARY
ANTIMATTERCONDENSER
VORTEXCHAMBER
HALLSOFREALISATION
FORUMOFTRANSCENDENCE
ANTIMATTERCONVECTOR
CLONINGLABORATORY
CHRYSALISACCELERATOR
BIOMODIFIER
PSIONICMODULATOR
SHIPMANUFACTURINGHALL
SUPRAREFRACTOR
HEATRECOVERY
SULPHIDEPROCESS
PSIONICNETWORK
TELEKINETICTRACTORBEAM
ENHANCEDSENSORTECHNOLOGY
NEUROMODALCOMPRESSOR
NEUROINTERFACE
INTERPLANETARYANALYSISNETWORK
OVERCLOCKINGHEAVYFIGHTER
TELEKINETICDRIVE
SIXTHSENSE
PSYCHOHARMONISER
EFFICIENTSWARMINTELLIGENCE
OVERCLOCKINGLARGECARGO
GRAVITATIONSENSORS
OVERCLOCKINGBATTLESHIP
PSIONICSHIELDMATRIX
KAELESHDISCOVERERENHANCEMENT

Missions

ATTACK1
GROUPEDATTACK2
TRANSPORT3
PARK4
PARKINTHATALLY5
SPY6
COLONIZE7
RECYCLEDEBRISFIELD8
DESTROY9
MISSILEATTACK10
ANOMALYENCOUNTER14
EXPEDITION15
SEARCHFORLIFEFORMS18

Speeds

TEN_PERCENT
TWENTY_PERCENT
THIRTY_PERCENT
FORTY_PERCENT
FIFTY_PERCENT
SIXTY_PERCENT
SEVENTY_PERCENT
EIGHTY_PERCENT
NINETY_PERCENT
HUNDRED_PERCENT
FIVE_PERCENT
FIFTEEN_PERCENT
TWENTY_FIVE_PERCENT
THIRTY_FIVE_PERCENT
FORTY_FIVE_PERCENT
FIFTY_FIVE_PERCENT
SIXTY_FIVE_PERCENT
SEVENTY_FIVE_PERCENT
EIGHTY_FIVE_PERCENT
NINETY_FIVE_PERCENT

Celestial types, lifeforms, classes

PLANET_TYPE1
DEBRIS_TYPE2
MOON_TYPE3
ANOMALY_TYPE4
NONE_LF_TYPE0 to 4
HUMANS0 to 4
ROCKTAL0 to 4
MECHAS0 to 4
KAELESH0 to 4
NO_CLASS0 to 3
COLLECTOR0 to 3
GENERAL0 to 3
DISCOVERER0 to 3
NO_ALLIANCE_CLASS0 to 3
WARRIOR0 to 3
TRADER0 to 3
RESEARCHER0 to 3

The dimensions of the universe

GALAXIESan integer
SYSTEMSan integer

The file, the server, the version

FILEa string
__FILE__a string
OGAME_SERVERa record
VERSIONa string
__VERSION__a string

The offering and the licence

IS_CLOUDa boolean
__IS_CLOUD__a boolean
IS_SELF_HOSTa boolean
__IS_SELF_HOST__a boolean
LICENSE_BOTS_ALLOWEDan integer
__LICENSE_BOTS_ALLOWED__an integer
LICENSE_UUIDthe empty string
__LICENSE_UUID__the empty string
LICENSE_USERNAMEthe empty string
__LICENSE_USERNAME__the empty string
LICENSE_EMAILthe empty string
__LICENSE_EMAIL__the empty string
CookieDomainthe empty string
DISCORD_WEBHOOKthe Discord webhook from the Notifications page
TELEGRAM_CHAT_IDthe Telegram chat from the Notifications page