Skip to content

uo.dll API

uo.dll is the EasyUO engine packaged as a DLL, for programs written in other languages: the same client reading and automation that EasyUO scripts use, called from your own code. EasyUO Reforged itself does not need it; it only matters if you write such a program. Keep uo.dll next to your program, or give its full path.

Everything goes through a handle and a stack of values.

  1. Open returns a handle. Each handle has its own stack and its own attached client.
  2. To do something, push the command, the name and any values onto the stack, then call Execute.
  3. Execute returns 0 when it worked, or a negative error code. It removes what you pushed, so the stack then holds only the results, from position 1 up.
  4. Read the results with the Get… functions, then empty the stack with SetTop(handle, 0).
  5. Close releases the handle.

There are three commands to read, change and run members:

Command Pushed Results
Get "Get", the property name Its value.
Set "Set", the property name, the new value Nothing.
Call "Call", the method name, its parameters What the method returns.

The first thing a program does is attach a client: Set CliNr 1 attaches the first running client, and CliCnt says how many there are.

The stack holds numbers, strings, booleans, pointers and nil. Unlike EasyUO scripts, uo.dll uses real types:

  • IDs and types are plain numbers, not the letter codes scripts see (#CharID reads ABCDEF; CharID returns the number behind it).
  • Strings keep their spaces; nothing is turned into _, and $ is just a character.
  • Where a script variable would read N/A, uo.dll returns 0, an empty string or false.
Code Name Meaning
0 RES_OK It worked.
-1 ERR_NOTFOUND No property, method or command with that name.
-2 ERR_WRONGPAR The name exists, but not with these parameters.
-3 ERR_GENERIC Something else went wrong.

Type tells which parameters a member accepts; GetError turns a code into its name.

Every function uses the stdcall convention (the normal 64-bit Windows convention) and takes the handle first. The names are exported with the original decorations, for example _UOOpen@0.

Function Export name What it does
Version() _UOVersion@0 API version: 3.
Open() _UOOpen@0 New handle (pointer-sized).
Close(h) _UOClose@4 Frees the handle.
Execute(h) _UOExecute@4 Runs Get, Set, Call, Type or Help; returns an error code.
Query(h) _UOQuery@4 Runs a query such as GetKeywords; returns an error code.
GetTop(h) _UOGetTop@4 Number of values on the stack.
SetTop(h, n) _UOSetTop@8 Cuts the stack down to n values; 0 empties it.
GetType(h, i) _UOGetType@8 Type of value i: 0 nil, 1 boolean, 2 pointer, 3 number, 4 string.
PushNil(h), PushBoolean(h, b), PushInteger(h, n), PushDouble(h, d), PushPointer(h, p) _UOPushNil@4, … Push a value.
PushStrVal(h, s), PushLStrVal(h, s, len) _UOPushStrVal@8, _UOPushLStrVal@12 Push a copy of a string (the L form may contain zero bytes).
PushStrRef(h, s), PushLStrRef(h, s, len) _UOPushStrRef@8, _UOPushLStrRef@12 Push a string without copying it; it must stay valid.
GetBoolean(h, i), GetInteger(h, i), GetDouble(h, i), GetPointer(h, i) _UOGetInteger@8, … Read value i.
GetString(h, i), GetLString(h, i, var len) _UOGetString@8, _UOGetLString@12 Read a string; it stays valid until the stack changes.
Insert(h, i), Remove(h, i), PushValue(h, i) _UOInsert@8, … Move, remove or copy stack values.
Mark(h), Clean(h) _UOMark@4, _UOClean@4 Remember the stack size / remove that many values from the bottom.

A sketch in Python with ctypes (64-bit Python):

import ctypes as C
uo = C.WinDLL(r"C:\Games\EasyUOReforged\uo.dll")
def fn(name, restype, *argtypes):
f = uo[name]
f.restype, f.argtypes = restype, argtypes
return f
H = C.c_ssize_t # the handle is pointer-sized
Open = fn('_UOOpen@0', H)
Close = fn('_UOClose@4', None, H)
Execute = fn('_UOExecute@4', C.c_int, H)
SetTop = fn('_UOSetTop@8', None, H, C.c_int)
PushStr = fn('_UOPushStrVal@8', None, H, C.c_char_p)
PushInt = fn('_UOPushInteger@8', None, H, C.c_int)
GetInt = fn('_UOGetInteger@8', C.c_int, H, C.c_int)
GetStr = fn('_UOGetString@8', C.c_char_p, H, C.c_int)
h = Open()
def run(command, name, *values):
SetTop(h, 0)
PushStr(h, command.encode())
PushStr(h, name.encode())
for v in values:
PushInt(h, v) if isinstance(v, int) else PushStr(h, v.encode())
return Execute(h) # 0 = it worked
run('Set', 'CliNr', 1) # attach the first client
run('Get', 'CharName'); print(GetStr(h, 1).decode())
run('Call', 'GetSkill', 'mage'); print('Magery', GetInt(h, 1) / 10)
Close(h)
NameDescriptionCategory
ARYour character’s physical resistance (armour rating before Age of Shadows).Properties
BackpackIDID of your character’s backpack.Properties
BlockInfoReads the client's walkability data for an area of up to 32×32 tiles starting at `x`, `y`, `z`.Methods
BuffBarOpen#true when the client’s buff bar window is open, #false when it is closed.Properties
CallRuns a method with the parameters that follow; pushes what it returns.Generic calls
CharDirDirection your character is facing, 0 (north) to 7.Properties
CharIDID of your character.Properties
CharNameYour character’s name.Properties
CharPosXYour character’s X position in the world (west–east).Properties
CharPosYYour character’s Y position in the world (north–south).Properties
CharPosZYour character’s height (Z coordinate).Properties
CharStatusLetters for your character’s states: frozen, female, flying or poisoned, yellow health bar, war mode, hidden.Properties
CharTypeBody type of your character, as a Sys26 type.Properties
ClickClicks at `x`, `y` in the client window, like `click`.Methods
CliCntNumber of supported UO clients running.Properties
CliDragPicks up an item with the client's own drag, like `event Drag`.Methods
CliLangLanguage code of the client, such as ENU.Properties
CliLeftX position of the game area inside the client window; set it to move the game area.Properties
CliLogged1 when a character is logged in, 0 at the login screens.Properties
CliNrWhich of the running clients the script drives, counting from 1.Properties
CliTitleTitle of the client window; set it to rename the window.Properties
CliTopY position of the game area inside the client window; set it to move the game area.Properties
CliVerVersion of the attached client, such as 7.0.117.1.Properties
CliXResWidth of the game area in pixels; set it to resize the game area.Properties
CliYResHeight of the game area in pixels; set it to resize the game area.Properties
CloseClientCloses the attached client, like `terminate uo`.Methods
ContIDID of the item a container gump on top belongs to.Properties
ContKindKind of the gump on top, as a code; tells crafting menus, runebooks and more apart.Properties
ContNameName of the gump on top, such as container_gump or paperdoll_gump.Properties
ContPosXX position of the gump on top; set it to move the gump.Properties
ContPosYY position of the gump on top; set it to move the gump.Properties
ContSizeXWidth of the top gump in pixels.Properties
ContSizeYHeight of the top gump in pixels.Properties
ContTopBrings a gump to the front, counted from the top gump (0), like `event ContTop`.Methods
ContTypeType of the item a container gump on top belongs to.Properties
CRYour character’s cold resistance.Properties
CursKindFacet you are on: 0 Felucca, 1 Trammel, 2 Ilshenar, 3 Malas, 4 Tokuno, 5 Ter Mur.Properties
CursorXMouse cursor X position relative to the game area.Properties
CursorYMouse cursor Y position relative to the game area.Properties
CustomSends a raw packet to the server: `packet` holds its bytes, exactly as the server expects them.Methods
DexYour character’s dexterity.Properties
DragPicks up an item through the server, like `exevent Drag`.Methods
DropCDrops the item last dragged into a container, or onto a stack, like `exevent DropC`.Methods
DropGDrops the item last dragged on the ground, like `exevent DropG`.Methods
DropPDPuts the item last dragged with `Drag` on, like `exevent DropPD`.Methods
EnemyHitsHealth in percent of the enemy in #EnemyID.Properties
EnemyIDID of the enemy whose health bar the client shows, or N/A.Properties
EquipEquips the items with the given IDs in one request, like `exevent Equip`.Methods
ERYour character’s energy resistance.Properties
ExMsgShows a message above an object, like `event ExMsg`.Methods
FilterItemsNarrows the list `ScanItems` made, and returns how many items are left.Methods
FollowersHow many follower slots your pets and summons use.Properties
FRYour character’s fire resistance.Properties
GetReads a property: pushes its value.Generic calls
GetBuffReads one buff of the list `ScanBuffs` made.Methods
GetCommandsPushes the names of the `Execute` commands: Call, Get, Help, Set, Type.Generic calls
GetContDescribes one open gump, counted from the top (0), skipping the ignored ones.Methods
GetErrorPushes the name of an error code: `RES_OK`, `ERR_NOTFOUND`, `ERR_WRONGPAR`, `ERR_GENERIC`, or `ERR_UNKNOWNERR`.Generic calls
GetFeaturesPushes `CEIKD`, the feature letters of this API version.Generic calls
GetInitPushes a short Lua script that makes the API available as `UO.Name` in Lua, the way OpenEUO used it.Generic calls
GetItemReads one item of the filtered list, like the `#Find…` variables after `finditem`.Methods
GetItemLayerReads the equip layer of one item of the filtered list, as `#FindLayer`.Methods
GetJournalReads one journal line of the list `ScanJournal` made: 0 is the newest.Methods
GetKeywordsPushes the name of every property and method, once each.Generic calls
GetPathPlans a walking route, like `path find`: from your character on its facet, or from `fromx`, `fromy`, `fromz` on `facet`, to `x`, `y` (with `z`, to the floor nearest that height).Methods
GetPixReads the colour of a pixel of the client window.Methods
GetShopReads the entry shown at the top of the shop gump, like `getshopinfo`.Methods
GetSkillReads a skill.Methods
GoldGold your character carries, as the status window shows it.Properties
HelpDoes nothing and returns 0.Generic calls
HideItemHides an item from your screen, like `hideitem`.Methods
HitsYour character’s current hit points.Properties
IgnoreContAdds a gump to the ignore list, by name or by kind, like `ignorecont`.Methods
IntYour character’s intelligence.Properties
KeyPresses a key in the client, like `key`.Methods
LHandIDID of the item for the left hand; set it, then event Macro 24 1 arms it.Properties
LLiftedIDID of the object last picked up (dragged).Properties
LLiftedKind1 while something hangs on the cursor, 0 otherwise.Properties
LLiftedTypeType of the object last picked up (dragged).Properties
LObjectIDID of the last object used; set it, then event Macro 17 uses that object.Properties
LObjectTypeType of the last object used.Properties
LShardNumber of the last shard chosen; set it before logging in to preselect a shard.Properties
LSkillNumber of the last skill used; set it, then event Macro 14 uses that skill.Properties
LSpellNumber of the last spell cast; set it, then event Macro 16 casts that spell.Properties
LTargetIDID of the last object targeted; set it, then event Macro 22 targets that object.Properties
LTargetKindWhat the last target was: 1 object, 2 ground, 3 resource such as a tree or water.Properties
LTargetTileMap graphic of the tile last targeted; used for resources such as trees.Properties
LTargetXWorld X position of the last target; used when targeting the ground or a resource.Properties
LTargetYWorld Y position of the last target; used when targeting the ground or a resource.Properties
LTargetZWorld height of the last target; used when targeting the ground or a resource.Properties
LuckYour character’s luck.Properties
MacroRuns one of the client's macros, like `event Macro`.Methods
ManaYour character’s current mana.Properties
MaxDmgMost damage of the weapon in your hands.Properties
MaxFolHow many follower slots your character has.Properties
MaxHitsThe most hit points your character can have.Properties
MaxManaThe most mana your character can have.Properties
MaxStamThe most stamina your character can have.Properties
MaxStatsYour character’s stat cap: the most strength, dexterity and intelligence together.Properties
MaxWeightMost weight your character can carry, calculated from strength: 3.5 × Str + 40.Properties
MinDmgLeast damage of the weapon in your hands.Properties
MountIDID of the mount item your character rides, or N/A while it is on foot.Properties
MountTypeType of the mount item your character rides, or N/A while it is on foot.Properties
MoveWalks towards a position without pathfinding, like `move`.Methods
MsgTypes text into the client, like `msg`.Methods
NextCPosXX position where the next gump will open.Properties
NextCPosYY position where the next gump will open.Properties
OpenClientStarts another client, like `uoxl new`.Methods
PathAvoidMarks the rectangle from `x`, `y` to `x2`, `y2` as a place routes should go round if they can, like `path avoid`.Methods
PathBlockMarks a tile, or the rectangle from `x`, `y` to `x2`, `y2`, as a place routes must never use, like `path block`.Methods
PathCanSays whether a character can stand at `x`, `y`, like `path can`.Methods
PathCheckAsks the client itself whether the character can step onto `x`, `y` in direction `dir` from the tile behind it, at height `z`, like `path check`: the check the client makes before every step, with everything it has loaded.Methods
PathClearForgets rules, like `path clear`.Methods
PathfindWalks to a nearby position with the client's pathfinding, like `event PathFind`.Methods
PathLinkAdds a teleporter, gate or ladder routes may use, from `x`, `y`, `z` to `x2`, `y2`, `z2` on the same facet, like `path link`.Methods
PathSetChanges a planning option, like `path set`: `accuracy`, `accuracyz`, `maxnodes`, `timeout`, `margin`, `turncost`, `heuristic`, `doorcost`, `difs`, `mobiles` or `doors`.Methods
PathUnblockRemoves the blocks that overlap a tile or a rectangle, like `path unblock`.Methods
PopupOpens the context menu of an object, like `exevent PopUp`.Methods
PRYour character’s poison resistance.Properties
PropertyReads the property tooltip of an object, like `event Property`.Methods
RenamePetRenames a pet, like `exevent RenamePet`.Methods
RHandIDID of the item for the right hand; set it, then event Macro 24 2 arms it.Properties
ScanBuffsReads the buff bar, like `scanbuffs`; with `icon`, only buffs with that icon ID.Methods
ScanItemsMakes a fresh list of the items and characters the client knows, like the first step of `finditem`.Methods
ScanJournalReads the journal.Methods
SetChanges a read/write property.Generic calls
SetDelayRegisters a function the DLL calls whenever a method has to wait (two pointers: the function, and a value passed back to it).Generic calls
SetShopSets how many of an item to buy, like `setshopitem`.Methods
SexYour character’s sex: 0 male, 1 female.Properties
ShardName of the shard the client is logged in to.Properties
SkillLockSets a skill's lock, like `exevent SkillLock`: `lock` 0 up, 1 down, 2 locked; `skill` a skill code or `all`.Methods
StaminaYour character’s current stamina.Properties
StatBarOpens a character's health bar, like `event StatBar`.Methods
StatLockSets a stat's lock, like `exevent StatLock`: `stat` is `str`, `dex` or `int`; `lock` 0 up, 1 down, 2 locked.Methods
StrYour character’s strength.Properties
SysMessageShows a system message in the client, like `event SysMessage`.Methods
SysMsgThe last system message the client showed.Properties
TargCurs1 while a target cursor is showing; set it to 1 to let the user pick a target.Properties
TileCntCounts the tiles at a map position, like `tile cnt`.Methods
TileGetReads one tile at a map position, like `tile get`; `layer` counts from 1.Methods
TileInitLoads the map files of the attached client, like `tile init`.Methods
TPYour character’s tithing points.Properties
TypeDescribes a member: pushes its kind (1 read-only property, 2 read/write property, 3 method), then one parameter mask per form (`n` number, `s` string, `b` boolean, `*` anything that follows).Generic calls
WeightWeight your character carries, in stones.Properties