Page 1 of 1

[0.12.15] Cannot index game.force on script.on_load

Posted: Wed Oct 28, 2015 10:01 pm
by Klonan
As title
Screenshot
im not sure if its a bug or something deliberate, but this worked no problem in 0.12.0-0.12.10

Re: [0.12.15] Cannot index game.force on script.on_load

Posted: Wed Oct 28, 2015 10:09 pm
by Adil
Well, remember the release notes
FactorioBot wrote: The callback registered in on_load function doesn't have access to the game API.
It's that.
You can only now work with your mod data during the event. Event if there are references to game objects in that your data, I believe you cannot use their api anyway.

Re: [0.12.15] Cannot index game.force on script.on_load

Posted: Wed Oct 28, 2015 10:20 pm
by Klonan
Adil wrote:Well, remember the release notes
FactorioBot wrote: The callback registered in on_load function doesn't have access to the game API.
It's that.
You can only now work with your mod data during the event. Event if there are references to game objects in that your data, I believe you cannot use their api anyway.
Ahh right, I must've glossed over that one, thanks for pointing it out

Re: [0.12.15] Cannot index game.force on script.on_load

Posted: Thu Oct 29, 2015 9:48 am
by kovarex
Klonan wrote:
Adil wrote:Well, remember the release notes
FactorioBot wrote: The callback registered in on_load function doesn't have access to the game API.
It's that.
You can only now work with your mod data during the event. Event if there are references to game objects in that your data, I believe you cannot use their api anyway.
Ahh right, I must've glossed over that one, thanks for pointing it out
By using the on_init and on_configuration_changed (https://forums.factorio.com/wiki/inde ... on_changed), you should be able to do all you need.

on_init is for starting the game, on_configuration_changed is for updating when your mod is added, or some mod version changed (including your mod).