Post by xcq on Sept 3, 2017 19:17:00 GMT
The problem is with:
When I change it to:
It is working properly. Why cant I use `while not`?
Here is full code:
notEnoughCrystals = false
while not notEnoughCrystals do
When I change it to:
enoughCrystals = true
while enoughCrystals do
It is working properly. Why cant I use `while not`?
Here is full code:
Settings:setCompareDimension(true, 897)
Settings:setScriptDimension(true, 897)
notEnoughEnergy = false
notEnoughCrystals = false
function notEnoughEnergy()
return exists("notEnoughEnergy.png")
end
function refillEnergy()
existsClick("yes.png")
existsClick("rechargeEnergy.png")
existsClick("yesPurchase.png")
if exists("enough.png") then
notEnoughCrystals = true
toast("You have not enough crystals!")
return false
else
existsClick("okPurchase.png")
existsClick("close.png")
return true
end
end
function replyOnesBattle()
existsClick("replyOnesBattle.png")
if notEnoughEnergy() then
if refillEnergy() then
existsClick("replyOnesBattle.png")
else
return --couldnt refill energy because of no crystals
end
end
startBattle()
end
function startBattle()
existsClick("startBattle.png")
end
function waitForBattleEnd()
while true do
if exists("crystal.png") then
toast("koniec")
return
end
wait(1)
end
end
function obtainBattleRewards()
existsClick("crystal.png")
wait(1)
existsClick("crystal.png")
existsClick("ok.png")
end
function playOnesBattle()
startBattle()
waitForBattleEnd()
obtainBattleRewards()
end
function farm(replyBattle)
while not notEnoughCrystals do
playOnesBattle();
if replyBattle then
replyOnesBattle()
end
end
toast("End of farming")
end
function notEnoughCrystals()
end
-- ========== Main ================
farm(true)