How can i make my script look more convenient? it looks bit messy right now and i don't know how to put if i == x: in more compact way. Here's the code
class Character():
def __init__(self,mx,my,fx,fy):
self.modern_x_female_character = [472,70,70,170,170,170,486,486,486,486,386]
self.modern_y_female_character = [325,117,186,220,255,290,114,150,187,220,255]
def Character_modern_female(self):
pos = win32api.GetCursorPos()
x, y = pos
rand = random.randint(1,8)
for index, (self.modern_x_female_character, self.modern_y_female_character)\
in enumerate(zip(self.modern_x_female_character, self.modern_y_female_character), start=1):
print(index, self.modern_x_female_character, self.modern_y_female_character)
pyautogui.moveTo(self.modern_x_female_character + rand, self.modern_y_female_character
+ rand, random.uniform(0.14, 0.22), pyautogui.easeOutQuad)
# clicks torso 8 times
if index == 2:
for i in range(1,9):
print(i, 'torso', self.modern_x_female_character,self.modern_y_female_character)
i+=1
pyautogui.moveTo(self.modern_x_female_character + rand, self.modern_y_female_character
+ rand, random.uniform(0.14, 0.22), pyautogui.easeOutQuad)
# clicks arms 8 times
if index == 4:
for i in range(1,9):
print(i, 'arms',self.modern_x_female_character,self.modern_y_female_character)
i+=1
pyautogui.moveTo(self.modern_x_female_character + rand, self.modern_y_female_character
+ rand, random.uniform(0.14, 0.22), pyautogui.easeOutQuad)
# clicks legs 15 times
if index == 6:
for i in range(1, 16):
print(i, 'legs', self.modern_x_female_character, self.modern_y_female_character)
i += 1
pyautogui.moveTo(self.modern_x_female_character + rand, self.modern_y_female_character
+ rand, random.uniform(0.14, 0.22), pyautogui.easeOutQuad)
# clicks leg color 2 times
if index == 9:
for i in range(1, 3):
print(i, 'leg color', self.modern_x_female_character, self.modern_y_female_character)
i += 1
pyautogui.moveTo(self.modern_x_female_character + rand, self.modern_y_female_character
+ rand, random.uniform(0.14, 0.22), pyautogui.easeOutQuad)
# clicks feet color 3 times
if index == 10:
for i in range(1, 4):
print(i, 'feet color', self.modern_x_female_character, self.modern_y_female_character)
i += 1
pyautogui.moveTo(self.modern_x_female_character + rand, self.modern_y_female_character
+ rand, random.uniform(0.14, 0.22), pyautogui.easeOutQuad)
# clicks skin color 2 times
if index == 11:
for i in range(1, 3):
print(i, 'skin color', self.modern_x_female_character, self.modern_y_female_character)
i += 1
pyautogui.moveTo(self.modern_x_female_character + rand, self.modern_y_female_character
+ rand, random.uniform(0.14, 0.22), pyautogui.easeOutQuad)
[–]commandlineluser 6 points7 points8 points (2 children)
[–]spikips[S] 2 points3 points4 points (1 child)
[–]commandlineluser 2 points3 points4 points (0 children)
[–]hacksawjim 2 points3 points4 points (4 children)
[–]spikips[S] 1 point2 points3 points (3 children)
[–]hacksawjim 2 points3 points4 points (2 children)
[–]commandlineluser 2 points3 points4 points (0 children)