Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Test script to recieve a message over rednet
- -- written by craftersanonmosse
- --------------------------------------------
- mon = peripheral.find("monitor")
- monX, monY = mon.getSize()
- --wmod = peripheral.wrap("right")
- mon.clear()
- rednet.open("right")
- id, message = rednet.receive()
- function receiveMessage()
- mon.setTextScale(1)
- mon.setCursorPos(1,1)
- -- mon.write(message)
- centerT(message, 1, colors.lightGray, colors.blue)
- end
- function centerT(text, line, backColor, txtColor)
- mon.setBackgroundColor(backColor)
- mon.setTextColor(txtColor)
- length = (string.len(text))
- dif = math.floor(monX - length)
- x = math.floor(dif / 2)
- mon.setCursorPos(x + 1, line)
- mon.write(text)
- end
- while true do
- receiveMessage()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement