Tebli 0 Posted April 27, 2019 Share Posted April 27, 2019 (edited) Can someone explain robot.inventorySpace() to me? I've spent hours on https://ocdoc.cil.li/component:inventory_controller and https://ocdoc.cil.li/component:robot trying to figure out how to write a function to check total amount of available inventory space. Please Help!! turns out there is no .inventorySpace(), explains why i couldnt get it to work. Edited April 27, 2019 by Tebli answer found Quote Link to post Share on other sites
0 ayangd 0 Posted July 2, 2019 Share Posted July 2, 2019 If you're talking about the total slots available, `robot.inventorySize()` is the answer. But, if you're talking about the empty slots available, scanning slots one by one is an option. Here is a simple code for that: local robot = require('robot') local function getEmptySlots() local emptySlots = 0 for i = 1, robot.inventorySize() do if robot.count(i) == 0 then emptySlots = emptySlots + 1 end end return emptySlots end Hope this helps. Have a nice day! Quote Link to post Share on other sites
Can someone explain robot.inventorySpace() to me? I've spent hours on https://ocdoc.cil.li/component:inventory_controller and https://ocdoc.cil.li/component:robot
trying to figure out how to write a function to check total amount of available inventory space.
Please Help!!
turns out there is no .inventorySpace(), explains why i couldnt get it to work.
Edited by Teblianswer found
Link to post
Share on other sites