Log In  
Follow
Musikid
[ :: Read More :: ]
function _init()
    chosen = 1
    mode = "menu"
    level = 1
    selx = 64
    sely = 64
    sinceshot = 0
    shotx = 64
    shoty = 64
    cls()
end

function _update()

    cls()
    if mode=="menu" then
        if chosen==16 then
            print("no-scope mode?! 16 ⬆️/⬇️/🅾️", 1, 1, 11)
            print("(x, y) will be provided instead", 1, 10, 7)
            print("warning: extremely difficult!", 1, 19, 8)
        else
            if chosen>10 then
                print("novelty crosshair " .. tostr(chosen) .. " ⬆️/⬇️/🅾️", 1, 1, 10)
            else
                print("crosshair " .. tostr(chosen) .. " ⬆️/⬇️/🅾️", 1, 1, 6)
            end 
        end
        spr((chosen - 1), 60, 60)

        if btnp(🅾️) then mode = "game" end
        if btnp(⬆️) then chosen += 1 end
        if btnp(⬇️) then chosen -= 1 end
        if chosen>16 then chosen = 16 end
        if chosen<1 then chosen = 1 end
    else if mode=="game" then

        rectfill(o, o, 128, 128, 12)

        spr(chosen-1, selx, sely)

        if sinceshot == 0 then
            spr(64, shotx, shoty, 2, 2)
        else if sinceshot == 1 then
            spr(66, shotx, shoty, 2, 2)
        else if sinceshot == 2 then
            spr(68, shotx, shoty, 2, 2)
        else if sinceshot == 3 then
            spr(70, shotx, shoty, 2, 2)
        else if sinceshot == 4 then
            spr(72, shotx, shoty, 2, 2)
        else if sinceshot == 5 then
            spr(74, shotx, shoty, 2, 2)
        end

        if btn(⬆️) then sely -= 1 end
        if btn(⬇️) then sely += 1 end
        if btn(➡️) then selx += 1 end
        if btn(⬅️) then selx -= 1 end
        if (btn(❎) and sinceshot>5) then
         sinceshot=0
         shotx = selx
         shoty = sely
        else sinceshot += 1 end

    end
    end
end

Hi! When I try to run this code, I get errors saying I didn't close IF statements that I did close...

(namely line 41)

P#128976 2023-04-24 22:34

[ :: Read More :: ]
function _init()
    chosen = 1
    cls()
end

function _update()

    cls()
    if chosen==16 then
        print("no-scope mode activated! 🅾️", 12, 1, 11)
    else
        if chosen>9 then
            print("novelty crosshair " .. tostr(chosen) .. " ⬆️/⬇️/🅾️", 1, 1, 10)
        else
            print("crosshair " .. tostr(chosen) .. " ⬆️/⬇️/🅾️", 1, 1, 6)
        end 
    end
    spr((chosen - 1), 60, 60)

    if btnp(⬆️) then chosen += 1 end
    if btnp(⬇️) then chosen -= 1 end
    if chosen>16 then chosen = 16 end
    if chosen<1 then chosen = 1 end

    end
end

With this code, I'm receiving an error at line 23:

SYNTAX ERROR LINE 23 (TAB 0)
 IF CHOSEN<1 THEN CHOSEN = 1 END
<EOF> EXPECTED NEAR END

Isn't the END the EOF?

Note: Edited due to a misspelling. Original:

SYNTAX ERROR LINE 23 (TAB 0)
 IF CHOSEN<1 THEN CHOSEN = 1 END
<EOF> EXPECTED NEAR END
P#128938 2023-04-23 22:28 ( Edited 2023-04-23 22:50)