Wahyu Bram
Wahyu Bram

Reputation: 1

Sikuli to Lua script error, but got no error message at all

I'm new in Lua Script. Need Your Help. I already scripting in sikuli and it's works. I use it for automated play Clash of Clans in Bluestack.

Because I plan to play Automated Clash of Clans in Bluestack without using Sikuli and hope it can work in minimize mode or backgroud mode, while in front layer I work something, e.g. work my paper with msword.

So, I learn that I can use AnkuLua to make that happens. Then I install AnkuLua in Bluestack and write the script in windows by LuaEdit 2010 app. then I load the script by AnkuLua.

The Problem is, show an error without any message. like this:

The Error Pic

I don't know where is my fault. Please Help me. I really appreciate for your help.

The code that i write in sikuli it show below:

The SIKULI Script

def elexir():
    if exists(Pattern("elexir.png").similar(0.65)):
        click(Pattern("elexir.png").similar(0.65))
        wait(0.5)   

def coin():
    if exists("coin.png"):
        click("coin.png")
        wait(0.5)

while True:
    elexir()
    elexir()
    elexir()
    eleixir()
    elexir()
    coin()
    coin()
    coin()
    coin()
    coin()

just that.... it's work perfectly with Sikuli.

now, i'm try to do it in Lua with some adjustment.

The Lua Script that I made is:

function Elexir()
    if exists(pattern("elexir.png")) then
        click(pattern("elexir.png"))
        wait(0.5)
    end
end

function Coin()
    if exists(pattern("coin.png")) then
        click(pattern("coin.png"))
        wait(0.5)
    end
end


while True do
    Elexir()
    Elexir()
    Elexir()
    Elexir()
    Coin()
    Coin()
    Coin()
    Coin()
end

Is i have a wrong perception in Lua Programming Language?

Before asking, I already change my script several times, and before the last script, there always a warning / message where the error source come from. after fixing and fixing, I got test it by "Debug>Check Syntax" menu and "Debug>Start Debugging" menu, and no report that my script is error. seems work. but when I copy it to Bluestack. the error appear.

Any advice will appreciated.

Upvotes: 0

Views: 416

Answers (1)

CHlM3RA
CHlM3RA

Reputation: 133

Lua is case-sensitive try changing

while True do

to

while true do

otherwise it's not executing the loop because True is false and just exiting the script.

Upvotes: 1

Related Questions