PokemonGo-Bot icon indicating copy to clipboard operation
PokemonGo-Bot copied to clipboard

FollowPath deletes previous line in console log

Open crvfts opened this issue 8 years ago • 5 comments

I know it's been a long time since follow_path has been updated but I gave it a shot today. It actually worked just fine functionally except for one thing: every time the walker wanted to update in console (just like MoveToFort does) it would actually delete the previous line, working its way up the logs deleting each one as it went along.

I tried to fix it but unfortunately I'm not great with python.

Is there any wild chance anyone could take a look at that or offer a quick fix so it doesn't erase previous logs in console?

crvfts avatar Apr 16 '17 03:04 crvfts

setting "walker_limit_output": false, stopped the erasing of the previous console log.

still can't figure out why that has such an odd result... shouldn't it print just like MoveToFort would?

crvfts avatar Apr 16 '17 06:04 crvfts

Hmmm, just looking at the code; "walker_limit_output" effectively causes Eventmanager to limit the output of 3 events; "move_to_fort", "moving_to_lured_fort" and "position_update" Look at the code under pokemongo_bot/eventmanager.py at line 58

Now I don't know why it would do as you describe. Do you have your code up somewhere? Maybe if I or others comb through your code we may explain why it does this

Thanks for looking into making the bot better 😄

davidakachaos avatar Apr 17 '17 20:04 davidakachaos

I ran with a fresh clone of master and received the same issue.

Could the error occur due to follow_path.py's emit event is not within an 'if' statement?

line 186

self.emit_event(
            'position_update',
            formatted="Walking from {last_position} to {current_position}, distance left: ({distance} {distance_unit})",
            data={
                'last_position': (last_lat, last_lng),
                'current_position': point["name"],
                'distance': format_dist(dist,self.distance_unit,self.append_unit),
                'distance_unit': self.distance_unit
            }
        )

crvfts avatar Apr 18 '17 18:04 crvfts

I notice in move_to_fort that emit events are within a condition but in follow_path the emit event for walking is not part of an 'if' statement. Please also accept my apologies- I am not very familiar with python nomenclature.

With my limited understanding it appears move_to_fort.py defines what "moving" is but follow_path.py does not.

crvfts avatar Apr 18 '17 18:04 crvfts

The part

moving = noised_dist > Constants.MAX_DISTANCE_FORT_IS_REACHABLE if self.bot.config.replicate_gps_xy_noise else dist > Constants.MAX_DISTANCE_FORT_IS_REACHABLE
        if moving:

Determines if we can move to the Pokestop (fort), if it's too far away, the bot doesn't move toward it.

Now the second if statement;

if self.is_attracted() > 0:

This checks if we are moving toward a lured Pokestop. So this isn't really related to each other. Remember, MoveToFort is created to move to Pokestops in range, while FollowPath is created to read a route defined in JSON or GPX and follow that path. I have never used follow_path myself, maybe one of the others knows something better.. @pogarek @MerlionRock any ideas?

davidakachaos avatar Apr 21 '17 08:04 davidakachaos