Farm Manager - Tribal Wars 2 Farmbot

Sorry, I don’t understand how to do both :sweat:. Anyway to learn the first method if it’s not too much trouble. Love the online tool! Ever deciding to make a bot for completing resource deposit?

Here is a complete guide on the file editing: https://docs.github.com/en/free-pro-team@latest/github/managing-files-in-a-repository/editing-files-in-another-users-repository

When you have created a commit with your change, Github gives you an URL to your version. You can use that URL to run your bot.
(If you create a pull request, this means that you already have a commit.)

1 Like

Got it to work with one string, how does one add multiple preset as a string like search for Preset with “A” and Preset with “B”? tried a bunch and no go, also I keep getting this, but a couple and re-run it starts to work.

 Starting the app....

run v2020-08-24 failed with exception: System.UnauthorizedAccessException: Access to the path 'C:\Users\B\AppData\Local\Temp\ccyj3guo.0bp\name-used-to-execute-file.exe' is denied.
   at System.IO.FileSystem.DeleteFile(String fullPath)
   at System.IO.File.Delete(String path)
   at Kalmit.ExecutableFile.ExecuteFileWithArguments(IImmutableList`1 environmentFiles, Byte[] executableFile, String arguments, IDictionary`2 environmentStrings)
   at Kalmit.ProcessFromElm019Code.CompileElm(IImmutableDictionary`2 elmCodeFiles, IImmutableList`1 pathToFileWithElmEntryPoint, String outputFileName, String elmMakeCommandAppendix)
   at Kalmit.ProcessFromElm019Code.CompileElmToJavascript(IImmutableDictionary`2 elmCodeFiles, IImmutableList`1 pathToFileWithElmEntryPoint, String elmMakeCommandAppendix)
   at Kalmit.ProcessFromElm019Code.ProcessFromElmCodeFiles(IImmutableDictionary`2 elmCodeFiles, Nullable`1 overrideElmAppInterfaceConfig)
   at Kalmit.PersistentProcess.PersistentProcessWithHistoryOnFileFromElm019Code..ctor(IProcessStoreReader storeReader, IImmutableDictionary`2 elmAppFiles, Action`1 logger, Nullable`1 overrideElmAppInterfaceConfig)
   at BotEngine.Windows.Console.RunAppSession.Run(TreeComponent appCodeTree, Func`2 getFileFromHashSHA256, String appProcessRecordingDirectory, Action`1 logEntry, Action`1 addSessionLogEntry, String appSettings, String sessionCustomName, AppSourceStructure appSource, String keyToStartOnlineSession, IEnumerable`1 sessionLengthLimits, IImmutableList`1 pauseAppKeys, IImmutableList`1 statusDisplayAdditionLines, RunSimulation simulation) in D:\a\dev-of-botengine\dev-of-botengine\implement\client\windows-console\BotEngine.Windows.Console\RunAppSession.cs:line 55
   at BotEngine.Windows.Console.BotEngine.runAppWithOptionsFromCommandLine(String appSourceInputAddress, String appSettings, String pauseAppKeysString, Boolean onlineSession, String keyToStartOnlineSession, String sessionLengthLimitArgumentString, RunSimulation simulation, Nullable`1 detailedSessionRecording) in D:\a\dev-of-botengine\dev-of-botengine\implement\client\windows-console\BotEngine.Windows.Console\Program.cs:line 690
[2020-10-15T02-59-34] v2020-08-24 Session ended.
1 Like

Such a feature would need a change in a different place. I assume I would start like this:

I understand from reading the error message: Something accesses a file written by the engine, and this access prevents the engine from cleaning up that file.

This file is only needed for a short amount of time. The engine is programmed to delete it automatically to free the storage space. It looks like you have some other process running that wants to access this new file.

I will change the engine program to avoid this problem. We can let the engine continue in case your system blocks the deletion of the file. It is just an edge case that we did not test so far.

Sorry not really good at this… trying my best :sob:

Change the type of the farmArmyPresetNamePattern from String to List String.

for this part I got this… Not sure if that’s correct

farmArmyPresetNamePattern : List String
farmArmyPresetNamePattern =
   ["SPEAR"]

Then I wasn’t to sure what to do here

Follow the messages from the compiler to find all the parts that use farmArmyPresetNamePattern and update these too.
It seems the filtering happens here

keep getting stuck :frowning:

run v2020-08-24 failed with exception: System.NotImplementedException: Failed for 1 attempts. Output file not found. Maybe the output from the Elm make process from the last attempt helps to find the cause:
Exit Code: 1
Standard Output:
Dependencies ready!
Detected problems in 1 module.
'
Standard Error:
'-- TYPE MISMATCH ------------------------------------------ src\BotEngineApp.elm

The (++) operator needs the same type of value on both sides:

1447|                 describeBranch ("Found no army presets matching the filter '" ++ farmPresetFilter ++ "'.")
                                                                                       ^^^^^^^^^^^^^^^^^^^^^^^^
I see a List on the left and a String on the right. Which should it be? Does the
string need [] around it to become a list?

-- TYPE MISMATCH ------------------------------------------ src\BotEngineApp.elm

This function cannot handle the argument sent through the (|>) pipe:

1442|                     |> List.filter (.name >> String.toLower >> String.contains (farmPresetFilter |> String.toLower))
                                                                                                          ^^^^^^^^^^^^^^
The argument is:

    List String

But (|>) is piping it to a function that expects:

    String

'
   at Kalmit.ProcessFromElm019Code.CompileElm(IImmutableDictionary`2 elmCodeFiles, IImmutableList`1 pathToFileWithElmEntryPoint, String outputFileName, String elmMakeCommandAppendix)
   at Kalmit.ProcessFromElm019Code.CompileElmToJavascript(IImmutableDictionary`2 elmCodeFiles, IImmutableList`1 pathToFileWithElmEntryPoint, String elmMakeCommandAppendix)
   at Kalmit.ProcessFromElm019Code.ProcessFromElmCodeFiles(IImmutableDictionary`2 elmCodeFiles, Nullable`1 overrideElmAppInterfaceConfig)
   at Kalmit.PersistentProcess.PersistentProcessWithHistoryOnFileFromElm019Code..ctor(IProcessStoreReader storeReader, IImmutableDictionary`2 elmAppFiles, Action`1 logger, Nullable`1 overrideElmAppInterfaceConfig)
   at BotEngine.Windows.Console.RunAppSession.Run(TreeComponent appCodeTree, Func`2 getFileFromHashSHA256, String appProcessRecordingDirectory, Action`1 logEntry, Action`1 addSessionLogEntry, String appSettings, String sessionCustomName, AppSourceStructure appSource, String keyToStartOnlineSession, IEnumerable`1 sessionLengthLimits, IImmutableList`1 pauseAppKeys, IImmutableList`1 statusDisplayAdditionLines, RunSimulation simulation) in D:\a\dev-of-botengine\dev-of-botengine\implement\client\windows-console\BotEngine.Windows.Console\RunAppSession.cs:line 55
   at BotEngine.Windows.Console.BotEngine.runAppWithOptionsFromCommandLine(String appSourceInputAddress, String appSettings, String pauseAppKeysString, Boolean onlineSession, String keyToStartOnlineSession, String sessionLengthLimitArgumentString, RunSimulation simulation, Nullable`1 detailedSessionRecording) in D:\a\dev-of-botengine\dev-of-botengine\implement\client\windows-console\BotEngine.Windows.Console\Program.cs:line 690

Yes, that is correct.

The TYPE MISMATCH errors that you found then showed where to adapt the program next.

In the case of the usage in the expression with describeBranch: Here the data only flows into the display of the status text. Here we just choose a mapping from the list of strings to a single string for display.

The other use is the one for actually deciding if a preset matches the filter.

Here is the complete change:

1 Like

Thank you that worked. You’re amazing and replies really fast! You have donation box anywhere, as I’d like to donate cause of how you’ve help a bunch.

Hey, it gives me a problem to start the bot. It says error because it can’t open chromium. Any fixes for this? I reinstalled the botengine and tried a new configuration but this doesnt seem to fix the problem.

What is the actual output that you get? A screenshot would work.
You can also go the default way of sharing an archive of your session: bots/guide/how-to-report-an-issue-with-a-bot-or-request-a-new-feature.md at main · Viir/bots · GitHub

Thank you for offering a donation. I have not yet found a way to set up such a donation box. It seems GitHub sponsors would be convenient, but they don’t seem to offer one-time donations at the moment.

Is there any change you can change the fact that a farm list needs to start with " farm" Now every one can know you’re using a bot if they are your coop. Which i rather dont have people know.

That sounds like a reasonable scenario to support. I adapted the bot to support this here: FrontendWeb.Main

You can change the pattern to look for with this new app setting:

+ `farm-army-preset-pattern`: Text for filtering the army presets to use for farm attacks. Army presets only pass the filter when their name contains this text.

Here is an example configuration, setting the pattern to ‘somethingelse’: FrontendWeb.Main

Hey, bot stopped working. Been getting this error, any idea?

I got an online session key. I ask the server to test this key. This might take a few seconds...

run v2020-08-24 failed with exception: System.AggregateException: One or more errors occurred. (A task was canceled.)
 ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at BotEngine.Windows.Console.BotEngine.TestOnlineSessionKey(String keyToTest) in D:\a\dev-of-botengine\dev-of-botengine\implement\client\windows-console\BotEngine.Windows.Console\Program.cs:line 791
   at BotEngine.Windows.Console.BotEngine.runAppWithOptionsFromCommandLine(String appSourceInputAddress, String appSettings, String pauseAppKeysString, Boolean onlineSession, String keyToStartOnlineSession, String sessionLengthLimitArgumentString, RunSimulation simulation, Nullable`1 detailedSessionRecording) in D:\a\dev-of-botengine\dev-of-botengine\implement\client\windows-console\BotEngine.Windows.Console\Program.cs:line 636
[2020-11-08T18-56-00] v2020-08-24 Session ended.

It looks like there is some problem with the backend server or the connectivity between server and clients.
I also cannot connect anymore to the reactor frontend here. I am rebooting the server to see if that helps.

Reboot completed. It is strange. I can see HTTP requests going through in the logs, but I do not see a response in the web browser.

Now I see there are responses in the web browsers, but they take a long time to arrive.

EDIT:
I spent more time investigating this. After recreating the docker container the server runs in, I now see the reactor working normally again.
Starting online sessions also works again.

1 Like

Same not able to get to the Reactor botengine webpage :frowning:

I spent more time investigating this. After recreating the docker container the server runs in, I now see the reactor working normally again.
Starting online sessions also works again.

1 Like

I can also verify it’s now working! Thanks for resolving it!

I would like to report that some times the bot attacks the same target with more than one village. I like the bot and it is working fine, but if there is any chance of improving the algorithm I think it would be a good idea. The whole infrastructure (web page, cmd and chrome page) are already perfectly done, i think improving the farming algorithm would be the icing on the cake. Thank you for everything!!

There is one more matter that worries me, is it possible to add some random task so that it looks like a player playing? I don’t know, maybe open sometimes some buildings in a random village or check timings for recruitments? Thank you for your time.
P.s. as the guy in the previous topics i would like to make a donation to your work, could you open a paypal profile?

I think this is normal as long as the attacks are from different farming cycles. It starts with the closest target each cycle.
If you want it never to attack the same village in the same session, you can add a memory of the attacked coordinates outside of the cycle’s memory scope.
You could move the field sentAttackByCoordinates out of the cycle state:

No problem, as long as you can identify your target element using javascript, you can also send a mouse click there.

Thank you, this is my paypal profile: Paypal_0@Viir.de