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

Openperipherals sensor peripheral

Started by flaghacker, 21 February 2014 - 02:30 PM
flaghacker #1
Posted 21 February 2014 - 03:30 PM
I'm trying to make some kind of a door system using the drawbridges from the mod tConstruct. I want to use the sensor from openperipherals to detect if a player is nearby. I can't get the pripheral to work.

This is my tets build:
https://www.dropbox.com/s/bsyac9q4n0wwdv5/2014-02-21_21.39.47.png
This is what I do:
https://www.dropbox.com/s/fy3kl4w0xrj6pmp/2014-02-21_21.43.18.png

As you can see it doens't work! Can you guys hepl me?
CometWolf #2
Posted 21 February 2014 - 05:20 PM
If that really si an openP sensor, and not an OCS sensor (about 90% seem to make that mistake), then the correct function would be

sensor.getPlayerNames()
flaghacker #3
Posted 22 February 2014 - 03:58 AM
Thanks, I found the function getTargets() somewhere on the internet… It is indeed the sensor from openperipherals. And how do you get the distance?

EDIT: I tested your function and it still doens't work…
https://www.dropbox....22_11.31.46.png
(The sensor is at the right side)
Edited on 22 February 2014 - 04:25 AM
Bomb Bloke #4
Posted 22 February 2014 - 05:28 AM
If the peripheral is placed on the computer's left side, then you need to use peripheral.wrap("right"), and vice versa. Note that the opposite is true for turtles.
plazter #5
Posted 24 February 2014 - 03:16 PM
Try the following:

for i,v in pairs(sensor.getPlayerNames()) do
     print(i, ". ", v)
end
Hope it works :)/> i'm having troubles with makeing a door with it xD