on_tick from the console

Place to get help with not working mods / modding interface.
Post Reply
JoeSchmoe
Inserter
Inserter
Posts: 34
Joined: Thu May 08, 2014 4:06 pm
Contact:

on_tick from the console

Post by JoeSchmoe »

I'm thinking about creating a mod but from what little modding i've done so far you need to edit control.lua and reload the game to see if it works, this slows things down quite a bit.
Is there anyway to do my write a function in the console, and then once it works copy it to control.lua? I think this would help speed up development.

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: on_tick from the console

Post by DaveMcW »

Yes, you can write it the same way as in control.lua.

Code: Select all

/c
script.on_event(defines.events.on_tick, function(event)
	game.player.print(game.tick)
end)
Writing it again overwrites your old function.

Code: Select all

/c
script.on_event(defines.events.on_tick, nil)
Note that you won't have access to any of your mod variables unless you build a getter.

Julianus
Inserter
Inserter
Posts: 29
Joined: Sat Jan 31, 2015 7:33 pm
Contact:

Re: on_tick from the console

Post by Julianus »

Hi JoeSchmoe,

do you reload the entire game, or just the save?

My observation was, that control.lua is reloaded on each save game load.

Post Reply

Return to “Modding help”