Back to "ali" tags

Count Items by ID by alistormccoy

1// Count Items by ID
2// This script will count items with the same graphic/ID within a
3// container  such as treasure maps, skill scrolls, aspect items,
4// etc. and print out the quantity of each uniquely named item.
5// It can be somewhat slow with a large amount of items, but it
6// certainly beats manually counting! You can retrieve the list
7// in plain text from your journal log file. ctrl+f 'AliCount'
8
9// set item ID here, type ">info" ingame
10@setvar! 'itemID' 8826
11
12// set Full Count to 0 if you just want the grand total
13@setvar! 'Full Count' 1
14
15// No edit below
16overhead 'Target Container'
17@setvar! 'container'
18
19removelist 'items'
20createlist 'items'
21
22removelist 'types'
23createlist 'types'
24
25@clearignore
26if findtypelist 'items' 'itemID' 'container'
27    sysmsg 'AliCount'
28    if 'Full Count' = 1
29        overhead 'Thinking...'
30        foreach 'item' in 'items'
31            getlabel 'item' 'desc'
32            if inlist 'types' 'desc'
33            else
34                pushlist 'types' 'desc'
35            endif
36        endfor
37        sysmsg 'Counter Started'
38        foreach 'type' in 'types'
39            foreach 'item' in 'items'
40                getlabel 'item' 'desc'
41                if 'type' in 'desc'
42                else
43                    @ignore 'item'
44                endif
45            endfor
46            if counttype 'itemID' 'container' as 'amount'
47                sysmsg '{{type}}: {{amount}}'
48            else
49                sysmsg '{{type}}: 0'
50            endif
51            @clearignore
52        endfor
53    endif
54    if counttype 'itemID' 'container' as 'amount'
55        sysmsg 'Grand Total: {{amount}}'
56    else
57        sysmsg 'Grand Total: 0'
58    endif
59else
60    overhead 'No items found matching that itemID'
61endif
62@clearignore