Advertisement
Guest User

LotJUpgradeShip

a guest
Feb 2nd, 2013
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.96 KB | None | 0 0
  1. <?xml version="1.0" encoding="iso-8859-1" ?>
  2. <!DOCTYPE muclient>
  3. <muclient>
  4. <plugin name="LotJupgradeship" author="@Cronlan" id="0b90ce53347f37f34ff36fcd" language="Lua" purpose="Automatic Upgrading" save_state="y" requires="4.40" version="1.72">
  5. <description trim="y">
  6. <![CDATA[ Upgradeship queue
  7.  
  8. ]]>
  9. </description>
  10. </plugin>
  11. <!-- Get our standard constants -->
  12. <include name="constants.lua" />
  13. <!-- Triggers -->
  14. <triggers>
  15. <trigger name="DismantComplete" script="dismantNext" match="You earn (.*) credits after selling the parts." enabled="y" group="UpgradeSh" regexp="y" sequence="100" />
  16. <trigger name="UpgradeDone" script="upgradeNext" match="You pay (.*) credits to complete the modification." enabled="y" group="UpgradeSh" regexp="y" sequence="100" />
  17. </triggers>
  18. <!-- Aliases -->
  19. <aliases>
  20. <alias name="DqueAdd" script="addItemD" match="^dqadd (.*)$" enabled="y" group="UpgradeshCmd" regexp="y" ignore_case="y" sequence="100" />
  21. <alias name="UqueAdd" script="addItemU" match="^uqadd (.*)$" enabled="y" group="UpgradeshCmd" regexp="y" ignore_case="y" sequence="100" />
  22. <alias name="begin" script="dismantstart" match="^dismantstart$" enabled="y" group="UpgradeshCMD" regexp="y" ignore_case="y" sequence="100" />
  23. <alias name="removedis" script="removeItemD" match="^remdq (.*)$" enabled="y" group="UpgradeshCmd" regexp="y" ignore_case="y" sequence="100" />
  24. <alias name="removeupg" script="removeItemU" match="^remuq (.*)$" enabled="y" group="UpgradeshCmd" regexp="y" ignore_case="y" sequence="100" />
  25. <alias name="ListCommands" script="displayList" match="^ListCommands$" enabled="y" group="UpgradeshCmd" regexp="y" ignore_case="y" sequence="100" />
  26. <alias name="ClearList" script="clearList" match="^clearUQ$" enabled="y" group="UpgradeshCmd" regexp="y" ignore_case="y" sequence="100" />
  27. <alias name="AddShip" script="addShip" match="^addShip (.*)$" enabled="y" group="UpgradeshCmd" regexp="y" ignore_case="y" sequence="100" />
  28. <alias name="resumeD" script="resumeD" match="^resumeD$" enabled="y" group="UpgradeshCmd" regexp="y" ignore_case="y" sequence="100" />
  29. <alias name="resumeU" script="resumeU" match="^resumeU$" enabled="y" group="UpgradeshCmd" regexp="y" ignore_case="y" sequence="100" />
  30. <alias name="nextD" script="nextD" match="^nextD$" enabled="y" group="UpgradeshCmd" regexp="y" ignore_case="y" sequence="100" />
  31. <alias name="nextU" script="nextU" match="^nextU$" enabled="y" group="UpgradeshCmd" regexp="y" ignore_case="y" sequence="100" />
  32. </aliases>
  33. <!-- Script -->
  34. <script>
  35. <![CDATA[
  36. require "pairsbykeys"
  37. currentShip = 1
  38. ShipList = {}
  39. DismantList = {}
  40. UpgradeList = {}
  41. currentPos = 1
  42. currentItem = ""
  43.  
  44. function displayList(name, line, args)
  45. Note("DismantStart - Begin taking apart the ship! Starts upgrading when done/empty")
  46. Note("uqadd <Component> <Number> - Add to the list for upgradeship")
  47. Note("dqadd <Component> <Number> - Add to the list for Dismantle")
  48. Note("remuq <Component> <Number> - Remove from list")
  49. Note("addship <shipname> -Add ship to list")
  50. note("remship <shipname> -Remove Ship from list")
  51. Note("ListCommands - Display this page")
  52. Note("ClearUQ - Clear list and start over")
  53. Note("resumeD -Begins where you left off if interrupted whilte using Dismantle")
  54. Note("resumeU -Begins where you left off if interrupted while using Upgradeship")
  55. end
  56.  
  57. function nextU(name, line, args)
  58. currentPos = currentPos + 1
  59. resumeU()
  60. end
  61.  
  62. function nextD(name, line, args)
  63. currentPos = currentPos + 1
  64. resumeD()
  65. end
  66.  
  67. function resumeD(name, line, args)
  68. Send("dismant " .. ShipList[currentShip] .. " " .. DismantList[currentPos])
  69. end
  70.  
  71. function resumeU(name, line, args)
  72. Send("upgradeship " .. ShipList[currentShip] .. " " .. UpgradeList[currentPos])
  73. end
  74.  
  75. function addShip(name, line, args)
  76. ShipList[#ShipList + 1] = args[1]
  77. Note("'" .. ShipList[#ShipList] .. "' added to ship list.")
  78. end
  79.  
  80. function nextShip(name, line, args)
  81. currentShip = currentShip + 1
  82. if (currentShip > #ShipList) then
  83. Note("No more ships in the queue! Lists cleared.")
  84. clearList()
  85. else
  86. currentPos = 0
  87. dismantstart()
  88. end
  89. end
  90.  
  91. function dismantstart(name, line, args)
  92. currentItem = ""
  93. if (#DismantList > 0) then
  94. currentPos = 0
  95. dismantNext()
  96. else
  97. Note("Nothing to remove, moving to upgrades!")
  98. upgradestart()
  99. end
  100. end
  101.  
  102. function upgradestart(name, line, args)
  103. currentItem = ""
  104. if (#UpgradeList > 0) then
  105. currentPos = 0
  106. upgradeNext()
  107. else
  108. Note("Upgrades are complete! Moving to next ship.")
  109. nextShip()
  110. end
  111. end
  112.  
  113. function dismantNext(name, line, args)
  114. currentPos = currentPos + 1
  115. if (currentPos > #DismantList) then
  116. Note("Dismantle Done. Starting Upgrades.")
  117. upgradestart()
  118. else
  119. Send("dismant " .. ShipList[currentShip] .." " .. DismantList[currentPos])
  120. end
  121. end
  122.  
  123. function upgradeNext(name, line, args)
  124. currentPos = currentPos + 1
  125. if (currentPos > #UpgradeList) then
  126. Note("Upgrades Complete. Moving to next Ship.")
  127. nextShip()
  128. else
  129. Send("upgradesh " .. ShipList[currentShip] .." " .. UpgradeList[currentPos])
  130. end
  131. end
  132.  
  133. function addItemD(name, line, args)
  134. DismantList[#DismantList + 1] = args[1]
  135. Note("'" .. DismantList[#DismantList] .. "' added to Dismantle queue.")
  136. end
  137.  
  138. function removeItemD(name, line, args)
  139. t = #DismantList
  140. for i, v in ipairs(DismantList) do
  141. if ((v == args[1]) or (i == tonumber(args[1]))) then
  142. Note("Removed '" .. DismantList[i] .. "' index(" .. i .. ") from Dismantle queue.")
  143. table.remove(DismantList, i)
  144. if (currentPos > i) then
  145. currentPos = currentPos - 1
  146. end
  147. break
  148. else
  149. if (t == i) then
  150. Note("Unable to find specified item.")
  151. end
  152. end
  153. end
  154. end
  155.  
  156. function addItemU(name, line, args)
  157. UpgradeList[#UpgradeList + 1] = args[1]
  158. Note("'" .. UpgradeList[#UpgradeList] .. "' added to Upgrade queue.")
  159. end
  160.  
  161. function removeItemU(name, line, args)
  162. t = #UpgradeList
  163. for i, v in ipairs(UpgradeList) do
  164. if ((v == args[1]) or (i == tonumber(args[1]))) then
  165. Note("Removed '" .. DismantList[i] .. "' index(" .. i .. ") from Dismantle queue.")
  166. table.remove(DismantList, i)
  167. if (currentPos > i) then
  168. currentPos = currentPos - 1
  169. end
  170. break
  171. else
  172. if (t == i) then
  173. Note("Unable to find specified item.")
  174. end
  175. end
  176. end
  177. end
  178.  
  179. function clearList()
  180. currentItem = ""
  181. DismantList = {}
  182. UpgradeList = {}
  183. ShipList = {}
  184. Note("Ship, Upgrade and Dismantle lists cleared.")
  185. currentPos = 0
  186. end
  187.  
  188.  
  189.  
  190. ]]>
  191. </script>
  192. <script>
  193. <![CDATA[ function OnHelp ()
  194. world.Note (world.GetPluginInfo (world.GetPluginID (), 3))
  195. end
  196.  
  197. ]]>
  198. </script>
  199. </muclient>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement