So I finally updated to update 181002 to learn the new way to access grid keys, and stumbled over this:
According to study 4 “physical” this is how to make use of grid key presses:
g.event = function(x,y,z)
But according to the new version of “awake” in update 181002, this is how to make use of grid key presses:
function g.event(x, y, z)
Both seem to work. Is there any difference between the 2, or can both be used interchangably? From my real bloody novice user experience, this format
function g.event(x, y, z)
blends in better with how functions have been introduced & used in previous studies.
On a slightly related note, there seems to be a bug in study 4 “physical” in the code for the “complete step sequencer”. When I enter the code as described…
engine.name = 'PolyPerc'
steps = {}
position = 1
counter = metro.alloc()
counter.time = 0.1
counter.count = -1
counter.callback = count
function init()
for i=1,16 do
table.insert(steps,1)
end
grid_redraw()
counter:start()
end
g = grid.connect()
g.event = function(x,y,z)
if z == 1 then
steps[x] = y
grid_redraw()
end
end
function grid_redraw()
g.all(0)
for i=1,16 do
g.led(i,steps[i],i==position and 15 or 4)
end
g.refresh()
end
function count()
position = (position % 16) + 1
engine.hz(steps[position]*100)
grid_redraw()
end
…nothing happens, i.e. the sequencer does not run.
After experimenting I found that
counter.callback = count
needs to be inside
function init()
in order to make the sequencer run.
Is there a way to explain to a novice user why only this counter.callback needs to be in the function init(), but not the other counter.xxx expressions?
Thanks much in advance!