Dec-18-2019, 01:38 PM
full code just for the heck of it
Traceback (most recent call last):
File "C:\Users\Owner\Documents\PythonScripts\AfkTool\afkToolv0_0_2.py", line 80, in <module>
t, d = get_time()
File "C:\Users\Owner\Documents\PythonScripts\AfkTool\afkToolv0_0_2.py", line 69, in get_time
if(err == True):
UnboundLocalError: local variable 'err' referenced before assignment
#afktool_v0.0.2 #include lib import multiprocessing import time as t from pynput.mouse import Button, Controller #init the mouse emulator mouse = Controller() #program info print print("please note this will repetedly click the mouse. anywhere you have the mouse will be clicked 1 time a second") print("afkTool version is in beta 0.0.2") print("this tool is made to afk farm on a exp. mob farm in minecraft") print("if you encounter an error that doesnt stop the program /n press cntl and c on this window and contact the devs") print("beta testers:") print("none yet. why is this here?") #global var def stopTread = False err = False #function to read user input for when running def main_u_input(): input("press any key to either abort or continue once completed") stopThread = True #main function def main_thread(tSet, delaySet=1): for i in range(0,tSet): iterationsLeft = tSet - int(i) print("time left in seconds {}. press ctrl+c on this window to quit".format(iterationsLeft)) mouse.click(Button.left,1) if(stopThread == True): print("aborting") break else: t.sleep(delaySet) #function to get user input on wheathe to continue def get_mode(): print("pick one of the following:") print("0 = quit") print("1 = run") m = input("please type the corresponding number and press enter>_") try: m = int(m) except ValueError: print("invalid input. try again") m = getMode() return m #function to get user input for time needs def get_time(): print("enter 1 for seconds") print("enter 2 for minutes") print("enter 3 for hours") timeTyp = input("please enter one of the coresponding numbers> ") timeLen = input("please enter how long you want to run> ") timeDel = input("please enter how long you want the delay between clicks in miliseconds or d for default> ") try: timeTyp = int(timeTyp) timeLen = int(timeLen) try: timeDel = float(timeDel*1000) except ValueError: if(timeDel.lower().strip(" ") == "d"): td = 1.0 else: err = True if(timeTyp == 1): tl = timeTyp elif(timeTyp == 2): tl = timeTyp * 60 elif(timeTyp == 3): tl = timeTyp * 3600 if(err == True): raise ValueError except ValueError: print("invalid input. try again") tl, td = get_time() return tl, td #main logic if(__name__ == "__main__"): while(True): mode = get_mode() if(mode == 1): t, d = get_time() p = multiprocessing.Process(target=main_thread, args=(t, d)) p.start() main_u_input() p.join() elif(mode == 0): break else: print("invalid input try again") continue quit()and the error output
Traceback (most recent call last):
File "C:\Users\Owner\Documents\PythonScripts\AfkTool\afkToolv0_0_2.py", line 80, in <module>
t, d = get_time()
File "C:\Users\Owner\Documents\PythonScripts\AfkTool\afkToolv0_0_2.py", line 69, in get_time
if(err == True):
UnboundLocalError: local variable 'err' referenced before assignment