libraryaddict

Untitled

Apr 23rd, 2012
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.04 KB | None | 0 0
  1. ID = 1259
  2. Color = "Red"
  3. if not lib then os.loadAPI("lib") end
  4. lib.Clear()
  5. lib.openRednet()
  6. lib.fillLine()
  7. lib.layout("Welcome to "..Color.."'s waiting room")
  8. lib.fillLine()
  9. lib.layout()
  10. lib.layout()
  11. lib.layout("Press S to signal you are ready to spleef!")
  12. lib.layout("Press R to attempt to repair the arena")
  13. lib.layout("Press I to attempt to force start the round")
  14. lib.layout("Press T to input your name or the teams name!")
  15. lib.layout("Press G to attempt to reset match data")
  16. lib.layout()
  17. lib.layout()
  18. lib.fillLine()
  19. print("")
  20. Ready = "No"
  21. while true do
  22.   event,param1,param2 = os.pullEvent()
  23.   if event == "char" then
  24.     if param1 == "s" then
  25.       if Ready == "No" then
  26.         lib.send(ID, "["..Color.."]".." ready")
  27.         lib.clearLine()
  28.         write("You have signalled you are ready")
  29.         Ready = "Yes"
  30.         Clear = os.startTimer(10)
  31.       else
  32.         lib.clearLine()
  33.         write("You are already ready!")
  34.         Clear = os.startTimer(10)
  35.       end
  36.     elseif param1 == "r" then
  37.       lib.send(ID, "["..Color.."]".." repair")
  38.       lib.clearLine()
  39.       write("Commanded the arena to repair itself")
  40.       Clear = os.startTimer(10)
  41.     elseif param1 == "i" then
  42.       lib.send(ID, "["..Color.."]".." force")
  43.       lib.clearLine()
  44.       write("Attempted to force start this round")
  45.       Clear = os.startTimer(10)
  46.     elseif param1 == "t" then
  47.       lib.clearLine()
  48.       write("Input name: ")
  49.       Team = lib.readLimit(10)
  50.       lib.cursor(-1)
  51.       lib.clearLine()
  52.       write("Team name has been set as "..Team)
  53.       TeamSend = lib.tag(Team, Color)
  54.       lib.send(ID, TeamSend)
  55.       Clear = os.startTimer(10)
  56.     elseif param1 == "g" then
  57.       lib.send(ID, "["..Color.."]".."ResetMatch")
  58.       lib.clearLine()
  59.       write("Attempted to reset round")
  60.       Clear = os.startTimer(10)
  61.     end
  62.   elseif event == "timer" and param1 == Clear then
  63.     lib.clearLine()
  64.   elseif event == "rednet_message" and param1 == ID then
  65.     if param2 == "UnReady" then
  66.       Ready = "No"
  67.     end
  68.   end
  69. end
Advertisement
Add Comment
Please, Sign In to add comment