Page 1 of 1

Question about entity

Posted: Wed Feb 19, 2014 10:09 pm
by darius456
Why:
This work: game.player.print(game.player.selected.getitemcount())
but this doesn't: game.player.selected.removeitem({name="iron-gear-wheel",count=2}) when I print result I get 0 -> it mean no item removed

My cursor is above assembly machine mk2 which produces iron-gear-wheel.
In this assembly currently are: 0 iron plate and 3 iron-gear-wheel.

I wish to remove iron-gear-wheel from assembly machine... completely remove (delete), not move to inventory.
Is it possible to create new entity (assembly machine) and order it thru the script to craft some specific item?

Please help, need this to my 3rd mod :)

Re: Question about entity

Posted: Thu Feb 20, 2014 9:57 am
by darius456
I have found this site in wiki: LINK

But this doesn't work:
remove - LuaEntity doesn't cantain readable property remove
clear - LuaEntity doesn't cantain readable property clear

This work:
getitemcount()
insert({name="name",count=x})

This work but...: - this method found here
game.player.selected.removeitem({name="name",count=x}) (and mouse over assembling machine or chest) - always return 0
when I use it on player inventory it work:
game.player.removeitem({name="name",count=x})

How to remove item from assembly machine? - > Solved -> game.player.selected.getinventory(2).remove({name="iron-gear-wheel",count=2})