autobuy

Ask for help
Post Reply
jay-z
Posts: 2
Joined: 29.07.2019 14:22

autobuy

Post by jay-z »

Code: Select all

runebook = 0x4006B4AA
npcTypes = [0x0191, 0x0190]
buyTypes = ["Black Pearls", "Mandrake Roots", "Blood Moss", "Blank Scroll"]

Ignore(Self())
SetMoveOpenDoor(1)
SetFindDistance(14)
SetAutoBuyDelay(5)




def main():
    for i in range(14):
        UseObject(runebook)
        CheckLag(15000)
        x = GetX(Self())
        y = GetY(Self())
        while GetX(Self()) == x and GetY(Self()) == y:
            for a in range(GetGumpsCount()):
                Wait(50)
                if GetGumpID(a) == 0x04AF:
                    button = ( i * 2 ) + 20
                    NumGumpButton(GetGumpsCount() - 1, button)
            Wait(50) 
        FindTypesArrayEx([0x0191, 0x0190], [0xFFFF], [Ground()], False)
        if GetFindedList():
            vendors = GetFindedList()
            for vendor in vendors:
                CheckLag(15000) 
                name = GetName(vendor)
                CheckLag(15000)    
                if name.find("Alchemist") or name.find("Mage") != -1:
                    if GetZ(vendor) != GetZ(Self()):
                        continue                
                    if GetDistance(vendor) > 1: 
                        NewMoveXY(GetX(vendor), GetY(vendor), True, 1, True) 
                    UOSay(name + " Buy")
                    CheckLag(15000) 
                    ClearShopList()
                    shoplist = GetShopList()
                    CheckLag(15000)
                    for elem in buyTypes:
                        if elem in shoplist:
                            AutoBuyEx(-1, -1, -1, -1, elem)
                            AutoBuyEx(-1, -1, 0, -1, elem)
                            Wait(500)  
                            
                    

 

if __name__ == "__main__":
    main()
can anyone please help understand why this doesnt buy anything? ty.
Post Reply