Player Detector - theoriginalbit/MoarPeripherals GitHub Wiki

Recipe
Type: player_detector
ID No.: 3470
Name: MoarPeripherals:blockPlayerDetector

The Player Detector is a peripheral block that fires a player event on all connected computers when used (right-clicked) by a player. The event includes the name/side of the Player Detector as the first parameter, and the username of the player that triggered it as the second.

This MoarPeripherals version of the Player Detector is similar to that seen in the MiscPeripherals mod (which is only compatible with older builds of ComputerCraft). The peripheral itself offers no functions (instead simply triggering events), and thus there is no need to wrap it.

##Events

Type Parameter 1 Parameter 2
player Peripheral "side". Player name.

##Recipe Recipe

##Code Example Attach one or more detectors to your system, start this code example, then right click the sensors to trigger screen output.

while true do
 local myEvent = {os.pullEvent("player")}

 --> myEvent[1] equals "player" (the type of event).
 --> myEvent[2] equals the "side" the peripheral is attached to.
 --> myEvent[3] equals the name of the player who triggered the detector.

 print("Player Detector located at \""..myEvent[2].."\" was activated by \""..myEvent[3].."\".")
end

##Version History

Build Date Details
v1.2.0 4 August 2014 New recipe.
v0.1.1 23 June 2014 Initial release.
⚠️ **GitHub.com Fallback** ⚠️