Closed jtcd closed 11 years ago
Mine seems to throw these exceptions quite a lot also (trade message, trade accept, set trade ready etc.)
It's on my list of things to investigate. I'll chime in if I find anything helpful.
@iMagooo Okay thanks!
I think I have a lead anyway. I have just added a method for sending group invites to friends. It works whenever i get the indefinitely perfect outcome and does not work when the TradeException gets thrown every trade.
The web request to send group invites to friends returns the result "Missing or invalid form session key" when it fails.
Seems like there is something wrong with the session key.
It's because you're missing the session key :P Check out https://github.com/waylaidwanderer/SteamGrouper - it may be helpful. Lemme read through my code again and find the relevant section for you.
Edit: Also, TradeException
being thrown has nothing to do with your sending group invite to friends. TradeException
is thrown when a trade error occurs. It's more likely that you're not doing the proper cleanup when this happens (aka not catching it and handling it) and the bot gets stuck and doesn't respond.
Here is the function I wrote that invites users to groups. https://github.com/waylaidwanderer/SteamGrouper/blob/master/SteamBot/Bot.cs#L708
@waylaidwanderer
Thanks a lot for the tips :)! I am not missing the session key in my invite to group method though, I know this because the method works normally when i get outcome 1 from above - "Bot works perfectly indefinitely". With regard to the TradeException
problem I have tried catching the exception and recursively retrying the process but to no avail.
Perhaps OnTradeClose() isn't being called and thus the bot is getting stuck?
Try running a loop that continually checks if Bot.CurrentTrade
is null
, and if it is, fires the OnTradeClose() function after the trade has initialized.
Hmm the problem starts from the very first trade. I've looked at your suggestion and UserHandler.OnTradeClose
calls Bot.CloseTrade
which returns immediately if Bot.CurrentTrade
== null.
public void CloseTrade()
{
if (CurrentTrade == null)
return;
...
}
Did I misunderstand you x)?
I have just tried using a fresh clone of the repository with VS 2010 .Net4.0 and I get the same problem. I was getting the same problem in VS 2012 using a fresh clone of the repository. Does anyone else get the same problems using fresh clones?
I've got a timer which starts in OnTradeInit()
, has an interval of 30 seconds and checks if the bot is listed as busy, while Bot.CurrentTrade == null
.
If true, OnTradeClose()
is called.
I find that option better than a continuous loop, the bot can only be stuck in Busy status if the bot was traded, so there's no need to check Bot.CurrentTrade
if it hasn't been in a trade.
This is a temporary fix, of course, until I work out a solution for the exceptions.
This is my function:
private void CheckTradeState()
{
while (true)
{
if (Bot.CurrentTrade == null && !tradeClosed)
{
OnTradeClose();
checkTrade.Abort();
break;
}
System.Threading.Thread.Sleep(800);
}
}
It polls every 800 milliseconds. checkTrade
is a Thread
, which I use by checkTrade = new Thread(CheckTradeState);
in OnTradeInit().
I rectified my problem by validating the session id whenever i start a Bot. Not a clean solution but my Bots have not thrown a single exception for the last 4 days. Thanks everyone for the help :)!
Hi!
Whenever I start a Bot I get 1 of 2 outcomes.
Outcome 1: It works perfectly indefinitely
Outcome 2: This exception is thrown every time a trade session is started:
The problem originates from this method:
json.success is false. I tried to look for the error by printing the entire serialized json string but is has only 1 element which is "success" = "false".
I am able to log in to steam and trade normally through the official steam client. I am using visual studio express 2012. Sorry in advance if this is a noob question. I'm just curious if anyone else has had this issue or knows how to resolve it. Thanks!