xXm0dzXx

test

Nov 10th, 2012
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. oldWrite = term.write
  2.  
  3. function mcWrite( text )
  4. local colorPalets = {
  5. ["&0"] = colors.black,
  6. ["&1"] = colors.blue,
  7. ["&2"] = colors.green,
  8. ["&3"] = colors.cyan,
  9. ["&4"] = colors.red,
  10. ["&5"] = colors.magenta,
  11. ["&7"] = colors.lightGray,
  12. ["&8"] = colors.gray,
  13. ["&b"] = colors.lightGreen,
  14. ["&c"] = colors.red,
  15. ["&d"] = colors.pink,
  16. ["&e"] = colors.yellow,
  17. ["&f"] = colors.white,
  18. ["&r"] = colors.black,
  19. }
  20.  
  21. for i=1,#text do
  22. local sCode = string.sub( text, i, i+1 )
  23. local sCode2 = string.sub( text, i-1, i )
  24. if colorPalets[ sCode ] then
  25. term.setBackgroundColour( colorPalets[ sCode ] )
  26. else
  27. if colorPalets[ sCode2 ] then else
  28. oldWrite( string.sub( text, i, i ) )
  29. end
  30. end
  31. end
  32. end
  33.  
  34. term.write = mcWrite
Advertisement
Add Comment
Please, Sign In to add comment