daily pastebin goal
31%
SHARE
TWEET

Container Sort

amandajean1 Apr 20th, 2017 538 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <!DOCTYPE muclient>
  3. <!-- Saved on Monday, November 16, 2009, 4:12 PM -->
  4. <!-- MuClient version 4.40 -->
  5.  
  6. <!-- Plugin "Container_Sort" generated by Plugin Wizard -->
  7.  
  8. <muclient>
  9. <plugin
  10.    name="Container_Sort"
  11.    author="Madcatz"
  12.    id="b5fb54e6d638c91a211d96f5"
  13.    language="Lua"
  14.    purpose="Sorts containers.  Allows getting and putting of items into container by level."
  15.    date_written="2009-11-16 16:10:52"
  16.    requires="4.33"
  17.    version="1.0"
  18.    >
  19. <description trim="y">
  20. <![CDATA[
  21. lget <container> <min level> <max level>  Get all items from <min level> to <max level> from <container>
  22. lput <container> <min level> <max level>  Puts all items from <min level> to <max level> into <container>
  23. sort <container>                          Sorts contents of <container>, by level
  24. ]]>
  25. </description>
  26. </plugin>
  27.  
  28.  
  29. <!--  Get our standard constants -->
  30.  
  31. <include name="constants.lua"/>
  32.  
  33. <!--  Triggers  -->
  34.  
  35. <triggers>
  36.   <trigger
  37.    group="putget"
  38.    keep_evaluating="y"
  39.    match="^$"
  40.    omit_from_output="y"
  41.    regexp="y"
  42.    sequence="100"
  43.   >
  44.   </trigger>
  45.   <trigger
  46.    group="putget"
  47.    keep_evaluating="y"
  48.    match="sortdone"
  49.    omit_from_output="y"
  50.    script="didput"
  51.    sequence="100"
  52.   >
  53.   </trigger>
  54.   <trigger
  55.    group="lputget"
  56.    keep_evaluating="y"
  57.    match="lgetdone"
  58.    omit_from_output="y"
  59.    script="didlgetput"
  60.    sequence="100"
  61.   >
  62.   </trigger>
  63.   <trigger
  64.    group="lputget"
  65.    keep_evaluating="y"
  66.    match="lputdone"
  67.    omit_from_output="y"
  68.    script="didlgetput"
  69.    sequence="100"
  70.   >
  71.   </trigger>
  72.   <trigger
  73.    group="invdatacap"
  74.    match="^(?P<idnum>\d*)\,(.*?)\,(.*?)\,(?P<level>\d*)\,(.*?)\,(.*?)\,(.*?)\,(.*?)$"
  75.    omit_from_output="y"
  76.    regexp="y"
  77.    script="makelist"
  78.    sequence="100"
  79.   >
  80.   </trigger>
  81.   <trigger
  82.    group="sortsecondary"
  83.    keep_evaluating="y"
  84.    match="^\| Id(\s*)\: (?P<idnum>\d*)(\s*)\|$"
  85.    omit_from_output="y"
  86.    regexp="y"
  87.    script="dosort"
  88.    sequence="100"
  89.   >
  90.   </trigger>
  91.   <trigger
  92.    group="invdatastart"
  93.    match="{/invdata}"
  94.    omit_from_output="y"
  95.    script="invdataend"
  96.    sequence="100"
  97.   >
  98.   </trigger>
  99.   <trigger
  100.    group="putget"
  101.    match="You will now see prompts."
  102.    omit_from_output="y"
  103.    send_to="2"
  104.    sequence="100"
  105.   >
  106.   <send>Sorting done!</send>
  107.   </trigger>
  108.   <trigger
  109.    group="putget"
  110.    match="You will no longer see prompts."
  111.    omit_from_output="y"
  112.    send_to="2"
  113.    sequence="100"
  114.   >
  115.   <send>Sorting...</send>
  116.   </trigger>
  117.   <trigger
  118.    group="invdatastart"
  119.    match="{invdata *}"
  120.    omit_from_output="y"
  121.    script="invdatastart"
  122.    sequence="100"
  123.   >
  124.   </trigger>
  125.   <trigger
  126.    group="invdatastart"
  127.    match="{invdata}"
  128.    omit_from_output="y"
  129.    script="invdatastart"
  130.    sequence="100"
  131.   >
  132.   </trigger>
  133.   <trigger
  134.    group="sortsecondary"
  135.    keep_evaluating="y"
  136.    match="*"
  137.    name="idenon"
  138.    omit_from_output="y"
  139.    sequence="100"
  140.   >
  141.   </trigger>
  142.   <trigger
  143.    group="sortmain"
  144.    match="+-----------------------------------------------------------------+"
  145.    omit_from_output="y"
  146.    script="idenstart"
  147.    sequence="100"
  148.   >
  149.   </trigger>
  150.   <trigger
  151.    group="putget"
  152.    match="You get * from *."
  153.    omit_from_log="y"
  154.    omit_from_output="y"
  155.    sequence="100"
  156.   >
  157.   </trigger>
  158.   <trigger
  159.    group="putget"
  160.    match="You put * into *."
  161.    omit_from_output="y"
  162.    sequence="100"
  163.   >
  164.   </trigger>
  165. </triggers>
  166.  
  167. <!--  Aliases  -->
  168.  
  169. <aliases>
  170.   <alias
  171.    script="sort"
  172.    match="sort *"
  173.    enabled="y"
  174.    sequence="100"
  175.   >
  176.   </alias>
  177.   <alias
  178.    script="lget"
  179.    match="lget * * *"
  180.    enabled="y"
  181.    sequence="100"
  182.   >
  183.   </alias>
  184.   <alias
  185.    script="lput"
  186.    match="lput * * *"
  187.    enabled="y"
  188.    sequence="100"
  189.   >
  190.   </alias>
  191. </aliases>
  192.  
  193. <!--  Script  -->
  194.  
  195.  
  196. <script>
  197. <![CDATA[
  198. idencount=0
  199. itemlist={}
  200. container=nil
  201. amsorting=0
  202. minlgetlev=0
  203. maxlgetlev=0
  204. Note(GetPluginInfo(GetPluginID(), 3))
  205.  
  206. function sort(name, line, wildcards)
  207.   tempdelay = GetSpeedWalkDelay()
  208.   SetSpeedWalkDelay(125)
  209.   amsorting=1
  210.   EnableTriggerGroup("sortmain")
  211.   SendNoEcho("identify "..wildcards[1])
  212. end
  213.  
  214. function lget(name, line, wildcards)
  215.   if tonumber(wildcards[2]) and tonumber(wildcards[3]) then
  216.     if tonumber(wildcards[2]) <= tonumber(wildcards[3]) then
  217.       tempdelay = GetSpeedWalkDelay()
  218.       SetSpeedWalkDelay(125)
  219.       minlgetlev = tonumber(wildcards[2])
  220.       maxlgetlev = tonumber(wildcards[3])
  221.       amsorting=0
  222.       EnableTriggerGroup("sortmain")
  223.       SendNoEcho("identify "..wildcards[1])
  224.     else
  225.       Note("Max level must be at least min level")
  226.     end
  227.   else
  228.     Note("Syntax:  lget <container> <min level> <max level>")
  229.   end
  230. end
  231.  
  232. function lput(name, line, wildcards)
  233.   if tonumber(wildcards[2]) and tonumber(wildcards[3]) then
  234.     if tonumber(wildcards[2]) <= tonumber(wildcards[3]) then
  235.       tempdelay = GetSpeedWalkDelay()
  236.       SetSpeedWalkDelay(125)
  237.       minlgetlev = tonumber(wildcards[2])
  238.       maxlgetlev = tonumber(wildcards[3])
  239.       amsorting=2
  240.       EnableTriggerGroup("sortmain")
  241.       SendNoEcho("identify "..wildcards[1])
  242.     else
  243.       Note("Max level must be at least min level")
  244.     end
  245.   else
  246.     Note("Syntax:  lput <container> <min level> <max level>")
  247.   end
  248. end
  249.  
  250. function idenstart(name, line, wildcards)
  251.   if GetTriggerInfo("idenon", 8) then
  252.     if idencount == 1 then
  253.       idencount = 2
  254.     else
  255.       EnableTriggerGroup("sortsecondary", false)
  256.       idencount=0
  257.       EnableTriggerGroup("sortmain", false)
  258.     end
  259.   else
  260.     EnableTriggerGroup("sortsecondary", true)
  261.     idencount=1
  262.   end
  263. end
  264.  
  265. function dosort(name, line, wildcards)
  266.   if amsorting==1 or amsorting==0 then
  267.     SendNoEcho("invdata "..wildcards["idnum"])
  268.     container = wildcards["idnum"]
  269.     EnableTriggerGroup("invdatastart", true)
  270.   else
  271.     SendNoEcho("invdata")
  272.     container = wildcards["idnum"]
  273.     EnableTriggerGroup("invdatastart", true)
  274.   end
  275. end
  276.  
  277. function makelist(name, line, wildcards)
  278.   itemlist[tostring(wildcards["idnum"])]=tonumber(wildcards["level"])
  279. end
  280.  
  281. function invdatastart(name, line, wildcards)
  282.   itemlist={}
  283.   EnableTriggerGroup("invdatacap", true)
  284. end
  285.  
  286. function invdataend(name, line, wildcards)
  287.   EnableTriggerGroup("invdatacap", false)
  288.   EnableTriggerGroup("invdatastart", false)
  289.   if amsorting==1 then
  290.     EnableTriggerGroup("putget", true)
  291.     startsorting()
  292.   elseif amsorting==0 then
  293.     startlget()
  294.   else
  295.     startlput()
  296.   end
  297. end
  298.  
  299. function startsorting()
  300.   listsize = 0
  301.   for i,j in pairs(itemlist) do
  302.     listsize = listsize+1
  303.   end
  304.   SendNoEcho("prompt")
  305.   for count = 1,listsize,1 do
  306.     highestlevel=-1
  307.     highestid=0
  308.     for id,lev in pairs(itemlist) do
  309.       if lev>highestlevel then
  310.         highestlevel = lev
  311.         highestid = id
  312.       end
  313.     end
  314.     itemlist[tostring(highestid)]=-1
  315.     EnableTriggerGroup("putget", true)
  316.     Queue("get "..highestid.." "..container, false)
  317.     Queue("put "..highestid.." "..container, false)
  318.   end
  319.   Queue("prompt", false)
  320.   Queue("echo sortdone", false)
  321. end
  322.  
  323. function didput(name, line, wildcards)
  324.   EnableTriggerGroup("putget", false)
  325.   SetSpeedWalkDelay(tempdelay)
  326. end
  327.  
  328. function startlget()
  329.   EnableTriggerGroup("lputget", true)
  330.   for id, lev in pairs(itemlist) do
  331.     if lev>=minlgetlev and lev<=maxlgetlev then
  332.       Queue("get "..id.." "..container, false)
  333.     end
  334.   end
  335.   Queue("echo lgetdone", false)
  336. end
  337.  
  338. function startlput()
  339.   EnableTriggerGroup("lputget", true)
  340.   for id, lev in pairs(itemlist) do
  341.     if lev>=minlgetlev and lev<=maxlgetlev then
  342.       Queue("put "..id.." "..container, false)
  343.     end
  344.   end
  345.   Queue("echo lputdone", false)
  346. end
  347.  
  348. function didlgetput(name, line, wildcards)
  349.   EnableTriggerGroup("lputget", false)
  350.   SetSpeedWalkDelay(tempdelay)
  351. end
  352. ]]>
  353. </script>
  354.  
  355.  
  356. </muclient>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top