How to use menucheck method in pyatom

Best Python code snippet using pyatom_python

Tester.py

Source:Tester.py Github

copy

Full Screen

1import pyautogui2import time3import re4import sys5import os6import easyocr7import pytesseract8class Tester:9 # Variables10 rotationsAfterBoss = 011 pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'12 # Initializing Object13 def __init__(self):14 self.reader = easyocr.Reader(['en'])15 self.temp = "123"16 # Major object functions17 def testClick(self, points):18 cordX = points["x"]19 cordY = points["y"]20 pyautogui.moveTo(point["x"], point["y"])21 pyautogui.click(cordX, cordY)22 def performTestMap(self, actor):23 # actor.processMissionMap()24 # actor.mission_start.sortMissions()25 '''26 data = actor.game_bot.db.data27 print(data)28 options = data["server_1"]["map_progress"]["missions"]["items"]29 sorted_options = sorted(30 options.items(), key=lambda option: option[1]["slot"])31 print(sorted_options)32 '''33 # img = actor.mission_start.mission_images["mission_time_region"]34 # time = actor.game_bot.screenshot_helper.getScreenshotTime(img)35 # print(time)36 # actor.mission_claim.processMissionClaim()37 # actor.mission_start.processMissionMap()38 def performTestMultipleRewards(self, actor):39 print("Testing")40 actor.startMultipleRewardsDuties()41 def performTestFirestone(self, actor):42 pyautogui.click(400,400)43 time.sleep(0.4)44 actor.firestone2.runFirestoneCheck()45 '''46 print("Testing")47 actor.game_bot.db.refreshData()48 db = actor.game_bot.db49 instructions = actor.game_bot.queue_processor.verifyQueueLibrary(db)50 '''51 #actor.startLibraryDuties()52 def runIdleLoop(self, actors, base_path = None):53 self.base_path = base_path54 game_bot = actors["Guild"].game_bot55 actors["Library"].firestone2.menuCheck = self.menuCheck56 actors["Guild"].guild2.menuCheck = self.menuCheck57 actors["Map"].map2.menuCheck = self.menuCheck58 actors["MagicQuarter"].magicquarter2.menuCheck = self.menuCheck59 actors["Library"].alchemy.menuCheck = self.menuCheck60 61 while True:62 game_bot.click({"x":400, "y":400})63 print("Running Loop in 5 seconds ")64 time.sleep(5)65 self.runCampaignLoop(actors["Map"])66 print("campaigns done")67 self.runFirestoneLoop(actors["Library"])68 print("firestone done")69 self.runAlchemyLoop(actors["Library"])70 print("alchemy done")71 self.runExpeditionLoop(actors["Guild"])72 print("expedition done")73 self.runMapLoop(actors["Map"])74 print("missions done")75 #self.runCampaignLoop(actors["Map"])76 #print("campaigns done")77 self.runMagicQuarterLoop(actors["MagicQuarter"])78 print("magic quarter done")79 print("sleeping for 3 minutes")80 time.sleep(150)81 print("sleeping for 30 seconds")82 time.sleep(25)83 def closeMenu(self, bot):84 close_button_active = [(255, 77, 5), (255, 88, 16)]85 print("in close menu")86 time.sleep(1)87 print(bot.get_pixel_color(1840,80))88 while bot.get_pixel_color(1840,80) in close_button_active:89 print("I was closed")90 bot.click({"x": 1840, "y": 50})91 time.sleep(1)92 def runFirestoneLoop(self, actor):93 actor.game_bot.click({"x":400, "y":400})94 time.sleep(0.4)95 actor.firestone2.runFirestoneCheck()96 self.closeMenu(actor.game_bot)97 def runAlchemyLoop(self, actor):98 actor.game_bot.click({"x":400, "y":400})99 time.sleep(0.4)100 actor.alchemy.runAlchemyCheck()101 self.closeMenu(actor.game_bot)102 def runExpeditionLoop(self, actor):103 actor.game_bot.click({"x":400, "y":400})104 time.sleep(0.4)105 actor.guild2.runExpeditionCheck()106 self.closeMenu(actor.game_bot)107 """108 pyautogui.click(400,400)109 print("Running Loop in 5 seconds ")110 time.sleep(5)111 pyautogui.click(400,400)112 print("sleeping for 3 minutes")113 pyautogui.click(1840,50)114 time.sleep(175)115 """116 def runMapLoop(self, actor):117 actor.game_bot.click({"x":400, "y":400})118 time.sleep(0.4)119 actor.map2.runMapCheck(self.base_path)120 self.closeMenu(actor.game_bot)121 def runCampaignLoop(self, actor):122 actor.game_bot.click({"x":400, "y":400})123 time.sleep(0.4)124 actor.map2.runCampaignCheck()125 self.closeMenu(actor.game_bot)126 def runMagicQuarterLoop(self, actor):127 actor.game_bot.click({"x":400, "y":400})128 time.sleep(0.4)129 actor.magicquarter2.runMagicQuarterCheck()130 self.closeMenu(actor.game_bot)131 def menuCheck(self, name, bot):132 names = {133 "Map": {134 "position": {"x":620, "y":40},135 "active": [(74, 211, 74), (99, 226, 96)]136 },137 "Campaign": {138 "position": {"x":485, "y":40},139 "active": [(74, 211, 74), (99, 226, 96)]140 },141 "Guild": {142 "position": {"x":1020, "y":990},143 "active": [(19, 138, 255), (96, 228, 253)]144 },145 "MagicQuarter": {146 "position": {"x":560, "y":880},147 "active": [(118, 44, 44)]148 },149 "Firestone": {150 "position": {"x":110, "y":40},151 "active": [(88, 129, 187)]152 },153 "Town": {154 # Need to update155 "position": {"x":1020, "y":990},156 "active": [(19, 138, 255), (96, 228, 253)]157 }, 158 }159 time.sleep(1)160 if bot.get_pixel_color(names[name]["position"]["x"], names[name]["position"]["y"]) in names[name]["active"]:161 return True162 else:163 return False164 def performTestGuild(self, actor):165 actor.startDuties()166 def performTestCampaign(self, actor):167 actor.startDuties()168 def performTestMagicQuarter(self, actor):169 actor.startDuties()170 def performTestMultipleRewards(self, actor):171 actor.startDuties()172 def performTestSingleReward(self, actor):173 actor.startDuties()174 def performTestServerSwap(self, actor):175 actor.startDuties()176 def performActorTest(self, actor):177 actor.startDuties()178 def performTestExpeditions(self, actor):179 area = {'region': (1030, 140, 150, 40), 'image': 'C:\\Users\\nickk\\Dropbox\\Portfolio\\Game Bots\\Firestone\\data\\imgs\\guild\\expedition_renew.png',180 'type': 'guild-expedition-time', 'msg': 'Test data'}181 actor.game_bot.screenshot_helper.getScreenshotTimeNoScreenshot(area)182 def performTest2(self, temp):183 #string = pytesseract.image_to_string(temp)184 reader = easyocr.Reader(['en'], gpu=False)185 string = reader.readtext(temp)186 print(string[0][1])187 def performTest3(self, actor):188 #string = pytesseract.image_to_string(temp)189 actor.getMagicTrainTime()190 def replace_chars(self, text):191 """192 Replaces all characters instead of numbers from 'text'.193 :param text: Text string to be filtered194 :return: Resulting number195 """196 list_of_numbers = re.findall(r'\d+', text)197 result_number = ''.join(list_of_numbers)...

Full Screen

Full Screen

init.py

Source:init.py Github

copy

Full Screen

1import sys,game2introText = r"""______ _ _____ _ ______ _ _ _ _ 3| ___ \ | | |_ _| | | ___ \ | | | | | | | | 4| |_/ / ___ _ _ ___ _ __ __| | | | | |__ ___ | |_/ / __ _| |_| |_| | ___ _ __ ___ ___ _ __ | |_ ___ 5| ___ \/ _ \ | | |/ _ \| '_ \ / _` | | | | '_ \ / _ \ | ___ \/ _` | __| __| |/ _ \ '_ ` _ \ / _ \ '_ \| __/ __|6| |_/ / __/ |_| | (_) | | | | (_| | | | | | | | __/ | |_/ / (_| | |_| |_| | __/ | | | | | __/ | | | |_\__ \7\____/ \___|\__, |\___/|_| |_|\__,_| \_/ |_| |_|\___| \____/ \__,_|\__|\__|_|\___|_| |_| |_|\___|_| |_|\__|___/8 __/ | 9 |___/ """10print(introText)11spacer = "\n"12print(spacer)13print("""Welcome to Beyond The Battlements14a Text Based Adventure Game created by Jokrr15I hope you enjoy playing this game""")16print(spacer)17menu = input("""Please select an option181: Start Game192: About203: Quit 21""")22#System Functions23def closeCheck():24 closecheck = input("This will close the program do you want to continue?(y/n)").lower()25 if closecheck == "y":26 closeprogram()27 elif closecheck == "n":28 print("Returning to Main Menu")29 menuCheck()30 else:31 print("""Input not recognized32 Reloading...""")33 closeCheck()34def closeprogram():35 print("Closing Program...")36 sys.exit()37#Menu option check38def gameLoad():39 print("Starting game...")40 game.adventureStart()41def gameAbout():42 print("Loading Information...")43def menuCheck():44 try:45 if menu == "1":46 gameLoad()47 elif menu == "2":48 gameAbout()49 elif menu == "3":50 closeCheck()51 except ValueError:52 print("Value Error: You did not input a number")53 print("Reloading")54 menuCheck()55 except Exception as e:56 print("Unknown Error: ", e)57 print("Reloading")58 menuCheck()...

Full Screen

Full Screen

Temperature Converter.py

Source:Temperature Converter.py Github

copy

Full Screen

11#######2#3# Temperature Converter4# Author: Mose Butler5# Date: 10-26-186# Version: 1.0.07#8#######910# Setting Global Variables11CONVERSION_CONSTANT = 3212CELSIUS_CONVERSION = 5/913FAHRENHEIT_CONVERSION = 1.814done = False151617# Function converts fahrenheit to celsius18def fahrenheit_to_celsius(temperature):19 return (temperature - CONVERSION_CONSTANT) * CELSIUS_CONVERSION202122# Function converts celsius to fahrenheit23def celsius_to_fahrenheit(temperature):24 return temperature * FAHRENHEIT_CONVERSION + CONVERSION_CONSTANT252627# Quick explanation of program28print("This program converts temperature from fahrenheit to celsius or celsius to fahrenheit."29 "\nEnter a value from a menu to start the program.")3031# Asks user for command based on menu options. Runs until user is finished with program.32while not done:33 menuCheck = input("\n[1] Convert celsius to fahrenheit."34 "\n[2] Convert fahrenheit to celsius."35 "\n[3] Exit program."36 "\n\nEnter Command: ")3738 # Compares user input to expected inputs39 if menuCheck == '1': # if user input matches will run celsius to fahrenheit function and continue loop40 temperatureCelsius = float(input("Enter temperature in celsius: "))41 convertedTemp = celsius_to_fahrenheit(temperatureCelsius)42 print("%0.2fC converts to %0.2fF." % (temperatureCelsius, convertedTemp))4344 elif menuCheck == '2': # if user input matches will run fahrenheit to celsius function and continue loop45 temperatureFahrenheit = float(input("Enter temperature in fahrenheit: "))46 convertedTemp = fahrenheit_to_celsius(temperatureFahrenheit)47 print("%0.2fF converts to %0.2fC." % (temperatureFahrenheit, convertedTemp))4849 elif menuCheck == '3': # if user input matches will terminate program50 done = True5152 else: # if user input is not recognized, will print statement and ask again53 print("Entry not valid.")54 ...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pyatom automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful