1

I am creating, or at least trying, a mobile game farmer bot using SikuliX IDE, but I am a novice on Python, my primary language is Java, and have no idea how to properly work with the logic of the game using Python.

The game logic is:
there are 4 spaces to put one monster
if you put rank1 of monster1 on space1, you can't put rank2 of the same monster on any other space
the game detects you select a monster if you hold the monster portrait for 2 seconds, then drag and drop to space
after monster reach level max, the autorun is stopped and the message screen "levelMax" appears
if I run out of runs, autorun is stopped, the message screen "runsZero" appears and bot stops

process of bot:
first run is the trigger to start the bot
after "levelMax" appears, it goes the process to replace all monsters level max to level 1 monsters and the cycle begins again, until all runs are out or there are no 4 monsters level 1.

ps:I'll post debug messages on edit, I forget to write down them
ps2: it's possible you guys detect the game based on the logic

Edit: [error] Error caused by: Traceback (most recent call last): File "C:\SikuliX\dragAndDrop.sikuli\dragAndDrop.py", line 40, in monstroUm = monster[monstroInt] IndexError: index out of range: 2

monster1 = ["rank1.png","rank2.png"]
monster2 = ["rank1.png","rank2.png"]
monster3 = ["rank1.png","rank2.png"]
monster4 = ["rank1.png","rank2.png"]
monstersArray = [monster1, monster2, monster3, monster4]
levelMax = "1524942610020.png"
close = "1524942624936.png"
manage = "1524942638721.png"
okButton = "1524943405776.png"
start = "1524943415429.png"
yesButton = "1524943424798.png"
runsZero = "runsZero.png"
closeChat = "closeChat.png"
arrowLeft = "arrowLeft.png"

nox = App.focus("NoxPlayer 6.0.8.0")
localizacoes = [Location(355, 324),Location(357, 506),Location(356, 679),Location(357, 855)]
Settings.DelayBeforeDrag = 2.5
Settings.DelayBeforeDrop = 2.5
running = True
while (nox.hasWindow() and running):
   localiza = 0
   monstersArrayInt = 0
   monstersSelect = monsters
   while localiza <= len(localizacoes):
       while monstersArrayInt <= len(monstersSelect):
            monster = monstersSelect[monstersArrayInt]
            monstroInt = 0
            while monstroInt <= len(monster):
                monstroUm = monster[monstroInt]
                if monsterWindow.exists(monstroUm,3):
                    noxWindow.dragDrop(monstroUm,localiza)
                    del monstersSelec[monstersArrayInt]
                    localiza += 1
                    break
                elif monstroInt == len(monstersSelect):
                    monstersArrayInt += 1
                    break
                else: #exists(monstroUm) == False:
                    monstroInt += 1
                    wheel(monsterWindow,WHEEL_DOWN, 2)
MusashiBR
  • 11
  • 3

0 Answers0