What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

Open Auction House Bot

AM ERROR AuctioneerNotFound System.NullReferenceException at OpenAuctionHouse.OpenAuctionHouse.buyFromAuctionHouse(String mySearchText, Int32 maxprice, Int32 minamount) in d:\Games\Archebuddy\Plugins\Auc\Auc.cs:line 164
at OpenAuctionHouse.OpenAuctionHouse.PluginRun() in d:\Games\Archebuddy\Plugins\Auc\Auc.cs:line 42
Object reference not set to an instance of an object.
Get this one



same error, i hope some1 will fix it coz i bought AB only for running AH bot,
Payed version of The Auction House sniper is no longer available, so i guess this one is our only rescue
 
No error so far.

Using this code:

Code:
using System;
using System.Drawing;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using ArcheBuddy.Bot.Classes;

namespace OpenAuctionHouse
{
    public class OpenAuctionHouse : Core
    {
        private int overbidamount = 40; // attempt to bid 40c above current bid
        private int waitSecondsForAuctionEnd = 180; // if a bid item is at < 3 minutes wait for it to end
        private int msToBidBeforeAuctionEnd = 2000; // wait until timeleft = 5 seconds until bidding myself

        private Random r = new Random();
        public static string GetPluginAuthor()
        {
            return "lypnn";
        }

        public static string GetPluginVersion()
        {
            return "2.2.0.0";
        }

        public static string GetPluginDescription()
        {
            return "Open Auction House";
        }

        //Call on plugin start
        public void PluginRun()
        {
            try
            {
                Log(DateTime.Now.ToShortTimeString() + " > ----- Open Auction House started -----");

                while (true)
                {
                    //buyFromAuctionHouse("Lumber", 500, 1); //  5s per item, minimum amount 1
                    
                    // add more items here
                }
            }
            catch (Exception e)
            {
                if (e.GetType() != typeof(System.Threading.ThreadAbortException))
                {
                    Log(DateTime.Now.ToShortTimeString() +" ERROR " +GetLastError().ToString() +" " +e.GetType().ToString() +" " +e.StackTrace);
                    Log(e.Message);
                }
            }
        }

        //Call on plugin stop
        public void PluginStop()
        {
            Log(DateTime.Now.ToShortTimeString() + " > ----- Open Auction House stopped -----");
        }

        ////////// no variables to edit below this line /////////////

        //buyout an auction house item
        public void buyFromAuctionHouse(string mySearchText, int maxprice, int minamount) // maxprice per item in copper, 1g = 1 00 00 copper
        {
            AuctionRequestParams req = new AuctionRequestParams(AuctionCategory.Off, 0, 0, mySearchText, false, ItemGrade.Common, AuctionSortType.Time, SortOrder.Asc);
            int pip; // per item price
            bool bidreturn;

            List<AuctionItem> items = getAuctionBuyList(req, 0);

            foreach (AuctionItem item in items)
            {
                if (!item.item.name.Equals(mySearchText)) // auctionitem item name must match the searchText
                    continue;

                if (Convert.ToInt32(item.time) > waitSecondsForAuctionEnd)
                {
                    pip = (int)item.buyBackPrice / item.item.count;

                    if (item.item.count < minamount || item.buyBackPrice == 0 || pip > maxprice)
                        continue;

                    if (me.goldCount >= item.buyBackPrice)
                    {
                        Thread.Sleep(100 + r.Next(150));
                        bidreturn = item.MakeAuctionBid(item.buyBackPrice);
                        Thread.Sleep(1000 + r.Next(500));
                        if (bidreturn)
                            Log(DateTime.Now.ToShortTimeString() + " > Attempting to BUYOUT " + item.item.count + " " + item.item.name + " with per item price " + pip.ToString() + " ... succeeded !");
                        else
                            Log(DateTime.Now.ToShortTimeString() + " > Attempting to BUYOUT " + item.item.count + " " + item.item.name + " with per item price " + pip.ToString() + " ... failed.");
                    }
                    else
                        Log(DateTime.Now.ToShortTimeString() + " > not enough gold to buyout " + item.item.count + " " + item.item.name + " for " + item.buyBackPrice);
                }
                else // auction items time is nearly over, check if we want to bid on it
                {
                    pip = (item.bidMoney != 0 ? item.bidMoney : item.sellPrice) / item.item.count;
                    if (pip + overbidamount <= maxprice && item.item.count >= minamount) // check if this is an item below maxprice
                    {
                        bidOnAuctionHouse(req, item.uniqId, maxprice);
                        break;
                    }
                }
            }
            Thread.Sleep(2000 + r.Next(3000)); // Random sleep 2-5s
        }
        public void bidOnAuctionHouse(AuctionRequestParams req, ulong itemId, int maxprice)
        {
            int pip; // per item price
            int myBidAmount;
            int sleepTime;
            bool bidreturn;

            List<AuctionItem> items = getAuctionBuyList(req, 9);
            foreach (AuctionItem item in items)
            {
                if (item.uniqId == itemId)
                {
                    pip = (item.bidMoney != 0 ? item.bidMoney : item.sellPrice) / item.item.count;
                    if (pip + overbidamount <= maxprice)
                    {
                        sleepTime = Convert.ToInt32(item.time) * 1000 - Convert.ToInt32(r.Next(500)) - msToBidBeforeAuctionEnd;
                        Log(DateTime.Now.ToShortTimeString() + " > waiting " + ((int)sleepTime / 1000).ToString() + " seconds to attempt a last-second-bid on " + item.item.count + " " + item.item.name + " (current bid price per item: " + pip + " maxprice: " +maxprice +")");
                        if (sleepTime > 100)
                            Thread.Sleep(sleepTime);
                        break;
                    }
                    else
                        return; // the item has become too expensive
                }
            }

            items = getAuctionBuyList(req, 9);
            foreach (AuctionItem item in items)
            {
                if (item.uniqId == itemId)
                {
                    pip = (item.bidMoney != 0 ? item.bidMoney : item.sellPrice) / item.item.count;
                    if (pip + overbidamount <= maxprice)
                    {
                        myBidAmount = (item.bidMoney != 0 ? item.bidMoney : item.sellPrice) + overbidamount;
                        if (me.goldCount >= myBidAmount)
                        {
                            bidreturn = item.MakeAuctionBid(myBidAmount);
                            Thread.Sleep(1000 + r.Next(500));
                            if (bidreturn)
                                Log(DateTime.Now.ToShortTimeString() + " > Successfully sent a BID on " + item.item.count + " " + item.item.name + " with " + myBidAmount + " (pip: " + (myBidAmount/item.item.count) + ")");
                            else
                                Log(DateTime.Now.ToShortTimeString() + " > Failed to send a BID on " + item.item.count + " " + item.item.name + " with " + myBidAmount + " (pip: " +(myBidAmount/item.item.count) +")");
                        }
                        else
                            Log(DateTime.Now.ToShortTimeString() + " > not enough gold to bid on " + item.item.count + " " + item.item.name + " with " + myBidAmount);
                    }
                    else
                        return; // the item has become too expensive
                }
            }
        }
    }
}
 
AM ERROR AuctioneerNotFound System.NullReferenceException at OpenAuctionHouse.OpenAuctionHouse.buyFromAuctionHouse(String mySearchText, Int32 maxprice, Int32 minamount) in d:\Games\Archebuddy\Plugins\Auc\Auc.cs:line 164
at OpenAuctionHouse.OpenAuctionHouse.PluginRun() in d:\Games\Archebuddy\Plugins\Auc\Auc.cs:line 42
Object reference not set to an instance of an object.
Get this one
This error tells you that you are not close enough to an auctioneer
 
Hi, look for your code:
Code:
 List<AuctionItem> items = getAuctionBuyList(req, 0);
            foreach (AuctionItem item in items)
What should be if items will be null? Exception.
So first of all you need to add check items != null before use items in foreach loops.
Also read about "try catch" - it can help you with errors in future
 
so i noticed that it will try and buy the item for 2 silver but if its anything below or above exactly your set about mine being 2 silver it wont buy it. is there any way to change that? so that it buys anything UNDER your set amount?
 
No error so far.

Using this code:

Code:
using System;
using System.Drawing;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using ArcheBuddy.Bot.Classes;

namespace OpenAuctionHouse
{
    public class OpenAuctionHouse : Core
    {
        private int overbidamount = 40; // attempt to bid 40c above current bid
        private int waitSecondsForAuctionEnd = 180; // if a bid item is at < 3 minutes wait for it to end
        private int msToBidBeforeAuctionEnd = 2000; // wait until timeleft = 5 seconds until bidding myself

        private Random r = new Random();
        public static string GetPluginAuthor()
        {
            return "lypnn";
        }

        public static string GetPluginVersion()
        {
            return "2.2.0.0";
        }

        public static string GetPluginDescription()
        {
            return "Open Auction House";
        }

        //Call on plugin start
        public void PluginRun()
        {
            try
            {
                Log(DateTime.Now.ToShortTimeString() + " > ----- Open Auction House started -----");

                while (true)
                {
                    //buyFromAuctionHouse("Lumber", 500, 1); //  5s per item, minimum amount 1
                    
                    // add more items here
                }
            }
            catch (Exception e)
            {
                if (e.GetType() != typeof(System.Threading.ThreadAbortException))
                {
                    Log(DateTime.Now.ToShortTimeString() +" ERROR " +GetLastError().ToString() +" " +e.GetType().ToString() +" " +e.StackTrace);
                    Log(e.Message);
                }
            }
        }

        //Call on plugin stop
        public void PluginStop()
        {
            Log(DateTime.Now.ToShortTimeString() + " > ----- Open Auction House stopped -----");
        }

        ////////// no variables to edit below this line /////////////

        //buyout an auction house item
        public void buyFromAuctionHouse(string mySearchText, int maxprice, int minamount) // maxprice per item in copper, 1g = 1 00 00 copper
        {
            AuctionRequestParams req = new AuctionRequestParams(AuctionCategory.Off, 0, 0, mySearchText, false, ItemGrade.Common, AuctionSortType.Time, SortOrder.Asc);
            int pip; // per item price
            bool bidreturn;

            List<AuctionItem> items = getAuctionBuyList(req, 0);

            foreach (AuctionItem item in items)
            {
                if (!item.item.name.Equals(mySearchText)) // auctionitem item name must match the searchText
                    continue;

                if (Convert.ToInt32(item.time) > waitSecondsForAuctionEnd)
                {
                    pip = (int)item.buyBackPrice / item.item.count;

                    if (item.item.count < minamount || item.buyBackPrice == 0 || pip > maxprice)
                        continue;

                    if (me.goldCount >= item.buyBackPrice)
                    {
                        Thread.Sleep(100 + r.Next(150));
                        bidreturn = item.MakeAuctionBid(item.buyBackPrice);
                        Thread.Sleep(1000 + r.Next(500));
                        if (bidreturn)
                            Log(DateTime.Now.ToShortTimeString() + " > Attempting to BUYOUT " + item.item.count + " " + item.item.name + " with per item price " + pip.ToString() + " ... succeeded !");
                        else
                            Log(DateTime.Now.ToShortTimeString() + " > Attempting to BUYOUT " + item.item.count + " " + item.item.name + " with per item price " + pip.ToString() + " ... failed.");
                    }
                    else
                        Log(DateTime.Now.ToShortTimeString() + " > not enough gold to buyout " + item.item.count + " " + item.item.name + " for " + item.buyBackPrice);
                }
                else // auction items time is nearly over, check if we want to bid on it
                {
                    pip = (item.bidMoney != 0 ? item.bidMoney : item.sellPrice) / item.item.count;
                    if (pip + overbidamount <= maxprice && item.item.count >= minamount) // check if this is an item below maxprice
                    {
                        bidOnAuctionHouse(req, item.uniqId, maxprice);
                        break;
                    }
                }
            }
            Thread.Sleep(2000 + r.Next(3000)); // Random sleep 2-5s
        }
        public void bidOnAuctionHouse(AuctionRequestParams req, ulong itemId, int maxprice)
        {
            int pip; // per item price
            int myBidAmount;
            int sleepTime;
            bool bidreturn;

            List<AuctionItem> items = getAuctionBuyList(req, 9);
            foreach (AuctionItem item in items)
            {
                if (item.uniqId == itemId)
                {
                    pip = (item.bidMoney != 0 ? item.bidMoney : item.sellPrice) / item.item.count;
                    if (pip + overbidamount <= maxprice)
                    {
                        sleepTime = Convert.ToInt32(item.time) * 1000 - Convert.ToInt32(r.Next(500)) - msToBidBeforeAuctionEnd;
                        Log(DateTime.Now.ToShortTimeString() + " > waiting " + ((int)sleepTime / 1000).ToString() + " seconds to attempt a last-second-bid on " + item.item.count + " " + item.item.name + " (current bid price per item: " + pip + " maxprice: " +maxprice +")");
                        if (sleepTime > 100)
                            Thread.Sleep(sleepTime);
                        break;
                    }
                    else
                        return; // the item has become too expensive
                }
            }

            items = getAuctionBuyList(req, 9);
            foreach (AuctionItem item in items)
            {
                if (item.uniqId == itemId)
                {
                    pip = (item.bidMoney != 0 ? item.bidMoney : item.sellPrice) / item.item.count;
                    if (pip + overbidamount <= maxprice)
                    {
                        myBidAmount = (item.bidMoney != 0 ? item.bidMoney : item.sellPrice) + overbidamount;
                        if (me.goldCount >= myBidAmount)
                        {
                            bidreturn = item.MakeAuctionBid(myBidAmount);
                            Thread.Sleep(1000 + r.Next(500));
                            if (bidreturn)
                                Log(DateTime.Now.ToShortTimeString() + " > Successfully sent a BID on " + item.item.count + " " + item.item.name + " with " + myBidAmount + " (pip: " + (myBidAmount/item.item.count) + ")");
                            else
                                Log(DateTime.Now.ToShortTimeString() + " > Failed to send a BID on " + item.item.count + " " + item.item.name + " with " + myBidAmount + " (pip: " +(myBidAmount/item.item.count) +")");
                        }
                        else
                            Log(DateTime.Now.ToShortTimeString() + " > not enough gold to bid on " + item.item.count + " " + item.item.name + " with " + myBidAmount);
                    }
                    else
                        return; // the item has become too expensive
                }
            }
        }
    }
}


is there a difference between yours and lypnn code?


its all about this error

ERROR ResponseTimeout System.NullReferenceException w OpenAuctionHouse.OpenAuctionHouse.buyFromAuctionHouse(String mySearchText, Int32 maxprice, Int32 minamount) w c:\ab\Plugins\allegro\allegro.cs:line 132
w OpenAuctionHouse.OpenAuctionHouse.PluginRun() w c:\ab\Plugins\allegro\allegro.cs:line 58

i guess it happens when ur searching for item which is not actually in AH?
maybe u dont have errors because ur searching for lumbers only?

so as OUT mentioned

Hi, look for your code:
Code:
 List<AuctionItem> items = getAuctionBuyList(req, 0);
            foreach (AuctionItem item in items)
What should be if items will be null? Exception.
So first of all you need to add check items != null before use items in foreach loops.
Also read about "try catch" - it can help you with errors in future


but i still dont get it coz im too low with C# :(
need some more help please
 
Last edited:
im getting this error after a while of running 7:20 PM ERROR ResponseTimeout System.NullReferenceException at OpenAuctionHouse.OpenAuctionHouse.buyFromAuctionHouse(String mySearchText, Int32 maxprice, Int32 minamount) in c:\Users\wilder\Desktop\Archage Buddy\Plugins\AH 2.0\AH 2.0.cs:line 78
at OpenAuctionHouse.OpenAuctionHouse.PluginRun() in c:\Users\wilder\Desktop\Archage Buddy\Plugins\AH 2.0\AH 2.0.cs:line 44
Object reference not set to an instance of an object.
 
am i the only one here who can't run this script ?

i've install it on my buddy, i can see the .dll on the plugin manager with autorun but it did absolutely nothing . (It's the second script i'm testing so maybe i'm doing something wrong if someone can help me ? )

error :\buddy\Plugins\AH\AH.dllUnknown executing error, or plugin was forcibly unloaded.
 
Last edited:
23:38 ERROR Unknown System.OverflowException at System.Convert.ToInt32(UInt64 value)
at OpenAuctionHouse.OpenAuctionHouse.buyFromAuctionHouse(String mySearchText, Int32 maxprice, Int32 minamount) in d:\aa bot\Plugins\ah\1.cs:line 79
at OpenAuctionHouse.OpenAuctionHouse.PluginRun() in d:\aa bot\Plugins\ah\1.cs:line 41
Value was either too large or too small for an Int32.
 
is there any way to make it so it post an item for a certain amount. for example have the pluggin list 1 carrot on the AH for 1 Silver each then people will post their carrots for 1silver each and i buy the carrots cheap. any way to implement that so it post 1 item every like 20 minutes or something like that
 
Melch follow the directions in the first post. Its very easy but you have to follow his directions.


Does this snipe auctions?
 
What i didnt understand was, i need to have use the plugin editor and ctrl C+ ctrl V the content, or do i have to put it somewhere else
 
The plugin doesnt work ... To bad :/

buyFromAuctionHouse("Log", 200, 2); // minimum amount set to 2
buyFromAuctionHouse("Vocation Tonic", 550, 1); // minimum amount set to 1

buyFromAuctionHouse("Lotus", 80, 2); // 80 copper per item, minimum amount 2
buyFromAuctionHouse("Azalea", 50, 2); // 50 copper per item, minimum amount 2

Both doesnt work at all, they just search for the item nothing more ...
 
you're asking it to buy from the ah Log at 2 silver and vocation tonic at 5silver 50 copper. The Lotus are at 80copper and Azalea is at 50 copper. maybe increase your price? My server logs are 288. 2 silver 88copper. Vocation tonics are 114455 (11g44s55c)
 
I got it thanks alot :D

buyFromAuctionHouse("Vocation Tonic", 55000, 10); // minimum amount set to 10
Correct? :D
 
Last edited:
Back
Top