Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. $partialjarsack = GameObj.inv.find { |obj| obj.name =~ /#{UserVars.partialjarsack}/}
  2. $fulljarsack = GameObj.inv.find { |obj| obj.name =~ /#{UserVars.fulljarsack}/}
  3. $emptyjarsack = GameObj.inv.find { |obj| obj.name =~ /#{UserVars.emptyjarsack}/}
  4. $overflowsack = GameObj.inv.find { |obj| obj.name =~ /#{UserVars.overflowsack}/}
  5. $gemsack = GameObj.inv.find { |obj| obj.name =~ /#{UserVars.gemsack}/}
  6. $reagentsack = GameObj.inv.find { |obj| obj.name =~ /#{UserVars.reagentsack}/}
  7. $lootsack = GameObj.inv.find { |obj| obj.name =~ /#{UserVars.lootsack}/}
  8. $jararray = Array.new
  9. $gemlist = Array.new
  10. $gemcount = Array.new
  11. $jarcount = nil
  12. $loc = nil
  13. $total = nil
  14. $gems_i_have = nil
  15. $gem_color = script.vars[1]
  16. $gem_type = script.vars[2]
  17. gem_im_looking_for = $gem_color + $gem_type
  18.  
  19. def count
  20. put "look in #{$gemsack}"
  21. sleep 1
  22. more_line = $line[/<.*>/]
  23.  
  24. $gemsack.contents.each { |obj|
  25. if obj.type =~ /gem|reagent/
  26. $gemlist << obj.name
  27. $total += 1
  28. end
  29. }
  30.  
  31. for gem in $gemlist.uniq
  32. count = $gemlist.count(gem)
  33. $gemcount << [gem, count, more_line]
  34. end
  35.  
  36. GameObj.inv.each {|obj|
  37. obj.contents.each { |i|
  38. if (i.noun =~ /^(?:jar|bottle|beaker)$/)
  39. if i.after_name.nil?
  40. next
  41. else
  42. $jarcount += 1
  43. look_result = dothistimeout "look in ##{i.id}", 3, /^Inside .*? you see [0-9]+ portion/
  44. if look_result =~ /^Inside .*? you see ([0-9]+) portion/ then
  45. count = $1.to_i
  46. $loc = $line[/<.*>/]
  47. end
  48. name = i.after_name.gsub(/^containing |large |medium |small |tiny |some /, '')
  49. name = name.split(//)
  50. name.pop
  51. name = name.join
  52. listed = false
  53. for gem in $gemcount
  54. if gem[0].include?(name)
  55. gem[1] += count
  56. gem << $loc
  57. listed = true
  58. $total = $total + count
  59. break
  60. end
  61. end
  62. if listed == false
  63. $gemcount << [name, count, $loc]
  64. $total += count
  65. end
  66. end
  67. end
  68. }
  69. }
  70.  
  71. echo count
  72.  
  73. for gem in $gemcount
  74. if gem[0] =~ /#{$gem_color} #{$gem_type}/
  75. puts "#{gem[0].ljust(30)} #{gem[1]}"
  76. $gems_i_have = gem[1]
  77. send_to_script "lnet", "chat to #{$person} I have #{gem[1]} #{gem[0]}"
  78. end
  79. end
  80.  
  81.  
  82. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement