So for all of you that like running the bot for a few hours at a time, it can be really hard to figure out what happened if the bot unexpectedly stops, your character dies, or you get disconnected. Im gonna show you how you can make a few small changes to make it much easier to see:
The exact time the bot performs each action
Counters for how many casts have been thrown and how many fish have been caught
Reduction in overall logging so that theres less clutter to go through if youre reviewing what the bot has done over the last few hours.
Youll have to be running the bot in a Python virtual environment, or make your own EXE if you wanna make these changes yourself. If you cant, maybe Siterizer will implement something like this at some point (but the poor man must be busy with all these suggestions, so cut him some slack :D).
First of all, and the easiest change you can make to make logging much better: Displaying the current time instead of [INFO].
For this, we have to go to logging_wrapper.py
Change the following line from:
format="[%(levelname)s] %(message)s",
to
format="[%(asctime)s] %(message)s",
Thats the time done!
Now lets do counters in fishing_actions.py:
At the very top, under all the imports, add the two new variables:
from win32api import mouse_event
from utils.config import dict, random_timeout
from time import sleep
from wrappers.win32api_wrapper import *
from wrappers.logging_wrapper import info, debug
import utils.global_variables as gv
import random
fish_counter=0
cast_counter=0
Make sure that you add 'info' to the import from loggingwrapper, like so:
from wrappers.logging_wrapper import info, debug
Now add two lines to the bottom of your fish_notice() function, dont forget the top line too, 'global fish_counter':
Now we only get one message each time the bot reels! If you want to see the bot print every time it detects a color however, you can change the logging level in config.yml to DEBUG.
Hope this helps you get a better overview of what the bot is doing. Theres much more you can do with this, but what I've shown here will make it look similar to the screenshot attached here.
Happy fishing!
So for all of you that like running the bot for a few hours at a time, it can be really hard to figure out what happened if the bot unexpectedly stops, your character dies, or you get disconnected. Im gonna show you how you can make a few small changes to make it much easier to see:
Youll have to be running the bot in a Python virtual environment, or make your own EXE if you wanna make these changes yourself. If you cant, maybe Siterizer will implement something like this at some point (but the poor man must be busy with all these suggestions, so cut him some slack :D).
First of all, and the easiest change you can make to make logging much better: Displaying the current time instead of [INFO].
For this, we have to go to logging_wrapper.py Change the following line from:
format="[%(levelname)s] %(message)s",
to
format="[%(asctime)s] %(message)s",
Thats the time done!
Now lets do counters in fishing_actions.py:
At the very top, under all the imports, add the two new variables:
Make sure that you add 'info' to the import from loggingwrapper, like so:
from wrappers.logging_wrapper import info, debug
Now add two lines to the bottom of your fish_notice() function, dont forget the top line too, 'global fish_counter':
And at the very start of our cast() function:
Inside fishing_loop.py, change the following from 'info' to 'debug'
info("Cast fishing rod")
todebug("Cast fishing rod")
This hides the default cast message, since we just made our own! You can also delete it entirely, if you dont want it to show in debug.
And thats all for our counters!
Now lets clean up the logging a little bit, and make it more simplistic.
In fishing_actions.py, you want to change 'info' to 'debug' on the following lines:
45:
debug("Green color spotted, Reeling a fish")
53:
debug("Orange color spotted, Pause fishing")
57:
debug("Red color spotted, Pause fishing")
No more spammy reeling messages! However, now the bot prints nothing when its reeling.
So lets make it print "Reeling a fish", but only once each time it reels!
At the very bottom of global_variables.py, add the following:
hasReel=False
In fishing_loop.py, add our new boolean to the 1st result_from_model function:
In fishing_loop.py, also add our new boolean to the 5th result_from_model function, this time setting it to false:
Now inside fishing_actions.py, add the following import at the top:
import utils.global_variables as gv
Inside fishing_actions.py, we want our reel function to look like this:
Now we only get one message each time the bot reels! If you want to see the bot print every time it detects a color however, you can change the logging level in config.yml to DEBUG.
Hope this helps you get a better overview of what the bot is doing. Theres much more you can do with this, but what I've shown here will make it look similar to the screenshot attached here. Happy fishing!