Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.31 KB | None | 0 0
  1. dofile(getinstalldir().."/libs/FindItems.lua")
  2.  
  3. local instrumentTypes = {3741, 3763, 3764, 3762, 3740, 10247}
  4.  
  5. local nextPlay = getticks()
  6. local nextPeace = nextPlay
  7. local ref, cnt = UO.ScanJournal(0)
  8. local minMusi = 700
  9.  
  10. function CheckJournal()
  11.    ref, cnt = UO.ScanJournal(ref)
  12.    for j = 1, cnt do
  13.       local text = UO.GetJournal(j)
  14.       if (string.find(text, "play poorly") or string.find(text, "attempt to calm")) then
  15.          nextPeace = nextPeace + 5000
  16.       end
  17.    end
  18. end
  19.  
  20. function Target(timeout)
  21.    local timeout = getticks() + timeout
  22.    while (getticks() < timeout and not UO.TargCurs) do
  23.       wait(100)
  24.    end
  25. end
  26.  
  27. function FindInstruments()
  28.    return ScanItems(true, {Type=instrumentTypes, ContID=UO.BackpackID})
  29. end
  30.  
  31. while true do
  32.    local instruments = FindInstruments()
  33.    if (#instruments == 0) then
  34.       stop()
  35.    end
  36.    local ticks = getticks()
  37.    if (ticks >= nextPlay) then
  38.       UO.LObjectID = instruments[1].ID
  39.       UO.Macro(17, 0)
  40.       nextPlay = ticks + 6500
  41.    end
  42.    local _, musi = UO.GetSkill("musi")
  43.    local _, peace, peaceCap = UO.GetSkill("peace")
  44.    if (ticks > nextPeace and peace < peaceCap and musi >= minMusi) then
  45.       UO.Macro(13, 9)
  46.       Target(5000)
  47.       UO.Macro(23, 0)
  48.       nextPeace = ticks + 5500
  49.    end
  50.    CheckJournal()
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement