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.
| Event | Purpose |
|---|---|
| OnStart | First execution or normal resume in the same session |
| OnRestored | Resume the saved autonomous spell after rejoining |
| OnTick | Repeated checks while running |
| OnPrestige | Notification 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 arguments | Return or value type | Meaning | Unlock |
|---|---|---|---|
Workshop | WorkshopContext | Entry point to your workshop. | Initial |
WorkshopContext
| Member and arguments | Return or value type | Meaning | Unlock |
|---|---|---|---|
Resources | ResourceCollection | Ordinary resources and research points. | Initial |
Equipment | EquipmentCollection | Equipment collection. | Initial |
Production | RecipeCollection | Production recipes. | Initial |
Research | ResearchCollection | Research projects. | Initial |
Golems | GolemCollection | Owned golems. | Initial |
Prestige | PrestigeCollection | Prestige options. Access itself requires Theory. | Theory |
Currencies | CurrencyCollection | Prestige currencies. | Initial |
Clock | GameClock | Online time and waiting. | Initial |
Log | GameLog | Your personal log. | Initial |
Epoch | long | Current run generation. Changes when prestige commits. | Initial |
ResourceStock
| Member and arguments | Return or value type | Meaning | Unlock |
|---|---|---|---|
Kind | ResourceKind | Typed selector identifying this object. | Initial |
IsUnlocked | bool | Whether the content is unlocked, not whether it is affordable. | Initial |
Total | Amount | Stock including reserved inputs, excluding unfinished output. | Initial |
Available | Amount | Stock not reserved as an input. | Initial |
Equipment
| Member and arguments | Return or value type | Meaning | Unlock |
|---|---|---|---|
Kind | EquipmentKind | Typed selector identifying this object. | Initial |
IsUnlocked | bool | Whether the content is unlocked, not whether it is affordable. | Initial |
Rank | int | Zero when locked; at least one when unlocked. | Initial |
CanUpgrade | bool | Whether an upgrade is currently eligible. | Theory |
Upgrade() | CommandResult | Buy the next rank, spending the required resources. | Initial |
Upgrade
var value = Workshop.Equipment[EquipmentKind.Storage].Upgrade();Recipe
| Member and arguments | Return or value type | Meaning | Unlock |
|---|---|---|---|
Kind | RecipeKind | Typed selector identifying this object. | Initial |
IsUnlocked | bool | Whether the content is unlocked, not whether it is affordable. | Initial |
Station | Equipment | Station used by this recipe. | Initial |
CanStart(Amount amount) | bool | Check whether production can start for the requested output. | Theory |
Start(Amount amount) | JobStartResult | Request production of this output quantity. Ok does not mean completion. | Initial |
CanStart
var value = Workshop.Production[RecipeKind.Iron].CanStart(20);Start
var value = Workshop.Production[RecipeKind.Iron].Start(20);ResearchProject
| Member and arguments | Return or value type | Meaning | Unlock |
|---|---|---|---|
Kind | ResearchKind | Typed selector identifying this object. | Initial |
IsUnlocked | bool | Whether the content is unlocked, not whether it is affordable. | Initial |
IsComplete | bool | Whether research was purchased in this run. | Initial |
CanBuy | bool | Whether the next purchase currently meets its requirements. | Theory |
Buy() | CommandResult | Purchase by paying the required resources. | Initial |
Buy
var value = Workshop.Research[ResearchKind.Smelting].Buy();GolemCollection
| Member and arguments | Return or value type | Meaning | Unlock |
|---|---|---|---|
Count | int | Current owned count, at most five. | Initial |
CanBuy | bool | Whether the next purchase currently meets its requirements. | Theory |
this[int index] | Golem | Select by typed symbol. Golems use a zero-based integer index. | Initial |
Buy() | CommandResult | Purchase by paying the required resources. | Initial |
Buy
var value = Workshop.Golems.Buy();Golem
| Member and arguments | Return or value type | Meaning | Unlock |
|---|---|---|---|
Index | int | Zero-based position in the owned list. | Initial |
IsIdle | bool | Whether neither mining nor charging occupies this golem. | Initial |
Battery | Amount | Current battery charge. | Initial |
BatteryCapacity | Amount | Battery capacity. | Initial |
CanMine(Mineral mineral, Amount amount) | bool | Check mining eligibility for a mineral and output quantity. | Theory |
Mine(Mineral mineral, Amount amount) | JobStartResult | Request mining of the chosen mineral and output quantity. | Initial |
CanMine
var value = Workshop.Golems[0].CanMine(Mineral.Ore, 20);Mine
var value = Workshop.Golems[0].Mine(Mineral.Ore, 20);PrestigeOption
| Member and arguments | Return or value type | Meaning | Unlock |
|---|---|---|---|
Kind | PrestigeKind | Typed selector identifying this object. | Theory |
CanRequest | bool | Whether prestige requirements are met. | Theory |
Preview() | PrestigePreview | Read current prestige eligibility, rewards and resets. | Theory |
Request() | CommandResult | Request prestige, which waits for accepted jobs before committing. | Theory |
Preview
var value = Workshop.Prestige[PrestigeKind.Recompile].Preview();Request
var value = Workshop.Prestige[PrestigeKind.Recompile].Request();CurrencyBalance
| Member and arguments | Return or value type | Meaning | Unlock |
|---|---|---|---|
Kind | CurrencyKind | Typed selector identifying this object. | Initial |
Total | Amount | Current balance. | Initial |
Job
| Member and arguments | Return or value type | Meaning | Unlock |
|---|---|---|---|
IsValid | bool | Whether the job reference is valid, including retained finished jobs. | Initial |
Status | JobStatus | Job status. Stale after invalidation. | Initial |
Cancel() | CommandResult | Cancel remaining work without reversing completed output. | Theory |
Wait() | WaitToken | Directly await job termination, then check Status. | Rebuild |
Cancel
var started = Workshop.Golems[0].Mine(Mineral.Ore, 20);
if (!started.Ok) return;
var job = started.Job;
var value = job.Cancel();Wait
var started = Workshop.Golems[0].Mine(Mineral.Ore, 20);
if (!started.Ok) return;
var job = started.Job;
await job.Wait();GameClock
| Member and arguments | Return or value type | Meaning | Unlock |
|---|---|---|---|
OnlineSeconds | double | Cumulative online seconds. | Initial |
Delay(double seconds) | WaitToken | Directly await 0 through 86400 online seconds. | Rebuild |
Delay
await Workshop.Clock.Delay(1.0);CommandResult
| Member and arguments | Return or value type | Meaning | Unlock |
|---|---|---|---|
Ok | bool | Operation success. For mining, production and prestige this means acceptance. | Initial |
Code | ApiCode | ApiCode explaining the result. | Initial |
RequestId | long | System-assigned request identifier. | Initial |
JobStartResult
| Member and arguments | Return or value type | Meaning | Unlock |
|---|---|---|---|
Ok | bool | Operation success. For mining, production and prestige this means acceptance. | Initial |
Code | ApiCode | ApiCode explaining the result. | Initial |
RequestId | long | System-assigned request identifier. | Initial |
Job | Job | Job reference on success, null on failure. | Initial |
PrestigePreview
| Member and arguments | Return or value type | Meaning | Unlock |
|---|---|---|---|
Kind | PrestigeKind | Typed selector identifying this object. | Initial |
CanRequest | bool | Whether prestige requirements are met. Snapshot at preview time. | Initial |
Code | ApiCode | ApiCode explaining the result. Snapshot at preview time. | Initial |
RewardKind | CurrencyKind | Reward currency in the preview. | Initial |
RewardAmount | Amount | Reward quantity in the preview. | Initial |
ResetsWorkshop | bool | Whether the workshop resets. | Initial |
ClearsShard | bool | Whether RuntimeShard is cleared. | Initial |
ClearsCore | bool | Whether WorldCore is cleared. | Initial |
Description | string | Display text. Do not parse it to decide eligibility. | Initial |
ResourceCollection
| Member and arguments | Return or value type | Meaning | Unlock |
|---|---|---|---|
this[ResourceKind kind] | ResourceStock | Select by typed symbol. Golems use a zero-based integer index. | Initial |
EquipmentCollection
| Member and arguments | Return or value type | Meaning | Unlock |
|---|---|---|---|
this[EquipmentKind kind] | Equipment | Select by typed symbol. Golems use a zero-based integer index. | Initial |
RecipeCollection
| Member and arguments | Return or value type | Meaning | Unlock |
|---|---|---|---|
this[RecipeKind kind] | Recipe | Select by typed symbol. Golems use a zero-based integer index. | Initial |
ResearchCollection
| Member and arguments | Return or value type | Meaning | Unlock |
|---|---|---|---|
this[ResearchKind kind] | ResearchProject | Select by typed symbol. Golems use a zero-based integer index. | Initial |
PrestigeCollection
| Member and arguments | Return or value type | Meaning | Unlock |
|---|---|---|---|
this[PrestigeKind kind] | PrestigeOption | Select by typed symbol. Golems use a zero-based integer index. | Theory |
CurrencyCollection
| Member and arguments | Return or value type | Meaning | Unlock |
|---|---|---|---|
this[CurrencyKind kind] | CurrencyBalance | Select by typed symbol. Golems use a zero-based integer index. | Initial |
GameLog
| Member and arguments | Return or value type | Meaning | Unlock |
|---|---|---|---|
Write(string text) | void | Write a string to your personal log. | Initial |
Write
Workshop.Log.Write("20");Amount
| Member and arguments | Return or value type | Meaning | Unlock |
|---|---|---|---|
static FromInt(int value) | Amount | Create an Amount from an integer. | Initial |
static FromScientific(double mantissa, long exponent) | Amount | Create an Amount from a mantissa and exponent. | Initial |
static Parse(string text) | Amount | Parse an Amount from a quantity string. | Initial |
FromInt
var value = Amount.FromInt(0);FromScientific
var value = Amount.FromScientific(1.0, 6000L);Parse
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.
