Page 1 of 1

get assembling recipe

Posted: Sun Oct 06, 2013 11:15 am
by drs9999
Hello, I just looked trough the wiki and saw that there is a handler to get the assembling machines recipe. So I tried to add it to the BP mod.

First the given example:

Code: Select all

game.player.print(game.player.selected.recipe.name) -- prints the recipe of the selected assembling machine
do not work for me.
I have to use game.player.controller.getselected() instead of game.player.selected

But still then recipe nor recipe.name are valid keys.

So is it a bug or just me doing something stupid?!

Re: get assembling recipe

Posted: Sun Oct 06, 2013 2:40 pm
by rk84
This should work.

Code: Select all

game.player.print(game.player.controller.getselected().getrecipe().name)

Re: get assembling recipe

Posted: Sun Oct 06, 2013 3:17 pm
by ficolas
It says game.player.selected on the wiki? Then it should be changed I guess :)

I didnt know this existed I needed it and I thnk I also asked for it but I dont remember :s
Anyways now I can use it :)

Re: get assembling recipe

Posted: Sun Oct 06, 2013 6:48 pm
by FreeER
Actually game.player.selected is for 0.7.1, it is being changed to a property rather than a method of the player (like it is now). Actually several methods are changing to properties, read Random Ramblings #4

Re: get assembling recipe

Posted: Sun Oct 06, 2013 6:52 pm
by ficolas
FreeER wrote:Actually game.player.selected is for 0.7.1, it is being changed to a property rather than a method of the player (like it is now). Actually several methods are changing to properties, read Random Ramblings #4
Aaaaah did not remember that :)

Re: get assembling recipe

Posted: Mon Oct 07, 2013 3:00 pm
by drs9999
ficolas wrote:Aaaaah did not remember that :)
Oh me too :D

Re: get assembling recipe

Posted: Mon Oct 07, 2013 9:36 pm
by slpwnd
Unfortunately this might break quite some mods. But in the long run it is better to have cleaner and simpler api.

Re: get assembling recipe

Posted: Mon Oct 07, 2013 9:56 pm
by Nova
Factorio is still alpha, every update has the capability to break any mod. Better break them now than in the final version or have a messy mod api. ;)