Find Item on Vendor by Sandro

1# Find Item on Vendor by Sandro
2# Finds the item you specify in the top layer or second layer of a vendor bag, and keeps those bags opened.
3# Edit this script in 2 places with the item type you seek.
4# Stand still and let the script open the backpack of all vendors in the area.
5# After all backpacks have been opened, you will be asked to
6# close any remaining open backpacks, then target yourself to re-open only the backpacks containing your item.
7
8setvar! timeout 600
9clearignore
10removelist 'vendors'
11createlist 'vendors'
12removelist 'backpacks'
13createlist 'backpacks'
14
15while not dead
16    @hotkey 'Next Monster Target'
17    @setvar! 'vendorID' lasttarget
18    if noto 'vendorID' = invulnerable 
19        if inlist 'vendors' 'vendorID'
20            # Close all vendor bags
21             walk "North"
22             walk "South"
23             overhead 'Close any open backpacks'
24             wait timeout
25             setvar! 'Target anything'
26             foreach pack in 'backpacks'
27                sysmsg 'opening pack {{index}}'
28                dclick pack
29                wait timeout
30             endfor
31            sysmsg 'done' 23
32            stop
33        else 
34            pushlist 'vendors' 'vendorID'
35        endif
36
37        if findtype 3701 'vendorID' as mainBackpack
38          dclick 'mainBackpack'
39          wait timeout
40          @ignore mainBackpack
41          # -------
42          # ITEM NAME HERE
43          # -------
44          if findtype 'aspect core' mainBackpack as foundItem
45              sysmsg 'found item 1 layer' 33
46              pushlist 'backpacks' mainBackpack
47          endif
48          while findtype 3701|29833|3705|3712|3648|3702 mainBackpack as container
49              @ignore container
50              getlabel container desc
51              if "Price: Not for sale" in desc
52                dclick container
53                wait timeout
54                # -------
55                # ITEM NAME HERE
56                # -------
57                if findtype 'aspect core' container as foundItem
58                    sysmsg 'found item 2 layer' 33
59                    if not inlist "backpacks" mainBackpack
60                        pushlist "backpacks" mainBackpack
61                    endif
62                    pushlist 'backpacks' container
63                endif
64              endif
65          endwhile
66        endif
67    else 
68        sysmsg 'not invul'
69    endif
70endwhile