Skip to main content
Version: TEdit 5

TEdit Scripting API Reference

Complete reference for the TEdit scripting API. Available in both JavaScript and Lua engines.

All API objects are accessed as globals: tile, batch, geometry, selection, sprites, draw, generate, chests, signs, npcs, tileEntities, world, metadata, log, finder, tools.

TypeScript Autocomplete

Download tedit-api.d.ts and place it next to your scripts for full VS Code autocomplete. See the Scripting Guide for setup instructions.


tile — Low-level tile read/write

MethodDescription
isActive(x, y) → boolCheck if tile is active
getTileType(x, y) → intGet tile type ID
getWall(x, y) → intGet wall type ID
getPaint(x, y) → intGet tile paint color
getWallPaint(x, y) → intGet wall paint color
getLiquidAmount(x, y) → intGet liquid amount (0–255)
getLiquidType(x, y) → intGet liquid type (0=none, 1=water, 2=lava, 3=honey)
getFrameU(x, y) → intGet sprite frame U coordinate
getFrameV(x, y) → intGet sprite frame V coordinate
getSlope(x, y) → stringGet slope type as string
getWire(x, y, color) → boolCheck wire (1=red, 2=blue, 3=green, 4=yellow)
getTileEcho(x, y) → boolCheck if tile has echo (invisible) coating
getWallEcho(x, y) → boolCheck if wall has echo (invisible) coating
getTileIlluminant(x, y) → boolCheck if tile has illuminant (full bright) coating
getWallIlluminant(x, y) → boolCheck if wall has illuminant (full bright) coating
setActive(x, y, active)Set tile active state
setType(x, y, type)Set tile type (also activates tile)
setWall(x, y, wallType)Set wall type
setPaint(x, y, color)Set tile paint color
setWallPaint(x, y, color)Set wall paint color
setLiquid(x, y, amount, type)Set liquid amount and type
setWire(x, y, color, enabled)Set wire state
setSlope(x, y, slope)Set slope (None, HalfBrick, SlopeTopRight, SlopeTopLeft, SlopeBottomRight, SlopeBottomLeft)
setFrameUV(x, y, u, v)Set sprite frame coordinates
setTileEcho(x, y, value)Set tile echo (invisible) coating
setWallEcho(x, y, value)Set wall echo (invisible) coating
setTileIlluminant(x, y, value)Set tile illuminant (full bright) coating
setWallIlluminant(x, y, value)Set wall illuminant (full bright) coating
clear(x, y)Reset tile to default empty state
copy(fromX, fromY, toX, toY)Copy all properties from one tile to another

batch — Bulk Operations

MethodDescription
forEachTile(callback)Iterate entire world — callback(x, y)
forEachInSelection(callback)Iterate selection — callback(x, y)
findTiles(predicate) → [{x, y}]Find tiles matching predicate(x, y) → bool (max 10,000)
findTilesByType(type, anchorOnly?) → [{x, y}]Find by type; anchorOnly returns sprite origins only
findTilesByWall(wallType) → [{x, y}]Find by wall type (max 10,000)
replaceTile(from, to) → intReplace all tiles of one type; returns count
replaceTileInSelection(from, to) → intReplace in selection only; returns count
replaceWall(from, to) → intReplace all walls of one type; returns count
clearTilesByType(type) → intClear all tiles of type; returns count

geometry — Shapes

MethodDescription
line(x1, y1, x2, y2) → [{x, y}]Line coordinates
rect(x, y, w, h) → [{x, y}]Rectangle outline
ellipse(cx, cy, rx, ry) → [{x, y}]Ellipse outline (centered)
fillRect(x, y, w, h) → [{x, y}]Filled rectangle
fillEllipse(cx, cy, rx, ry) → [{x, y}]Filled ellipse (centered)
setTiles(type, x, y, w, h)Fill rect with tiles (with undo)
setWalls(type, x, y, w, h)Fill rect with walls (with undo)
clearTiles(x, y, w, h)Clear tiles in rect (with undo)

selection — Selection

Property/MethodDescription
isActive → boolWhether selection is active
x, y, width, heightSelection bounds
left, top, right, bottomSelection edges (right/bottom exclusive)
set(x, y, w, h)Create and activate selection
clear()Deactivate selection
contains(x, y) → boolPoint-in-selection test

sprites — Multi-tile Sprite Placement

MethodDescription
listSprites() → [{tileId, name, styleCount}]List all sprite sheets
getStyles(tileId) → [{index, name, width, height}]Get styles for a tile type
place(tileId, styleIndex, x, y) → boolPlace sprite by tile ID and style index
placeByName(name, x, y) → boolPlace first style matching name (case-insensitive)
note

Placing a sprite automatically creates associated entities (Chest, Sign, TileEntity) at the anchor position.

draw — Drawing Tools

Picker Configuration

MethodDescription
setTile(tileType)Set tile type to paint
setWall(wallType)Set wall type to paint
setErase(bool)Enable/disable eraser mode
setPaintMode(mode)Set mode: 'tile'/'tileandwall', 'wire', 'liquid'
setTileColor(color)Set tile paint color (0 = off)
setWallColor(color)Set wall paint color (0 = off)
setBrickStyle(style)'full', 'half', 'topright', 'topleft', 'bottomright', 'bottomleft'
setActuator(enabled, inactive?)Set actuator state
setTileCoating(echo?, illuminant?)Set tile coating
setWallCoating(echo?, illuminant?)Set wall coating
setLiquid(type, amount?)Type: 'water'/'lava'/'honey'/'shimmer'/'none'; amount: 'full'/'half'/'quarter'
setWire(red?, blue?, green?, yellow?)Set wire paint flags
setTileMask(mode, tileType?)'off', 'match', 'empty', 'notmatching'
setWallMask(mode, wallType?)Set wall mask mode
setBrush(width, height, shape?)Shape: 'square', 'round', 'right', 'left', 'star', 'triangle', 'crescent', 'donut', 'cross'/'x'
setRotation(degrees)Set brush rotation in degrees
setFlip(horizontal?, vertical?)Set brush flip state
setSpray(enabled, density?, tickMs?)Enable spray mode (density default 50, tick default 100ms)
setBrushOutline(outline, enabled)Set brush outline width and enable/disable
reset()Reset tile picker and brush to defaults

Drawing Operations

MethodDescription
pencil(x1, y1, x2, y2)Draw 1px line between two points
brush(x1, y1, x2, y2)Draw brush-width line between two points
fill(x, y)Flood fill from point (respects selection)
hammer(x1, y1, x2, y2)Auto-slope tiles along brush-width line

Wire Routing

Route wires (or tiles) along CAD-style paths. Uses the current picker configuration set by setWire() or setTile().

MethodDescription
routeWire(x1, y1, x2, y2, mode?, direction?) → intRoute a single wire path; returns tiles placed
routeBus(wireCount, x1, y1, x2, y2, mode?, direction?) → intRoute parallel wires; returns tiles placed
routeWirePath(x1, y1, x2, y2, mode?, direction?) → [{x, y}]Get single wire path coordinates (no placement)
routeBusPath(wireCount, x1, y1, x2, y2, mode?, direction?) → [{x, y}]Get bus path coordinates (no placement)

Parameters:

  • mode'90' (default) for 90° elbow, '45' for 45° miter
  • direction'auto' (default), 'h' for horizontal-first, 'v' for vertical-first
  • wireCount — Number of parallel wires (auto-converts to brush size: spacing × (count − 1) + 1)

Spacing: 90° mode uses 2-tile spacing (1-tile gap), 45° mode uses 3-tile spacing (2-tile gap).

// Route red wire with 90° elbow
draw.setWire(true, false, false, false);
draw.routeWire(100, 200, 150, 220, '90', 'h');

// Route 4 parallel blue wires with 45° miter
draw.setWire(false, true, false, false);
draw.routeBus(4, 100, 200, 150, 220, '45', 'auto');

// Route tiles instead of wires
draw.setTile(1); // Stone
draw.routeWire(50, 50, 80, 70);

// Get path coordinates for custom processing
var path = draw.routeWirePath(10, 10, 30, 20, '90', 'v');
for (var i = 0; i < path.length; i++) {
log.print(path[i].x + "," + path[i].y);
}

generate — Procedural Generation

Trees & Forests

MethodDescription
listTreeTypes() → [{name, tileId}]List all supported tree type names and tile IDs
tree(type, x, y) → boolPlace a single tree at ground position (x, y); type is a name string
forest(types[], x, y, w, h, density?) → intPlace random trees in rectangle; density 0.0–1.0 (default 0.15)
forestInSelection(types[], density?) → intPlace random trees in current selection
findSurface(x, yStart, yEnd) → intScan downward for first solid tile; returns y or -1

Tree types: oak (5), palm (323), mushroom (72), topaz (583), amethyst (584), sapphire (585), emerald (586), ruby (587), diamond (588), amber (589), sakura (596), willow (616), ash (634)

note

Trees grow upward from the given y coordinate (ground level). The forest and forestInSelection methods use findSurface internally to locate the ground in each column.

WorldGen Structures

Ported from Terraria's WorldGen methods — the core primitives for procedural terrain generation.

MethodDescription
tileRunner(x, y, strength, steps, tileType, speedX?, speedY?)Wandering painter: fills diamond-shaped blobs with tileType. Port of WorldGen.TileRunner.
tunnel(x, y, strength, steps, speedX?, speedY?)Carve natural cave tunnels (clears tiles along a wandering path)
lake(x, y, liquidType?, strength?)Create irregular liquid pool. liquidType: "water" (default), "lava", "honey", "shimmer". strength scales pool size (default 1.0).
oreVein(oreName, x, y, size?)Place named ore vein with presets. size: "small" (0.5x), "medium" (1x, default), "large" (2x).
listOreTypes() → [{name, tileId}]List available ore names and tile IDs

Ore types: copper (7), tin (166), iron (6), lead (167), silver (9), tungsten (168), gold (8), platinum (169), meteorite (37), hellstone (58), cobalt (107), palladium (221), mythril (108), orichalcum (222), adamantite (111), titanium (223), chlorophyte (211), luminite (408)

TileRunner parameters
  • strength controls blob radius (~3–15 for ore, ~10–40 for large patches)
  • steps controls how far the painter wanders (~5–20 for ore, ~20–60 for veins)
  • speedX/speedY add directional bias (default 0 = random wander)
  • The painter fills a diamond (Manhattan distance) that tapers from full strength to 0 over steps iterations
  • Frame-important tiles (furniture, plants) are skipped automatically
// Scatter gold ore around a point
generate.oreVein("gold", 500, 400);
generate.oreVein("gold", 500, 400, "large");

// Carve a horizontal tunnel
generate.tunnel(100, 300, 8, 30, 1.0, 0.0);

// Create a water pool
generate.lake(500, 500, "water", 1.5);

// Place a custom tile patch using tileRunner
var dirt = metadata.tileId("Dirt Block");
generate.tileRunner(300, 300, 10, 20, dirt);

// List all ore types
log.print(JSON.stringify(generate.listOreTypes()));

chests — Chest Inventory

Property/MethodDescription
count → intTotal chests
getAll() → [{x, y, name, items}]All chests; items array contains {slot, id, name, stack, prefix}
getAt(x, y) → {x, y, name, items}Chest at position (or null)
findByItem(id) → [...]Find chests containing item by NetId
findByItemName(name) → [...]Find chests containing item by name (case-insensitive substring match)
setName(x, y, name)Set chest name/label
findByName(name) → [...]Find chests by name (case-insensitive substring match)
setItem(x, y, slot, id, stack, prefix)Set slot contents
clearItem(x, y, slot)Clear slot
addItem(x, y, id, stack, prefix) → boolAdd to first empty slot; returns false if full

signs — Sign Text

Property/MethodDescription
count → intTotal signs
getAll() → [{x, y, text}]All signs
getAt(x, y) → {x, y, text}Sign at position (or null)
setText(x, y, text)Update sign text

npcs — World NPCs

Manage all world NPCs including town NPCs, bosses, enemies, and any bestiary entry.

Property/MethodDescription
count → intTotal NPCs
getAll() → [{name, displayName, spriteId, x, y, homeX, homeY, isHomeless}]All NPCs including duplicates
setHome(name, x, y)Set home for first NPC matching name (case-insensitive)
setHome(name, x, y, index)Set home for Nth NPC matching name (0-based)
setHomeAll(name, x, y) → intSet home for all NPCs matching name; returns count
create(name, displayName, x, y)Create NPC by name, fullName, bestiaryId, or sprite ID
remove(name) → boolRemove first NPC matching name

tileEntities — Tile Entity Management

Tile entities are special objects attached to certain tiles: weapon racks, item frames, mannequins, hat racks, food platters, logic sensors, training dummies, and pylons.

Counts

PropertyDescription
count → intTotal tile entities
mannequinCount → intDisplay doll / mannequin count
weaponRackCount → intWeapon rack count
hatRackCount → intHat rack count
itemFrameCount → intItem frame count
foodPlatterCount → intFood platter count
logicSensorCount → intLogic sensor count
trainingDummyCount → intTraining dummy count
pylonCount → intTeleportation pylon count

Queries

MethodDescription
getAll() → [{x, y, type, ...}]All tile entities
getAt(x, y) → {x, y, type, ...}Entity at position (or null)
getAllByType(typeName) → [...]Get by type name (see type names below)
getAllMannequins() → [...]All display dolls / mannequins
getAllWeaponRacks() → [...]All weapon racks
getAllHatRacks() → [...]All hat racks
getAllItemFrames() → [...]All item frames
getAllFoodPlatters() → [...]All food platters
findByItem(itemId) → [...]Find entities containing a specific item

Type names for getAllByType: DisplayDoll, WeaponRack, HatRack, ItemFrame, FoodPlatter, LogicSensor, TrainingDummy, TeleportationPylon, DeadCellsDisplayJar, KiteAnchor, CritterAnchor

Single-Item Entities (Weapon Rack, Item Frame, Food Platter, Dead Cells Jar)

These entities hold a single item with an ID, prefix, and stack size.

MethodDescription
setItem(x, y, itemId, prefix?, stack?)Set item on entity (prefix default 0, stack default 1)
clearItem(x, y)Remove item from entity

Return dict keys: x, y, type, itemId, prefix, stack

// Example: Put a Terra Blade on a weapon rack at (100, 200)
tileEntities.setItem(100, 200, 757); // 757 = Terra Blade

// Example: Find all weapon racks and list their items
var racks = tileEntities.getAllWeaponRacks();
for (var i = 0; i < racks.length; i++) {
var r = racks[i];
if (r.itemId > 0) {
log.print("Rack at " + r.x + "," + r.y + " has item " + metadata.itemName(r.itemId));
}
}

Display Doll / Mannequin

Mannequins have equipment slots, dye slots, a weapon slot (Misc[0]), and a pose.

MethodDescription
setEquipment(x, y, slot, itemId, prefix?)Set equipment slot (0-based)
clearEquipment(x, y, slot)Clear equipment slot
setDye(x, y, slot, dyeId, prefix?)Set dye slot
clearDye(x, y, slot)Clear dye slot
setWeapon(x, y, itemId, prefix?)Set weapon (Misc[0] slot)
clearWeapon(x, y)Clear weapon slot
setPose(x, y, poseId)Set pose (0–8)
getPose(x, y) → intGet current pose ID

Return dict keys: x, y, type, items (equipment array), dyes (dye array), pose

Hat Rack

MethodDescription
setHatRackItem(x, y, slot, itemId, prefix?)Set item in hat rack slot
clearHatRackItem(x, y, slot)Clear hat rack item slot
setHatRackDye(x, y, slot, dyeId, prefix?)Set dye in hat rack slot
clearHatRackDye(x, y, slot)Clear hat rack dye slot

Return dict keys: x, y, type, items, dyes

Logic Sensor

MethodDescription
setLogicSensor(x, y, logicCheck, on)Set logic check type and on/off state

Return dict keys: x, y, type, logicCheck, on

Training Dummy

MethodDescription
setTrainingDummyNpc(x, y, npcId)Set the NPC bound to a training dummy

Return dict keys: x, y, type, npcId

world — World Properties

Core

PropertyDescription
width → intWorld width in tiles (read-only)
height → intWorld height in tiles (read-only)
title ↔ stringWorld name
worldId ↔ intWorld ID
seed ↔ stringWorld seed
isFavorite ↔ boolFavorited in world list
isChinese ↔ boolChinese localization flag
isConsole ↔ boolConsole world flag
fileRevision ↔ uintFile revision counter
worldGenVersion ↔ ulongWorld generation version
creationTime ↔ longCreation timestamp
lastPlayed ↔ longLast played timestamp

Spawn & Dungeon

PropertyDescription
spawnX ↔ int, spawnY ↔ intSpawn coordinates
dungeonX ↔ int, dungeonY ↔ intDungeon coordinates

Levels

PropertyDescription
surfaceLevel ↔ doubleSurface level Y
rockLevel ↔ doubleUnderground level Y
safeGroundLayers ↔ boolSafe ground layers enabled

Time

PropertyDescription
time ↔ doubleCurrent time value
dayTime ↔ boolIs daytime
fastForwardTime ↔ boolTime fast-forward active
sundialCooldown ↔ byteEnchanted Sundial cooldown
fastForwardTimeToDusk ↔ boolFast-forward to dusk active
moondialCooldown ↔ byteEnchanted Moondial cooldown

Moon

PropertyDescription
moonPhase ↔ intMoon phase (0–7)
bloodMoon ↔ boolBlood moon active
moonType ↔ byteMoon style
isEclipse ↔ boolEclipse active

Weather

PropertyDescription
isRaining ↔ boolIs raining
tempRainTime ↔ intRain time remaining
tempMaxRain ↔ floatMaximum rain intensity
slimeRainTime ↔ doubleSlime rain time remaining
tempMeteorShowerCount ↔ intMeteor shower count
tempCoinRain ↔ intCoin rain value
numClouds ↔ shortNumber of clouds
windSpeedSet ↔ floatWind speed
cloudBgActive ↔ floatCloud background activity

Sandstorm

PropertyDescription
sandStormHappening ↔ boolSandstorm active
sandStormTimeLeft ↔ intSandstorm time remaining
sandStormSeverity ↔ floatCurrent sandstorm severity
sandStormIntendedSeverity ↔ floatTarget sandstorm severity

Holidays

PropertyDescription
forceHalloweenForToday ↔ boolForce Halloween today
forceXMasForToday ↔ boolForce Christmas today
forceHalloweenForever ↔ boolForce Halloween permanently
forceXMasForever ↔ boolForce Christmas permanently

Difficulty

PropertyDescription
hardMode ↔ boolHardmode enabled
gameMode ↔ int0=Classic, 1=Expert, 2=Master, 3=Journey
spawnMeteor ↔ boolMeteor queued to spawn
combatBookUsed ↔ boolAdvanced Combat Techniques used
combatBookVolumeTwoWasUsed ↔ boolAdvanced Combat Techniques Vol 2 used
peddlersSatchelWasUsed ↔ boolPeddler's Satchel used
partyOfDoom ↔ boolParty of Doom active

World Seeds

PropertyDescription
drunkWorld ↔ boolDrunk world (05162020)
goodWorld ↔ boolFor the Worthy
tenthAnniversaryWorld ↔ bool10th Anniversary
dontStarveWorld ↔ boolThe Constant (Don't Starve)
notTheBeesWorld ↔ boolNot the Bees
remixWorld ↔ boolRemix
noTrapsWorld ↔ boolNo Traps
zenithWorld ↔ boolZenith (Get fixed boi)
skyblockWorld ↔ boolSkyblock
vampireSeed ↔ boolVampire seed
infectedSeed ↔ boolInfected seed
dualDungeonsSeed ↔ boolDual dungeons seed
isCrimson ↔ boolCrimson world (false = Corruption)

Ore Tiers

PropertyDescription
altarCount ↔ intDemon altars smashed
shadowOrbSmashed ↔ boolShadow orb smashed
shadowOrbCount ↔ intShadow orbs smashed count
savedOreTiersCopper ↔ intCopper ore tile ID (alternate: Tin)
savedOreTiersIron ↔ intIron ore tile ID (alternate: Lead)
savedOreTiersSilver ↔ intSilver ore tile ID (alternate: Tungsten)
savedOreTiersGold ↔ intGold ore tile ID (alternate: Platinum)
savedOreTiersCobalt ↔ intCobalt ore tile ID (alternate: Palladium)
savedOreTiersMythril ↔ intMythril ore tile ID (alternate: Orichalcum)
savedOreTiersAdamantite ↔ intAdamantite ore tile ID (alternate: Titanium)

Boss Progression — Pre-Hardmode

PropertyDescription
downedSlimeKing ↔ boolKing Slime defeated
downedEyeOfCthulhu ↔ boolEye of Cthulhu defeated
downedEaterOfWorlds ↔ boolEater of Worlds / Brain of Cthulhu defeated
downedQueenBee ↔ boolQueen Bee defeated
downedSkeletron ↔ boolSkeletron defeated
downedDeerclops ↔ boolDeerclops defeated

Boss Progression — Hardmode

PropertyDescription
downedDestroyer ↔ boolDestroyer defeated
downedTwins ↔ boolTwins defeated
downedSkeletronPrime ↔ boolSkeletron Prime defeated
downedMechBossAny → boolAny mech boss defeated (read-only, computed)
downedPlantera ↔ boolPlantera defeated
downedGolem ↔ boolGolem defeated
downedFishron ↔ boolDuke Fishron defeated
downedLunaticCultist ↔ boolLunatic Cultist defeated
downedMoonlord ↔ boolMoon Lord defeated
downedEmpressOfLight ↔ boolEmpress of Light defeated
downedQueenSlime ↔ boolQueen Slime defeated

Boss Events

PropertyDescription
downedHalloweenTree ↔ boolMourning Wood defeated
downedHalloweenKing ↔ boolPumpking defeated
downedChristmasTree ↔ boolEverscream defeated
downedSanta ↔ boolSanta-NK1 defeated
downedChristmasQueen ↔ boolIce Queen defeated
downedClown ↔ boolClown defeated

Celestial Pillars

PropertyDescription
downedCelestialSolar ↔ boolSolar Pillar defeated
downedCelestialNebula ↔ boolNebula Pillar defeated
downedCelestialVortex ↔ boolVortex Pillar defeated
downedCelestialStardust ↔ boolStardust Pillar defeated
celestialSolarActive ↔ boolSolar Pillar currently active
celestialVortexActive ↔ boolVortex Pillar currently active
celestialNebulaActive ↔ boolNebula Pillar currently active
celestialStardustActive ↔ boolStardust Pillar currently active

Events & Invasions

PropertyDescription
downedGoblins ↔ boolGoblin army defeated
downedFrost ↔ boolFrost Legion defeated
downedPirates ↔ boolPirate invasion defeated
downedMartians ↔ boolMartian Madness defeated
downedDD2InvasionT1 ↔ boolOld One's Army tier 1
downedDD2InvasionT2 ↔ boolOld One's Army tier 2
downedDD2InvasionT3 ↔ boolOld One's Army tier 3
invasionType ↔ intCurrent invasion type
invasionSize ↔ intCurrent invasion size
invasionX ↔ doubleCurrent invasion X position

NPC Rescue Flags

PropertyDescription
savedGoblin ↔ boolGoblin Tinkerer rescued
savedMech ↔ boolMechanic rescued
savedWizard ↔ boolWizard rescued
savedStylist ↔ boolStylist rescued
savedTaxCollector ↔ boolTax Collector rescued
savedBartender ↔ boolTavernkeep rescued
savedGolfer ↔ boolGolfer rescued
savedAngler ↔ boolAngler rescued
anglerQuest ↔ intCurrent Angler quest ID

NPC Pets

PropertyDescription
boughtCat ↔ boolTown cat purchased
boughtDog ↔ boolTown dog purchased
boughtBunny ↔ boolTown bunny purchased

NPC Unlock Flags

PropertyDescription
unlockedMerchantSpawn ↔ boolMerchant unlocked
unlockedDemolitionistSpawn ↔ boolDemolitionist unlocked
unlockedPartyGirlSpawn ↔ boolParty Girl unlocked
unlockedDyeTraderSpawn ↔ boolDye Trader unlocked
unlockedTruffleSpawn ↔ boolTruffle unlocked
unlockedArmsDealerSpawn ↔ boolArms Dealer unlocked
unlockedNurseSpawn ↔ boolNurse unlocked
unlockedPrincessSpawn ↔ boolPrincess unlocked

Town Slimes

PropertyDescription
unlockedSlimeBlueSpawn ↔ boolBlue town slime
unlockedSlimeGreenSpawn ↔ boolGreen town slime
unlockedSlimeOldSpawn ↔ boolOld town slime
unlockedSlimePurpleSpawn ↔ boolPurple town slime
unlockedSlimeRainbowSpawn ↔ boolRainbow town slime
unlockedSlimeRedSpawn ↔ boolRed town slime
unlockedSlimeYellowSpawn ↔ boolYellow town slime
unlockedSlimeCopperSpawn ↔ boolCopper town slime

Lantern Night

PropertyDescription
lanternNightCooldown ↔ intLantern night cooldown
lanternNightManual ↔ boolManually triggered lantern night
lanternNightGenuine ↔ boolGenuine lantern night active
lanternNightNextNightIsGenuine ↔ boolNext night will be a genuine lantern night

Party

PropertyDescription
partyManual ↔ boolManually triggered party
partyGenuine ↔ boolGenuine party active
partyCooldown ↔ intParty cooldown

Backgrounds

PropertyDescription
bgOcean ↔ byteOcean background style
bgDesert ↔ byteDesert background style
bgCrimson ↔ byteCrimson background style
bgHallow ↔ byteHallow background style
bgSnow ↔ byteSnow background style
bgJungle ↔ byteJungle background style
bgCorruption ↔ byteCorruption background style
bgTree ↔ byteForest background style 1
bgTree2 ↔ byteForest background style 2
bgTree3 ↔ byteForest background style 3
bgTree4 ↔ byteForest background style 4
underworldBg ↔ byteUnderworld background style
mushroomBg ↔ byteMushroom biome background style
iceBackStyle ↔ intIce background style
jungleBackStyle ↔ intJungle background style (cave)
hellBackStyle ↔ intHell background style

Tree & Cave Styles

PropertyDescription
treeX0 ↔ int, treeX1 ↔ int, treeX2 ↔ intTree style zone boundaries
treeStyle0 ↔ inttreeStyle3 ↔ intTree styles per zone
treeTop1 ↔ inttreeTop4 ↔ intTree top styles per zone
caveBackX0 ↔ int, caveBackX1 ↔ int, caveBackX2 ↔ intCave background zone boundaries
caveBackStyle0 ↔ intcaveBackStyle3 ↔ intCave background styles per zone

World Bounds

PropertyDescription
topWorld ↔ floatTop world boundary
bottomWorld ↔ floatBottom world boundary
leftWorld ↔ floatLeft world boundary
rightWorld ↔ floatRight world boundary

Other

PropertyDescription
cultistDelay ↔ intCultist respawn delay
apocalypse ↔ boolApocalypse mode

metadata — Game Data Lookup

MethodDescription
tileId(name) → intTile ID by name, 0 if not found (case-insensitive)
wallId(name) → intWall ID by name, 0 if not found (case-insensitive)
itemId(name) → intItem ID by name, 0 if not found (case-insensitive)
tileName(id) → stringTile name by ID, empty string if not found
wallName(id) → stringWall name by ID, empty string if not found
itemName(id) → stringItem name by ID, empty string if not found
allTiles() → [{id, name}]All tile definitions
allWalls() → [{id, name}]All wall definitions
allItems() → [{id, name}]All item definitions

log — Output

MethodDescription
print(msg)Log info message
warn(msg)Log warning
error(msg)Log error
progress(value)Update progress bar (0.0–1.0)

finder — Find Sidebar Integration

MethodDescription
clear()Clear all find results
addResult(name, x, y, type, extraInfo?) → boolAdd result (max 1,000); returns false if cap reached
navigate(index)Navigate to result by index
navigateFirst()Navigate to first result

tools — UI Tools & File Operations

MethodDescription
listTools() → [string]Available tool names
copySelection()Copy selection to clipboard
getTilePickerTile() → intCurrent tile picker tile value
getTilePickerWall() → intCurrent wall picker value
getFilePath() → stringGet the current world file path
setFilePath(path)Set the current world file path (does not save)
getWorldsFolder() → stringGet the default Terraria worlds folder path
getCloudWorldsFolders() → [{userId, path}]Get all Steam Cloud world folder paths
save() → boolSave world to current file path (no UI dialog)
saveAs(filename, version?) → boolSave world to file (no UI dialog, optional version override)
load(filename) → boolLoad a world file, replacing the current world (blocks until complete)
Short filenames

saveAs and load accept just a filename (e.g. "MyWorld.wld" or even "MyWorld") — if there are no path separators, the file resolves to the default Terraria worlds folder. The .wld extension is added automatically if missing.

note

The tools API is only available when running scripts in the TEdit UI. It is not available in test/headless mode.

// Save the current world
tools.save();

// Save to the default worlds folder — just use the filename
tools.saveAs("MyWorld-Copy");

// Full paths still work
tools.saveAs("C:/Users/me/Documents/My Games/Terraria/Worlds/MyWorld-Copy.wld");

// Load from the default worlds folder
tools.load("OtherWorld");

// List cloud world folders
var clouds = tools.getCloudWorldsFolders();
for (var i = 0; i < clouds.length; i++) {
log.print("Steam user " + clouds[i].userId + ": " + clouds[i].path);
}