Post by bielsantoro on Nov 29, 2019 4:19:53 GMT
Hello guys, since I started I made a lot of progression but I don't think it's enough that's why I'm making this post. As u can see in the video the code is working properly but when it's about making decision about moons it's taking a lot of time. I thought many ways to make it faster but it was effortless.
The logic:
There are 6 grades: 1*, 2*, 3*, 4*, 5*, 6*
Respectively the max levels are: 15, 20, 25, 30, 35, 40
Users will be able to set how many moons of witch grade they want to be selected. (In this example I set one for witch grade, just to test)
It should not select more than 3 monsters, the other slot should be used with a stronger monster.
What the bot should do is to scan a region match the condition (i.e if it's a 2* moon not level 20 it should select)
The code:
Video:
The logic:
There are 6 grades: 1*, 2*, 3*, 4*, 5*, 6*
Respectively the max levels are: 15, 20, 25, 30, 35, 40
Users will be able to set how many moons of witch grade they want to be selected. (In this example I set one for witch grade, just to test)
It should not select more than 3 monsters, the other slot should be used with a stronger monster.
What the bot should do is to scan a region match the condition (i.e if it's a 2* moon not level 20 it should select)
The code:
while contmonst <= 2 and contsq <= 6 do -- primeira pagina
reg1:highlight(2)
if reg1:exists("sixstar.png") and d6 ~= 0 then
if reg1:exists("lvl40.png") then
print("Chegou ao fim")
stopMusic()
else
click(reg1:getCenter())
reg1 = reg1:offset(-81, 0)
contmonst = contmonst + 1;
contsq = contsq + 1;
d6 = d6 - 1;
end
elseif reg1:exists("fivestar.png") and d5 ~= 0 then
if reg1:exists("lvl35.png") then
reg1 = reg1:offset(-81, 0)
contsq = contsq + 1
else
click(reg1:getCenter())
reg1 = reg1:offset(-81, 0)
contmonst = contmonst + 1;
contsq = contsq + 1;
d5 = d5 - 1;
end
elseif reg1:exists("fourstar.png") and d4 ~= 0 then
if reg1:exists("lvl30.png") then
reg1 = reg1:offset(-81, 0)
contsq = contsq + 1
else
click(reg1:getCenter())
reg1 = reg1:offset(-81, 0)
contmonst = contmonst + 1;
contsq = contsq + 1;
d4 = d4 - 1;
end
elseif reg1:exists("threestar.png") and d3 ~= 0 then
if reg1:exists("lvl25.png") then
reg1 = reg1:offset(-81, 0)
contsq = contsq + 1;
else
click(reg1:getCenter())
reg1 = reg1:offset(-81, 0)
contmonst = contmonst + 1;
contsq = contsq + 1;
d3 = d3 - 1;
end
elseif reg1:exists("twostar.png") and d2 ~= 0 then
if reg1:exists("lvl20.png") then
reg1 = reg1:offset(-81, 0)
contsq = contsq + 1;
else
click(reg1:getCenter())
reg1 = reg1:offset(-81, 0)
contmonst = contmonst + 1;
contsq = contsq + 1;
d2 = d2 - 1;
end
elseif reg1:exists("onestar.png") and d1~= 0 then
if reg1:exists("lvl15.png") then
reg1 = reg1:offset(-81, 0)
contsq = contsq + 1
else
click(reg1:getCenter())
reg1 = reg1:offset(-81, 0)
contmonst = contmonst + 1;
contsq = contsq + 1;
d1 = d1 - 1;
end
else
reg1 = reg1:offset(-81, 0)
contsq = contsq + 1
end
end
Video: