Here are my first few steps in LUA land. I've coded a lot of languages so the syntax is pretty easy, code will get prettier with time. Just need to get as fluent with the new UO.dll interace as I am with the old EUO client functions and variables...
Any comments?
function Display(type, msg)
MsgBox = Obj.Create("TMessageBox")
MsgBox.Title = 'Message'
if type == "OK" then
MsgBox.Button = 0
MsgBox.Icon = 4
else if type == "YESNO" then
MsgBox.Button = 4
MsgBox.Icon = 2
end end
MsgBox.Default = 0
return MsgBox.Show(msg)
end
function FindItem(fid)
cnt = UO.ScanItems(true)
i = 0
while i < cnt do
id,type = UO.GetItem(i)
if id == fid then break end
i = i + 1
end
return type
end
--Main
repeat
Display("OK", "Please target the item you wish to ID")
UO.TargCurs = true
while UO.TargCurs == true do wait(100) end
findtype = FindItem(UO.LTargetID)
until Display("YESNO", "Item ID: " .. UO.LTargetID .. " | Item Type: " .. findtype .. "\n\nID Another Item?") == 7