This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
gheotic's profile picture

Peripierals++- Using the playerinterface

Started by gheotic, 27 October 2015 - 07:57 AM
gheotic #1
Posted 27 October 2015 - 08:57 AM
Does anyone have a simple working script, that uses the playerinterface from the peripheral++ mod?

Link to documentation: http://peripheralsplusplus.readthedocs.org/en/latest/peripherals/player_interface/
SquidDev #2
Posted 27 October 2015 - 09:55 AM
First wrap the peripheral as normal:

local p = peripheral.wrap("left")

Supposing you have a chest to the north of your computer, you would want to input and output into that chest. You also would want to get the inventory of the desired player

p.setOutputSide("north")
p.setInputSide("north")

local inv = p.getPlayerInv("dan200")

If you want to move something from slot 1 of the chest to the player:

inv.pushToSlot(1, 64, -1) -- 64 to pass all items, -1 to pass to any slot. You can change this to force a slot and limit the number of items

If you want to pull something from slot 1 of the player to the chest, just do it in reverse:

inv.retrieveFromSlot(1, 64, -1)
gheotic #3
Posted 27 October 2015 - 11:20 AM
First wrap the peripheral as normal:

local p = peripheral.wrap("left")

Supposing you have a chest to the north of your computer, you would want to input and output into that chest. You also would want to get the inventory of the desired player

p.setOutputSide("north")
p.setInputSide("north")

local inv = p.getPlayerInv("dan200")

If you want to move something from slot 1 of the chest to the player:

inv.pushToSlot(1, 64, -1) -- 64 to pass all items, -1 to pass to any slot. You can change this to force a slot and limit the number of items

If you want to pull something from slot 1 of the player to the chest, just do it in reverse:

inv.retrieveFromSlot(1, 64, -1)

Thank you! i dont know where i went wrong when trying this myself, but your script works like a charm!