Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.67 KB | None | 0 0
  1. // Author: Di
  2. // Description: find, chase and tame nearby pets accordingly to skill level
  3. // v2.1: pet release and tamed detection improvements
  4. // v2.0: improved pets list and created unstuck pathfind heuristic
  5. // Configure skill limit ▼
  6. if skill! 'animal taming' >= 100
  7. setskill 'animal taming' 'locked'
  8. stop
  9. endif
  10. @createlist 'pets'
  11. @clearlist 'pets'
  12. if skill 'animal taming' < 60
  13. // Eagle
  14. pushlist 'pets' 0x5
  15. // Goat
  16. pushlist 'pets' 0xd1
  17. // Pig
  18. pushlist 'pets' 0xcb
  19. pushlist 'pets' 0x122
  20. // Hind
  21. pushlist 'pets' 0xed
  22. // Timber wolf
  23. pushlist 'pets' 0xe1
  24. // Llama
  25. pushlist 'pets' 0xdc
  26. // Horse
  27. pushlist 'pets' 0xcc
  28. pushlist 'pets' 0xe2
  29. pushlist 'pets' 0xe4
  30. pushlist 'pets' 0xc8
  31. pushlist 'pets' 0x3e9f
  32. pushlist 'pets' 0x3ea0
  33. pushlist 'pets' 0x3ea1
  34. pushlist 'pets' 0x3ea2
  35. // Cow
  36. pushlist 'pets' 0xe7
  37. pushlist 'pets' 0xd8
  38. // Bear
  39. pushlist 'pets' 0xa7
  40. pushlist 'pets' 0xd3
  41. // Cougar
  42. pushlist 'pets' 0x3f
  43. elseif skill 'animal taming' < 71
  44. // Grizzly Bear
  45. pushlist 'pets' 0xd4
  46. // Grey Wolf
  47. pushlist 'pets' 0x1b
  48. pushlist 'pets' 0x19
  49. // Snow Leopard
  50. pushlist 'pets' 0x41
  51. pushlist 'pets' 0x40
  52. // Walrus
  53. pushlist 'pets' 0xdd
  54. // Polar Bear
  55. pushlist 'pets' 0xd5
  56. // Great Hart
  57. pushlist 'pets' 0xea
  58. elseif skill 'animal taming' < 95.1
  59. // Gaman
  60. pushlist 'pets' 0xf8
  61. // Bull
  62. pushlist 'pets' 0xe8
  63. pushlist 'pets' 0xe9
  64. // Great Hart
  65. pushlist 'pets' 0xea
  66. // White Wolf
  67. pushlist 'pets' 0x25
  68. pushlist 'pets' 0x22
  69. // Snow Leopard
  70. pushlist 'pets' 0x41
  71. pushlist 'pets' 0x40
  72. else
  73. // Bull
  74. pushlist 'pets' 0xe8
  75. pushlist 'pets' 0xe9
  76. // Unicorn
  77. pushlist 'pets' 0x7a
  78. // Ki-rin
  79. pushlist 'pets' 0x84
  80. endif
  81. if not listexists 'errors'
  82. createlist 'errors'
  83. pushlist 'errors' 'too many owners'
  84. pushlist 'errors' 'only be tamed by'
  85. pushlist 'errors' 'no chance of taming'
  86. pushlist 'errors' 'looks tame already'
  87. //pushlist 'errors' 'clear path to the animal'
  88. pushlist 'errors' 'cannot be seen'
  89. endif
  90. @createlist 'unstuck'
  91. if list 'unstuck' == 0
  92. pushlist 'unstuck' 'east'
  93. pushlist 'unstuck' 'west'
  94. pushlist 'unstuck' 'south'
  95. pushlist 'unstuck' 'north'
  96. endif
  97. // Search
  98. if not @findobject 'pet'
  99. for 0 to 'pets'
  100. if @findtype 'pets[]' 'any' 'ground'
  101. @settimer 'stuck' 0
  102. @setalias 'pet' 'found'
  103. break
  104. endif
  105. endfor
  106. else
  107. // Pathfind
  108. @settimer 'pathfind' 0
  109. while @findobject 'pet' and not @inrange 'pet' 2
  110. if dead
  111. break
  112. elseif @timer 'pathfind' >= 5000
  113. // Diverge
  114. if direction == 0
  115. @poplist 'unstuck' 'north'
  116. elseif direction == 2
  117. @poplist 'unstuck' 'east'
  118. elseif direction == 4
  119. @poplist 'unstuck' 'south'
  120. elseif direction == 6
  121. @poplist 'unstuck' 'west'
  122. endif
  123. // Unstuck
  124. if list 'unstuck' != 0
  125. for 5
  126. run 'unstuck[0]'
  127. pause 100
  128. endfor
  129. poplist 'unstuck' 'front'
  130. endif
  131. break
  132. elseif @x 'pet' > x 'self' and @y 'pet' > y 'self'
  133. run 'southeast'
  134. elseif @x 'pet' < x 'self' and @y 'pet' > y 'self'
  135. run 'southwest'
  136. elseif @x 'pet' > x 'self' and @y 'pet' < y 'self'
  137. run 'northeast'
  138. elseif @x 'pet' < x 'self' and @y 'pet' < y 'self'
  139. run 'northwest'
  140. elseif @x 'pet' > x 'self' and @y 'pet' == y 'self'
  141. run 'east'
  142. elseif @x 'pet' < x 'self' and @y 'pet' == y 'self'
  143. run 'west'
  144. elseif @x 'pet' == x 'self' and @y 'pet' > y 'self'
  145. run 'south'
  146. elseif @x 'pet' == x 'self' and @y 'pet' < y 'self'
  147. run 'north'
  148. endif
  149. pause 100
  150. endwhile
  151. if @inrange 'pet' 2
  152. // Tame
  153. clearjournal
  154. useskill 'animal taming'
  155. waitfortarget 1000
  156. target! 'pet'
  157. // Handle
  158. if @property '(tame)' 'pet'
  159. for 5
  160. if @gumpexists 0x909cc741 or not @findobject 'pet'
  161. break
  162. elseif dead or followers == 0
  163. break
  164. elseif @name 'pet' != 'trashpet'
  165. rename 'pet' 'trashpet'
  166. else
  167. msg 'trashpet release'
  168. endif
  169. pause 500
  170. endfor
  171. replygump 0x909cc741 2
  172. sysmsg 'Success: tamed and released!' 88
  173. ignoreobject 'pet'
  174. @unsetalias 'pet'
  175. else
  176. @settimer 'stuck' 0
  177. for 0 to 'errors'
  178. if @injournal 'errors[]'
  179. sysmsg 'Ignore: error message!' 25
  180. ignoreobject 'pet'
  181. @unsetalias 'pet'
  182. break
  183. endif
  184. endfor
  185. endif
  186. elseif @timer 'stuck' >= 20000
  187. sysmsg 'Ignore: stuck timeout!' 25
  188. ignoreobject 'pet'
  189. @unsetalias 'pet'
  190. endif
  191. endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement