You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wrote a python script to automate Pokemon BDSP Shiny Egg Farming. It works by using the Python API points create_controller() and press_buttons(). But the script messes up at random times because NXBT skips an input or adds an input.
I'm running:
Ubuntu 24.04.1 LTS
Python 3.11.11
I also use time.sleep() to slow down the inputs to lower the chance of inputs failing. I have custom functions for a single key press, multiple presses, and hold down the key.
Here's an example:
def Key_Press_Multi(key, numPresses):
for i in range(numPresses):
nx.press_buttons(controller_index, key, down=0.1)
time.sleep(0.7)
Function using the custom functions
def Move_To_Man_From_PokeCenter():
global current_egg_count
print("-- Walking to the Daycare man --")
# ---- WALK TO THE DAYCARE MAN ----
# Left 6 Steps
Key_Press_Multi(DPAD_LEFT, 6)
# Move Up 10 Steps
Key_Press_Multi(DPAD_UP, 10)
# Left 7 Steps
Key_Press_Multi(DPAD_LEFT, 7)
# ---- DIALOGUE SECTION ----
print("-- Getting a new egg --")
time.sleep(1)
Key_Press_Multi(A, 8)
time.sleep(4)
Key_Press_Multi(A, 2)
time.sleep(6)
Key_Press_Multi(B, 2)
time.sleep(4)
Key_Press_Once(B)
time.sleep(2.2)
current_egg_count += 1
# ---- FROM DAYCARE MAN TO BIKE LANE ----
print("-- Walking from Daycare man to biking lane --")
# Move Right 6 Steps
Key_Press_Multi(DPAD_UP, 3)
Key_Press_Multi(DPAD_RIGHT, 7)
time.sleep(0.5)
# READY TO BIKE UP AND DOWN
Key_Press_Once(SELECT)
time.sleep(0.3)
Key_Press_Once(DPAD_UP)
print("In Position - Ready to Bike")
What will often happen is if an input does mess up, they will walk one more step, or one less step. And that will ruin the afk script.
Is there any solution to this?
The text was updated successfully, but these errors were encountered:
Hey did you ever work out this issue? I am having similar issues where inputs are missed even after giving large enough delays (from 0.5s to multiple s) I believe the time.sleep causes some issues as I tried adding it to some functions but it caused an issue nearly immediately adding a input so I try putting al delays into the MACRO = """macro""" which I found helped, I also removed all loops but un sure if that helps or not, did notice less mess ups afterwards.
I wrote a python script to automate Pokemon BDSP Shiny Egg Farming. It works by using the Python API points create_controller() and press_buttons(). But the script messes up at random times because NXBT skips an input or adds an input.
I'm running:
Ubuntu 24.04.1 LTS
Python 3.11.11
I also use time.sleep() to slow down the inputs to lower the chance of inputs failing. I have custom functions for a single key press, multiple presses, and hold down the key.
Here's an example:
Function using the custom functions
What will often happen is if an input does mess up, they will walk one more step, or one less step. And that will ruin the afk script.
Is there any solution to this?
The text was updated successfully, but these errors were encountered: