So here you go...
finditem POF C_ , #backpackID
msg #findID #findType #findCol $
Simple enough, right? Find Gold in your backpack and message back it's ID, Type and Color.
Here's your wonderful OEUO replacement for those two lines.
local ignorelist = {}
findtype = function(typ, source)
ncnt = UO.ScanItems(true)
for nindex = 0,(ncnt-1) do
local nid,ntype,nkind,ncontid,nx,ny,nz,nstack,nrep,ncol = UO.GetItem(nindex)
if ntype == typ and ignorelist[nid] == nil then
if source == nil or ( source ~= nil and source == ncontid ) then
return {nid,ntype,nkind,ncontid,nx,ny,nz,nstack,nrep,ncol}
end
end
end
return nil
end
local gold = findtype(3821,UO.BackpackID)
if gold ~= nil then
UO.Msg(gold[1]..' '..gold[2]..' '..gold[10]..'\013\010')
end
Make you feel like it's an improvement doesn't it? Like you just want to jump on board with both feet?
How about another example of OEUO's awesomeness?
finditem %monsters G_1
event macro 27
Find a monster from the variable %monsters that is on the ground within 1 space and attack it.
Here's the replacement in OEUO:
local ignorelist = {}
local monstertypes = {}
monstertypes[211] = true -- black bear
monstertypes[212] = true -- grizzly bear
findground = function(types, distance)
ncnt = UO.ScanItems(true)
for nindex = 0,(ncnt-1) do
local nid,ntype,nkind,ncontid,nx,ny,nz,nstack,nrep,ncol = UO.GetItem(nindex)
local dist1 = math.abs(nx - UO.CharPosX)
local dist2 = math.abs(ny - UO.CharPosY)
if dist1 <= distance and dist2 <= distance then
if types[ntype] == true and ignorelist[nid] == nil and ncontid == 0 then
return {nid,ntype,nkind,ncontid,nx,ny,nz,nstack,nrep,ncol}
end
end
end
return nil
end
local monster = findground(monstertypes, 1)
if monster ~= nil then
UO.LTargetID = monster[1]
UO.LTargetKind = 1
UO.Macro(27,0)
end
That's 26 lines of code to do what EUO does with 2. That's 795 Chars (with spaces) to do what 36 Chars (with spaces) can do in EUO.