Official ScriptUO EasyUO Scripts > Scripting Chat
Dealing with NCP vendors...
OMGBurgers:
I'm working on my shopper vendor and I'm having problems scrolling through the shop list to find the items I want to buy. Randomly usually every other click on the down arrow than highlighting an item and using the getshopinfo or whatever command sometimes adds the item to my buy list. Then I have to make it click the minus to get rid of it.
Anyone have any stable sample code I can compare mine to? this is what I got atm.
--- Code: ---set #RESULT
repeat
{
gosub TM_HandleContextMenu %currentnpc %CONTEXT_Buy #TRUE
gosub contwait bill_gump 283_248 30
}
until #RESULT = CONTINUE
getshopinfo
set %vendorstatus EMPTY
for %a 1 #SHOPCNT
{
gosub clickmod -42 -137
click %x %y f ;click top item in list
wait 2
getshopinfo
if #shopitemtype = DPF
{
click %x %y d
wait 10
set %amount 1600 - %beetleweight
if #shopitemmax > %amount
{
setShopItem #shopItemID %amount
set %vendorstatus STOCKED
}
else
{
setShopItem #shopItemID #shopItemMax
set %vendorstatus EMPTY
}
wait 10
gosub clickmod 47 208
click %x %y f ;click the accept button
wait 2s
break
}
gosub clickmod 73 -17
click %x %y f ;click down arrow
wait 2
gosub clickmod 228 86
click %x %y f ;click minus arrow
wait 2
}
return %vendorstatus
--- End code ---
Cerveza:
Maybe play with this?
--- Code: ---sub buy ; <vendorid/s> <itemtype> <maxprice> <popup option#> <# of items>
{
set %vendor_empty #false
NAMESPACE PUSH
NAMESPACE LOCAL buy
set !_vendors %1
set !_itemtype %2
set !_maxprice %3
set !_popup_option %4
set !_amount %5
set !_popup_y !_popup_option * 20
set ! !_lastitemtype
finditem !_itemtype C_ , #backpackid
set !_item_bp_stack #findstack
set !_item_bp_cnt #findcnt
sub_buy_again:
finditem !_vendors G_8
if #findkind <> -1
{
open_context:
set !_vendor #findid
exevent popup !_vendor
wait 10
click 20 !_popup_y
set %maxwait #scnt + 60
while #contname <> bill_gump || #contsize <> 283_248
{
wait 5
if #scnt >= %maxwait
goto open_context
}
wait 20
scroll_one_down:
gosub pause
getshopinfo
if #shopitemtype <> !_itemtype
{
if !_lastitemtype <> #shopitemtype
set !_lastitemtype #shopitemtype
else
{
set !_x #contposx + 73
set !_y #contposy - 16
click !_x !_y r
NAMESPACE POP
NAMESPACE CLEAR
return #false
}
sleep 0
set !_x #contposx + 73
set !_y #contposy - 16
click !_x !_y
sleep 0
goto scroll_one_down
}
if #shopitemprice <= !_maxprice
{
wait 20
set !_x #contposx - 33
set !_y #contposy - 128
click !_x !_y
wait 10
click !_x !_y x 3
wait 10
click !_x !_y x 3
wait 5
if !_amount > #shopitemmax
{
set !_amount #shopitemmax
set %vendor_empty #true
}
setshopitem #shopitemid !_amount
wait 5
set !_x !_x + 75
set !_y !_y + 335
click !_x !_y
wait 2s
finditem !_itemtype C_ , #backpackid
if #findstack = !_item_bp_stack && #findcnt = !_item_bp_cnt
goto sub_buy_again
NAMESPACE POP
NAMESPACE CLEAR
return #true
}
else
}
click !_x !_y r
NAMESPACE POP
NAMESPACE CLEAR
return #false
}
--- End code ---
Maybe give you ideas about stepping down the list.
OMGBurgers:
Well I fixed it. I haven't messed with NPC buy/sell gumps in a long time and i thought I had to highlight the top item for getshopinfo to work, but you don't. So I took 2 unneeded clicks out and it works like a charm. I should have tried more with it before I got too confused haha.
Khameleon:
awesome, I can't wait for this to hit Beta phase.
OMGBurgers:
I collected about 200k blank scrolls last night with it. Right now it's just hard coded for blank scrolls. Now I'm going to train inscribe enough to make spellbooks then run a script to make me slayers. While that's running I'm going to try to become unconfused and start modifying it to work with the main shopper script lol.
Right now it works pretty damn good. I'm very satisified with it. I've been brainstorming how to deal with the stone issue but I think it's pretty easy. I'll just have one stone equal a value of 10 or something. That way a reagent that is like a tenth of a stone lets say, will equal a 1 value. Should be simple enough.
I added a few lines to TM's recall subs that checks if the rune was able to be defaulted. If it tried to default an empty position it returns an error and then considers that runebook empty. Working pretty well and it allows me to keep my trammel/felucca runes in seperate books.
Navigation
[0] Message Index
[#] Next page
Go to full version