Hanryu

countcru.cmd

May 28th, 2024 (edited)
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.80 KB | None | 0 0
  1. #countcru.cmd
  2. # .countcru
  3. # count the total items in a crucible
  4. #
  5. # written by Hanryu
  6. # Please report any bugs to Hanryu#0052 (Discord) or [email protected]
  7. # This script may be reused in whole or in part as long as credit is given
  8. # This script is designed to use Oulander, http://outlanderapp.com
  9. #
  10. #2020-07-19
  11. # taken from makeingot.cmd and now standalone
  12. #2020-12-10
  13. # added nugget counting
  14. # 2024-08-13
  15. # ingot vol counting material echo
  16. # 2024-09-06
  17. # fix ingot vol counting with multiple types
  18. # 2024-09-12
  19. # count nugs and ingots of same type together
  20. # turned into a full refactor
  21. #debug 5
  22.  
  23. #### LOAD VARIABLES ####
  24. var CrucibleCount 0
  25. var matList
  26. var c 0
  27. #### Convert digit to text number ###
  28. var CONVERT.numbers |first|second|third|fourth|fifth|sixth|seventh|eighth|ninth|tenth|eleventh
  29.  
  30. #### LOAD ACTIONS ####
  31. action math CrucibleCount add $1 when "^.* - (\d+)"
  32. action if contains("%$1", "%") then var $1 0;var matList $1|%matList;eval $1 (20 * $2) + %$1 when "^.+enormous (\w+) .+ - (\d+)"
  33. action if contains("%$1", "%") then var $1 0;var matList $1|%matList;eval $1 (10 * $2) + %$1 when "^.+massive (\w+) .+ - (\d+)"
  34. action if contains("%$1", "%") then var $1 0;var matList $1|%matList;eval $1 (5 * $2) + %$1 when "^.+huge (\w+) .+ - (\d+)"
  35. action if contains("%$1", "%") then var $1 0;var matList $1|%matList;eval $1 (4 * $2) + %$1 when "^.+large (\w+) .+ - (\d+)"
  36. action if contains("%$1", "%") then var $1 0;var matList $1|%matList;eval $1 (3 * $2) + %$1 when "^.+medium (\w+) .+ - (\d+)"
  37. action if contains("%$1", "%") then var $1 0;var matList $1|%matList;eval $1 (2 * $2) + %$1 when "^.+small (\w+) .+ - (\d+)"
  38. action if contains("%$1", "%") then var $1 0;var matList $1|%matList;eval $1 (1 * $2) + %$1 when "^.+tiny (\w+) .+ - (\d+)"
  39. action math c add 1;var ingotMat%c $2|$1;var matList $1|%matList when "an? (.+?) ingot - (\d+)"
  40. action eval $2 $1 + %$2 when "About (\d+) volumes? of material make up the (\w+) ingot\.$"
  41.  
  42. top:
  43. put count crucible
  44. put Encumbrance
  45. waitfor Encumbrance
  46. put #echo >talk #996633 Items in crucible = %CrucibleCount
  47.  
  48. ingotLoop:
  49. math c subtract 1
  50. if (%c < 0) then goto echoLoop
  51. var duplicateIngotCount %ingotMat%c[0]
  52. duplicateLoop:
  53. var numeral %CONVERT.numbers[%duplicateIngotCount]
  54. put count %numeral %ingotMat%c[1] ingot in crucible
  55. waitforre ^About
  56. math duplicateIngotCount subtract 1
  57. if (%duplicateIngotCount < 1) then goto ingotLoop
  58. else goto duplicateLoop
  59.  
  60. echoLoop:
  61. eval c countsplit("%matList", "|")
  62. if (%c <= 1) then goto done
  63. put #echo >talk #ffff00 %matList[0] volumes: %%matList[0]
  64. #removes duplicates
  65. eval matList replacere("%matList", "\b%matList[0]s?\b\|?", "")
  66. goto echoLoop
  67.  
  68. done:
  69. # eval matList replacere("%matList", "\|?%matList[%c]\|?", "")
  70. put #parse ** COUNTCRU DONE **
  71. exit
  72.  
Advertisement
Add Comment
Please, Sign In to add comment