Back to "b" tags

Search Player Vendor and Prompt to Buy Item by Jaseowns

1# Search Player Vendor and Prompt to Buy Item by Jaseowns
2# UO Outlands
3######
4# Check out the video: https://youtu.be/xT0IzyYWmlg
5####
6# What does this scriopt do?
7# - We want to search vendors for a specific item and get the price
8# - set the item id, item hue and a description if needed
9####
10# Below are some examples:
11// Skill Orb search
12# pushlist "itemDescToLookFor" "skill"
13# @setvar! item_id_to_buy 22336
14# @setvar! item_hue_to_buy 2966
15    
16// Tinkering skill scroll search
17# pushlist "itemDescToLookFor" "tinkering"
18# itemDescToLookFor: "tinkering"
19# @setvar! item_id_to_buy 8826
20# @setvar! item_hue_to_buy 2291
21
22// if you go through a gate, this does not work right so beware
23if not varexist sneakylootbag or not find sneakylootbag backpack
24    overhead "Select your sneaky loot bag" 88
25    @setvar! sneakylootbag
26endif
27
28clearignore
29removelist "itemDescToLookFor"
30createlist "itemDescToLookFor"
31// This needs to be case sensetive
32// If your item type matches multiples (skill scroll) use
33// a helper description like this and uncomment line 34
34// pushlist "itemDescToLookFor" "tinkering"
35
36// Set your item type here using >info
37@setvar! item_id_to_buy 8826
38@setvar! item_hue_to_buy 2291
39@setvar! globalTimeout 650
40
41removelist "playVendors"
42createlist "playVendors"
43
44removelist "foundVendors"
45createlist "foundVendors"
46
47while not dead
48    hotkey "Next Monster Target"
49    wait 200
50    @setvar! playerVendor lasttarget 
51    if inlist "playVendors" playerVendor
52        // skip
53        sysmsg "Might be all done..." 34
54        overhead "All done!" 88
55        stop
56    else
57        pushlist "playVendors" playerVendor
58        if noto playerVendor = "invulnerable"
59            dclick playerVendor
60            wait globalTimeout
61            for 2
62                while findtype 2473|3644|3645|3646|3647|3710|3701|3702|29832|29833|2472|2475|3648|3649|3708|29078|41449|41450|3705|3712|2474|3709|3650|3651|29077 playerVendor as container
63                    getlabel container desc
64                    if "Price: Not for sale" in desc
65                        dclick container
66                        wait globalTimeout
67                    else
68                        sysmsg desc
69                    endif
70                    ignore container
71                endwhile
72            endfor
73            while findtype item_id_to_buy playerVendor item_hue_to_buy as item
74                getlabel playerVendor descPlayerVendor
75                getlabel item desc
76                
77                if list itemDescToLookFor > 0
78                    foreach itemDescToLook in itemDescToLookFor
79                        if itemDescToLook in desc
80                            overhead "This vendor: {{descPlayerVendor}}" 88
81                            menu item 0
82                            wait 250
83                            while gumpexists 4274928655
84                                sysmsg "Waiting on user input... {{desc}}" 88
85                                wait 250
86                            endwhile
87                            while find item backpack
88                                overhead "we bought it!"
89                                if find item sneakylootbag
90                                    break
91                                else
92                                    lift item 60000
93                                    drop sneakylootbag -1 -1 -1
94                                    wait globalTimeout
95                                endif
96                            endwhile
97                            wait globalTimeout
98                        endif
99                    endfor
100                else
101                    overhead "This vendor: {{descPlayerVendor}}" 88
102                    menu item 0
103                    wait 250
104                    while gumpexists 4274928655
105                        sysmsg "Waiting on user input... {{desc}}" 88
106                        wait 250
107                    endwhile
108                    while find item backpack
109                        overhead "we bought it!"
110                        if find item sneakylootbag
111                            break
112                        else
113                            lift item 60000
114                            drop sneakylootbag -1 -1 -1
115                            wait globalTimeout
116                        endif
117                    endwhile
118                endif
119                ignore item
120            endwhile
121        endif
122    endif
123endwhile