Advertisement
DavidJSGardner

Callum's Item Deconstructor

Sep 13th, 2012
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.49 KB | None | 0 0
  1. ;====================================================
  2. ; Script Name: Callum's Item Deconstructor
  3. ; Author: Callum O'Lyre
  4. ; Purpose: Useful for deconstructing items back to hides, bones, ingots or bandages
  5. ; Warning: It does not discriminate, when using scissors to make clothing into bandages
  6. ; it doesn't hold back its wrath and will turn everything it can in the bag
  7. ; into bandages.
  8. ;====================================================
  9.  
  10. Set %ContainerTypes BO_WN_UMF_CTD_DLN_CUD_UXM_CKF_JKF_TXM_ZTD_VMF_TMF_LKF_AUD_OKF_ZJF_BKF
  11. set %DeconstructionBag N/A
  12.  
  13. GoSub ShowItemBreakdownermenu
  14. GoSub ButtonListener
  15.  
  16. Sub SetDestructionBag
  17. DestructionBag:
  18. set #TARGCURS 1
  19. Event Sysmessage Target the bag with the items to be deconstructed.
  20. while #TARGCURS = 1
  21. wait 1
  22.  
  23. finditem #LTARGETID G_2
  24. if #findtype in %ContainerTypes
  25. {
  26. set %DeconstructionBag #LTARGETID
  27. set #lobjectid #LTARGETID
  28. Event Macro 17 0
  29. }
  30. else
  31. {
  32. Event Sysmessage Silly Merchant, that is not a recognized container.
  33. goto DestructionBag
  34. }
  35. return
  36.  
  37. Sub SmeltSomeItems
  38. finditem * 1 C_ , %1
  39. for #FINDINDEX 1 #FINDCNT
  40. {
  41. set #lobjectid %2
  42. event macro 17 0
  43.  
  44. while #targcurs = 0
  45. wait 1
  46.  
  47. set #ltargetid #FINDID
  48. event macro 22 0
  49. wait 2s
  50. }
  51. Event Sysmessage Bag Complete!
  52. return
  53.  
  54. Sub ItemProps
  55. finditem #ltargetid
  56. event property #findid
  57. wait 5
  58.  
  59. str pos #property $
  60. set %tmp #strres - 1
  61. str left #property %tmp
  62. set %name #strres
  63.  
  64. if #findstack > 1
  65. {
  66. str len #findstack
  67. set %tmp #strres + 1
  68. str del %name 1 %tmp
  69. set %name #strres
  70. }
  71. return
  72.  
  73. Sub showItemBreakdownermenu
  74. menu Clear
  75. menu Window Title Item Breakdowner
  76. menu Window Color Black
  77. menu Window Size 100 72
  78. menu Font Transparent #true
  79. menu Font Align Right
  80. menu Font Name MS Sans Serif
  81. menu Font Size 8
  82. menu Font Style
  83. menu Font Color WindowText
  84. menu Font Transparent #false
  85. menu Font Align Left
  86. menu Font BGColor Black
  87. menu Font Color Yellow
  88. menu Text BagName 24 6 Unset
  89. menu Combo Create ToolType 2 25 122
  90. menu Combo Add ToolType Scissors
  91. menu Combo Add ToolType Seam Rippers
  92. menu Combo Add ToolType Tongs
  93. menu Combo Select ToolType 1
  94. menu Font Size 10
  95. menu Button BeginDeconstruction 2 50 122 20 Deconstruct!
  96. menu Button BagSelection 2 2 20 20 _
  97. menu Font Size 8
  98. menu Show 10 55
  99. return
  100.  
  101. Sub ButtonListener
  102. Reset:
  103. set #menubutton 0
  104.  
  105. ListenToTheButtons:
  106. if #menubutton = BagSelection
  107. {
  108. GoSub SetDestructionBag
  109. GoSub ItemProps
  110. menu Set BagName %name
  111. Goto Reset
  112. }
  113.  
  114. if #menubutton = BeginDeconstruction
  115. {
  116. menu Get ToolType
  117. set %ToolType #menures
  118. if %ToolType = 1
  119. {
  120. Set %Tool KAG
  121. }
  122. if %ToolType = 2
  123. {
  124. Set %Tool YLK
  125. }
  126. if %ToolType = 3
  127. {
  128. Set %Tool TBG
  129. }
  130. Finditem %Tool C_ , #BackpackID
  131. if #FINDID = X
  132. {
  133. set #sysmsgcol 1939
  134. Event Sysmessage Silly Merchant, You don't seem to have the proper tool in your main pack!
  135. set #sysmsgcol 0
  136. Goto Reset
  137. }
  138. Set %ToolID #FindID
  139.  
  140. if %DeconstructionBag = N/A
  141. {
  142. set #sysmsgcol 1939
  143. Event Sysmessage Silly Merchant, You need to select a container to destroy items from!
  144. set #sysmsgcol 0
  145. Goto Reset
  146. }
  147. menu Delete BeginDeconstruction
  148. GoSub SmeltSomeItems %DeconstructionBag %ToolID
  149. menu Button BeginDeconstruction 2 50 122 20 Deconstruct!
  150. Goto Reset
  151. }
  152.  
  153. if #menubutton = closed
  154. {
  155. halt
  156. }
  157.  
  158. GoTo ListenToTheButtons
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement