Scripts are JavaScript and run per bot right inside HIVE – over the bot's existing game connection. All commands are available globally. Game requests are throttled automatically (at least 0.3 s apart) so the account doesn't stand out.
Stop and pause work at any time, even in the middle of a loop. Game API errors can be caught with try { … } catch (e) { LogError(e.message) }.
Own planets/moons can be given everywhere as an object from GetPlanets(), as an ID, as a name or as a coordinate: "1:16:4" = planet, "1:16:4:3" = moon.
Irreversible or externally visible actions need the word "BESTÄTIGT" as their last argument – without it nothing happens. Signing in, signing out and captchas aren't available to scripts because they would end the running game session. Scripts have no access to files, the network or the PC.
MISSION.ATTACK, ACS_ATTACK, TRANSPORT, DEPLOY, ACS_DEFEND, SPY, COLONIZE, HARVEST, DESTROY, MISSILE_ATTACK, EXPEDITION, TRADE, DISCOVERY CELESTIAL.PLANET (1), DEBRIS (2), MOON (3), DEEPSPACE (4) SHIP.SmallCargo, LargeCargo, LightFighter, HeavyFighter, Cruiser, Battleship, Battlecruiser, Bomber, Destroyer, Deathstar, ColonyShip, Recycler, EspionageProbe, SolarSatellite, Crawler, Reaper, Pathfinder DEFENCE.RocketLauncher, LightLaser, HeavyLaser, GaussCannon, IonCannon, PlasmaTurret, SmallShieldDome, LargeShieldDome, AntiBallisticMissiles, InterplanetaryMissiles BUILDING.MetalMine, CrystalMine, DeuteriumSynthesizer, SolarPlant, FusionReactor, MetalStorage, CrystalStorage, DeuteriumTank, RoboticsFactory, Shipyard, ResearchLab, NaniteFactory, Terraformer, SpaceDock, LunarBase, SensorPhalanx, JumpGate, … RESEARCH.EspionageTechnology, ComputerTechnology, WeaponsTechnology, …, Astrophysics, IntergalacticResearchNetwork, GravitonTechnology LF_BUILDING.ResidentialSector, BiosphereFarm, … LF_RESEARCH.IntergalacticEnvoys, HighPerformanceExtractors, … CHARACTER_CLASS.NONE, COLLECTOR, GENERAL, DISCOVERER ALLIANCE_CLASS.NONE, WARRIOR, TRADER, RESEARCHER FEATURE.Defender, Expeditions, AutoFarm, Harvest, SleepMode, Colonize, AutoDiscovery, BrainAutoMine, BrainAutoResearch, BrainAutoRepatriate, BrainAutobuildCargo, … MESSAGE_TAB.ESPIONAGE (20), COMBAT (21), EXPEDITIONS (22), TRANSPORT (23), OTHER (24) Statt der Konstanten gehen auch die Zahlen-IDs oder Namen als Text (z. B. "LargeCargo").
// Example: expedition waves from the home planet
const LARGE_CARGO = 4000
while (true) {
if (IsSleeping()) { SleepMin(5); continue }
const home = GetHomeWorld()
const slots = GetSlots()
const free = Math.min(slots.ExpTotal - slots.ExpInUse, slots.Total - slots.InUse)
for (let i = 0; i < free; i++) {
const system = home.Coordinate.System + RandomInt(-1, 1)
const target = home.Coordinate.Galaxy + ":" + system + ":16"
const fleet = SendFleet(home, { LargeCargo: LARGE_CARGO, Pathfinder: 1 }, target, MISSION.EXPEDITION)
if (!fleet) { LogWarn("No ships left"); break }
SleepRandSec(2, 5)
}
SleepRandSec(300, 600)
}
LogInfo(...werte)–const s = GetSlots()
LogInfo("Fleet slots:", s.InUse, "/", s.Total)
LogWarn(...werte)–if (GetShips(GetHomeWorld()).ColonyShip === 0)
LogWarn("No colony ship left on the home planet")
LogError(...werte)–try {
SendFleet(home, { LargeCargo: 100 }, "1:16:16", MISSION.EXPEDITION)
} catch (e) {
LogError("Sending failed:", e.message)
}
LogDebug(...werte)–const fleets = GetFleets()
LogDebug("Raw data of the first fleet:", fleets[0])
Print(...werte)–Print("Script", ScriptName, "started")
Sleep(millisekunden)–for (const p of GetPlanets()) {
LogInfo(p.Name, GetResources(p).Metal)
Sleep(1500) // 1.5 s between the requests
}
SleepSec(sekunden)–while (IsUnderAttack()) {
LogWarn("Attack in progress – waiting")
SleepSec(30)
}
SleepMin(minuten)–while (true) {
BuyOfferOfTheDay()
SleepMin(60)
}
SleepRandSec(min, max)–for (let i = 0; i < 3; i++) {
SendFleet(home, { LargeCargo: 2000 }, "1:16:16", MISSION.EXPEDITION)
SleepRandSec(3, 8)
}
Exit()–if (IsVacationMode()) {
LogInfo("Vacation mode active – nothing to do")
Exit()
}
IsSleeping()true | falsewhile (true) {
if (IsSleeping()) { SleepMin(10); continue }
// … the actual work …
SleepMin(5)
}
function OnExit() { … }–StopModule("Expeditions") // module off while the script runs
function OnExit() {
StartModule("Expeditions") // on again at the end
}
argsanything | null// started with StartScript("Transport", { target: "1:20:8", amount: 500 })
const target = args ? args.target : "1:16:4"
const amount = args ? args.amount : 100
ScriptName / InstanceNameTextLogInfo(ScriptName + " runs on " + InstanceName)
Skript „_shared“–// script “_shared”:
function ToMsu(r) { return r.Metal + r.Crystal * 1.5 + r.Deuterium * 3 }
// any other script of this bot:
LogInfo("MSU: " + FormatNumber(ToMsu(GetResources(GetHomeWorld()))))
FormatNumber(zahl)TextLogInfo("Metal:", FormatNumber(GetResources(GetHomeWorld()).Metal)) // Metal: 1,366,412
FormatDuration(sekunden)Textfor (const f of GetFleets())
LogInfo("Fleet", f.ID, "back in", FormatDuration(f.BackIn || f.ArriveIn))
FormatTime(zeitstempel | isoText, format?)Textconst r = LatestReturn(MISSION.EXPEDITION)
LogInfo("Last expedition back at", FormatTime(r.At))
ParseCoord(koordinate){ Galaxy, System, Position, Type }const c = ParseCoord("2:150:8")
LogInfo("Galaxy", c.Galaxy, "system", c.System)
FormatCoord(koordinate)Textconst home = GetHomeWorld()
const target = FormatCoord({ Galaxy: home.Coordinate.Galaxy, System: home.Coordinate.System + 1, Position: 16 })
// target = "1:17:16"
RandomInt(min, max)numberconst home = GetHomeWorld() const system = home.Coordinate.System + RandomInt(-2, 2) const target = home.Coordinate.Galaxy + ":" + system + ":16"
DailyRandom(min, max, salt?)number// a different offset of 0–15 minutes every day, but fixed for the day
const offset = DailyRandom(0, 900)
SleepUntil(NextTimeAt("06:00") + offset)
DailyRandomTime("von", "bis", salt?)"HH:MM:SS"const wakeUp = DailyRandomTime("06:10", "06:40")
LogInfo("Return today at", wakeUp)
FleetSave(GetHomeWorld(), wakeUp)
Timestamp()numberconst start = Timestamp()
// … work …
LogInfo("Took:", FormatDuration(Timestamp() - start))
TimeOfDay()TextLogInfo("It is", TimeOfDay())
NextTimeAt("HH:MM[:SS]")timestampconst target = NextTimeAt("07:00")
LogInfo("Still", FormatDuration(target - Timestamp()), "until 07:00")
TimeAt("HH:MM[:SS]", tagVersatz?)timestampconst tomorrowMorning = TimeAt("06:30", 1)
LogInfo("Tomorrow 06:30 =", FormatTime(tomorrowMorning))
IsTimeBetween("von", "bis")true | falseif (IsTimeBetween("01:00", "06:30")) { LogInfo("Night pause"); SleepUntil("06:30") }
SleepUntil("HH:MM[:SS]" | zeitstempel)–SleepUntil("06:30")
LogInfo("Good morning – bringing the fleet back")
SleepUntilIfToday("HH:MM[:SS]")true (waited) | false (already past today)if (SleepUntilIfToday("18:00")) BuyOfferOfTheDay()
else LogInfo("18:00 already past today – skipped")
GetUserInfo(){ PlayerID, PlayerName, Points, Rank, Total, HonourPoints, Class }const me = GetUserInfo() LogInfo(me.PlayerName, "– rank", me.Rank, "of", me.Total, "–", me.Points, "points")
GetUsername()Textconst login = GetUsername()
LogInfo("Login:", login.replace(/^(..).*(@.*)$/, "$1***$2")) // logged masked
GetUserClass()0 | 1 | 2 | 3if (GetUserClass() === CHARACTER_CLASS.DISCOVERER)
LogInfo("Discoverer: more expedition yield")
GetAllianceClass()0 | 1 | 2 | 3if (GetAllianceClass() === ALLIANCE_CLASS.TRADER) LogInfo("Trader alliance")
GetResearch(){ EnergyTechnology, LaserTechnology, …, Astrophysics, ComputerTechnology, … }const r = GetResearch()
const maxExpos = Math.floor(Math.sqrt(r.Astrophysics))
LogInfo("Max. expeditions by astrophysics:", maxExpos)
IsUnderAttack()true | falseif (IsUnderAttack() && !IsScriptRunning("Fleetsave")) StartScript("Fleetsave")
IsVacationMode()true | falseif (IsVacationMode()) Exit()
GetStaff(){ Commander, Admiral, Engineer, Geologist, Technocrat }const staff = GetStaff()
if (!staff.Admiral) LogWarn("No admiral – one fleet slot less")
HasCommander() / HasAdmiral() / HasEngineer() / HasGeologist() / HasTechnocrat()true | falseif (HasGeologist()) LogInfo("Geologist active: +10 % mine production")
GetServerData(){ Speed, SpeedFleetWar, SpeedFleetPeaceful, SpeedFleetHolding, Galaxies, Systems, DonutGalaxy, DonutSystem, DebrisFactor, … }const sd = GetServerData()
LogInfo("Universe", sd.Name, "speed", sd.Speed, "–", sd.Galaxies, "galaxies")
GetServerInfo(){ Name, Number, Language, PlayerCount, PlayersOnline, Opened, StartDate, … }const info = GetServerInfo() LogInfo(info.PlayersOnline, "of", info.PlayerCount, "players online")
GetServerTime()ISO timestamp (text)const t = new Date(GetServerTime())
if (t.getHours() >= 1 && t.getHours() < 6) LogInfo("Night time on the server")
GetServerSpeed() / GetServerFleetSpeed()numberLogInfo("Economy x" + GetServerSpeed(), "fleet x" + GetServerFleetSpeed())
GetServerName() / GetServerLanguage() / GetServerUrl() / GetServerVersion()TextLogInfo(GetServerName(), GetServerLanguage().toUpperCase(), "version", GetServerVersion())
GetOgamedIP()TextLogInfo("ogamed goes out via", GetOgamedIP())
GetHiveIP()TextLogInfo("HIVE:", GetHiveIP(), "– game:", GetOgamedIP())
GetOgamedTasks(){ Low, Normal, Important, Critical, Total }while (GetOgamedTasks().Total > 0) Sleep(500)
LogInfo("ogamed is free")
GameLogin()–try { GetUserInfo() } catch (e) { LogWarn("Session gone – signing in again"); GameLogin() }
GetPlanets()[ { ID, Name, Type, Coordinate, Coords, Fields, Temperature } ]for (const p of GetPlanets())
LogInfo(p.Name, p.Coords, p.Fields.Built + "/" + p.Fields.Total, "fields")
GetMoons()[ { ID, Name, Type, Coordinate, Coords, Fields } ]LogInfo("You have", GetMoons().length, "moons")
GetCelestials()[ celestials ]for (const c of GetCelestials())
LogInfo(c.Type === "Moon" ? "Moon" : "Planet", c.Name, c.Coords)
GetPlanetsLive() / GetMoonsLive()[ celestials ]const before = GetPlanets().length
SleepMin(1)
if (GetPlanetsLive().length > before) LogInfo("New colony!")
GetHomeWorld()celestial { ID, Name, Type, Coords, Coordinate, … } | nullconst home = GetHomeWorld()
LogInfo("Home:", home.Name, home.Coords)
GetCelestial(ref)Celestialsconst moon = GetCelestial("1:16:4:3")
const colony = GetCelestial("Colony")
GetPlanetAt(koordinate)planet | nullconst p = GetPlanetAt("1:16:4")
if (p) LogInfo(p.Name, "has", p.Fields.Total, "fields, max.", p.Temperature.Max, "°C")
GetMoonAt(koordinate)moon | nullif (!GetMoonAt(GetHomeWorld().Coords)) LogInfo("The home planet has no moon (yet)")
NearestOwnMoon(ref | koordinate)moon | nullconst moon = NearestOwnMoon(GetHomeWorld())
if (!moon) LogWarn("No moon for a fleet save")
GetEmpire("planets" | "moons")[ { ID, Name, Coords, Coordinate, Fields, Resources, Buildings, Facilities, Ships, Defences } ]let metal = 0
for (const p of GetEmpire("planets")) metal += p.Resources.Metal
LogInfo("Metal in total:", metal)
MaxPlanets()numberif (GetPlanets().length < MaxPlanets()) StartModule("Colonize")
GetResources(ref){ Metal, Crystal, Deuterium, Energy, Food, Population, Darkmatter }const r = GetResources(GetHomeWorld())
if (r.Energy < 0) LogWarn("Energy shortage on the home planet")
GetResourcesDetails(planet){ Metal: { Available, StorageCapacity, CurrentProduction }, Crystal, Deuterium, Energy, Food, Population }const d = GetResourcesDetails(GetHomeWorld())
if (d.Metal.Available >= d.Metal.StorageCapacity)
LogWarn("Metal storage full – mine stalls")
GetResourceSettings(planet){ MetalMine, CrystalMine, DeuteriumSynthesizer, SolarPlant, FusionReactor, SolarSatellite, Crawler }const f = GetResourceSettings(GetHomeWorld())
if (f.MetalMine < 1) LogWarn("Metal mine only runs at", f.MetalMine * 100, "%")
SetResourceSettings(planet, { MetalMine, CrystalMine, DeuteriumSynthesizer, SolarPlant, FusionReactor, SolarSatellite, Crawler })the new settings (like GetResourceSettings)// fusion reactor off at night, saves deuterium
for (const p of GetPlanets())
SetResourceSettings(p, { FusionReactor: 0 })
PlanetProduction(planet){ Metal, Crystal, Deuterium, Food }const p = PlanetProduction("Home planet")
LogInfo("per day:", FormatNumber(p.Metal * 24), "metal")
StorageCapacity(stufe)amountconst b = GetBuildings("Home planet")
LogInfo("Metal storage holds", FormatNumber(StorageCapacity(b.MetalStorage)))
ResourceValue(rohstoffe, kurs?)numberLogInfo("The home planet is worth", FormatNumber(ResourceValue(GetResources(GetHomeWorld()))), "MSU")
EnergyProduction(gebäude, stufe)EnergyLogInfo(EnergyProduction(BUILDING.SolarPlant, 30))
SolarSatelliteProduction(planet)energy per satelliteLogInfo(SolarSatelliteProduction("Home planet"))
SolarSatellitesNeeded(planet, [energie])amountconst n = SolarSatellitesNeeded("Home planet")
if (n > 0) BuildShips("Home planet", SHIP.SolarSatellite, n)
OptimalCrawlers(planet)amountconst missing = OptimalCrawlers("Home planet") - GetShips("Home planet").Crawler
if (missing > 0) BuildShips("Home planet", SHIP.Crawler, missing)
MaxCrawlers(planet)amountLogInfo(MaxCrawlers("Home planet"))
GetBuildings(ref){ MetalMine, CrystalMine, DeuteriumSynthesizer, SolarPlant, FusionReactor, SolarSatellite, MetalStorage, CrystalStorage, DeuteriumTank }const b = GetBuildings(GetHomeWorld())
LogInfo("Mines:", b.MetalMine, b.CrystalMine, b.DeuteriumSynthesizer)
GetFacilities(ref){ RoboticsFactory, Shipyard, ResearchLab, AllianceDepot, MissileSilo, NaniteFactory, Terraformer, SpaceDock, LunarBase, SensorPhalanx, JumpGate }if (GetFacilities(GetHomeWorld()).Shipyard < 4) LogWarn("Shipyard too small for Large Cargo")
GetTechs(ref){ supplies, facilities, ships, defenses, researches }const t = GetTechs(GetHomeWorld())
LogInfo("Shipyard", t.facilities.Shipyard, "– LC:", t.ships.LargeCargo)
GetConstructions(ref){ BuildingID, BuildingCountdown, ResearchID, ResearchCountdown, LFBuildingID, LFBuildingCountdown, LFResearchID, LFResearchCountdown }const k = GetConstructions(GetHomeWorld())
if (k.BuildingID === 0) LogInfo("Build queue free")
else LogInfo("Building done in", FormatDuration(k.BuildingCountdown))
GetProduction(ref)[ { ID, Nbr } ]if (GetProduction(GetHomeWorld()).length === 0) LogInfo("Shipyard is free")
ShipyardQueueTime(ref)secondsconst rest = ShipyardQueueTime(GetHomeWorld())
LogInfo("Shipyard free in", FormatDuration(rest))
GetShips(ref){ LightFighter, …, SmallCargo, LargeCargo, …, Reaper, Pathfinder }const s = GetShips(GetHomeWorld())
LogInfo("Large Cargo:", s.LargeCargo, "Pathfinder:", s.Pathfinder)
GetDefences(ref){ RocketLauncher, LightLaser, …, AntiBallisticMissiles, InterplanetaryMissiles }const d = GetDefences(GetHomeWorld()) if (d.RocketLauncher < 100) BuildDefence(GetHomeWorld(), DEFENCE.RocketLauncher, 100 - d.RocketLauncher)
MobileShips(schiffe, reserve?){ Schiffname: Anzahl }const send = MobileShips(GetShips(home), { LargeCargo: 50, EspionageProbe: 1 })
SendFleet(home, send, "1:16:4:3", MISSION.DEPLOY)
ShipsTotal(schiffe)numberLogInfo("Ships at home:", ShipsTotal(GetShips(GetHomeWorld())))
GetItems(ref)[ { Ref, Name, Title, Rarity, Amount, AmountFree, AmountBought, Image } ]for (const i of GetItems(GetHomeWorld()))
if (i.Amount > 0) LogInfo(i.Name, "×", i.Amount)
GetArtifacts(ref){ ArtifactsCollected, ArtifactsLimit }const a = GetArtifacts(GetHomeWorld())
if (a.ArtifactsCollected >= a.ArtifactsLimit) LogWarn("Artefact storage full")
BuildBuilding(ref, id)–const home = GetHomeWorld() if (GetConstructions(home).BuildingID === 0) BuildBuilding(home, BUILDING.MetalMine)
BuildCancelable(ref, id)–BuildCancelable(GetHomeWorld(), BUILDING.CrystalMine)
BuildShips(ref, id, anzahl)–BuildShips(GetHomeWorld(), SHIP.LargeCargo, 100)
BuildDefence(ref, id, anzahl)–BuildDefence(GetHomeWorld(), DEFENCE.RocketLauncher, 200)
BuildProduction(ref, id, anzahl)–BuildProduction("Home planet", DEFENCE.RocketLauncher, 100)
BuildProduction("Home planet", SHIP.EspionageProbe, 10)
CancelBuilding(ref)–if (GetConstructions(home).BuildingID === BUILDING.Terraformer) CancelBuilding(home)
BuildResearch(ref, id)–const home = GetHomeWorld() if (GetConstructions(home).ResearchID === 0) BuildResearch(home, RESEARCH.Astrophysics)
CancelResearch(ref)–CancelResearch(GetHomeWorld())
ResearchTime(forschung, [stufe], [planet])secondsLogInfo("Astro takes", FormatDuration(ResearchTime(RESEARCH.Astrophysics)))
GetPrice(id, stufeOderAnzahl){ Metal, Crystal, Deuterium, Energy, … }const cost = GetPrice(SHIP.LargeCargo, 100)
const r = GetResources(GetHomeWorld())
if (r.Metal >= cost.Metal && r.Crystal >= cost.Crystal)
BuildShips(GetHomeWorld(), SHIP.LargeCargo, 100)
PriceRange(id, vonStufe, bisStufe){ Metal, Crystal, Deuterium }const k = PriceRange(BUILDING.MetalMine, 31, 35)
LogInfo("Metal mine 31–35 costs", FormatNumber(k.Metal), "M", FormatNumber(k.Crystal), "C")
CanAfford(kosten, bestand)true | falseif (CanAfford(GetPrice(BUILDING.MetalMine, 31), GetResources(home))) BuildBuilding(home, BUILDING.MetalMine)
MissingResources(kosten, bestand){ Metal, Crystal, Deuterium }const missing = MissingResources(GetPrice(RESEARCH.Astrophysics, 10), GetResources(home))
LogInfo("Missing", FormatNumber(missing.Crystal), "crystal")
MaxBuildable(id, rohstoffe)amountconst res = GetResources("Home planet")
BuildShips("Home planet", SHIP.LargeCargo, MaxBuildable(SHIP.LargeCargo, res))
GetRequirements(id)[ { ID, Name, Level } ]for (const r of GetRequirements(SHIP.LargeCargo))
LogInfo("Needs", r.Name, "level", r.Level)
BuildTime(id, stufe, ref)secondsconst t = BuildTime(BUILDING.MetalMine, 30, GetHomeWorld())
LogInfo("Metal mine 30 takes", FormatDuration(t))
GetNextLevel(ref, id)levelconst n = GetNextLevel("Home planet", BUILDING.MetalMine)
LogInfo("Metal mine", n, "costs", PriceRange(BUILDING.MetalMine, n, n))
NextMineToBuild(planet, [maxMetall], [maxKristall], [maxDeut], [startOptimiert])building name or nullconst next = NextMineToBuild("Home planet", 40, 35, 30)
if (next) BuildBuilding("Home planet", next)
NextEnergySourceToBuild(planet, [maxSolar], [maxFusion], [satelliten])building/ship name or nullLogInfo(NextEnergySourceToBuild("Home planet", 30, 20, true))
NextResearchToBuild([planet])research name or nullconst r = NextResearchToBuild()
if (r) BuildResearch("Home planet", r)
NextLunarFacilityToBuild(mond, [{ LunarBase, RoboticsFactory, SensorPhalanx, JumpGate, Shipyard }])building name or nullconst b = NextLunarFacilityToBuild("1:16:4:3", { SensorPhalanx: 8 })
if (b) BuildBuilding("1:16:4:3", b)
NextLifeformBuildingToBuild(planet, [{ max, preventIfMoreExpensiveThanNextMine, preventTechBuilding }])building name or nullconst b = NextLifeformBuildingToBuild("Home planet", { max: { ResidentialSector: 40, BiosphereFarm: 40 } })
if (b) BuildLifeformBuilding("Home planet", b)
NextLifeformResearchToBuild(planet, [höchststufen])research name or nullconst t = NextLifeformResearchToBuild("Home planet")
if (t) BuildLifeformResearch("Home planet", t)
IsAstrophysicsPositionValid(position)true/falsefor (let pos = 1; pos <= 15; pos++) if (!IsAstrophysicsPositionValid(pos)) LogInfo("Position", pos, "still locked")
AmortizationDays(planet, gebäude)daysfor (const m of [BUILDING.MetalMine, BUILDING.CrystalMine, BUILDING.DeuteriumSynthesizer])
LogInfo(m, AmortizationDays("Home planet", m), "days")
BuildingROI(planet, gebäude)numberLogInfo(BuildingROI("Home planet", BUILDING.CrystalMine))
NextAmortizationDays(planet)daysfor (const p of GetPlanets()) LogInfo(p.Name, NextAmortizationDays(p), "days")
AstrophysicsAmortizationDays()daysLogInfo("Astro:", AstrophysicsAmortizationDays(), "Plasma:", PlasmaAmortizationDays())
PlasmaAmortizationDays()daysif (PlasmaAmortizationDays() < NextAmortizationDays("Home planet")) BuildResearch("Home planet", RESEARCH.PlasmaTechnology)
GetLifeformBuildings(ref){ LifeformType, ResidentialSector, BiosphereFarm, ResearchCentre, … }const lf = GetLifeformBuildings(GetHomeWorld())
LogInfo("Residential sector level", lf.ResidentialSector)
GetLifeformResearch(ref){ IntergalacticEnvoys, HighPerformanceExtractors, … }const t = GetLifeformResearch(GetHomeWorld())
LogInfo("High-performance extractors level", t.HighPerformanceExtractors)
GetLifeformBonuses()large object with bonus fieldsLogDebug(GetLifeformBonuses())
BuildLifeformBuilding(ref, id)–BuildLifeformBuilding(GetHomeWorld(), LF_BUILDING.ResidentialSector)
BuildLifeformResearch(ref, id)–BuildLifeformResearch(GetHomeWorld(), LF_RESEARCH.HighPerformanceExtractors)
GetLifeformPrice(id, stufe){ Metal, Crystal, Deuterium, Food, Population, … }const k = GetLifeformPrice(LF_BUILDING.BiosphereFarm, 10)
LogInfo("Biosphere farm 10 costs", k.Metal, "metal")
LifeformBuildTime(gebäude, stufe, planet)secondsLogInfo(FormatDuration(LifeformBuildTime(LF_BUILDING.ResidentialSector, 20, "Home planet")))
LifeformResearchTime(forschung, stufe, [zeitReduktion])secondsLogInfo(FormatDuration(LifeformResearchTime(LF_RESEARCH.IntergalacticEnvoys, 5)))
LifeformPopulation(planet){ LivingSpace, Satisfied, FoodProduction, FoodConsumption }const p = LifeformPopulation("Home planet")
if (p.FoodProduction < p.FoodConsumption) LogWarn("Not enough food!")
GetSlots(){ InUse, Total, ExpInUse, ExpTotal }const s = GetSlots()
const freeExpos = Math.min(s.ExpTotal - s.ExpInUse, s.Total - s.InUse)
LogInfo("Free expedition slots:", freeExpos)
GetFleets()[ { ID, Mission, ReturnFlight, Origin, Destination, Ships, Resources, ArrivalTime, BackTime, ArriveIn, BackIn } ]const expos = GetFleets().filter(f => f.Mission === MISSION.EXPEDITION) const latest = Math.max(0, ...expos.map(f => f.BackIn || 0)) LogInfo(expos.length, "expeditions, all back in", FormatDuration(latest))
RefreshFleets()list of fleets (like GetFleets)const fleets = RefreshFleets() LogInfo(fleets.length, "fleets on their way")
LatestReturn(mission?){ Count, InSeconds, At }const r = LatestReturn(MISSION.EXPEDITION) LogInfo(r.Count, "expeditions, the last back at", FormatTime(r.At))
WaitForFleets(mission?, maxSekunden?)true (all back) | false (time limit)WaitForFleets(MISSION.EXPEDITION)
LogInfo("All expeditions back – next wave")
MaxExpeditions()numberconst s = GetSlots()
if (s.ExpInUse < MaxExpeditions()) LogInfo("An expedition slot is still free")
SendFleet(start, schiffe, ziel, mission, tempo?, rohstoffe?)fleet | null// transport from the home planet to the colony, 50 % speed
const fleet = SendFleet(GetHomeWorld(), { LargeCargo: 200 }, "1:20:8", MISSION.TRANSPORT, 5,
{ Metal: 1000000, Crystal: 500000 })
if (fleet) LogInfo("On its way, arrival in", FormatDuration(fleet.ArriveIn))
SendFleet(…, rohstoffe, { recallIn | recallAt })fleet | nullSendFleet(home, ships, "1:16:4:3", MISSION.DEPLOY, 1, {}, { recallAt: "03:15" })
SendFleetValidated(von, schiffe, ziel, mission, [speed], [rohstoffe], [erzwingen]){ Success, FleetID, Code, Error }const r = SendFleetValidated("Home planet", { LargeCargo: 50 }, "1:16:4:3", MISSION.TRANSPORT, 10, { Metal: 1000000 })
if (!r.Success) LogWarn("Not sent:", r.Error)
DeployAll(von, ziel, [speed], [behalten]){ Success, FleetID, Code, Error }DeployAll("1:16:4", "1:16:4:3", 10, { EspionageProbe: 5 })
CancelFleet(flottenId)–for (const f of GetFleets())
if (f.Mission === MISSION.DEPLOY && !f.ReturnFlight) CancelFleet(f.ID)
RecallFleetsByMission(mission)number of recalled fleetsconst n = RecallFleetsByMission(MISSION.DEPLOY) LogInfo(n, "deployments recalled")
FleetSave(start, rückkehrUm, optionen?){ FleetID, Destination, OneWay, Fuel, RecallAt, ReturnAt, Payload, Ships }const f = FleetSave(GetHomeWorld(), "06:30", { keep: { EspionageProbe: 1 }, keepDeuterium: 50000 })
LogInfo("Fleet save", f.FleetID, "back at", FormatTime(f.ReturnAt))
Notify("Fleet save until " + FormatTime(f.ReturnAt), "Night save")
TriggerFleetSave(ref, [minDauerSek], [{ mission, waitForFleets, all }])–// send everything away for at least 8 hours before going to sleep
TriggerFleetSave(GetHomeWorld(), 8 * 3600, { all: true, waitForFleets: true })
SwitchFleet(ref, [speed])true if done// clear the attacked celestial: fleet to the moon or the planet opposite
for (const a of GetAttacks())
SwitchFleet(FormatCoord(a.Destination) + ":" + a.Destination.Type, 10)
ScheduleRecall(flottenId, wann)timestamp of the recallconst f = SendFleet(home, { LargeCargo: 10 }, "1:16:16", MISSION.EXPEDITION)
ScheduleRecall(f.ID, 1800) // recall after 30 minutes
CancelScheduledRecall(flottenId)true if one was scheduledCancelScheduledRecall(f.ID)
GetScheduledRecalls()[ { FleetID, RecallAt, In, ScheduledBy } ]for (const r of GetScheduledRecalls()) LogInfo("Fleet", r.FleetID, "recall in", FormatDuration(r.In))
ScheduleFlight(optionen)ID of the entryconst id = ScheduleFlight({
from: GetHomeWorld(), to: "1:16:16", mission: MISSION.EXPEDITION,
ships: { LargeCargo: 300, Pathfinder: 1 }, at: "07:30:00", repeat: "daily",
random: [0, 600], name: "Morning expedition"
})
LogInfo("Planned:", id)
ScheduleJump(optionen)ID of the entryconst jump = ScheduleJump({ from: "1:100:8:3", to: "2:50:4:3", ships: "all", at: "23:00:00" })
// afterwards: everything from the target moon to its planet
ScheduleFlight({ after: jump, from: "2:50:4:3", to: "2:50:4", mission: MISSION.DEPLOY, ships: "all", resources: "all" })
GetScheduledFlights()[ { ID, Name, Kind, Active, Repeat, Next, Departure, Running, LastOutcome, LastMessage } ]for (const f of GetScheduledFlights()) LogInfo(f.Name, f.Active ? FormatTime(f.Next) : "off", f.LastOutcome || "")
CancelScheduledFlight(id)true if it existedCancelScheduledFlight(id)
SetScheduledFlightActive(id, aktiv)true if doneSetScheduledFlightActive(id, false) // pause while the attack is on
RepatriateNow([ohneLimit])"success", "stop", "failure" or "delay"const r = RepatriateNow()
if (r !== "success") LogWarn("Repatriation:", r)
CollectDeuterium(minMenge)–CollectDeuterium(500000)
CalcFlight(start, ziel, schiffe, mission?, tempo?){ FlightTime, Fuel, Distance, Cargo, FreeCargo, ArrivalAt, ReturnAt }const plan = CalcFlight(GetHomeWorld(), "1:16:16", { LargeCargo: 4000, Pathfinder: 1 }, MISSION.EXPEDITION)
LogInfo("Flight", FormatDuration(plan.FlightTime), "– deut", plan.Fuel, "– back", plan.ReturnAt)
if (GetResources(GetHomeWorld()).Deuterium < plan.Fuel) LogWarn("Not enough deuterium")
FlightTime(start, ziel, schiffe, mission?, tempo?)seconds// how long does the whole home fleet need at 10 % to the own moon?
const ships = GetShips(GetHomeWorld())
const oneWay = FlightTime(GetHomeWorld(), "1:16:4:3", ships, MISSION.DEPLOY, 1)
LogInfo("One-way flight at 10 %:", FormatDuration(oneWay))
FuelConsumption(start, ziel, schiffe, mission?, tempo?)Deuteriumconst deut = FuelConsumption(GetHomeWorld(), "2:100:8", { LargeCargo: 500 }, MISSION.TRANSPORT, 10)
LogInfo("The transport costs", deut, "deuterium")
Distance(a, b)numberlet nearest = null
for (const m of GetMoons())
if (!nearest || Distance(GetHomeWorld(), m) < Distance(GetHomeWorld(), nearest)) nearest = m
LogInfo("Nearest moon:", nearest.Name, nearest.Coords)
ShipSpeed(schiffId)numberLogInfo("Pathfinder:", ShipSpeed(SHIP.Pathfinder), "– Large Cargo:", ShipSpeed(SHIP.LargeCargo))
LowestSpeed(schiffe)SpeedLogInfo(LowestSpeed({ LargeCargo: 100, Recycler: 10 }))
ValidSpeeds()list, e.g. [1, 2, …, 10]LogInfo(ValidSpeeds())
OptimalFarmSpeed(von, ziel, schiffe, beute, [maxSpritAnteil], [maxFlugSek])speed (1–10)const speed = OptimalFarmSpeed("Home planet", "1:20:8", { LargeCargo: 20 }, { Metal: 400000, Crystal: 200000 }, 0.05, 3600)
SendFleet("Home planet", { LargeCargo: 20 }, "1:20:8", MISSION.ATTACK, speed)
ShipFuelConsumption(schiff)DeuteriumLogInfo(ShipFuelConsumption(SHIP.Recycler))
ShipFuelCapacity(schiff)DeuteriumLogInfo(ShipFuelCapacity(SHIP.Pathfinder))
FleetFuelCapacity(schiffe)DeuteriumLogInfo(FleetFuelCapacity({ LargeCargo: 500 }))
CargoCapacity(schiffe)numberconst cap = CargoCapacity(GetShips(GetHomeWorld()))
LogInfo("All ships at home hold", cap, "resources")
ShipCargo(schiffId)numberLogInfo("One Large Cargo holds", ShipCargo(SHIP.LargeCargo))
ShipsNeeded(menge, schiffId)numberconst r = GetResources(GetCelestial("Colony"))
const lc = ShipsNeeded(r, SHIP.LargeCargo)
SendFleet(GetCelestial("Colony"), { LargeCargo: lc }, GetHomeWorld().Coords, MISSION.TRANSPORT, 10, r)
CargoMix(benötigterLaderaum, verfügbareSchiffe){ LargeCargo, SmallCargo, Capacity, Enough }const mix = CargoMix(2500000, GetShips(home))
if (mix.Enough) SendFleet(home, { LargeCargo: mix.LargeCargo, SmallCargo: mix.SmallCargo }, target, MISSION.TRANSPORT)
PackResources(rohstoffe, laderaum, reihenfolge?){ Metal, Crystal, Deuterium }const r = GetResources(home)
const load = PackResources(r, CargoCapacity({ LargeCargo: 100 }))
SendFleet(home, { LargeCargo: 100 }, "1:20:8", MISSION.TRANSPORT, 10, load)
MaxTransportable(schiffe, rohstoffe, [deutBehalten]){ Metal, Crystal, Deuterium }const load = MaxTransportable({ LargeCargo: 100 }, GetResources("Home planet"), 50000)
SendFleet("Home planet", { LargeCargo: 100 }, "1:16:4:3", MISSION.TRANSPORT, 10, load)
SendExpedition(von, schiffe, ziel, [speed], [rohstoffe]){ Success, FleetID, Code, Error }const home = GetHomeWorld()
const r = SendExpedition(home, { LargeCargo: 1500, Pathfinder: 1, EspionageProbe: 1 }, home.Coordinate.Galaxy + ":" + home.Coordinate.System + ":16")
LogInfo(r.Success ? "Expo " + r.FleetID : r.Error)
SystemsInRange(system, anzahl)[ number ]const home = GetHomeWorld()
for (const s of SystemsInRange(home.Coordinate.System, 3))
SendFleet(home, { LargeCargo: 4000, Pathfinder: 1 }, home.Coordinate.Galaxy + ":" + s + ":16", MISSION.EXPEDITION)
IdealExpeditionShips(verfügbar, hauptschiff, anzahlExpeditionen)ships objectconst home = GetHomeWorld() const fleet = IdealExpeditionShips(GetShips(home), SHIP.LargeCargo, 3) SendExpedition(home, fleet, home.Coordinate.Galaxy + ":" + home.Coordinate.System + ":16")
FullExpeditionShips(verfügbar, hauptschiff, anzahlExpeditionen)ships objectLogInfo(FullExpeditionShips(GetShips("Home planet"), SHIP.LargeCargo, 4))
MilitaryShipForExpedition(verfügbar, anzahlExpeditionen)ship name or nullLogInfo(MilitaryShipForExpedition(GetShips("Home planet"), 3))
GetExpeditionMessages()[ { ID, Coordinate, Content, Resources, Ships, CreatedAt } ]let metal = 0, crystal = 0, deut = 0
for (const m of GetExpeditionMessages()) {
metal += m.Resources.Metal; crystal += m.Resources.Crystal; deut += m.Resources.Deuterium
}
LogInfo("Expeditions brought:", metal, "M", crystal, "C", deut, "D")
ExpeditionStats(stunden?){ Hours, Count, Resources, Value, Ships, ByType }const s = ExpeditionStats(24) Notify(s.Count + " expeditions, " + FormatNumber(s.Value) + " MSU", "Expeditions today")
JumpGate(vonMond, zuMond, schiffe){ Success, RechargeCountdown, Error }const r = JumpGate("1:16:4:3", "2:100:8:3", { Battleship: 50 })
if (!r.Success) LogError("Jump failed:", r.Error)
JumpGateCooldown(stufe)secondsLogInfo("Jump gate level 5 recharges in", FormatDuration(JumpGateCooldown(5)))
JumpGateReady(mond)secondsconst wait = JumpGateReady("1:16:4:3")
if (wait > 0) SleepSec(wait + 5)
JumpGate("1:16:4:3", "2:100:8:3", { Battleship: 50 })
JumpGateInfo(mond){ Ready, Cooldown, Destinations: [ { ID, Coords, Name } ] }const info = JumpGateInfo("1:16:4:3")
if (!info.Ready) SleepSec(info.Cooldown + 5)
const target = info.Destinations.find(d => d.Coords === "2:100:8")
if (target) JumpGate("1:16:4:3", target.ID, { Battleship: 50 })
Phalanx(mond, koordinate)[ fleet ]for (const f of Phalanx("1:16:4:3", "1:18:7"))
LogInfo("Fleet mission", f.Mission, "arrival in", FormatDuration(f.ArriveIn))
GetAttacks()[ { ID, MissionType, Origin, Destination, DestinationName, ArrivalTime, ArriveIn, AttackerName, AttackerID, Missiles, Ships } ]for (const a of GetAttacks())
LogWarn(a.AttackerName, "attacks", a.DestinationName, "– arrival in", FormatDuration(a.ArriveIn))
IsPlanetUnderAttack(ref)true | falsefor (const p of GetPlanets())
if (IsPlanetUnderAttack(p)) StartScript("Fleetsave", { planet: p.Coords })
SpyCrash(ref, [ziel])–SpyCrash("Home planet")
GetGalaxyInfo(galaxie, system){ Galaxy, System, Planets: [ { Name, Coordinate, Player, Alliance, Debris, Inactive, Vacation, … } | null ], ExpeditionDebris }const sys = GetGalaxyInfo(1, 16)
for (const p of sys.Planets)
if (p && p.Inactive) LogInfo("Inactive:", p.Player.Name, FormatCoord(p.Coordinate))
ScanSystem(galaxie, system){ Galaxy, System, Planets: [ { Position, Name, Player, Alliance, HasMoon, Inactive, Vacation, Debris, … } ] }for (const s of SystemsInRange(GetHomeWorld().Coordinate.System, 20)) {
ScanSystem(1, s)
SleepRandSec(2, 5)
}
GetCachedSystem(galaxie, system, maxAlterMin?){ ScannedAt, Info } | nullconst c = GetCachedSystem(1, 17, 60) || { Info: ScanSystem(1, 17) }
LogInfo(c.Info.Planets.length, "planets in 1:17")
FindPlayer(name)[ { Coords, PlanetName, PlayerName, PlayerID, Alliance, HasMoon, Inactive, Vacation, ScannedAt } ]for (const p of FindPlayer(GetAttacks()[0].AttackerName))
LogInfo("Attacker planet:", p.Coords, p.HasMoon ? "(with moon)" : "")
GalaxyCacheInfo(){ Systems, Planets, Players, OldestScan, NewestScan }const i = GalaxyCacheInfo() LogInfo(i.Systems, "systems,", i.Players, "players in the cache")
ClearGalaxyCache()–ClearGalaxyCache()
GetEspionageReports(seite?)[ { ID, Type, From, Target, LootPercentage } ]for (const b of GetEspionageReports())
LogInfo("Report", b.ID, "for", FormatCoord(b.Target))
GetEspionageReport(meldungsId){ Username, Metal, Crystal, Deuterium, HasFleetInformation, HasDefensesInformation, …, Schiffe, Verteidigung }const r = GetEspionageReport(GetEspionageReports()[0].ID) LogInfo(r.Username, "has", r.Metal + r.Crystal + r.Deuterium, "resources")
GetEspionageReportFor(koordinate)espionage reportconst r = GetEspionageReportFor("1:18:7")
if (r.HasFleetInformation && r.LightFighter === 0) LogInfo("Target without fighters")
SimulateBattle(angreifer, verteidiger, optionen?){ AttackerWins, DefenderWins, Draws (in %), AverageRounds, Attacker: { Lost, Remaining, LostResources }, Defender: {…}, Debris, DefencesRebuilt }const report = GetEspionageReportFor("1:18:7")
const sim = SimulateBattle({ Cruiser: 200, LargeCargo: 50 }, report)
LogInfo("Win:", sim.AttackerWins, "% – own losses:", FormatNumber(ResourceValue(sim.Attacker.LostResources)), "MSU")
if (sim.AttackerWins === 100 && sim.Attacker.LostResources.Metal === 0) LogInfo("Attack without losses possible")
GetAvailableDiscoveries(ref)numberconst n = GetAvailableDiscoveries(GetHomeWorld()) LogInfo(n, "discovery fleets available")
GetDiscoveryPositions(ref, koordinate)[ coordinate ]const free = GetDiscoveryPositions(GetHomeWorld(), "1:17:1") LogInfo(free.length, "positions in system 1:17 can be explored")
SendDiscovery(ref, ziel)true | falsefor (const c of GetDiscoveryPositions(home, "1:17:1").slice(0, 3)) {
SendDiscovery(home, c)
SleepRandSec(2, 5)
}
SendSystemDiscovery(ref, galaxie, system)[ sent coordinates ]const targets = SendSystemDiscovery(GetHomeWorld(), 1, 17) LogInfo(targets.length, "discoveries sent to system 1:17")
GetGamePage(seite)the page's HTML as textconst html = GetGamePage({ page: "ingame", component: "overview" })
const m = html.match(/darkmatter[^>]*>\s*([\d.]+)/i)
if (m) LogInfo("Dark matter:", m[1])
GetAllianceInfoPage(allianzId)HTML as textconst html = GetAllianceInfoPage(500123)
LogInfo(html.includes("Bewerbung") ? "Accepts applications" : "closed")
BuyOfferOfTheDay()"bought" | "already" | "unknown"const r = BuyOfferOfTheDay()
if (r === "bought") LogInfo("Daily offer bought")
GetAuction(){ HasFinished, Endtime, NumBids, CurrentBid, MinimumBid, HighestBidder, CurrentItem, Resources, … }const a = GetAuction() LogInfo(a.CurrentItemLong, "– bid", a.CurrentBid, "– ends in", FormatDuration(a.Endtime))
BidAuction(ref, rohstoffe)–const a = GetAuction()
if (!a.HasFinished && a.HighestBidder !== GetUserInfo().PlayerName)
BidAuction(GetHomeWorld(), { Metal: a.MinimumBid })
BidAuctionMinimum()–const a = GetAuction() if (a && !a.HasFinished) BidAuctionMinimum()
Notify(text, titel?){ Discord, Telegram } – each true if sentconst f = FleetSave(GetHomeWorld(), "06:30")
Notify("Back at " + FormatTime(f.ReturnAt) + ", deut " + FormatNumber(f.Fuel), "Fleet save started")
NotifyDiscord(text, titel?)true | falseif (IsUnderAttack()) NotifyDiscord("Attack on " + GetAttacks()[0].DestinationName, "⚠️ Attack")
NotifyTelegram(text, titel?)true | falseNotifyTelegram("Daily offer: " + BuyOfferOfTheDay())
StartModule(name)true | falseStartModule("Expeditions")
StopModule(name, sofort?)true | false// the script handles the expeditions itself
StopModule("Expeditions")
IsModuleActive(name)true | falseif (!IsModuleActive("Defender")) StartModule("Defender")
DefenderOnExit()–DefenderOnExit()
// ... attack protection may be off for a while now:
StopModule("Defender")
IsFeatureRunning(feature)true/falseLogInfo("Defender running:", IsFeatureRunning(FEATURE.Defender))
ListProfiles()list of textsLogInfo(ListProfiles())
GetRunningProfiles()list of textsLogInfo("Active:", GetRunningProfiles())
LoadProfile(name | [namen])–LoadProfile(IsTimeBetween("23:00", "07:00") ? "Night" : "Day")
ResetProfile()–ResetProfile()
StartSleepMode(bis)–StartSleepMode("07:30")
WakeUpNow()–if (IsSleeping() && IsUnderAttack()) WakeUpNow()
CancelGhostSleep()–CancelGhostSleep()
GetNextWakeTime()timestamp or nullconst t = GetNextWakeTime()
if (t) LogInfo("Wakes up at", FormatTime(t))
StartScript(name, args?)true if startedStartScript("Transport", { target: "1:20:8", amount: 500 })
StopScript(name)true if it was runningif (IsUnderAttack()) StopScript("Expos")
PauseScript(name)true | falsePauseScript("FarmRound")
SleepMin(15)
ResumeScript("FarmRound")
ResumeScript(name)true | falseif (GetScriptState("Expos") === "paused") ResumeScript("Expos")
IsScriptRunning(name)true | falseif (!IsScriptRunning("Guard")) StartScript("Guard")
GetScriptState(name)"running" | "paused" | "stopped" | "finished" | "error"if (GetScriptState("Expos") === "error") StartScript("Expos") // restart after an error
ListScripts()[ { Name, State, Autostart } ]for (const s of ListScripts()) LogInfo(s.Name, s.State, s.Autostart ? "(Autostart)" : "")
SendSignal(skript, daten?)true if deliveredSendSignal("Expos", { pause: true, reason: "fleet save" })
WaitSignal(timeoutSek?){ from, data } | null bei Timeoutconst msg = WaitSignal(60)
if (msg && msg.data.pause) {
LogInfo("Pause requested by", msg.from)
SleepMin(10)
}
SetShared(schlüssel, wert)–SetShared("fleetSaveActive", true)
// … save the fleet …
SetShared("fleetSaveActive", false)
GetShared(schlüssel, standard?)value | default | nullwhile (GetShared("fleetSaveActive", false)) SleepSec(30)
StorePut(schlüssel, wert)–const today = new Date().toISOString().slice(0, 10)
StorePut("expo:" + today, ExpeditionStats(24))
StoreGet(schlüssel, standard?)value | defaultconst cfg = StoreGet("config", { lcPerExpo: 4000, systems: 2 })
LogInfo("LC per expedition:", cfg.lcPerExpo)
StoreHas(schlüssel)true | falseif (!StoreHas("config")) StorePut("config", { lcPerExpo: 4000 })
StoreDelete(schlüssel)–StoreDelete("tmp:fleetsave")
StoreKeys(präfix?)[ text ]for (const k of StoreKeys("expo:")) LogInfo(k, StoreGet(k).Count, "expeditions")
GlobalPut(schlüssel, wert)–GlobalPut("settings/" + InstanceName, { expoSlots: 5 })
GlobalGet(schlüssel, standard?)the stored value | default | nullconst e = GlobalGet("settings/" + InstanceName, {})
LogInfo(e)
GlobalGetEntry(schlüssel){ Value, Bot, Universe, UpdatedAt } | nullconst e = GlobalGetEntry("settings/" + InstanceName)
if (e) LogInfo("from", e.Bot, "in", e.Universe, "at", FormatTime(e.UpdatedAt))
GlobalHas(schlüssel)true/falseif (!GlobalHas("settings/" + InstanceName)) StartScript("Settings")
GlobalDelete(schlüssel)–GlobalDelete("test")
GlobalKeys(präfix?, bot?)[ { Key, Bot, Universe, UpdatedAt } ]for (const e of GlobalKeys("settings/")) LogInfo(e.Key, "–", e.Bot, e.Universe)
SetDashboardCard(id, kasten)–const r = GetResources(GetHomeWorld())
SetDashboardCard("storage", {
title: "Homeworld storage",
level: r.Deuterium < 1000000 ? "warning" : "success",
rows: { Metal: FormatNumber(r.Metal), Crystal: FormatNumber(r.Crystal), Deuterium: FormatNumber(r.Deuterium) },
text: "As of " + TimeOfDay(),
})
RemoveDashboardCard(id)–function OnExit() {
RemoveDashboardCard("storage")
}
const FORM = { … }–const FORM = {
title: "Transport",
fields: [
{ key: "target", label: "Target", type: "celestial" },
{ key: "amount", label: "Deuterium", type: "number", default: 100000, min: 0 },
{ key: "now", label: "Send right away", type: "bool", default: true },
],
}
const values = GetFormValues()
LogInfo(values.target, values.amount, values.now)
GetFormValues(skript?){ key: value, … }const cfg = GetFormValues("Settings")
if (cfg.active) LogInfo("Target:", cfg.target)
UniBots()[{ Alias, Role ("main" | "guard" | "none"), Protects, LoggedIn, PlayerName, Self }]for (const b of UniBots())
LogInfo(b.Alias, b.Role, b.LoggedIn ? "online" : "offline")
UniRole()"main" | "guard" | "none"if (UniRole() === "guard") LogInfo("I'm watching over", UniMain())
UniMain()bot name | nullconst main = UniMain()
if (main) UniSend("note", { text: "Player X active" }, main)
UniSend(thema, daten?, an?)message IDUniSend("active", { player: "Raider", system: "1:120" })
UniReceive(thema?)[{ Id, At, From, To, Topic, Data }]while (true) {
for (const m of UniReceive("attack"))
LogWarn(m.From, "is under attack:", m.Data.attacker, "→", m.Data.target, "level", m.Data.level)
SleepRandSec(20, 40)
}
UniShare(schlüssel, wert, minuten?)–UniShare("inactives/1:120", GetCachedSystem(1, 120), 60)
UniGet(schlüssel, standard?)the value | default | nullconst sys = UniGet("inactives/1:120")
if (!sys) ScanSystem(1, 120)
UniGetEntry(schlüssel){ Value, From, At } | nullconst e = UniGetEntry("inactives/1:120")
if (e) LogInfo("from", e.From, "at", e.At)
UniReserve(schlüssel, minuten?)true/falseif (UniReserve("farm/1:120:8", 45))
LogInfo("Target is mine")
else
LogInfo("Target reserved by", UniHolder("farm/1:120:8"))
UniRelease(schlüssel)–UniRelease("farm/1:120:8")
UniHolder(schlüssel)bot name | nullLogInfo(UniHolder("farm/1:120:8") ?? "free")
GetThreats()[{ Level ("green" | "yellow" | "red"), Target, TargetName, TargetIsMoon, Attacker, AttackerId, Origin, Arrival, ArriveIn, Fleets, OnlyProbes, ShipsKnown, Ships, Missiles, AttackerWinChance, Loot, Collisions: [{ FleetId, Mission, ReturnFlight, Lands, MinutesFromArrival, Ships, Cargo, RecallLands, RecallHelps }], Reasons }]for (const t of GetThreats()) {
for (const c of t.Collisions)
if (c.RecallHelps) { LogWarn("Recalling fleet", c.FleetId); CancelFleet(c.FleetId) }
}
AbandonPlanet(ref, "BESTÄTIGT")true | falseconst p = GetCelestial("1:400:8")
if (p.Fields.Total < 150 && p.Fields.Built === 0)
AbandonPlanet(p, "BESTÄTIGT")
TearDown(ref, gebäude, "BESTÄTIGT")–// tear down a lunar base level to free a field
TearDown("1:16:4:3", BUILDING.LunarBase, "BESTÄTIGT")
SendIPM(von, ziel, anzahl, [primärziel], "BESTÄTIGT")flight time of the missiles in secondsconst sec = SendIPM("Home planet", "1:20:8", 10, DEFENCE.PlasmaTurret, "BESTÄTIGT")
LogInfo("Impact in", FormatDuration(sec))
DeleteEspionageReport(meldungsId, "BESTÄTIGT")–for (const b of GetEspionageReports())
if (b.LootPercentage < 0.5) DeleteEspionageReport(b.ID, "BESTÄTIGT")
DeleteAllEspionageReports("BESTÄTIGT")–DeleteAllEspionageReports("BESTÄTIGT")
DeleteAllMessages(tab, "BESTÄTIGT")–// clean up expedition and combat reports once a day DeleteAllMessages(MESSAGE_TAB.EXPEDITIONS, "BESTÄTIGT") DeleteAllMessages(MESSAGE_TAB.COMBAT, "BESTÄTIGT")
ActivateItem(ref, itemRef, "BESTÄTIGT")ogamed's answerconst booster = GetItems(home).find(i => i.Name === "Bronze Deuterium Booster" && i.Amount > 0) if (booster) ActivateItem(home, booster.Ref, "BESTÄTIGT")
SendPlayerMessage(spielerId, text, "BESTÄTIGT")–for (const a of GetAttacks())
SendPlayerMessage(a.AttackerID, "Nothing to get here.", "BESTÄTIGT")
MessageAttackers(text, "BESTÄTIGT")–if (IsUnderAttack()) MessageAttackers("The fleet is gone and so are the resources – save your fuel.", "BESTÄTIGT")
PostGamePage(seite, formulardaten, "BESTÄTIGT")the game's answer as text (read JSON answers with JSON.parse)const answer = PostGamePage("page=ingame&component=marketplace&tab=history_buying&action=collectItem&asJson=1",
{ marketItemId: 12345, token: "…" }, "BESTÄTIGT")
LogInfo(answer)
GameLogout("BESTÄTIGT")–GameLogout("BESTÄTIGT")
SleepMin(RandomInt(20, 40))
GameLogin()