All pastes #413970 Raw Edit

Mine

public text v1 · immutable
#413970 ·published 2007-03-28 20:04 UTC
rendered paste body
#define MERCHANT_NAME "Cookie One-Eye"
#define ITEM_NAME "Smoked Talbuk Venison"
#define ITEM_NAME2 "Filtered Draenic Water"
function main()
{
        extension -require isxwarden
        extension -require isxwow
        call buy
}
function second()
{
        call main
}
function buy()
{
        if ${Unit[MERCHANT_NAME].IsMerchant}
        {
                Unit[MERCHANT_NAME]:Use
                wait 10
                call buyItem ITEM_NAME
                call buyItem ITEM_NAME2
        }
        else
        {
                echo MERCHANT_NAME does not seem to be a merchant
        }
}
function buyItem(string Name)
{
        declare numitems int local 0
        declare i int local 1   
        declare Index int local 0
        while  ${i} <= ${WoWScript[GetMerchantNumItems()]}
        {
                if ${WoWScript[GetMerchantItemInfo(${i})].Equal[${Name}]}
                {
                        Index:Set[${i}]
                }
                i:Inc
                numitems:Set[${WoWScript[GetMerchantItemInfo(${Index}),5]}]
                waitframe
        }
        while ${numitems} > 0
        {
                WoWScript BuyMerchantItem(${Index})
        }
        else
        {
                echo MERCHANT_NAME does not sell ${Name}
        }

}