For example:
Code: Select all
player.print("Hello, world!")
Code: Select all
player.print("Hello, world!")
Something like this:WIZ4 wrote:What should I prescribe in the scenario, that every 10 minutes this command would be played
For example:Code: Select all
player.print("Hello, world!")
Code: Select all
script.on_event(defines.events.on_tick, function(event)
local interval = 10 * 60 * 60 -- 60 ticks per second, 60 seconds per minute, 10 minutes
if (event.tick % interval) == 0 then
game.print("It has been 10 minutes my dudes")
end
end)
Thanks for this, but how can I limit the number of repetitions?Klonan wrote:Something like this:WIZ4 wrote:What should I prescribe in the scenario, that every 10 minutes this command would be played
For example:Code: Select all
player.print("Hello, world!")
Documentation:Code: Select all
script.on_event(defines.events.on_tick, function(event) local interval = 10 * 60 * 60 -- 60 ticks per second, 60 seconds per minute, 10 minutes if (event.tick % interval) == 0 then game.print("It has been 10 minutes my dudes") end end)
http://lua-api.factorio.com/latest/events.html#on_tick
Code: Select all
if condition then script.on_event(defines.events.on_tick, nil) end