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

Help With Monitors

Started by Mike_Wazowski00, 28 July 2013 - 11:26 AM
Mike_Wazowski00 #1
Posted 28 July 2013 - 01:26 PM
I want a code that will when have a monitor saying "Click the player detonator" and when someone right clicks a player detector it will pop up on monitor saying "Hello Player!" and then sit there or ten seconds then go away and have the original screen popup. I would also like it to support 6 people in the same time frame and each stay up for ten seconds. And I needed it to keep track of who came in. I got it all done but the ten seconds and it keeps track of who came in on the computer.
here is my code:

p = 1
j = 0
local monitor = peripheral.wrap("top")
monitor.clear()
monitor.setTextColor(2)
monitor.setTextScale(1.9)
repeat
 monitor.setCursorPos(1,1)
 p = 1
 repeat
   event, m = os.pullEvent("player")
   monitor.write("Hello ")
   monitor.write(m)
   print(m)
   p = p + 1
   monitor.setCursorPos(1,p)
 until p == 10
monitor.clear()
until j == 5

Thankyou in advanced:)
JD_minecraft #2
Posted 28 July 2013 - 06:51 PM
I do not have much time at the moment but what you would want to do is the following:
1. Check for player
2. Add that player to a table (you might want to look that up) & add to another table the number 10
3. Subtract from all the table entries 1
4. If a table entry is 0 then remove the corresponding player from the other table
5. Draw the monitor text