Jump to content




Peripierals++- Using the playerinterface


  • You cannot reply to this topic
2 replies to this topic

#1 gheotic

  • Members
  • 64 posts
  • LocationDenmark

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://peripheralspl...ayer_interface/

#2 SquidDev

    Frickin' laser beams | Resident Necromancer

  • Members
  • 1,427 posts
  • LocationDoes anyone put something serious here?

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)


#3 gheotic

  • Members
  • 64 posts
  • LocationDenmark

Posted 27 October 2015 - 11:20 AM

View PostSquidDev, on 27 October 2015 - 09:55 AM, said:

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!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users