API reference

The API lets your spell inspect and control the workshop. This reference lists all 78 ArcaneScript API v2 members, grouped by their owning type.

Reading the reference

Access your own workshop through Workshop. A property reads a value, a method uses () to perform a call, and an indexer uses [] to select an object. All public properties are read-only.

Golem.Mine(Mineral mineral, Amount amount) takes a mineral and the requested output quantity. Integers convert to Amount automatically, so you can write golem.Mine(Mineral.Ore, 20). ResourceKind.Ore selects stock; Mineral.Ore selects what to mine. They are different types.

Argument names below explain their purpose. Pass arguments in the listed order without omitting any. Method examples are snippets to place inside a Program method. Mining, production, purchase and prestige examples request actual game actions.

Results and lifetimes

JobStartResult.Ok means mining or production was accepted, not fully completed. Check success before using Job; it is null on failure. CommandResult.Ok means a purchase or cancellation committed, or a prestige request was accepted.

Can checks inspect current conditions without reserving resources. Even after true, the action checks its conditions again. Always inspect the action's result too.

Workshop views, Job, results and previews are limited to locals, parameters and return values. They cannot go in fields, arrays or Persist state. Prestige and rejoining invalidate references. WaitToken is only for directly awaiting Wait or Delay.

Job.Status includes Running, Waiting, Completed, Cancelled, Failed and Stale. Queued is reserved, not a public job queue. An invalidated Job reports IsValid=false and Status=Stale. Check Status after waiting as well.

Events and persistence

Program event methods are public, take no arguments and return void.

EventPurpose
OnStartFirst execution or normal resume in the same session
OnRestoredResume the saved autonomous spell after rejoining
OnTickRepeated checks while running
OnPrestigeNotification after prestige

[Persist] is an annotation on Program fields, not a callable method. See Equipment and research for unlocks and Prestige for event ordering.

Quantity and wait limits

Mine and Start accept finite, positive quantities, including fractions. Purchase APIs do not take a caller-supplied price. Delay accepts finite values from 0 through 86400 seconds. Zero resumes no earlier than the next tick.

Create Amount values with FromInt, FromScientific or Parse. There is no implicit conversion from long or double to Amount, or from Amount to ordinary numeric types. See Troubleshooting for rejection codes.

The current API catalog also requires Theory for Job.Cancel. Before that unlock, cancel through the game's job screen.

ArcaneProgram

Member and argumentsReturn or value typeMeaningUnlock
WorkshopWorkshopContextEntry point to your workshop.Initial

WorkshopContext

Member and argumentsReturn or value typeMeaningUnlock
ResourcesResourceCollectionOrdinary resources and research points.Initial
EquipmentEquipmentCollectionEquipment collection.Initial
ProductionRecipeCollectionProduction recipes.Initial
ResearchResearchCollectionResearch projects.Initial
GolemsGolemCollectionOwned golems.Initial
PrestigePrestigeCollectionPrestige options. Access itself requires Theory.Theory
CurrenciesCurrencyCollectionPrestige currencies.Initial
ClockGameClockOnline time and waiting.Initial
LogGameLogYour personal log.Initial
EpochlongCurrent run generation. Changes when prestige commits.Initial

ResourceStock

Member and argumentsReturn or value typeMeaningUnlock
KindResourceKindTyped selector identifying this object.Initial
IsUnlockedboolWhether the content is unlocked, not whether it is affordable.Initial
TotalAmountStock including reserved inputs, excluding unfinished output.Initial
AvailableAmountStock not reserved as an input.Initial

Equipment

Member and argumentsReturn or value typeMeaningUnlock
KindEquipmentKindTyped selector identifying this object.Initial
IsUnlockedboolWhether the content is unlocked, not whether it is affordable.Initial
RankintZero when locked; at least one when unlocked.Initial
CanUpgradeboolWhether an upgrade is currently eligible.Theory
Upgrade()CommandResultBuy the next rank, spending the required resources.Initial

Upgrade

ArcaneScript
var value = Workshop.Equipment[EquipmentKind.Storage].Upgrade();

Recipe

Member and argumentsReturn or value typeMeaningUnlock
KindRecipeKindTyped selector identifying this object.Initial
IsUnlockedboolWhether the content is unlocked, not whether it is affordable.Initial
StationEquipmentStation used by this recipe.Initial
CanStart(Amount amount)boolCheck whether production can start for the requested output.Theory
Start(Amount amount)JobStartResultRequest production of this output quantity. Ok does not mean completion.Initial

CanStart

ArcaneScript
var value = Workshop.Production[RecipeKind.Iron].CanStart(20);

Start

ArcaneScript
var value = Workshop.Production[RecipeKind.Iron].Start(20);

ResearchProject

Member and argumentsReturn or value typeMeaningUnlock
KindResearchKindTyped selector identifying this object.Initial
IsUnlockedboolWhether the content is unlocked, not whether it is affordable.Initial
IsCompleteboolWhether research was purchased in this run.Initial
CanBuyboolWhether the next purchase currently meets its requirements.Theory
Buy()CommandResultPurchase by paying the required resources.Initial

Buy

ArcaneScript
var value = Workshop.Research[ResearchKind.Smelting].Buy();

GolemCollection

Member and argumentsReturn or value typeMeaningUnlock
CountintCurrent owned count, at most five.Initial
CanBuyboolWhether the next purchase currently meets its requirements.Theory
this[int index]GolemSelect by typed symbol. Golems use a zero-based integer index.Initial
Buy()CommandResultPurchase by paying the required resources.Initial

Buy

ArcaneScript
var value = Workshop.Golems.Buy();

Golem

Member and argumentsReturn or value typeMeaningUnlock
IndexintZero-based position in the owned list.Initial
IsIdleboolWhether neither mining nor charging occupies this golem.Initial
BatteryAmountCurrent battery charge.Initial
BatteryCapacityAmountBattery capacity.Initial
CanMine(Mineral mineral, Amount amount)boolCheck mining eligibility for a mineral and output quantity.Theory
Mine(Mineral mineral, Amount amount)JobStartResultRequest mining of the chosen mineral and output quantity.Initial

CanMine

ArcaneScript
var value = Workshop.Golems[0].CanMine(Mineral.Ore, 20);

Mine

ArcaneScript
var value = Workshop.Golems[0].Mine(Mineral.Ore, 20);

PrestigeOption

Member and argumentsReturn or value typeMeaningUnlock
KindPrestigeKindTyped selector identifying this object.Theory
CanRequestboolWhether prestige requirements are met.Theory
Preview()PrestigePreviewRead current prestige eligibility, rewards and resets.Theory
Request()CommandResultRequest prestige, which waits for accepted jobs before committing.Theory

Preview

ArcaneScript
var value = Workshop.Prestige[PrestigeKind.Recompile].Preview();

Request

ArcaneScript
var value = Workshop.Prestige[PrestigeKind.Recompile].Request();

CurrencyBalance

Member and argumentsReturn or value typeMeaningUnlock
KindCurrencyKindTyped selector identifying this object.Initial
TotalAmountCurrent balance.Initial

Job

Member and argumentsReturn or value typeMeaningUnlock
IsValidboolWhether the job reference is valid, including retained finished jobs.Initial
StatusJobStatusJob status. Stale after invalidation.Initial
Cancel()CommandResultCancel remaining work without reversing completed output.Theory
Wait()WaitTokenDirectly await job termination, then check Status.Rebuild

Cancel

ArcaneScript
var started = Workshop.Golems[0].Mine(Mineral.Ore, 20);
if (!started.Ok) return;
var job = started.Job;
var value = job.Cancel();

Wait

ArcaneScript
var started = Workshop.Golems[0].Mine(Mineral.Ore, 20);
if (!started.Ok) return;
var job = started.Job;
await job.Wait();

GameClock

Member and argumentsReturn or value typeMeaningUnlock
OnlineSecondsdoubleCumulative online seconds.Initial
Delay(double seconds)WaitTokenDirectly await 0 through 86400 online seconds.Rebuild

Delay

ArcaneScript
await Workshop.Clock.Delay(1.0);

CommandResult

Member and argumentsReturn or value typeMeaningUnlock
OkboolOperation success. For mining, production and prestige this means acceptance.Initial
CodeApiCodeApiCode explaining the result.Initial
RequestIdlongSystem-assigned request identifier.Initial

JobStartResult

Member and argumentsReturn or value typeMeaningUnlock
OkboolOperation success. For mining, production and prestige this means acceptance.Initial
CodeApiCodeApiCode explaining the result.Initial
RequestIdlongSystem-assigned request identifier.Initial
JobJobJob reference on success, null on failure.Initial

PrestigePreview

Member and argumentsReturn or value typeMeaningUnlock
KindPrestigeKindTyped selector identifying this object.Initial
CanRequestboolWhether prestige requirements are met. Snapshot at preview time.Initial
CodeApiCodeApiCode explaining the result. Snapshot at preview time.Initial
RewardKindCurrencyKindReward currency in the preview.Initial
RewardAmountAmountReward quantity in the preview.Initial
ResetsWorkshopboolWhether the workshop resets.Initial
ClearsShardboolWhether RuntimeShard is cleared.Initial
ClearsCoreboolWhether WorldCore is cleared.Initial
DescriptionstringDisplay text. Do not parse it to decide eligibility.Initial

ResourceCollection

Member and argumentsReturn or value typeMeaningUnlock
this[ResourceKind kind]ResourceStockSelect by typed symbol. Golems use a zero-based integer index.Initial

EquipmentCollection

Member and argumentsReturn or value typeMeaningUnlock
this[EquipmentKind kind]EquipmentSelect by typed symbol. Golems use a zero-based integer index.Initial

RecipeCollection

Member and argumentsReturn or value typeMeaningUnlock
this[RecipeKind kind]RecipeSelect by typed symbol. Golems use a zero-based integer index.Initial

ResearchCollection

Member and argumentsReturn or value typeMeaningUnlock
this[ResearchKind kind]ResearchProjectSelect by typed symbol. Golems use a zero-based integer index.Initial

PrestigeCollection

Member and argumentsReturn or value typeMeaningUnlock
this[PrestigeKind kind]PrestigeOptionSelect by typed symbol. Golems use a zero-based integer index.Theory

CurrencyCollection

Member and argumentsReturn or value typeMeaningUnlock
this[CurrencyKind kind]CurrencyBalanceSelect by typed symbol. Golems use a zero-based integer index.Initial

GameLog

Member and argumentsReturn or value typeMeaningUnlock
Write(string text)voidWrite a string to your personal log.Initial

Write

ArcaneScript
Workshop.Log.Write("20");

Amount

Member and argumentsReturn or value typeMeaningUnlock
static FromInt(int value)AmountCreate an Amount from an integer.Initial
static FromScientific(double mantissa, long exponent)AmountCreate an Amount from a mantissa and exponent.Initial
static Parse(string text)AmountParse an Amount from a quantity string.Initial

FromInt

ArcaneScript
var value = Amount.FromInt(0);

FromScientific

ArcaneScript
var value = Amount.FromScientific(1.0, 6000L);

Parse

ArcaneScript
var value = Amount.Parse("20");

Selectors and statuses

ResourceKind

Ore, Crystal, Moonstone, Fragment, Iron, Alloy, Frame, Ether, Circuit, ResearchPoint

Mineral

Ore, Crystal, Moonstone, Fragment

EquipmentKind

Storage, Mana, Dock, Core, Rift, Furnace, Foundry, Alchemy

RecipeKind

Iron, Alloy, Frame, Ether, Circuit

ResearchKind

Smelting, Moonstone, Ancient, Theory

PrestigeKind

Recompile, Rebuild, Ascend

CurrencyKind

RuntimeShard, WorldCore, AscensionSigil

ApiCode

Ok, Locked, InvalidId, InvalidAmount, InsufficientResource, InsufficientRp, CapacityFull, Busy, ScriptStopped, StaleEpoch, RateLimited, PrestigePending, SaveNotReady, SaveBlocked, SafeStopped, NumericLimit

JobStatus

Queued, Running, Waiting, Completed, Cancelled, Failed, Stale

Selectors do not convert to strings or integer IDs. The seven selector types from ResourceKind through CurrencyKind can be stored in fields and arrays. ApiCode and JobStatus are limited to locals, parameters and return values.