Skripte sind JavaScript und laufen pro Bot direkt in HIVE – über die bestehende Spielverbindung des Bots. Alle Befehle sind global verfügbar. Anfragen ans Spiel werden automatisch gedrosselt (mind. 0,3 s Abstand), damit das Konto nicht auffällt.
Anhalten und Pause greifen jederzeit, auch mitten in einer Schleife. Fehler der Spiel-API lassen sich mit try { … } catch (e) { LogError(e.message) } abfangen.
Eigene Planeten/Monde kann man überall als Objekt aus GetPlanets(), als ID, als Name oder als Koordinate angeben: "1:16:4" = Planet, "1:16:4:3" = Mond.
Unwiderrufliche oder nach außen sichtbare Aktionen brauchen als letztes Argument das Wort "BESTÄTIGT" – ohne passiert nichts. Anmelden, Abmelden und Captcha gibt es für Skripte nicht, weil sie die laufende Spielsitzung beenden würden. Skripte haben keinen Zugriff auf Dateien, Netzwerk oder den 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").
// Beispiel: Expeditionswellen vom Heimatplaneten
const LARGE_CARGO = 4000
while (true) {
if (IsSleeping()) { SleepMin(5); continue }
const home = GetHomeWorld()
const slots = GetSlots()
const frei = Math.min(slots.ExpTotal - slots.ExpInUse, slots.Total - slots.InUse)
for (let i = 0; i < frei; i++) {
const system = home.Coordinate.System + RandomInt(-1, 1)
const ziel = home.Coordinate.Galaxy + ":" + system + ":16"
const fleet = SendFleet(home, { LargeCargo: LARGE_CARGO, Pathfinder: 1 }, ziel, MISSION.EXPEDITION)
if (!fleet) { LogWarn("Keine Schiffe mehr"); break }
SleepRandSec(2, 5)
}
SleepRandSec(300, 600)
}
LogInfo(...werte)–const s = GetSlots()
LogInfo("Flottenslots:", s.InUse, "/", s.Total)
LogWarn(...werte)–if (GetShips(GetHomeWorld()).ColonyShip === 0)
LogWarn("Kein Kolonieschiff mehr auf dem Heimatplaneten")
LogError(...werte)–try {
SendFleet(home, { LargeCargo: 100 }, "1:16:16", MISSION.EXPEDITION)
} catch (e) {
LogError("Senden fehlgeschlagen:", e.message)
}
LogDebug(...werte)–const fleets = GetFleets()
LogDebug("Rohdaten erste Flotte:", fleets[0])
Print(...werte)–Print("Skript", ScriptName, "gestartet")
Sleep(millisekunden)–for (const p of GetPlanets()) {
LogInfo(p.Name, GetResources(p).Metal)
Sleep(1500) // 1,5 s Abstand zwischen den Abfragen
}
SleepSec(sekunden)–while (IsUnderAttack()) {
LogWarn("Angriff läuft – warte")
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("Urlaubsmodus aktiv – nichts zu tun")
Exit()
}
IsSleeping()true | falsewhile (true) {
if (IsSleeping()) { SleepMin(10); continue }
// … eigentliche Arbeit …
SleepMin(5)
}
function OnExit() { … }–StopModule("Expeditions") // Modul während des Skripts aus
function OnExit() {
StartModule("Expeditions") // beim Ende wieder an
}
argsbeliebig | null// gestartet mit StartScript("Transport", { ziel: "1:20:8", menge: 500 })
const ziel = args ? args.ziel : "1:16:4"
const menge = args ? args.menge : 100
ScriptName / InstanceNameTextLogInfo(ScriptName + " läuft auf " + InstanceName)
Skript „_shared“–// Skript „_shared“:
function ToMsu(r) { return r.Metal + r.Crystal * 1.5 + r.Deuterium * 3 }
// jedes andere Skript dieses Bots:
LogInfo("MSU: " + FormatNumber(ToMsu(GetResources(GetHomeWorld()))))
FormatNumber(zahl)TextLogInfo("Metall:", FormatNumber(GetResources(GetHomeWorld()).Metal)) // Metall: 1,366,412
FormatDuration(sekunden)Textfor (const f of GetFleets())
LogInfo("Flotte", f.ID, "zurück in", FormatDuration(f.BackIn || f.ArriveIn))
FormatTime(zeitstempel | isoText, format?)Textconst r = LatestReturn(MISSION.EXPEDITION)
LogInfo("Letzte Expedition zurück um", FormatTime(r.At))
ParseCoord(koordinate){ Galaxy, System, Position, Type }const c = ParseCoord("2:150:8")
LogInfo("Galaxie", c.Galaxy, "System", c.System)
FormatCoord(koordinate)Textconst home = GetHomeWorld()
const ziel = FormatCoord({ Galaxy: home.Coordinate.Galaxy, System: home.Coordinate.System + 1, Position: 16 })
// ziel = "1:17:16"
RandomInt(min, max)Zahlconst home = GetHomeWorld() const system = home.Coordinate.System + RandomInt(-2, 2) const ziel = home.Coordinate.Galaxy + ":" + system + ":16"
DailyRandom(min, max, salt?)Zahl// jeden Tag ein anderer, aber über den Tag fester Versatz von 0–15 Minuten
const versatz = DailyRandom(0, 900)
SleepUntil(NextTimeAt("06:00") + versatz)
DailyRandomTime("von", "bis", salt?)"HH:MM:SS"const aufstehen = DailyRandomTime("06:10", "06:40")
LogInfo("Heute Rückkehr um", aufstehen)
FleetSave(GetHomeWorld(), aufstehen)
Timestamp()Zahlconst start = Timestamp()
// … Arbeit …
LogInfo("Dauer:", FormatDuration(Timestamp() - start))
TimeOfDay()TextLogInfo("Es ist", TimeOfDay())
NextTimeAt("HH:MM[:SS]")Zeitstempelconst ziel = NextTimeAt("07:00")
LogInfo("Noch", FormatDuration(ziel - Timestamp()), "bis 07:00")
TimeAt("HH:MM[:SS]", tagVersatz?)Zeitstempelconst morgenFrueh = TimeAt("06:30", 1)
LogInfo("Morgen 06:30 =", FormatTime(morgenFrueh))
IsTimeBetween("von", "bis")true | falseif (IsTimeBetween("01:00", "06:30")) { LogInfo("Nachtpause"); SleepUntil("06:30") }
SleepUntil("HH:MM[:SS]" | zeitstempel)–SleepUntil("06:30")
LogInfo("Guten Morgen – Flotte zurückholen")
SleepUntilIfToday("HH:MM[:SS]")true (gewartet) | false (heute schon vorbei)if (SleepUntilIfToday("18:00")) BuyOfferOfTheDay()
else LogInfo("18:00 heute schon vorbei – übersprungen")
GetUserInfo(){ PlayerID, PlayerName, Points, Rank, Total, HonourPoints, Class }const me = GetUserInfo() LogInfo(me.PlayerName, "– Platz", me.Rank, "von", me.Total, "–", me.Points, "Punkte")
GetUsername()Textconst login = GetUsername()
LogInfo("Login:", login.replace(/^(..).*(@.*)$/, "$1***$2")) // maskiert ausgeben
GetUserClass()0 | 1 | 2 | 3if (GetUserClass() === CHARACTER_CLASS.DISCOVERER)
LogInfo("Entdecker: mehr Expeditions-Ertrag")
GetAllianceClass()0 | 1 | 2 | 3if (GetAllianceClass() === ALLIANCE_CLASS.TRADER) LogInfo("Händler-Allianz")
GetResearch(){ EnergyTechnology, LaserTechnology, …, Astrophysics, ComputerTechnology, … }const r = GetResearch()
const maxExpos = Math.floor(Math.sqrt(r.Astrophysics))
LogInfo("Max. Expeditionen laut Astrophysik:", 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("Kein Admiral – ein Flottenslot weniger")
HasCommander() / HasAdmiral() / HasEngineer() / HasGeologist() / HasTechnocrat()true | falseif (HasGeologist()) LogInfo("Geologe aktiv: +10 % Minenproduktion")
GetServerData(){ Speed, SpeedFleetWar, SpeedFleetPeaceful, SpeedFleetHolding, Galaxies, Systems, DonutGalaxy, DonutSystem, DebrisFactor, … }const sd = GetServerData()
LogInfo("Uni", sd.Name, "Speed", sd.Speed, "–", sd.Galaxies, "Galaxien")
GetServerInfo(){ Name, Number, Language, PlayerCount, PlayersOnline, Opened, StartDate, … }const info = GetServerInfo() LogInfo(info.PlayersOnline, "von", info.PlayerCount, "Spielern online")
GetServerTime()ISO-Zeitstempel (Text)const t = new Date(GetServerTime())
if (t.getHours() >= 1 && t.getHours() < 6) LogInfo("Nachtruhe auf dem Server")
GetServerSpeed() / GetServerFleetSpeed()ZahlLogInfo("Ökonomie x" + GetServerSpeed(), "Flotte x" + GetServerFleetSpeed())
GetServerName() / GetServerLanguage() / GetServerUrl() / GetServerVersion()TextLogInfo(GetServerName(), GetServerLanguage().toUpperCase(), "Version", GetServerVersion())
GetOgamedIP()TextLogInfo("ogamed geht raus über", GetOgamedIP())
GetHiveIP()TextLogInfo("HIVE:", GetHiveIP(), "– Spiel:", GetOgamedIP())
GetOgamedTasks(){ Low, Normal, Important, Critical, Total }while (GetOgamedTasks().Total > 0) Sleep(500)
LogInfo("ogamed ist frei")
GameLogin()–try { GetUserInfo() } catch (e) { LogWarn("Sitzung weg – melde neu an"); 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, "Felder")
GetMoons()[ { ID, Name, Type, Coordinate, Coords, Fields } ]LogInfo("Du hast", GetMoons().length, "Monde")
GetCelestials()[ Himmelskörper ]for (const c of GetCelestials())
LogInfo(c.Type === "Moon" ? "Mond" : "Planet", c.Name, c.Coords)
GetPlanetsLive() / GetMoonsLive()[ Himmelskörper ]const vorher = GetPlanets().length
SleepMin(1)
if (GetPlanetsLive().length > vorher) LogInfo("Neue Kolonie!")
GetHomeWorld()Himmelskörper { ID, Name, Type, Coords, Coordinate, … } | nullconst home = GetHomeWorld()
LogInfo("Heimat:", home.Name, home.Coords)
GetCelestial(ref)Himmelskörperconst mond = GetCelestial("1:16:4:3")
const kolonie = GetCelestial("Kolonie")
GetPlanetAt(koordinate)Planet | nullconst p = GetPlanetAt("1:16:4")
if (p) LogInfo(p.Name, "hat", p.Fields.Total, "Felder, max.", p.Temperature.Max, "°C")
GetMoonAt(koordinate)Mond | nullif (!GetMoonAt(GetHomeWorld().Coords)) LogInfo("Heimatplanet hat (noch) keinen Mond")
NearestOwnMoon(ref | koordinate)Mond | nullconst mond = NearestOwnMoon(GetHomeWorld())
if (!mond) LogWarn("Kein Mond für einen Fleetsave vorhanden")
GetEmpire("planets" | "moons")[ { ID, Name, Coords, Coordinate, Fields, Resources, Buildings, Facilities, Ships, Defences } ]let metall = 0
for (const p of GetEmpire("planets")) metall += p.Resources.Metal
LogInfo("Metall gesamt:", metall)
MaxPlanets()Zahlif (GetPlanets().length < MaxPlanets()) StartModule("Colonize")
GetResources(ref){ Metal, Crystal, Deuterium, Energy, Food, Population, Darkmatter }const r = GetResources(GetHomeWorld())
if (r.Energy < 0) LogWarn("Energiemangel auf dem Heimatplaneten")
GetResourcesDetails(planet){ Metal: { Available, StorageCapacity, CurrentProduction }, Crystal, Deuterium, Energy, Food, Population }const d = GetResourcesDetails(GetHomeWorld())
if (d.Metal.Available >= d.Metal.StorageCapacity)
LogWarn("Metalllager voll – Mine steht")
GetResourceSettings(planet){ MetalMine, CrystalMine, DeuteriumSynthesizer, SolarPlant, FusionReactor, SolarSatellite, Crawler }const f = GetResourceSettings(GetHomeWorld())
if (f.MetalMine < 1) LogWarn("Metallmine läuft nur mit", f.MetalMine * 100, "%")
SetResourceSettings(planet, { MetalMine, CrystalMine, DeuteriumSynthesizer, SolarPlant, FusionReactor, SolarSatellite, Crawler })die neuen Einstellungen (wie GetResourceSettings)// Nachts Fusionskraftwerk aus, spart Deuterium
for (const p of GetPlanets())
SetResourceSettings(p, { FusionReactor: 0 })
PlanetProduction(planet){ Metal, Crystal, Deuterium, Food }const p = PlanetProduction("Heimatplanet")
LogInfo("pro Tag:", FormatNumber(p.Metal * 24), "Metall")
StorageCapacity(stufe)Anzahlconst b = GetBuildings("Heimatplanet")
LogInfo("Metallspeicher fasst", FormatNumber(StorageCapacity(b.MetalStorage)))
ResourceValue(rohstoffe, kurs?)ZahlLogInfo("Heimatplanet ist", FormatNumber(ResourceValue(GetResources(GetHomeWorld()))), "MSU wert")
EnergyProduction(gebäude, stufe)EnergieLogInfo(EnergyProduction(BUILDING.SolarPlant, 30))
SolarSatelliteProduction(planet)Energie pro SatellitLogInfo(SolarSatelliteProduction("Heimatplanet"))
SolarSatellitesNeeded(planet, [energie])Anzahlconst n = SolarSatellitesNeeded("Heimatplanet")
if (n > 0) BuildShips("Heimatplanet", SHIP.SolarSatellite, n)
OptimalCrawlers(planet)Anzahlconst fehlt = OptimalCrawlers("Heimatplanet") - GetShips("Heimatplanet").Crawler
if (fehlt > 0) BuildShips("Heimatplanet", SHIP.Crawler, fehlt)
MaxCrawlers(planet)AnzahlLogInfo(MaxCrawlers("Heimatplanet"))
GetBuildings(ref){ MetalMine, CrystalMine, DeuteriumSynthesizer, SolarPlant, FusionReactor, SolarSatellite, MetalStorage, CrystalStorage, DeuteriumTank }const b = GetBuildings(GetHomeWorld())
LogInfo("Minen:", 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("Werft zu klein für Große Transporter")
GetTechs(ref){ supplies, facilities, ships, defenses, researches }const t = GetTechs(GetHomeWorld())
LogInfo("Werft", 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("Bauschleife frei")
else LogInfo("Bau fertig in", FormatDuration(k.BuildingCountdown))
GetProduction(ref)[ { ID, Nbr } ]if (GetProduction(GetHomeWorld()).length === 0) LogInfo("Werft ist frei")
ShipyardQueueTime(ref)Sekundenconst rest = ShipyardQueueTime(GetHomeWorld())
LogInfo("Werft frei in", FormatDuration(rest))
GetShips(ref){ LightFighter, …, SmallCargo, LargeCargo, …, Reaper, Pathfinder }const s = GetShips(GetHomeWorld())
LogInfo("Große Transporter:", 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 senden = MobileShips(GetShips(home), { LargeCargo: 50, EspionageProbe: 1 })
SendFleet(home, senden, "1:16:4:3", MISSION.DEPLOY)
ShipsTotal(schiffe)ZahlLogInfo("Schiffe auf der Heimat:", 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("Artefaktspeicher voll")
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("Heimatplanet", DEFENCE.RocketLauncher, 100)
BuildProduction("Heimatplanet", 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])SekundenLogInfo("Astro dauert", FormatDuration(ResearchTime(RESEARCH.Astrophysics)))
GetPrice(id, stufeOderAnzahl){ Metal, Crystal, Deuterium, Energy, … }const kosten = GetPrice(SHIP.LargeCargo, 100)
const r = GetResources(GetHomeWorld())
if (r.Metal >= kosten.Metal && r.Crystal >= kosten.Crystal)
BuildShips(GetHomeWorld(), SHIP.LargeCargo, 100)
PriceRange(id, vonStufe, bisStufe){ Metal, Crystal, Deuterium }const k = PriceRange(BUILDING.MetalMine, 31, 35)
LogInfo("Metallmine 31–35 kostet", FormatNumber(k.Metal), "M", FormatNumber(k.Crystal), "K")
CanAfford(kosten, bestand)true | falseif (CanAfford(GetPrice(BUILDING.MetalMine, 31), GetResources(home))) BuildBuilding(home, BUILDING.MetalMine)
MissingResources(kosten, bestand){ Metal, Crystal, Deuterium }const fehlt = MissingResources(GetPrice(RESEARCH.Astrophysics, 10), GetResources(home))
LogInfo("Es fehlen", FormatNumber(fehlt.Crystal), "Kristall")
MaxBuildable(id, rohstoffe)Anzahlconst res = GetResources("Heimatplanet")
BuildShips("Heimatplanet", SHIP.LargeCargo, MaxBuildable(SHIP.LargeCargo, res))
GetRequirements(id)[ { ID, Name, Level } ]for (const r of GetRequirements(SHIP.LargeCargo))
LogInfo("Braucht", r.Name, "Stufe", r.Level)
BuildTime(id, stufe, ref)Sekundenconst t = BuildTime(BUILDING.MetalMine, 30, GetHomeWorld())
LogInfo("Metallmine 30 dauert", FormatDuration(t))
GetNextLevel(ref, id)Stufeconst n = GetNextLevel("Heimatplanet", BUILDING.MetalMine)
LogInfo("Metallmine", n, "kostet", PriceRange(BUILDING.MetalMine, n, n))
NextMineToBuild(planet, [maxMetall], [maxKristall], [maxDeut], [startOptimiert])Gebäudename oder nullconst next = NextMineToBuild("Heimatplanet", 40, 35, 30)
if (next) BuildBuilding("Heimatplanet", next)
NextEnergySourceToBuild(planet, [maxSolar], [maxFusion], [satelliten])Gebäude-/Schiffsname oder nullLogInfo(NextEnergySourceToBuild("Heimatplanet", 30, 20, true))
NextResearchToBuild([planet])Forschungsname oder nullconst r = NextResearchToBuild()
if (r) BuildResearch("Heimatplanet", r)
NextLunarFacilityToBuild(mond, [{ LunarBase, RoboticsFactory, SensorPhalanx, JumpGate, Shipyard }])Gebäudename oder nullconst b = NextLunarFacilityToBuild("1:16:4:3", { SensorPhalanx: 8 })
if (b) BuildBuilding("1:16:4:3", b)
NextLifeformBuildingToBuild(planet, [{ max, preventIfMoreExpensiveThanNextMine, preventTechBuilding }])Gebäudename oder nullconst b = NextLifeformBuildingToBuild("Heimatplanet", { max: { ResidentialSector: 40, BiosphereFarm: 40 } })
if (b) BuildLifeformBuilding("Heimatplanet", b)
NextLifeformResearchToBuild(planet, [höchststufen])Forschungsname oder nullconst t = NextLifeformResearchToBuild("Heimatplanet")
if (t) BuildLifeformResearch("Heimatplanet", t)
IsAstrophysicsPositionValid(position)true/falsefor (let pos = 1; pos <= 15; pos++) if (!IsAstrophysicsPositionValid(pos)) LogInfo("Position", pos, "noch gesperrt")
AmortizationDays(planet, gebäude)Tagefor (const m of [BUILDING.MetalMine, BUILDING.CrystalMine, BUILDING.DeuteriumSynthesizer])
LogInfo(m, AmortizationDays("Heimatplanet", m), "Tage")
BuildingROI(planet, gebäude)ZahlLogInfo(BuildingROI("Heimatplanet", BUILDING.CrystalMine))
NextAmortizationDays(planet)Tagefor (const p of GetPlanets()) LogInfo(p.Name, NextAmortizationDays(p), "Tage")
AstrophysicsAmortizationDays()TageLogInfo("Astro:", AstrophysicsAmortizationDays(), "Plasma:", PlasmaAmortizationDays())
PlasmaAmortizationDays()Tageif (PlasmaAmortizationDays() < NextAmortizationDays("Heimatplanet")) BuildResearch("Heimatplanet", RESEARCH.PlasmaTechnology)
GetLifeformBuildings(ref){ LifeformType, ResidentialSector, BiosphereFarm, ResearchCentre, … }const lf = GetLifeformBuildings(GetHomeWorld())
LogInfo("Wohnsektor Stufe", lf.ResidentialSector)
GetLifeformResearch(ref){ IntergalacticEnvoys, HighPerformanceExtractors, … }const t = GetLifeformResearch(GetHomeWorld())
LogInfo("Hochleistungsextraktoren Stufe", t.HighPerformanceExtractors)
GetLifeformBonuses()großes Objekt mit Bonus-FeldernLogDebug(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("Biosphärenfarm 10 kostet", k.Metal, "Metall")
LifeformBuildTime(gebäude, stufe, planet)SekundenLogInfo(FormatDuration(LifeformBuildTime(LF_BUILDING.ResidentialSector, 20, "Heimatplanet")))
LifeformResearchTime(forschung, stufe, [zeitReduktion])SekundenLogInfo(FormatDuration(LifeformResearchTime(LF_RESEARCH.IntergalacticEnvoys, 5)))
LifeformPopulation(planet){ LivingSpace, Satisfied, FoodProduction, FoodConsumption }const p = LifeformPopulation("Heimatplanet")
if (p.FoodProduction < p.FoodConsumption) LogWarn("Nahrung reicht nicht!")
GetSlots(){ InUse, Total, ExpInUse, ExpTotal }const s = GetSlots()
const freiExpos = Math.min(s.ExpTotal - s.ExpInUse, s.Total - s.InUse)
LogInfo("Freie Expeditionsplätze:", freiExpos)
GetFleets()[ { ID, Mission, ReturnFlight, Origin, Destination, Ships, Resources, ArrivalTime, BackTime, ArriveIn, BackIn } ]const expos = GetFleets().filter(f => f.Mission === MISSION.EXPEDITION) const spaeteste = Math.max(0, ...expos.map(f => f.BackIn || 0)) LogInfo(expos.length, "Expeditionen, alle zurück in", FormatDuration(spaeteste))
RefreshFleets()Liste der Flotten (wie GetFleets)const fleets = RefreshFleets() LogInfo(fleets.length, "Flotten unterwegs")
LatestReturn(mission?){ Count, InSeconds, At }const r = LatestReturn(MISSION.EXPEDITION) LogInfo(r.Count, "Expeditionen, letzte zurück um", FormatTime(r.At))
WaitForFleets(mission?, maxSekunden?)true (alle zurück) | false (Zeitlimit)WaitForFleets(MISSION.EXPEDITION)
LogInfo("Alle Expeditionen zurück – nächste Welle")
MaxExpeditions()Zahlconst s = GetSlots()
if (s.ExpInUse < MaxExpeditions()) LogInfo("Es ist noch ein Expeditionsplatz frei")
SendFleet(start, schiffe, ziel, mission, tempo?, rohstoffe?)Flotte | null// Transport vom Heimatplaneten zur Kolonie, 50 % Tempo
const fleet = SendFleet(GetHomeWorld(), { LargeCargo: 200 }, "1:20:8", MISSION.TRANSPORT, 5,
{ Metal: 1000000, Crystal: 500000 })
if (fleet) LogInfo("Unterwegs, Ankunft in", FormatDuration(fleet.ArriveIn))
SendFleet(…, rohstoffe, { recallIn | recallAt })Flotte | 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("Heimatplanet", { LargeCargo: 50 }, "1:16:4:3", MISSION.TRANSPORT, 10, { Metal: 1000000 })
if (!r.Success) LogWarn("Nicht gesendet:", 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)Anzahl zurückgerufener Flottenconst n = RecallFleetsByMission(MISSION.DEPLOY) LogInfo(n, "Stationierungen zurückgerufen")
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("Fleetsave", f.FleetID, "zurück um", FormatTime(f.ReturnAt))
Notify("Fleetsave bis " + FormatTime(f.ReturnAt), "Nachtsicherung")
TriggerFleetSave(ref, [minDauerSek], [{ mission, waitForFleets, all }])–// Vor dem Schlafengehen alles für mindestens 8 Stunden wegschicken
TriggerFleetSave(GetHomeWorld(), 8 * 3600, { all: true, waitForFleets: true })
SwitchFleet(ref, [speed])true, wenn umgesetzt// angegriffenen Himmelskörper räumen: Flotte auf den Mond bzw. Planeten gegenüber
for (const a of GetAttacks())
SwitchFleet(FormatCoord(a.Destination) + ":" + a.Destination.Type, 10)
ScheduleRecall(flottenId, wann)Zeitstempel des Rückrufsconst f = SendFleet(home, { LargeCargo: 10 }, "1:16:16", MISSION.EXPEDITION)
ScheduleRecall(f.ID, 1800) // nach 30 Minuten zurückrufen
CancelScheduledRecall(flottenId)true, wenn einer geplant warCancelScheduledRecall(f.ID)
GetScheduledRecalls()[ { FleetID, RecallAt, In, ScheduledBy } ]for (const r of GetScheduledRecalls()) LogInfo("Flotte", r.FleetID, "Rückruf 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" })
// danach: alles vom Zielmond auf seinen Planeten
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, wenn umgesetztSetScheduledFlightActive(id, false) // aussetzen, solange der Angriff läuft
RepatriateNow([ohneLimit])"success", "stop", "failure" oder "delay"const r = RepatriateNow()
if (r !== "success") LogWarn("Rücktransport:", 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("Flug", FormatDuration(plan.FlightTime), "– Deut", plan.Fuel, "– zurück", plan.ReturnAt)
if (GetResources(GetHomeWorld()).Deuterium < plan.Fuel) LogWarn("Zu wenig Deuterium")
FlightTime(start, ziel, schiffe, mission?, tempo?)Sekunden// Wie lange braucht die ganze Heimatflotte bei 10 % zum eigenen Mond?
const ships = GetShips(GetHomeWorld())
const oneWay = FlightTime(GetHomeWorld(), "1:16:4:3", ships, MISSION.DEPLOY, 1)
LogInfo("Einfacher Flug bei 10 %:", FormatDuration(oneWay))
FuelConsumption(start, ziel, schiffe, mission?, tempo?)Deuteriumconst deut = FuelConsumption(GetHomeWorld(), "2:100:8", { LargeCargo: 500 }, MISSION.TRANSPORT, 10)
LogInfo("Transport kostet", deut, "Deuterium")
Distance(a, b)Zahllet naechste = null
for (const m of GetMoons())
if (!naechste || Distance(GetHomeWorld(), m) < Distance(GetHomeWorld(), naechste)) naechste = m
LogInfo("Nächster Mond:", naechste.Name, naechste.Coords)
ShipSpeed(schiffId)ZahlLogInfo("Pathfinder:", ShipSpeed(SHIP.Pathfinder), "– Großer Transporter:", ShipSpeed(SHIP.LargeCargo))
LowestSpeed(schiffe)GeschwindigkeitLogInfo(LowestSpeed({ LargeCargo: 100, Recycler: 10 }))
ValidSpeeds()Liste, z. B. [1, 2, …, 10]LogInfo(ValidSpeeds())
OptimalFarmSpeed(von, ziel, schiffe, beute, [maxSpritAnteil], [maxFlugSek])speed (1–10)const speed = OptimalFarmSpeed("Heimatplanet", "1:20:8", { LargeCargo: 20 }, { Metal: 400000, Crystal: 200000 }, 0.05, 3600)
SendFleet("Heimatplanet", { 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)Zahlconst lr = CargoCapacity(GetShips(GetHomeWorld()))
LogInfo("Alle Schiffe auf der Heimat fassen", lr, "Rohstoffe")
ShipCargo(schiffId)ZahlLogInfo("Ein Großer Transporter fasst", ShipCargo(SHIP.LargeCargo))
ShipsNeeded(menge, schiffId)Zahlconst r = GetResources(GetCelestial("Kolonie"))
const lc = ShipsNeeded(r, SHIP.LargeCargo)
SendFleet(GetCelestial("Kolonie"), { 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 }, ziel, MISSION.TRANSPORT)
PackResources(rohstoffe, laderaum, reihenfolge?){ Metal, Crystal, Deuterium }const r = GetResources(home)
const ladung = PackResources(r, CargoCapacity({ LargeCargo: 100 }))
SendFleet(home, { LargeCargo: 100 }, "1:20:8", MISSION.TRANSPORT, 10, ladung)
MaxTransportable(schiffe, rohstoffe, [deutBehalten]){ Metal, Crystal, Deuterium }const ladung = MaxTransportable({ LargeCargo: 100 }, GetResources("Heimatplanet"), 50000)
SendFleet("Heimatplanet", { LargeCargo: 100 }, "1:16:4:3", MISSION.TRANSPORT, 10, ladung)
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)[ Zahl ]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)Schiffe-Objektconst home = GetHomeWorld() const flotte = IdealExpeditionShips(GetShips(home), SHIP.LargeCargo, 3) SendExpedition(home, flotte, home.Coordinate.Galaxy + ":" + home.Coordinate.System + ":16")
FullExpeditionShips(verfügbar, hauptschiff, anzahlExpeditionen)Schiffe-ObjektLogInfo(FullExpeditionShips(GetShips("Heimatplanet"), SHIP.LargeCargo, 4))
MilitaryShipForExpedition(verfügbar, anzahlExpeditionen)Schiffsname oder nullLogInfo(MilitaryShipForExpedition(GetShips("Heimatplanet"), 3))
GetExpeditionMessages()[ { ID, Coordinate, Content, Resources, Ships, CreatedAt } ]let metall = 0, kristall = 0, deut = 0
for (const m of GetExpeditionMessages()) {
metall += m.Resources.Metal; kristall += m.Resources.Crystal; deut += m.Resources.Deuterium
}
LogInfo("Expeditionen brachten:", metall, "M", kristall, "K", deut, "D")
ExpeditionStats(stunden?){ Hours, Count, Resources, Value, Ships, ByType }const s = ExpeditionStats(24) Notify(s.Count + " Expeditionen, " + FormatNumber(s.Value) + " MSU", "Expeditionen heute")
JumpGate(vonMond, zuMond, schiffe){ Success, RechargeCountdown, Error }const r = JumpGate("1:16:4:3", "2:100:8:3", { Battleship: 50 })
if (!r.Success) LogError("Sprung fehlgeschlagen:", r.Error)
JumpGateCooldown(stufe)SekundenLogInfo("Sprungtor Stufe 5 lädt", FormatDuration(JumpGateCooldown(5)))
JumpGateReady(mond)Sekundenconst warten = JumpGateReady("1:16:4:3")
if (warten > 0) SleepSec(warten + 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 ziel = info.Destinations.find(d => d.Coords === "2:100:8")
if (ziel) JumpGate("1:16:4:3", ziel.ID, { Battleship: 50 })
Phalanx(mond, koordinate)[ Flotte ]for (const f of Phalanx("1:16:4:3", "1:18:7"))
LogInfo("Flotte Mission", f.Mission, "Ankunft in", FormatDuration(f.ArriveIn))
GetAttacks()[ { ID, MissionType, Origin, Destination, DestinationName, ArrivalTime, ArriveIn, AttackerName, AttackerID, Missiles, Ships } ]for (const a of GetAttacks())
LogWarn(a.AttackerName, "greift", a.DestinationName, "an – Ankunft in", FormatDuration(a.ArriveIn))
IsPlanetUnderAttack(ref)true | falsefor (const p of GetPlanets())
if (IsPlanetUnderAttack(p)) StartScript("Fleetsave", { planet: p.Coords })
SpyCrash(ref, [ziel])–SpyCrash("Heimatplanet")
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("Inaktiv:", 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, "Planeten in 1:17")
FindPlayer(name)[ { Coords, PlanetName, PlayerName, PlayerID, Alliance, HasMoon, Inactive, Vacation, ScannedAt } ]for (const p of FindPlayer(GetAttacks()[0].AttackerName))
LogInfo("Angreifer-Planet:", p.Coords, p.HasMoon ? "(mit Mond)" : "")
GalaxyCacheInfo(){ Systems, Planets, Players, OldestScan, NewestScan }const i = GalaxyCacheInfo() LogInfo(i.Systems, "Systeme,", i.Players, "Spieler im Cache")
ClearGalaxyCache()–ClearGalaxyCache()
GetEspionageReports(seite?)[ { ID, Type, From, Target, LootPercentage } ]for (const b of GetEspionageReports())
LogInfo("Bericht", b.ID, "zu", FormatCoord(b.Target))
GetEspionageReport(meldungsId){ Username, Metal, Crystal, Deuterium, HasFleetInformation, HasDefensesInformation, …, Schiffe, Verteidigung }const r = GetEspionageReport(GetEspionageReports()[0].ID) LogInfo(r.Username, "hat", r.Metal + r.Crystal + r.Deuterium, "Rohstoffe")
GetEspionageReportFor(koordinate)Spionageberichtconst r = GetEspionageReportFor("1:18:7")
if (r.HasFleetInformation && r.LightFighter === 0) LogInfo("Ziel ohne Jäger")
SimulateBattle(angreifer, verteidiger, optionen?){ AttackerWins, DefenderWins, Draws (in %), AverageRounds, Attacker: { Lost, Remaining, LostResources }, Defender: {…}, Debris, DefencesRebuilt }const bericht = GetEspionageReportFor("1:18:7")
const sim = SimulateBattle({ Cruiser: 200, LargeCargo: 50 }, bericht)
LogInfo("Sieg:", sim.AttackerWins, "% – eigene Verluste:", FormatNumber(ResourceValue(sim.Attacker.LostResources)), "MSU")
if (sim.AttackerWins === 100 && sim.Attacker.LostResources.Metal === 0) LogInfo("Verlustfreier Angriff möglich")
GetAvailableDiscoveries(ref)Zahlconst n = GetAvailableDiscoveries(GetHomeWorld()) LogInfo(n, "Entdeckungsflotten verfügbar")
GetDiscoveryPositions(ref, koordinate)[ Koordinate ]const frei = GetDiscoveryPositions(GetHomeWorld(), "1:17:1") LogInfo(frei.length, "Positionen im System 1:17 erkundbar")
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)[ gesendete Koordinaten ]const ziele = SendSystemDiscovery(GetHomeWorld(), 1, 17) LogInfo(ziele.length, "Entdeckungen ins System 1:17 gesendet")
GetGamePage(seite)HTML der Seite als Textconst html = GetGamePage({ page: "ingame", component: "overview" })
const m = html.match(/darkmatter[^>]*>\s*([\d.]+)/i)
if (m) LogInfo("Dunkle Materie:", m[1])
GetAllianceInfoPage(allianzId)HTML als Textconst html = GetAllianceInfoPage(500123)
LogInfo(html.includes("Bewerbung") ? "Nimmt Bewerbungen an" : "geschlossen")
BuyOfferOfTheDay()"bought" | "already" | "unknown"const r = BuyOfferOfTheDay()
if (r === "bought") LogInfo("Tagesangebot gekauft")
GetAuction(){ HasFinished, Endtime, NumBids, CurrentBid, MinimumBid, HighestBidder, CurrentItem, Resources, … }const a = GetAuction() LogInfo(a.CurrentItemLong, "– Gebot", a.CurrentBid, "– endet 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 } – jeweils true, wenn gesendetconst f = FleetSave(GetHomeWorld(), "06:30")
Notify("Zurück um " + FormatTime(f.ReturnAt) + ", Deut " + FormatNumber(f.Fuel), "Fleetsave gestartet")
NotifyDiscord(text, titel?)true | falseif (IsUnderAttack()) NotifyDiscord("Angriff auf " + GetAttacks()[0].DestinationName, "⚠️ Angriff")
NotifyTelegram(text, titel?)true | falseNotifyTelegram("Tagesangebot: " + BuyOfferOfTheDay())
StartModule(name)true | falseStartModule("Expeditions")
StopModule(name, sofort?)true | false// Skript übernimmt die Expeditionen selbst
StopModule("Expeditions")
IsModuleActive(name)true | falseif (!IsModuleActive("Defender")) StartModule("Defender")
DefenderOnExit()–DefenderOnExit()
// ... Angriffsschutz darf jetzt zeitweise aus sein:
StopModule("Defender")
IsFeatureRunning(feature)true/falseLogInfo("Defender läuft:", IsFeatureRunning(FEATURE.Defender))
ListProfiles()Liste von TextenLogInfo(ListProfiles())
GetRunningProfiles()Liste von TextenLogInfo("Aktiv:", GetRunningProfiles())
LoadProfile(name | [namen])–LoadProfile(IsTimeBetween("23:00", "07:00") ? "Nacht" : "Tag")
ResetProfile()–ResetProfile()
StartSleepMode(bis)–StartSleepMode("07:30")
WakeUpNow()–if (IsSleeping() && IsUnderAttack()) WakeUpNow()
CancelGhostSleep()–CancelGhostSleep()
GetNextWakeTime()Zeitstempel oder nullconst t = GetNextWakeTime()
if (t) LogInfo("Wacht auf um", FormatTime(t))
StartScript(name, args?)true, wenn gestartetStartScript("Transport", { ziel: "1:20:8", menge: 500 })
StopScript(name)true, wenn es liefif (IsUnderAttack()) StopScript("Expos")
PauseScript(name)true | falsePauseScript("Farmrunde")
SleepMin(15)
ResumeScript("Farmrunde")
ResumeScript(name)true | falseif (GetScriptState("Expos") === "paused") ResumeScript("Expos")
IsScriptRunning(name)true | falseif (!IsScriptRunning("Wache")) StartScript("Wache")
GetScriptState(name)"running" | "paused" | "stopped" | "finished" | "error"if (GetScriptState("Expos") === "error") StartScript("Expos") // nach Fehler neu starten
ListScripts()[ { Name, State, Autostart } ]for (const s of ListScripts()) LogInfo(s.Name, s.State, s.Autostart ? "(Autostart)" : "")
SendSignal(skript, daten?)true, wenn zugestelltSendSignal("Expos", { pause: true, grund: "Fleetsave" })
WaitSignal(timeoutSek?){ from, data } | null bei Timeoutconst msg = WaitSignal(60)
if (msg && msg.data.pause) {
LogInfo("Pause angefordert von", msg.from)
SleepMin(10)
}
SetShared(schlüssel, wert)–SetShared("fleetsaveAktiv", true)
// … Flotte retten …
SetShared("fleetsaveAktiv", false)
GetShared(schlüssel, standard?)Wert | standard | nullwhile (GetShared("fleetsaveAktiv", false)) SleepSec(30)
StorePut(schlüssel, wert)–const heute = new Date().toISOString().slice(0, 10)
StorePut("expo:" + heute, ExpeditionStats(24))
StoreGet(schlüssel, standard?)Wert | standardconst cfg = StoreGet("config", { lcProExpo: 4000, systeme: 2 })
LogInfo("LC pro Expedition:", cfg.lcProExpo)
StoreHas(schlüssel)true | falseif (!StoreHas("config")) StorePut("config", { lcProExpo: 4000 })
StoreDelete(schlüssel)–StoreDelete("tmp:fleetsave")
StoreKeys(präfix?)[ Text ]for (const k of StoreKeys("expo:")) LogInfo(k, StoreGet(k).Count, "Expeditionen")
GlobalPut(schlüssel, wert)–GlobalPut("einstellungen/" + InstanceName, { expoSlots: 5 })
GlobalGet(schlüssel, standard?)der gespeicherte Wert | standard | nullconst e = GlobalGet("einstellungen/" + InstanceName, {})
LogInfo(e)
GlobalGetEntry(schlüssel){ Value, Bot, Universe, UpdatedAt } | nullconst e = GlobalGetEntry("einstellungen/" + InstanceName)
if (e) LogInfo("von", e.Bot, "in", e.Universe, "um", FormatTime(e.UpdatedAt))
GlobalHas(schlüssel)true/falseif (!GlobalHas("einstellungen/" + InstanceName)) StartScript("Einstellungen")
GlobalDelete(schlüssel)–GlobalDelete("test")
GlobalKeys(präfix?, bot?)[ { Key, Bot, Universe, UpdatedAt } ]for (const e of GlobalKeys("einstellungen/")) LogInfo(e.Key, "–", e.Bot, e.Universe)
SetDashboardCard(id, kasten)–const r = GetResources(GetHomeWorld())
SetDashboardCard("lager", {
title: "Lager Homeworld",
level: r.Deuterium < 1000000 ? "warning" : "success",
rows: { Metall: FormatNumber(r.Metal), Kristall: FormatNumber(r.Crystal), Deuterium: FormatNumber(r.Deuterium) },
text: "Stand " + TimeOfDay(),
})
RemoveDashboardCard(id)–function OnExit() {
RemoveDashboardCard("lager")
}
const FORM = { … }–const FORM = {
title: "Transport",
fields: [
{ key: "ziel", label: "Ziel", type: "celestial" },
{ key: "menge", label: "Deuterium", type: "number", default: 100000, min: 0 },
{ key: "sofort", label: "Sofort senden", type: "bool", default: true },
],
}
const werte = GetFormValues()
LogInfo(werte.ziel, werte.menge, werte.sofort)
GetFormValues(skript?){ key: wert, … }const cfg = GetFormValues("Einstellungen")
if (cfg.aktiv) LogInfo("Ziel:", cfg.ziel)
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("Ich passe auf", UniMain(), "auf")
UniMain()Bot-Name | nullconst main = UniMain()
if (main) UniSend("hinweis", { text: "Spieler X aktiv" }, main)
UniSend(thema, daten?, an?)Nachrichten-IDUniSend("aktiv", { spieler: "Raider", system: "1:120" })
UniReceive(thema?)[{ Id, At, From, To, Topic, Data }]while (true) {
for (const m of UniReceive("attack"))
LogWarn(m.From, "wird angegriffen:", m.Data.attacker, "→", m.Data.target, "Stufe", m.Data.level)
SleepRandSec(20, 40)
}
UniShare(schlüssel, wert, minuten?)–UniShare("inaktive/1:120", GetCachedSystem(1, 120), 60)
UniGet(schlüssel, standard?)der Wert | standard | nullconst sys = UniGet("inaktive/1:120")
if (!sys) ScanSystem(1, 120)
UniGetEntry(schlüssel){ Value, From, At } | nullconst e = UniGetEntry("inaktive/1:120")
if (e) LogInfo("von", e.From, "um", e.At)
UniReserve(schlüssel, minuten?)true/falseif (UniReserve("farm/1:120:8", 45))
LogInfo("Ziel gehört mir")
else
LogInfo("Ziel reserviert von", UniHolder("farm/1:120:8"))
UniRelease(schlüssel)–UniRelease("farm/1:120:8")
UniHolder(schlüssel)Bot-Name | nullLogInfo(UniHolder("farm/1:120:8") ?? "frei")
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("Rufe Flotte", c.FleetId, "zurück"); 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")–// Mondbasis-Stufe zurückbauen, um ein Feld frei zu bekommen
TearDown("1:16:4:3", BUILDING.LunarBase, "BESTÄTIGT")
SendIPM(von, ziel, anzahl, [primärziel], "BESTÄTIGT")Flugzeit der Raketen in Sekundenconst sek = SendIPM("Heimatplanet", "1:20:8", 10, DEFENCE.PlasmaTurret, "BESTÄTIGT")
LogInfo("Einschlag in", FormatDuration(sek))
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")–// Einmal am Tag Expeditions- und Kampfberichte aufräumen DeleteAllMessages(MESSAGE_TAB.EXPEDITIONS, "BESTÄTIGT") DeleteAllMessages(MESSAGE_TAB.COMBAT, "BESTÄTIGT")
ActivateItem(ref, itemRef, "BESTÄTIGT")Antwort von ogamedconst booster = GetItems(home).find(i => i.Name === "Deuterium-Booster Bronze" && i.Amount > 0) if (booster) ActivateItem(home, booster.Ref, "BESTÄTIGT")
SendPlayerMessage(spielerId, text, "BESTÄTIGT")–for (const a of GetAttacks())
SendPlayerMessage(a.AttackerID, "Hier gibt es nichts zu holen.", "BESTÄTIGT")
MessageAttackers(text, "BESTÄTIGT")–if (IsUnderAttack()) MessageAttackers("Flotte ist weg, Rohstoffe auch – spar dir den Sprit.", "BESTÄTIGT")
PostGamePage(seite, formulardaten, "BESTÄTIGT")Antwort des Spiels als Text (bei JSON-Antworten mit JSON.parse lesen)const antwort = PostGamePage("page=ingame&component=marketplace&tab=history_buying&action=collectItem&asJson=1",
{ marketItemId: 12345, token: "…" }, "BESTÄTIGT")
LogInfo(antwort)
GameLogout("BESTÄTIGT")–GameLogout("BESTÄTIGT")
SleepMin(RandomInt(20, 40))
GameLogin()