Crafting and Usage.Edit
The following program will detect when the player detector has been right-clicked by a player and will the output the player's usename.
while true do --Will keep logging players as the program runs a, b = os.pullEvent(player) --Will log the type of event (player) and the username print(b) end
The event that happened (player) is stored to the variable "a", and the player's name is stored to the variable "b". (Text after double dash is a comment and will be ignored, and won't run) There are many possible usages for such a block, e.g. a door that would only open if certain players right-click the Player Detector. The Detector is not entirely secure, however, as it can be easily broken in unprotected areas.
Example using above code for Player Detecting Door:
while true do --Will keep running the following code every time it reaches the end term.clear() --Will clear the screen term.setCursorPos(1,1) --Will set Cursor at top left corner print("Waiting for player..") a,b=os.pullEvent(player) if b=="Notch" then --If the player "Notch" (configurable) interacts... redstone.setOutput("right",true) --...the computer will output redstone from the right side (configurable) sleep(2.5) --Will delay the rest of the code by 2.5 seconds (also configurable) redstone.setOutput("right",false) --Willl stop outputting redstone from the right side end --If statement ends here end --While loop ends here, and start all over
[THIS ARTICLE IS A WORK IN PROGRESS. FEEL FREE TO EDIT IF YOU HAVE ANYTHING HELPFUL TO CONTRIBUTE,]