Page 1 of 1

Getting assembling machine crafting content.

Posted: Thu May 09, 2013 4:55 pm
by ficolas
Im going to change the way the underground mining drill works, you will need to select a recipe (normal drilling, fast drilling and soft drilling), at the beggining you only have normal drilling and you need to research the other, this allows me to add diferent tipes of drilling and to make the drill animated.

But my problem now is, that I want to get the assembly machine content (an object called normal drilling, fast drilling or soft drilling) so I did this:

Code: Select all

if 	minerEntities[z].name=="underground-mining-drill-2" and math.random(5)<=glob.undergroundminer[i].richness and minerEntities[z].getitemcount("soft-drilling")>0 or minerEntities[z].getitemcount("fast-drilling")>0 or minerEntities[z].getitemcount("normal-drilling")>0 then
But that doesnt seem to work, so I went to the game, and did this:

Code: Select all

game.getplayer().print(game.player.character.getselected().getitemcount("normal-drilling"))
And it prints 0...
even when there is one... Whats the problem?

I think that the problem is that assembly machines arent inventories, so you cant place stuff inside with the code :S

Re: Getting assembling machine crafting content.

Posted: Thu May 09, 2013 5:06 pm
by kovarex
The assembling machine doesn't work with the getitemcount command, I can add this for the next release.

Re: Getting assembling machine crafting content.

Posted: Thu May 09, 2013 5:27 pm
by ficolas
yes please :) and thanx.

I have readed something about a 0.4.3, but 0.4.2 isnt out yet, so why would 0.4.3 be released?
What will be the next update, 0.4.2 or 0.5?

Re: Getting assembling machine crafting content.

Posted: Thu May 09, 2013 5:40 pm
by kovarex
The next will be probably 0.5, the 0.4.3 was just update of the scenario pack.

Btw, you can now solve the problem with assembling machine in little bit ugly way.

You can do:

Code: Select all

machine.getinventory(1).getitemcount("my-item") + machine.getinventory(2).getitemcount("my-item")
Those 1 and 2 are constants for input/output inventory, these are not defined in defines (and will be in next version).

Re: Getting assembling machine crafting content.

Posted: Thu May 09, 2013 5:59 pm
by ficolas
kovarex wrote:The next will be probably 0.5, the 0.4.3 was just update of the scenario pack.

Btw, you can now solve the problem with assembling machine in little bit ugly way.

You can do:

Code: Select all

machine.getinventory(1).getitemcount("my-item") + machine.getinventory(2).getitemcount("my-item")
Those 1 and 2 are constants for input/output inventory, these are not defined in defines (and will be in next version).
Ok thanx :)

What is the inventory slot number one?
The input?

So I need to use only the second, the input?

Re: Getting assembling machine crafting content.

Posted: Thu May 09, 2013 6:09 pm
by ficolas
Also, im not sure if this is a bug or not, but an assembly machine with effectivity 1, takes 4 seconds to craft a recipe that should take 8 seconds.