I am currently trying to understand the trigger logic behind the "defines.events.on_tick" event. I have the following code implemented in control.lua:
Code: Select all
update_ticks = {15, 30, 45, 60}
script.on_event(defines.events.on_tick, function(event)
update(event)
end)
function update(event)
for i=1,#update_ticks,1 do
if event.tick % update_ticks[i] == 0 then
game.print("updated at tick ".. event.tick)
end
end
end
Code: Select all
function update(event)
for i=1,#update_ticks,1 do
if event.tick % update_ticks[i] == 0 then
game.print("updated at tick ") -- I simply removed the reference to event.tick here
end
end
end
Thanks!