failFTW

H4X API

Feb 25th, 2014
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.10 KB | None | 0 0
  1. -- H4X API v1.0
  2. -- Author: fail_FTW
  3.  
  4. function color( str )
  5.   code = "color." .. str
  6.   term.setTextColor( code )
  7. end
  8.  
  9. function pC( str )
  10.   local x, z = term.getSize()
  11.   if z == 1 then
  12.     x = math.floor( x )
  13.     z = math.floor( z )
  14.     z = z / 2
  15.     x = x - string.len( str )
  16.     term.setCursorPos( x, z )
  17.   else
  18.     term.scroll( 1 )
  19.     local Cx, Cz = term.getCursorPos()
  20.     term.setCursorPos( x, Cz )
  21.   end
  22.   print( str )
  23. end
  24.  
  25. function sPC( str )
  26.   local x, z = term.getSize()
  27.   if z == 1 then
  28.     x = math.floor( x )
  29.     z = math.floor( z )
  30.     z = z / 2
  31.     x = x - string.len( str )
  32.     term.setCursorPos( x, z )
  33.   else
  34.     term.scroll( 1 )
  35.     local Cx, Cz = term.getCursorPos()
  36.     term.setCursorPos( x, Cz )
  37.   end
  38.   textutils.slowPrint( str )
  39. end
  40.  
  41. function wC( str )
  42.   local x, z = term.getSize()
  43.   if z == 1 then
  44.     x = math.floor( x )
  45.     z = math.floor( z )
  46.     z = z / 2
  47.     x = x - string.len( str )
  48.     term.setCursorPos( x, z )
  49.   else
  50.     term.scroll( 1 )
  51.     local Cx, Cz = term.getCursorPos()
  52.     term.setCursorPos( x, Cz )
  53.   end
  54.   term.write( str )
  55. end
Advertisement
Add Comment
Please, Sign In to add comment