mathiasvatter / cksp-compiler-issues

Issues-only repository of the ksp-compiler
0 stars 0 forks source link

Local arrays do not work #5

Closed mathiasvatter closed 2 months ago

mathiasvatter commented 7 months ago

Describe the bug declaring local arrays throws CompileError

To Reproduce

on listener
    get.noteRange()
end on

function get.noteRange()
    declare local has_note[128] := (0)
    declare local id
    declare local zone_id
    for i := 0 to 127
        set_key_color(i, KEY_COLOR_INACTIVE)
        id := play_note(i,2,0,-1)
        change_vol(id, -2000000,0)
        set_event_par_arr(id, EVENT_PAR_ALLOW_GROUP, 0, ALL_GROUPS)
        set_event_par_arr(id, EVENT_PAR_ALLOW_GROUP, 1, 0)
        wait(1)
        zone_id := get_event_par(id, EVENT_PAR_ZONE_ID)
        if zone_id # 0
            set_key_color(i, KEY_COLOR_DEFAULT)
            has_note[i] := 1
        end if

        if i-1 >= 0
            if has_note[i]-has_note[i-1] = -1
                range[1] := i-1
            end if
        end if
    end for
    range[0] := search(has_note, 1)

end function

on init

    declare note_id[128], note, range[2] := 10
end on

CKSP Version v0.0.2

Environment (please complete the following information): all

mathiasvatter commented 2 months ago

fixed in v0.0.6