Sparta252

3x1 mon Nazov

Jan 3rd, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.76 KB | None | 0 0
  1. -- Program na monitor 3x1 - Nazov miestnosti By Sparta252
  2. mon = peripheral.wrap("bottom")
  3. mon.setTextScale(1)
  4.  
  5. x,y = mon.getSize()
  6.  
  7. mon.clear()
  8. mon.setTextColor(colors.cyan)
  9. for i=1, x do
  10.  mon.setCursorPos(i,1)
  11.  mon.write("#")
  12.  mon.setCursorPos(i,y)
  13.  mon.write("#")
  14. end
  15.  
  16. for i=1, y do
  17.  mon.setCursorPos(1,i)
  18.  mon.write("#")
  19.  mon.setCursorPos(x,i)
  20.  mon.write("#")
  21. end
  22.  
  23. mon.setTextColor(colors.green)
  24. bambus = fs.open("text.lua","r")
  25. alfa = bambus.readLine()
  26. bambus.close()
  27. if string.len(alfa) > x then
  28.  print("Chyba : Dlhy text : ".. string.len(alfa))
  29.  print("Vase X : "..x)
  30. elseif string.len(alfa) < x then
  31.  mon.setCursorPos(x/2+1-(string.len(alfa)/2),3)
  32.  mon.write(alfa)
  33. else
  34.  print("CHYBA")
  35. end
  36. repeat
  37. sleep(30)
  38. os.reboot()
  39. until nil
Advertisement
Add Comment
Please, Sign In to add comment