Farm Manager - Tribal Wars 2 Farmbot (old version from 2018)

It just happened again when i was watching. However i noticed it opens the Raport window and all reports where normaly visible, and then sudenly the browser closed.

20-13-46.557: I click on the button to navigate to the next report.
20-13-49.765: Caption of the current open report: ‘Dziś o 11:17:23 - xx atakuje: ( Wioska barbarzyńska )’
20-13-49.765: Hey, I have seen a report with the same caption before! I skip this report and continue with the next one. If you see this happen all the time, make sure that the game is visible in the web browser.
20-13-51.118: I click on the button to navigate to the next report.
20-13-54.335: Caption of the current open report: ‘Dziś o 11:17:23 - xx atakuje: ( Wioska barbarzyńska )’
20-13-54.336: Hey, I have seen a report with the same caption before! This has happened 3 consecutive times. This could be caused by the the bug in the Tribal Wars 2 Web App which breaks reports display (Bug In Tribal Wars 2 Web App - Broken Report Display). I start the process to recover from this bug.
20-13-54.336: I begin the process to restart the report UI and continue at report with time ‘11:17:23’.
20-13-56.090: I clicked the button to open the report list. Next, I set the page size to 100.
20-14-02.831: I parse the reports in there to find the best to continue with.
20-14-02.836: I parsed 0 report items.
20-14-02.836: I did not find a report item with time of ‘11:17:23’. I continue with the last report in the list.
20-14-02.838: RuntimeException: System.AggregateException: One or more errors occurred. —> System.AggregateException: One or more errors occurred. —> System.NullReferenceException: Object reference not set to an instance of an object.
at Submission#0.ReloadAndEnterReportAtTime(String reportTimeToContinueAt)
at Submission#0.<>d__0.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.d__91.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.CodeAnalysis.Scripting.Script1.d__21.MoveNext()
— End of inner exception stack trace —
at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at BotSharp.ScriptRun.ScriptRun.<>c__DisplayClass75_1.<Start>b__3() at System.Threading.Tasks.Task1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
— End of inner exception stack trace —
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at BotSharp.ScriptRun.ScriptRun.<>c__DisplayClass75_0.b__4()
—> (Inner Exception #0) System.AggregateException: One or more errors occurred. —> System.NullReferenceException: Object reference not set to an instance of an object.
at Submission#0.ReloadAndEnterReportAtTime(String reportTimeToContinueAt)
at Submission#0.<>d__0.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.d__91.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.CodeAnalysis.Scripting.Script1.d__21.MoveNext()
— End of inner exception stack trace —
at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at BotSharp.ScriptRun.ScriptRun.<>c__DisplayClass75_1.<Start>b__3() at System.Threading.Tasks.Task1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
—> (Inner Exception #0) System.NullReferenceException: Object reference not set to an instance of an object.
at Submission#0.ReloadAndEnterReportAtTime(String reportTimeToContinueAt)
at Submission#0.<>d__0.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.d__91.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.CodeAnalysis.Scripting.Script1.d__21.MoveNext()<—
<—

20-14-02.839: status transition from None to Failed.

For an overview of this session, see http://manage.botengine.org/operation-session/a3a2b50ab22fb737

1 Like

Sure, when we know what happens in your case, and what option you prefer, we can adapt the bot.
Last time I dug up some information about this case was here:

To continue, from there: How did the report list look like when the bot crashed on the same code location? Did the reports eventually show up there? If that is the case, a solution could be to wait longer. But if the reports do not show up in the list (quick enough), would you prefer to have the bot start from scratch?

Commenting out a known line is simple: A comment can look like this:

// Text on this line is not interpreted as program

So what lines couse the error?

Credits are only consumed when the bot is Running or is Paused.

Ok, that is some progress on the way of finding out what happens in your case :+1:
When the game has arrived in this state, how can you make it display the list of reports again?

Sure, I made a version of the Farmbot which is adapted to your case. You can download it from https://botengine.blob.core.windows.net/blob-library/by-name/tribal-wars-2-farmbot.v2018-12-09.cs

How does this version work for you?

Maybe it works when the bot waits more time before attempting the click, or clicks another time if the first try fails.
I adapted the bot to try this, you can download this version of the bot from https://botengine.blob.core.windows.net/blob-library/by-name/tribal-wars-2-farmbot.v2018-10-12.cs

What log do you get with that version?

Hello VIIR,

Still the same… i can see he goes to the map to select the villa but the button to activate the villa is not pressed…or activated…

20-21-01.321: Bot operation started in session 29e320994a612864.
20-21-09.675: Welcome! - ¡Bienvenido! - Bienvenue! ---- This is the Tribal Wars 2 Farmbot. I read your battle reports and send troops to your farms again. To learn more about how I work, see Testing the Tribal Wars 2 Farmbot 2018. In case you have any questions, feel free to ask at https://forum.botlab.org
20-21-22.171: Looks like opening the web browser was successful.
20-21-22.237: Starting cycle 0 of 1.
20-21-23.353: I did not find the button to open the report list. Maybe the game is still loading. (The location of the current page is ‘about:blank’). If you have not done this yet, please log in and enter the game in the web browser I opened when the script started. For now, I keep looking for that button to appear…
20-21-38.791: I did not find the button to open the report list. Maybe the game is still loading. (The location of the current page is ‘The medieval online strategy game - Tribal Wars 2’). If you have not done this yet, please log in and enter the game in the web browser I opened when the script started. For now, I keep looking for that button to appear…
20-21-53.852: I did not find the button to open the report list. Maybe the game is still loading. (The location of the current page is ‘https://en.tribalwars2.com/game.php?world=en41&character_id=1064021’). If you have not done this yet, please log in and enter the game in the web browser I opened when the script started. For now, I keep looking for that button to appear…
20-22-02.589: Found the button to open the report list.
20-22-02.590: Please configure filtering in the reports list now. I will wait for 10 seconds before continuing. In case you need more time to configure the game, you can pause the bot.
20-22-12.597: Url without character id: ‘https://en.tribalwars2.com/game.php?world=en41&character_id
20-22-14.437: Found the button to open the report list. I click on this button…
20-22-22.112: Found at least one report item in the reports list.
20-23-30.461: Number of parsed report items: 100
20-23-30.461: Found a report in the report list. I click on it.
20-23-32.709: In the current cycle, I have looked at 0 reports and sent 0 attacks from 0 villages.
20-23-32.738: In this session, I have looked at 0 reports and sent 0 attacks from 0 villages.
20-23-38.038: Caption of the current open report: ‘Today at 1:20:53 AM - MFD A02 attacks ( Barbarian village )’
20-23-39.214: Parse the battle report details…
20-23-42.473: Battle report details:
{ “AttackerVillageLocation”: “521|504” , “DefenderVillageLocation”: “521|503” , “DefenderIsBarbarian”: “True” }
20-23-42.501: This report looks like I should attack here.
20-23-43.390: Current active village location is 519|504
20-23-43.401: Begin switching to village 521|504.
20-23-50.140: I clicked on the menu button to activate the village. Now I wait for the game to show 521|504 as the active village.
20-24-01.993: I failed to switch to the originally attacking village. I skip this report. If you see this happen all the time, make sure that the game is visible in the web browser.
20-24-04.037: I click on the button to navigate to the next report.
20-24-09.468: Caption of the current open report: ‘Today at 1:12:13 AM - MFD HQ attacks ( Kurenai Yuki’s village )’
20-24-10.339: Parse the battle report details…
20-24-13.509: Battle report details:
{ “AttackerVillageLocation”: “519|504” , “DefenderVillageLocation”: “492|493” , “DefenderIsBarbarian”: “True” }
20-24-13.534: This report looks like I should attack here.
20-24-14.773: Current active village location is 519|504
20-24-14.787: Try to find and click the button to attack again.
20-24-16.803: status transition from None to Pausing.

I will wait for your reply
Thanks

I don’t know if u guys were with the same problem as I was, but when the bot was trying to switch villages, he couldn’t do it. I realize it was chat’s fault (The village was too close to the chat, and the bot was probably conflicting). I closed the chat and the bot work perfectly.

Hope it help!

1 Like

it stops after 1 session , how can i increese it ?
and it farms only with 1 village
how can i fix it ?

For the second case try to follow the instructions in my commentary above.
For the first case change this on the script:

const int numberOfFarmCyclesToRepeatRandomAdditionMax = 0;

if you scroll through commentaries you’ll find with more details how to proceed.

1 Like

can you repost it here ?

This is the part. Trying to be more precisely:

Open the bot engine and before started go to “Development Environment”, it will show tons and tons lines of code.

In my bot is line 38, yours should be near. Change the number to how many cycles your want.

There’s also line 31:
const int breakBetweenCycleDurationMinSeconds = 60 * 60;

The cycle will only repeat after this 60 minutes, so u can change it and put 30 minutes, or 120 minutes…

Give a look at the green lines of the code. It explains better than i do haha

1 Like

Thanks, this will be helpful for many people. :+1:
I am going to add this somewhere well visible.

Hey @bdc , thank you for the feedback.
One more question about your setup: Do you see a chat window in Tribal Wars 2? Can you send me a screenshot of the game when the bot has tried to switch the village?

Hello VIIR,

You are right, the chat was open, and i think that was prohibiting for the bot to switch villas.
I closed the chat in that chrome browser and started it again ,and now it switches from villa. The bot works with all villas that it can find reports on now. Thank you!

1 Like

Why is it telling me there are no credits when I just purchased them?

“The current balance of this account is 0 BotEngine credits”

can we program it, that the bot always sent 50 attacks each village ?

Hello Mark, thank you for the purchase!
After the purchase, an email was sent to you email afddress. In this email, under License Key there is secret code that you can use to add the credits to your account.

To add the credits to your account, log in to your BotEngine account, then enter the code received via email from paddle on the BotEngine website at https://manage.botengine.org/credits/RedeemCreditsVoucher
Below is a screenshot of the form to enter the voucher code or License Key:
title
You will then see the added credits reflected in your current account balance at https://manage.botengine.org/credits

I updated the bot to fix village switching:

Thank you @PlayXLD for the help fixing this!

Hey Viir, looks like you have discovered a new bot! Thank you for sharing this with us!
I added a link to this bot to the bot catalog:
https://forum.botlab.org/t/bot-e6b2745c-tribal-wars-2-farmbot-v2018-12-15/1930

Yes ty i figured it out :slight_smile:

sometimes the bot don’t farm with my 3d village
it does farm with 2 villages
it seems that he still have problems switching some villa’s ?