Jessecar96 / SteamBot

Automated bot software for interacting with Steam Trade
http://scrap.tf
MIT License
1.33k stars 910 forks source link

ERROR: Error Polling Trade: SteamTrade.Exceptions .TradeException: #108

Closed tkphoto closed 11 years ago

tkphoto commented 11 years ago
 ERROR: Error Polling Trade: SteamTrade.Exceptions
.TradeException: Error validating local copy of items in the trade: Count mismat
ch
   at SteamTrade.Trade.ValidateLocalTradeItems() in c:\Users\tk\Documents\GitHub
\SteamBot\SteamTrade\Trade.cs:line 737
   at SteamTrade.Trade.SetReady(Boolean ready) in c:\Users\tk\Documents\GitHub\S
teamBot\SteamTrade\Trade.cs:line 437
   at SteamBot.tk.ProcessTradeMessage(String message) in c:\Users\tk\Documents\G
itHub\SteamBot\SteamBot\tk.cs:line 94
   at SteamBot.tk.OnTradeMessage(String message) in c:\Users\tk\Documents\GitHub
\SteamBot\SteamBot\tk.cs:line 82
   at SteamTrade.Trade.Poll() in c:\Users\tk\Documents\GitHub\SteamBot\SteamTrad
e\Trade.cs:line 585
   at SteamBot.Bot.<.ctor>b__2() in c:\Users\tk\Documents\GitHub\SteamBot\SteamB
ot\Bot.cs:line 132

I get this error whenever i use a Trade.SetReady(true); after the next line of adding any items

ie

Trade.AddAllItemsByDefindex(5001);
Trade.SetReady(true);

Is there a solution to making a bot automatically ready up after it adds something to trade ?

coffman34 commented 11 years ago

What is on line 82 and 94 of tk.cs?

tkphoto commented 11 years ago

line 82: ProcessTradeMessage(message); line 94: Trade.SetReady(true);

Basically im trying to get it to insert a weapon which it does using 'addwep'.. but it doesnt readyup as it crashes with the error

But in whatever situation i put a Trade.SetReady(true); after a line with adding an item (AddItemsByCraftType ) it crashes.. I tested with reacting to a word saying rdyup with Trade.SetReady(true); it works.. so its obviously a problem with steambot accepting a readyup statement after items being added , in any quantity aswell

cwhelchel commented 11 years ago

@tkphoto You might be better off making the Bot ready up after the other user readies up (there's an override or event for that in UserHandler).

The trade is probably still processing the the Add command and the items have not been fully added before you hit the validation code by calling SetReady.

tkphoto commented 11 years ago

Yeah i think thats the problem with it, i wanted to work this out mainly as a way of getting 2 bots to interact with each other to offload some items. The other way you mentioned works, but of course is about a human readying up the trade.

Ive got automatically adding type of items etc.. and the amount i want done.. its just getting a bot to readyup first.. which the 2nd will readyup already automatically afterwards.... and then either one to go ahead with the trade.. if you have any suggestions for this .. i would be grateful

coffman34 commented 11 years ago

Does UserHandler.cs inherit SimpleUserHandler?

What I mean is, if I add code in UserHandler.cs, and use it, will code that is also in SimpleUserHandler.cs work, or affect the bot?

cwhelchel commented 11 years ago

@coffman34 It's the other way around. SimpleUserHandler inherits from UserHandler. If you add stuff to UserHandler you can use it in SimpleUserHandler or any other child classes.

@tkphoto You should sleep for some arbitrary amount of time before reading up after adding items to the trade. See if that works.

coffman34 commented 11 years ago

Thank you for that.

ghost commented 11 years ago

I'm having exactly the same problem! I've tried doing: System.Threading.Thread.Sleep(2000); to make it wait for 2 seconds before clicking ready, after it adds the items, but I am still receiving this error.

Any ideas?

coffman34 commented 11 years ago

Just move your Trade.SetReady(true) somewhere away from right behind Trade.addItem. IMHO You should be using a separate function to add items, and Trade.SetReady(true) be set in it's normal location, also, make sure you have checks in validate() so that the user can't rip you off.

jamlord commented 11 years ago

@tkphoto Did you ever complete a working system to transfer items between bot accounts? I almost have one working but I'm still running into a few errors.