编译 .lua 到 .exe

我正在尝试编译我的脚本` loops= 100

function OnEvent(event, arg)

if keypress(0x61) then

x1, y1 = GetMousePosition()

end

if keypress(0x62) then
    i = 0

    while (i<loops) do
        if IsModifierPressed("lshift") then
        i = loops
        end
        ReleaseKey("lshift")

        if not IsModifierPressed("lshift") then

            i=i+1
        move1 = math.random(1300,1400)
        move2 = math.random(1300,1400)
        move3 = math.random(1300,1400)
        MoveMouseTo(x1,y1)
        Sleep(math.random(75,100))
        PressMouseButton(3)
        Sleep(math.random(75,100))
        ReleaseMouseButton(3)
        Sleep(math.random(75,100))
        x1 = x1+move1
        MoveMouseTo(x1,y1)
            Sleep(math.random(75,100))
        PressMouseButton(1)
        Sleep(math.random(75,100))
            ReleaseMouseButton(1)
            Sleep(math.random(75,100))
        if IsModifierPressed("lshift") then
        i = loops
        end
        ReleaseKey("lshift")

        MoveMouseTo(x1,y1)
        Sleep(math.random(75,100))
        PressMouseButton(3)
        Sleep(math.random(75,100))
        ReleaseMouseButton(3)
        Sleep(math.random(75,100))
        x1 = x1+move2
        MoveMouseTo(x1,y1)
            Sleep(math.random(75,100))
        PressMouseButton(1)
        Sleep(math.random(75,100))
            ReleaseMouseButton(1)
            Sleep(math.random(75,100))
        if IsModifierPressed("lshift") then
        i = loops
        end
        ReleaseKey("lshift")

        MoveMouseTo(x1,y1)
        Sleep(math.random(75,100))
        PressMouseButton(3)
        Sleep(math.random(75,100))
        ReleaseMouseButton(3)
        Sleep(math.random(75,100))
        x1 = x1+move3
        MoveMouseTo(x1,y1)
            Sleep(math.random(75,100))
        PressMouseButton(1)
        Sleep(math.random(75,100))
            ReleaseMouseButton(1)
            Sleep(math.random(75,100))
        if IsModifierPressed("lshift") then
        i = loops
        end
        ReleaseKey("lshift")

        x1 = x1-move1-move2-move3
    end
end
        MoveMouseTo(x1,y1)
        Sleep(math.random(50,75))
        PressMouseButton(3)
        Sleep(math.random(50,75))
        ReleaseMouseButton(3)
        Sleep(math.random(50,75))
        x1 = x1+move1
        MoveMouseTo(x1,y1)
        Sleep(math.random(50,75))
        PressMouseButton(1)
        Sleep(math.random(50,75))
        ReleaseMouseButton(1)
        x1 = x1-move1

end end` 使用 Free Pascal 编译器将其转换为 .exe。每次我运行编译器都会出现错误 (1,6) Fatal: Syntax error, "BEGIN" expected but "identifier LOOPS" found Fatal: Compilation aborted。我对编程相当新手,想知道问题出在哪里。

点赞
用户1442917
用户1442917

似乎你在试图使用自由的Pascal编译器编译Lua脚本,这可能行不通。你可以查看这个 SO问题,获取有关如何将Lua脚本编译为可执行文件的信息。

2016-05-17 20:20:22