Jessecar96 / SteamBot

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

Bot missing OnTradeRemoveItem event #188

Closed lazy1 closed 11 years ago

lazy1 commented 11 years ago

It is quite rare thing but it happened twice during the last month. Usually when the steam is very slow. Its practically impossible to reproduce.

For some reason bot was missing the event when the user pulled out the item he put before.

Any idea how to troubleshoot?

gamemaster1494 commented 11 years ago

I'm guessing it happened between trade polls. Maybe try reducing the trade poll interval. 800 is .8 of a second... So they would of had to been fast to do it. Other than that, I have no idea.

gamemaster1494 commented 11 years ago

Its weird too. I've tried using the items directly from the vars in the trade, and it can still glitch up.... Its like it says they added it, never removed it, and traded but poof they are gone... This is really screwing up my bots =/

lazy1 commented 11 years ago

I found an approach to deal with it. Not sure if if works or not because its a rare event. The point is when you get the status of the trade you get the entire log of actions during this particular trade. So before accepting the trade I pull the log. Count the number of items added by the other party, subtract the number of removed and if the resulting number is correct then my bot accepts.

teliosdev commented 11 years ago

@gamemaster1494 that's not what would cause it, since valve sends all events that have ever happened in the trade.

lazy1 commented 11 years ago

If anybody interested: Adding this additional checks allowed to catch 2 instances when user pulled the item and the bot missed that. However at one instance the check didn't catch the pulling of the item and the trade went unbalanced.

gamemaster1494 commented 11 years ago

Why wouldn't it detect it though? The trade is still polling...

I have put down some logging systems into the trade classes. I have gotten 1 instance where it shows the user added the item, nothing removed, user accepted, as did bot, and trade done. However, 1 item of the trade didn't go through. Upon further investigation, it was a weapon that was added when the version skipped. Like current version was 4, ask events, new version was 6. 6th version item went through, but the 5th didn't, even though it did trigger the tradeadditem event. Though this is only 1 instance, I am waiting for it to show up more to see if this is a common thing with all of them

gamemaster1494 commented 11 years ago

@lazy1 Exactly what did you do? Did you pull the items from OtherItemsOffered # and check it with the bots number it is keeping track of?

lazy1 commented 11 years ago

I added the function which pulls trade status and count items added minus items removed. Not relying on OtheItemsOffered.

cwhelchel commented 11 years ago

Is this fixed thanks to #236? Can some one verify?

iMagooo commented 11 years ago

@redjazz96 @FunkyLoveCow

This is still an issue, it happened this morning in a trade with someone else's bot. image

Paid 42.44ref for 8 keys @ 5.55ref (44.44ref). If I truly added 44.44ref, the bot would say I added too much metal.

It has also happened a couple times on my bot within the last month.

Basically what happens is Steam reports an incorrect number of items added, mainly when the Steam servers are lagging badly (like this morning, due to the TF2 update).

For instance, say I double clicked 6 keys into the trade offer. Sometimes, only 5 keys would end up in the trade window, but the Steam tradechat (not the chat generated by the bot) would say: "You added Mann Co... Key" x6. The bot manager also states that 6 keys are added, so it pays for 6 keys, despite there only being 5. Steam reports 6 Key added events when there should only be 5.

This has nothing to do with the UserHandler, since the UserHandler has a verify check for the number of keys added vs. bot metal added.

This issue is due to the fact that the Steam servers incorrectly report the wrong number of keys added. Is it possible to fix it or is it an issue on Steams side of things?

From Geel9's Steam profile comments, first page: image

So my guess is that the scrap.tf bots are susceptable to the issue as well.

Although, these are examples of Bot missing OnTradeAddItem event, not OnTradeRemoveItem event. My guess is that both problems stem from similar issues.

cwhelchel commented 11 years ago

@iMagooo I think this problem relates to #327 in that the trade poll algorithm needs to be re-written to make use of the extra data from the web API. This could alleviate some of the issues here. I have my ideas on an implementation but it's hard to test when this kind of thing happens when Steam is laggy.

@redjazz96 Perhaps reopen?

iMagooo commented 11 years ago

@cwhelchel My bot seems to have this issue around once daily, especially if I'm in game at the time of trading.

How can I go about obtaining more information about the trade events for debugging purposes?

cwhelchel commented 11 years ago

@iMagooo there is a #define you can compile the steamtrade project with. Look for a debug print method and you'll find it. When enabled it can print more info to stdout. However it may still now have everything about the trade events

iMagooo commented 11 years ago

I found and enabled the Conditional in the TradeManager.cs, I also enabled Debug level logging from the settings.json, neither changes seem to output any form of trade events other than the regular "Success: User added: #CI_Bar_C" etc.

fiskWasTaken commented 11 years ago

I guess this is now a non-issue since this can only really be used for live logging purposes. That being said, I think they'll fix it soon.