SHOW:
|
|
- or go back to the newest paste.
| 1 | --Setting up the screen | |
| 2 | local ver = "1.2.1" | |
| 3 | rednet.open("back")
| |
| 4 | function start() | |
| 5 | term.clear() | |
| 6 | term.setCursorPos(1,1) | |
| 7 | term.setTextColor(colors.yellow) | |
| 8 | print("Message Board V."..ver)
| |
| 9 | term.setTextColor(colors.white) | |
| 10 | end | |
| 11 | start() | |
| 12 | ||
| 13 | --Actual code starts... | |
| 14 | --now: | |
| 15 | function getInfo() | |
| 16 | term.write("Please enter your username: ")
| |
| 17 | usr = read() | |
| 18 | print("Enter your message:")
| |
| 19 | message = read() | |
| 20 | end | |
| 21 | ||
| 22 | function fill() | |
| 23 | msg = nil | |
| 24 | local id, msg, dist = rednet.receive(15) | |
| 25 | if msg == nil then | |
| 26 | term.setTextColor(colors.red) | |
| 27 | print("Error! Please tell Austin or Panda!")
| |
| 28 | sleep(10) | |
| 29 | os.reboot() | |
| 30 | end | |
| 31 | end | |
| 32 | ||
| 33 | function msgSend() | |
| 34 | rednet.broadcast("start")
| |
| 35 | local id, msg, dist = rednet.receive(15) | |
| 36 | if msg == "go on" then | |
| 37 | rednet.broadcast("user")
| |
| 38 | fill() | |
| 39 | rednet.broadcast(usr) | |
| 40 | fill() | |
| 41 | rednet.broadcast("message")
| |
| 42 | fill() | |
| 43 | rednet.broadcast(message) | |
| 44 | fill() | |
| 45 | rednet.broadcast("end")
| |
| 46 | else | |
| 47 | term.setTextColor(colors.red) | |
| 48 | print("Error! Please tell Austin or Panda!")
| |
| 49 | sleep(10) | |
| 50 | os.reboot() | |
| 51 | end | |
| 52 | os.reboot() | |
| 53 | end | |
| 54 | ||
| 55 | getInfo() | |
| 56 | msgSend() |