Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.setBackgroundColor(colors.black)
- term.clear()
- rednet.open("back")
- term.setCursorPos(1,1)
- print("welcome to spaceteeeeeem")
- print("que snazzy intro music")
- --host/join
- --shell.run("host/join")
- --ping each other, make sure connection is stable
- --send = rednet.send(to the other player)
- --recieve =
- keys = {"q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l","z","x","c","v","b","n","m"}
- correct = 0
- function timeRemaining()
- timer1,timer2 = os.pullEvent("alarm")
- return true
- end
- function sending()
- event, character = os.pullEvent("char")
- return true
- end
- function receiving()
- sID, message = rednet.receive()
- return true
- end
- complete = false
- r = math.random(1,26)
- task = tostring(keys[r])
- print("Press "..task)
- host = true
- local rem = 21
- local k = os.time() + 0.02
- if k >= 18000 then
- k=k-18000
- end
- os.setAlarm(k)
- while not complete do
- event, character, message, timer1, timer2 = nil,nil,nil,nil,nil
- parallel.waitForAny(sending,receiving,timeRemaining)
- print(timer1)
- if timer1 == "alarm" then
- rem = rem - 1
- if rem == 0 then
- textutils.slowPrint("Critical Failure")
- error()
- end
- print("Time Remaining: " .. rem)
- end
- if event then
- print(character)
- rednet.broadcast(character)
- end
- if message then
- print(message)
- if message == task then
- print("Correct")
- correct = correct + 1
- complete = true
- else
- print("Incorrect")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement