Don't like ads? PRO users don't see any ads ;-)
Guest

sayildlib

By: a guest on Aug 10th, 2012  |  syntax: Lua  |  size: 19.27 KB  |  hits: 37  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. -- Sayild Library 10/08/2012 --
  2.  
  3. function qs1(tablename, left, right)
  4.         if type(tablename) == 'table' then
  5.                 left = left or 1
  6.                 right = right or #tablename
  7.                 local i,j,x
  8.                 if right-left+1 <= 25 then
  9.                         for i=left+1, right do
  10.                                 x=tablename[i]
  11.                                 j=i-1
  12.                                 while j>=left and x<tablename[j] do
  13.                                         tablename[j+1]=tablename[j]
  14.                                         j=j-1
  15.                                 end
  16.                                 tablename[j+1]=x
  17.                         end
  18.                 else
  19.                         i,j,x = left, right, tablename[math.floor((left+right)/2)]
  20.                         local temp
  21.                         repeat
  22.                                 while tablename[i]<x and i < right do
  23.                                         i = i+1
  24.                                 end
  25.                                 while tablename[j]>x and j > left do
  26.                                         j = j-1
  27.                                 end
  28.                                 if (i <= j) then
  29.                                         temp = tablename[i]
  30.                                         tablename[i] = tablename[j]
  31.                                         tablename[j] = temp
  32.                                         i = i+1
  33.                                         j = j-1
  34.                                 end
  35.                         until i > j
  36.                         if (left < j) then
  37.                                 qs1(tablename, left, j)
  38.                         end
  39.                         if (right > i) then
  40.                                 qs1(tablename, i, right)
  41.                         end
  42.                 end
  43.         end
  44. end
  45.  
  46. function qs2(tablename, left, right, argument)
  47.         if type(tablename) == 'table' then
  48.                 left = left or 1
  49.                 right = right or #tablename
  50.                 local i,j,x
  51.                 if right-left+1 <= 25 then
  52.                         for i=left+1, right do
  53.                                 x=tablename[i]
  54.                                 j=i-1
  55.                                 while j>=left and x[argument] < tablename[j][argument] do
  56.                                         tablename[j+1]=tablename[j]
  57.                                         j=j-1
  58.                                 end
  59.                                 tablename[j+1]=x
  60.                         end
  61.                 else
  62.                         i,j,x = left, right, tablename[math.floor((left+right)/2)][argument]
  63.                         local temp
  64.                         repeat
  65.                                 while tablename[i][argument]<x and i < right do
  66.                                         i = i+1
  67.                                 end
  68.                                 while tablename[j][argument]>x and j > left do
  69.                                         j = j-1
  70.                                 end
  71.                                 if (i <= j) then
  72.                                         temp = tablename[i]
  73.                                         tablename[i] = tablename[j]
  74.                                         tablename[j] = temp
  75.                                         i = i+1
  76.                                         j = j-1
  77.                                 end
  78.                         until i > j
  79.                         if (left < j) then
  80.                                 qs2(tablename, left, j, argument)
  81.                         end
  82.                         if (right > i) then
  83.                                 qs2(tablename, i, right, argument)
  84.                         end
  85.                 end
  86.         end
  87. end
  88.  
  89. function qs3(tablename, left, right)
  90.         if type(tablename) == 'table' then
  91.                 left = left or 1
  92.                 right = right or #tablename
  93.                 local i,j,x
  94.                 if right-left+1 <= 25 then
  95.                         for i=left+1, right do
  96.                                 x=tablename[i]
  97.                                 j=i-1
  98.                                 while j>=left and x>tablename[j] do
  99.                                         tablename[j+1]=tablename[j]
  100.                                         j=j-1
  101.                                 end
  102.                                 tablename[j+1]=x
  103.                         end
  104.                 else
  105.                         i,j,x = left, right, tablename[math.floor((left+right)/2)]
  106.                         local temp
  107.                         repeat
  108.                                 while tablename[i]>x and i < right do
  109.                                         i = i+1
  110.                                 end
  111.                                 while tablename[j]<x and j > left do
  112.                                         j = j-1
  113.                                 end
  114.                                 if (i <= j) then
  115.                                         temp = tablename[i]
  116.                                         tablename[i] = tablename[j]
  117.                                         tablename[j] = temp
  118.                                         i = i+1
  119.                                         j = j-1
  120.                                 end
  121.                         until i > j
  122.                         if (left < j) then
  123.                                 qs3(tablename, left, j)
  124.                         end
  125.                         if (right > i) then
  126.                                 qs3(tablename, i, right)
  127.                         end
  128.                 end
  129.         end
  130. end
  131.  
  132. function qs4(tablename, left, right, argument)
  133.         if type(tablename) == 'table' then
  134.                 left = left or 1
  135.                 right = right or #tablename
  136.                 local i,j,x
  137.                 if right-left+1 <= 25 then
  138.                         for i=left+1, right do
  139.                                 x=tablename[i]
  140.                                 j=i-1
  141.                                 while j>=left and x[argument]>tablename[j][argument] do
  142.                                         tablename[j+1]=tablename[j]
  143.                                         j=j-1
  144.                                 end
  145.                                 tablename[j+1]=x
  146.                         end
  147.                 else
  148.                         i,j,x = left, right, tablename[math.floor((left+right)/2)][argument]
  149.                         local temp
  150.                         repeat
  151.                                 while tablename[i][argument]>x and i < right do
  152.                                         i = i+1
  153.                                 end
  154.                                 while tablename[j][argument]<x and j > left do
  155.                                         j = j-1
  156.                                 end
  157.                                 if (i <= j) then
  158.                                         temp = tablename[i]
  159.                                         tablename[i] = tablename[j]
  160.                                         tablename[j] = temp
  161.                                         i = i+1
  162.                                         j = j-1
  163.                                 end
  164.                         until i > j
  165.                         if (left < j) then
  166.                                 qs4(tablename, left, j, argument)
  167.                         end
  168.                         if (right > i) then
  169.                                 qs4(tablename, i, right, argument)
  170.                         end
  171.                 end
  172.         end
  173. end
  174.  
  175.  
  176. function seq1(tablename,value)
  177.    if type(tablename) == 'table' then
  178.       for i,j in ipairs(tablename) do
  179.          if j == value then
  180.             return i
  181.          end
  182.       end
  183.    end
  184.    return
  185. end
  186.  
  187. function seq2(tablename,value,argument)
  188.    if type(tablename) == 'table' then
  189.       for i,j in ipairs(tablename) do
  190.          if j[argument] == value then
  191.             return i
  192.          end
  193.       end
  194.    end
  195.    return
  196. end
  197.  
  198. function bin1(tablename,value)
  199.    if type(tablename) == 'table' then
  200.       local left,right = 1, #tablename
  201.       while left <= right do
  202.          local mid = math.floor((right+left)/2)
  203.          if tablename[mid] == value then
  204.             return mid
  205.          end
  206.          if tablename[mid] > value then
  207.             right = mid-1
  208.          else
  209.             left = mid+1
  210.          end
  211.       end
  212.    end
  213.    return
  214. end
  215.  
  216. function bin2(tablename,value,argument)
  217.    if type(tablename) == 'table' then
  218.       local left,right = 1, #tablename
  219.       while left <= right do
  220.          local mid = math.floor((right+left)/2)
  221.          if tablename[mid][argument] == value then
  222.             return mid
  223.          end
  224.          if tablename[mid][argument] > value then
  225.             right = mid-1
  226.          else
  227.             left = mid+1
  228.          end
  229.       end
  230.    end
  231.    return
  232. end
  233.  
  234. function table:find(value,argument) --Working
  235.    if argument then
  236.       return seq2(self,value,argument)
  237.    end
  238.    return seq1(self,value)
  239. end
  240.  
  241. function table:newsort(argument, order) --Working
  242.         if argument == 'asc' or argument == 'desc' then
  243.                 order = argument
  244.                 argument = false
  245.         end
  246.         order = order or 'asc'
  247.         if order == 'asc' then
  248.                 if argument then
  249.                         qs2(self,1,#self,argument)
  250.                 else
  251.                         qs1(self,1,#self)
  252.                 end
  253.         else
  254.                 if argument then
  255.                         qs4(self,1,#self,argument)
  256.                 else
  257.                         qs3(self,1,#self)
  258.                 end
  259.         end
  260. end
  261.  
  262. function table:binaryfind(value,argument) --Working
  263.    if argument then
  264.       return bin2(self,value,argument)
  265.    end
  266.    return bin1(self,value)
  267. end
  268.  
  269. function dropflask()
  270.    dropitems(283,284,285)
  271. end
  272.  
  273. function depositall()
  274.    say("Hi")
  275.    wait(1500,2500)
  276.    npcsay("Deposit all")
  277.    wait(300,500)
  278.    npcsay("yes")
  279.    wait(200,300)
  280. end
  281.  
  282. function travelvenore()
  283.    say("Hi")
  284.    wait(1500,2500)
  285.    npcsay("Venore")
  286.    wait(300,500)
  287.    npcsay("yes")
  288.    wait(200,300)
  289. end
  290.  
  291. function traveledron()
  292.    say("Hi")
  293.    wait(1500,2500)
  294.    npcsay("Edron")
  295.    wait(300,500)
  296.    npcsay("yes")
  297.    wait(200,300)
  298. end
  299.  
  300. function travelcarlin()
  301.    say("Hi")
  302.    wait(1500,2500)
  303.    npcsay("Carlin")
  304.    wait(300,500)
  305.    npcsay("yes")
  306.    wait(200,300)
  307. end
  308.  
  309. function travelthais()
  310.    say("Hi")
  311.    wait(1500,2500)
  312.    npcsay("Thais")
  313.    wait(300,500)
  314.    npcsay("yes")
  315.    wait(200,300)
  316. end
  317.  
  318. function traveldarashia()
  319.    say("Hi")
  320.    wait(1500,2500)
  321.    npcsay("Darashia")
  322.    wait(300,500)
  323.    npcsay("yes")
  324.    wait(200,300)
  325.     npcsay("yes")
  326.    wait(200,300)
  327. end
  328.  
  329. function travelankrahmun()
  330.    say("Hi")
  331.    wait(1500,2500)
  332.    npcsay("Ankrahmun")
  333.    wait(300,500)
  334.    npcsay("yes")
  335.    wait(200,300)
  336. end
  337.  
  338. function travellibertybay()
  339.    say("Hi")
  340.    wait(1500,2500)
  341.    npcsay("Liberty Bay")
  342.    wait(300,500)
  343.    npcsay("yes")
  344.    wait(200,300)
  345. end
  346.  
  347. function travelyalahar()
  348.    say("Hi")
  349.    wait(1500,2500)
  350.    npcsay("Yalahar")
  351.    wait(300,500)
  352.    npcsay("yes")
  353.    wait(200,300)
  354. end
  355.  
  356. function travelporthope()
  357.    say("Hi")
  358.    wait(1500,2500)
  359.    npcsay("Port Hope")
  360.    wait(300,500)
  361.    npcsay("yes")
  362.    wait(200,300)
  363. end
  364.  
  365. function travelfarmine()
  366.    say("Hi")
  367.    wait(1500,2500)
  368.    npcsay("Farmine")
  369.    wait(300,500)
  370.    npcsay("yes")
  371.    wait(200,300)
  372. end
  373.  
  374. function travelgoroma()
  375.    say("Hi")
  376.    wait(1500,2500)
  377.    npcsay("Goroma")
  378.    wait(300,500)
  379.    npcsay("yes")
  380.    wait(200,300)
  381. end
  382.  
  383. function opentrade()
  384.    if not tradeopen then
  385.       say("Hi")
  386.       wait(1500,2500)
  387.       npcsay("Trade")
  388.       wait(600,800)
  389.       updateworld()
  390.    end
  391. end
  392.  
  393. function sellflasks()
  394.    opentrade()
  395.    if tradeopen then
  396.       for i=283,285 do
  397.          local count = countitem(i)
  398.          while count > 0 do
  399.             sellitems(i,count)
  400.             wait(200,300)
  401.             count = countitem(i)
  402.          end
  403.       end
  404.    end
  405. end
  406.  
  407. function staminalow()
  408.         while $stamina < 60*16 do
  409.         if $battlesigned then
  410.       pausewalking(500)
  411.    else
  412.      closeclient()
  413.    end
  414.    wait(100)
  415. end
  416.  
  417. function repairsoft()
  418.   say('hi')
  419.         wait(2000, 3000)
  420.                 while itemcount(6530) > 0 do
  421.                         npcsay('repair')
  422.                                 wait(500, 1500)
  423.                         npcsay('yes')
  424.                                 wait(500, 1500)
  425. end
  426.  
  427. function windowcount(item)
  428.    item = item or "all"
  429.    return wincount(item)
  430. end
  431.  
  432. function openitem(item, origem, next, index)
  433.    index = index or 0
  434.    next = next or false
  435.    return openitemindex(item, origem, next, index)
  436. end
  437.  
  438. function wait(time1, time2)
  439.    time2 = time1 or time2
  440.    sleep(time1, time2)
  441. end
  442.  
  443. function islocation(value)
  444.    value = value or 0
  445.    return isloc(value)
  446. end
  447.  
  448. function islocationxyz(x,y,z,distance)
  449.    distance= distance or 0
  450.    return _islocationxyz(x,y,z,distance)
  451. end
  452.  
  453. function moveitems(item, origem, destino, count)
  454.    if destino == nil and count == nil then
  455.       moveitemsb(item, origem, 100)
  456.       return
  457.    end
  458.    if count == nil then
  459.       moveitemsb(item, origem, destino)
  460.       return
  461.    end
  462.    moveitemsa(item, origem, destino, count)
  463. end
  464.  
  465. function buyitemsupto(itemname, amount, currentamount)
  466.    currentamount = currentamount or itemcount(itemname)
  467.    amount = amount-currentamount
  468.    while amount > 0 do
  469.       buyitems(itemname, amount)
  470.       wait(200,300)
  471.       amount = amount-100
  472.    end
  473. end
  474.  
  475. function sellitemsupto(itemname, amount, currentamount)
  476.    currentamount = currentamount or itemcount(itemname)
  477.    amount = amount-currentamount
  478.    while amount > 0 do
  479.       sellitems(itemname, amount)
  480.       wait(200,300)
  481.       amount = amount-100
  482.    end
  483. end
  484.  
  485. function entermachine(item)
  486.   local currentamount = itemcount(item)
  487.   amount = currentamount - 20
  488.   count = 0
  489.   maxtry = 50
  490.   while itemcount(item) > amount and count < maxtry do
  491.       count = count + 1
  492.       if islocationxyz(33268, 31830, 10, 5) then
  493.          if toptileitem(33268, 31830, 10) == 846 then
  494.             useitem(846, 33268, 31830, 10)
  495.             wait(400,600)
  496.          end
  497.    
  498.          useitemon(item, 33268, 31830, 10)
  499.          wait(500,600)
  500.  
  501.          if(currentamount == itemcount(item)) then
  502.            if toptileitem(33268, 31830, 10) == 842 then
  503.               useitem(842, 33268, 31830, 10)
  504.               wait(400,600)
  505.            end
  506.          else
  507.             currentamount = itemcount(item)
  508.          end
  509.       else
  510.          break
  511.       end
  512.    end
  513.    if toptileitem(33268, 31830, 10) == 842 then
  514.       useitem(842, 33268, 31830, 10)
  515.       wait(400,600)
  516.    end
  517. end
  518.  
  519. function dropitems(pos,...)
  520.    local items = {...}
  521.    if type(pos) == 'number' then
  522.       table.insert(items,pos)
  523.       pos = 'ground'
  524.    end
  525.    for i,j in ipairs(items) do
  526.       while itemcount(j) > 0 do
  527.          moveitemsb(j,pos,100)
  528.       end
  529.    end
  530. end
  531.  
  532. function levitate(direction,updown)
  533.    local dir = {x = {n = 0, s = 0, w = -1, e = 1}, y = {n = -1, s = 1, w = 0, e = 0}}
  534.    if direction == 'w' or direction == 'e' or direction == 'n' or direction == 's' then
  535.       local startposz,tries,maxtries = posz,0,math.random(4,6)
  536.  
  537.       if not updown or (updown ~= 'up' and updown ~= 'down') then
  538.          local toptileid = toptileitem(posx+dir.x[direction],posy+dir.y[direction],posz)
  539.  
  540.          updown = 'up'
  541.          if toptileid == 0 or itemproperty(toptileid).isUnpassable == true then
  542.             updown = 'down'
  543.          end
  544.       end
  545.  
  546.       while mp >= 50 and level >= 12 and posz == startposz and tries < maxtries do
  547.          turn(direction)                       
  548.          cast('exani hur '..updown)
  549.          wait(1000,1500)
  550.          tries=tries+1
  551.          if posz ~= startz then
  552.             return true
  553.          end
  554.       end
  555.    end
  556.    return false
  557. end
  558.  
  559. function depotdeposit(bptomove,...)
  560.    lastonto = 0
  561.    local items = {...}
  562.    local _nexti = true
  563.    for i,j in pairs(items) do
  564.       _nexti = true
  565.       while itemcount(items[i]) > 0 and _nexti do
  566.          _nexti = moveitemsonto(items[i], "all", bptomove, 100, lastonto)
  567.          wait(400,500)
  568.       end
  569.    end
  570. end
  571.  
  572. function itemcount(item, origem)
  573.    origem = origem or "all"
  574.    return _itemcount(item, origem)
  575. end
  576.  
  577. function countitem(item, origem)
  578.    origem = origem or "all"
  579.    return _itemcount(item, origem)
  580. end
  581.  
  582. function higherwindows(name)
  583.    name = name or "all"
  584.    _controlwindows(name, true)
  585. end
  586.  
  587. function minimizewindows(name)
  588.    name = name or "all"
  589.    _controlwindows(name, false)
  590. end
  591.  
  592. function haste()
  593.    if not hasted then
  594.         cast("utani hur")
  595. end
  596. end
  597.  
  598. function antiidle()
  599.     turn("n")
  600.         turn("e")
  601.         turn("s")
  602.         turn("w")
  603. end
  604.  
  605. function manashield()
  606.    if not manashielded then
  607.         cast("utamo vita")
  608. end
  609. end
  610.  
  611. function charge()
  612.    if not hasted then
  613.         cast("utani tempo hur")
  614. end
  615. end
  616.  
  617. function stronghaste()
  618.    if not hasted then
  619.         cast("utani gran hur")
  620. end
  621. end
  622.  
  623. function maround(range,allfloors,...)
  624.    local names = {...}
  625.    range = range or 7
  626.    allfloors = allfloors or false
  627.  
  628.    if type(range) == 'string' then
  629.       table.insert(names,range)
  630.       range = 7
  631.    end
  632.    if type(allfloors) == 'string' then
  633.       table.insert(names,allfloors)
  634.       allfloors = false
  635.    end
  636.  
  637.    local name = ''
  638.    for i,j in pairs(names) do
  639.       name = name..names[i]..';'
  640.    end
  641.  
  642.    return _maround(range,allfloors,name)
  643. end
  644.  
  645. function paround(range,allfloors,...)
  646.    local names = {...}
  647.    range = range or 7
  648.    allfloors = allfloors or false
  649.  
  650.    if type(range) == 'string' then
  651.       table.insert(names,range)
  652.       range = 7
  653.    end
  654.    if type(allfloors) == 'string' then
  655.       table.insert(names,allfloors)
  656.       allfloors = false
  657.    end
  658.  
  659.    local name = ''
  660.    for i,j in pairs(names) do
  661.       name = name..names[i]..';'
  662.    end
  663.  
  664.    return _paround(range,allfloors,name)
  665. end
  666.  
  667. function pickupitems(dir,...)
  668.    local items = {...}
  669.    local dire = {dirs = {'c', 'n', 's', 'w', 'e', 'nw', 'ne', 'sw', 'se'},
  670.                  x = {c = 0, n = 0, s = 0, w = -1, e = 1, nw = -1, ne = 1, sw = -1, se = 1},
  671.                  y = {c = 0, n = -1, s = 1, w = 0, e = 0, nw = -1, ne = -1, sw = 1, se = 1}}
  672.  
  673.    if not dir or not table.find(dire.dirs,dir) then
  674.       if dir ~= nil then
  675.          table.insert(items,dir)
  676.       end
  677.       dir = 'c'
  678.    end
  679.    
  680.    local pos = {x = posx+dire.x[dir], y = posy+dire.y[dir], z = posz}  
  681.    local topid = toptileitem(pos.x,pos.y,pos.z)
  682.    local id = topid
  683.    local item = itemproperty(topid)
  684.    
  685.    if #items == 0 then
  686.       if topid ~= 0 and item.isTakeable then
  687.          moveitems(topid,ground(pos.x,pos.y,pos.z),'all',100)
  688.       end
  689.    else
  690.       for i,j in pairs(items) do
  691.          if type(j) == 'number' then
  692.             id = j
  693.          else
  694.             id = itemid(j)
  695.          end
  696.  
  697.          if topid == id and item.isTakeable then
  698.             moveitems(topid,ground(pos.x,pos.y,pos.z),'all',100)
  699.             break
  700.          end
  701.       end
  702.    end
  703. end
  704.  
  705. function gotolabel(label)
  706.    if type(label) == 'number' then
  707.       _gotolabeln(label)
  708.    else
  709.       _gotolabels(label)
  710.    end
  711. end
  712.  
  713. function useitem(item, x, y, z)
  714.    x = x or 'all'
  715.    if type(x) == 'number' then
  716.       _useitemxyz(item, x, y, z)
  717.    else
  718.       _useitem(item, x)
  719.    end
  720. end
  721.  
  722. function useitemon(item, x, y, z)
  723.    if z == nil then
  724.       y = y or 'all'
  725.       useitemonitem(item, x, y)
  726.    else
  727.       _useitemon(item, x, y, z)
  728.    end
  729. end
  730.  
  731. function say(text, channel)
  732.    if channel == nil then
  733.       _say(text)
  734.    else
  735.       anysay(text, channel)
  736.    end
  737. end
  738.  
  739. function underattack(type)
  740.    type = type or 'all'
  741.    return _underattack(type)
  742. end
  743.  
  744. function gold()
  745.    return itemcount(3031) + (itemcount(3035) * 100) + (itemcount(3043) * 10000)
  746. end
  747.  
  748. function antifurnituretrap(weapontouse)
  749.    weapontouse = weapontouse or 3308 -- machete
  750.    local blockwalkids = {2025, 2029, 2030, 2043, 2044, 2045, 2046, 2047, 2048, 2059, 2060, 2061, 2445, 2446, 2447, 2448, 2449, 2450, 2451, 2452, 2453, 2454, 2465, 2466, 2467, 2468, 2524, 2904, 2959, 2960, 2961, 2962, 2963, 2964, 2975, 2976, 2979, 2982, 2986, 2997, 2998, 2999, 3000, 3484, 3485, 3486, 3487, 3510, 3511, 3512, 3513, 5046, 5055, 5056, 6109, 6110, 6111, 6112, 6367, 6368, 6369, 6370, 7860, 7861, 7862, 7863, 9132, 9141, 10208, 10210, 10211, 10212, 10213, 10214, 10215}
  751.  
  752.    for i=-7,7 do
  753.       for j=-5,5 do
  754.          local x,y,z = posx+i,posy+j,posz
  755.          if table.binaryfind(blockwalkids,toptileitem(x,y,z)) then
  756.             if tilereachable(x,y,z) then
  757.                pausewalking(10000)
  758.                local topid = toptileitem(x,y,z)
  759.                while tilereachable(x,y,z) and (math.abs(posx-x) > 1 or math.abs(posy-y) > 1) do
  760.                   reachlocation(x,y,z)
  761.                   wait(100,200)
  762.                   updateworld()
  763.                end        
  764.                while toptileitem(x,y,z) == topid and posz == z and (math.abs(posx-x) <= 1 and math.abs(posy-y) <= 1) do
  765.                   useitemon(weapontouse,toptileitem(x,y,z),ground(x,y,z))
  766.                   pausewalking(5000)
  767.                   wait(400,500)
  768.                   updateworld()
  769.                end
  770.                pausewalking(0)
  771.             end
  772.          end
  773.       end
  774.    end
  775. end
  776.  
  777. function getcreatures(filter)
  778.    filter = filter or 'pmfs'
  779.    return _getcreatures(filter)
  780. end
  781.  
  782. function openhole(x,y,z,holes)
  783.         x,y,z = x or wptx, y or wpty, z or wptz
  784.         holes = holes or {{593,594}, {606, 607}, {608, 609}, {867, 868}}
  785.         reachlocation(x,y,z)
  786.         if x and y and z and math.abs(posx-x) <= 7 and math.abs(posy-y) <= 5 and posz == z then
  787.                 local v = 1
  788.                 while v <= #holes and not isitemontile(holes[v][1],x,y,z) do
  789.                         v = v+1
  790.                 end
  791.                 if v <= #holes then
  792.                         local id = toptileitem(x,y,z)
  793.                         while id ~= holes[v][2] do
  794.                                 if id == holes[v][1] then
  795.                                         if iscreatureontile(x,y,z) then
  796.                                                 local dir = wheretomove(x,y,z)
  797.                                                 moveitems(99,ground(x,y,z),ground(dir.x,dir.y,z),100)
  798.                                                 wait(1400,1600)
  799.                                         else
  800.                                                 useitemon(shovel,x,y,z)
  801.                                                 wait(900,1100)
  802.                                         end
  803.                                 else
  804.                                         local dir = wheretomove(x,y,z)
  805.                                         moveitems(id,ground(x,y,z),ground(dir.x,dir.y,z),100)
  806.                                         wait(500,700)
  807.                                 end
  808.                                 id = topitem(x,y,z)
  809.                         end
  810.                         return true
  811.                 end
  812.         end
  813.         return false
  814. end
  815.  
  816. function opensand(x,y,z)
  817.    return openhole(x,y,z, {{231,615}})
  818. end
  819.  
  820. function uselever(x,y,z,id)
  821.         x,y,z = x or wptx, y or wpty, z or wptz
  822.         local levers = {2771, 2772}
  823.         if id then
  824.                 levers = {id}
  825.         end
  826.         reachlocation(x,y,z)
  827.         if x and y and z and math.abs(posx-x) <= 7 and math.abs(posy-y) <= 5 and posz == z then
  828.                 local v = 1
  829.                 while v <= #levers and not isitemontile(levers[v],x,y,z) do
  830.                         v = v+1
  831.                 end
  832.                 if v <= #levers then
  833.                         local id = toptileitem(x,y,z)
  834.                         while isitemontile(levers[v],x,y,z) do
  835.                                 if id == levers[v] then
  836.                                         if iscreatureontile(x,y,z) then
  837.                                                 local dir = wheretomove(x,y,z)
  838.                                                 moveitems(99,ground(x,y,z),ground(dir.x,dir.y,z),100)
  839.                                                 wait(1400,1600)
  840.                                         else
  841.                                                 useitem(levers[v],ground(x,y,z))
  842.                                                 wait(500,700)
  843.                                         end
  844.                                 else
  845.                                         local dir = wheretomove(x,y,z)
  846.                                         moveitems(id,ground(x,y,z),ground(dir.x,dir.y,z),100)
  847.                                         wait(500,700)
  848.                                 end
  849.                                 id = toptileitem(x,y,z)
  850.                         end
  851.                         return true
  852.                 end
  853.         end
  854.         return false
  855. end
  856.  
  857. function getitems(...)
  858.    local items = {...}
  859.  
  860.    local item = ''
  861.    for i,j in pairs(items) do
  862.       item = item..items[i]..';'
  863.    end
  864.  
  865.    return _getitems(item)
  866. end