However, i have no idea how to do anything in control.lua without copy&pasting pre-existing code into it, and changing it a bit to fit my needs.
What i'm trying to do below is to get this "command" script to run each time i fire up a save, or when i start a new game.
For the new game, i have managed to get an on_event/on_player_created script running.
For the on_load, when loading a game (new game works fine), however, Factorio gives me the error:
So, what do i have to do with the "local player = game.players... etc." line?...Error while running the on_load:
__modname__/control.lua:2: attempt to index global 'game' (a nil value)
Also looking for a bit of guidance here, because i really want to understand scripting in control.lua, but i simply CANNOT make sense of the API, or anything i read, and i have absolutely no fucking clue where to even start looking. T_T
Script