Advertisement
Guest User

skywrite

a guest
Sep 7th, 2012
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.41 KB | None | 0 0
  1. --Program by Lion4ever
  2. local args={...}
  3. function Usage()
  4. print("Usage: skywrite <text> <x> <y> <z>")
  5. print("<x> is the offset forward, <y> is up and")
  6. print("<z> is to its right (x,y,z are optional)")
  7. print("to remove a text: send an empty turtle")
  8. print("use '&' instead of space")
  9. print("slot 1&2 are for letters, 3&4 for background")
  10. end
  11. function pixel(y,z)
  12. if turtle.detect() then
  13. turtle.select(5)
  14. turtle.dig()
  15. end
  16. p=tonumber(string.sub(m,a[y]*15+z,a[y]*15+z))
  17. if turtle.getItemCount(p)==0 then
  18. p=p+1
  19. end
  20. if turtle.getItemCount(p)~=0 then
  21. turtle.select(p)
  22. turtle.place()
  23. end
  24. turtle.select(5)
  25. end
  26. if #args>4 or #args<1 then
  27. Usage()
  28. return
  29. end
  30. a={}
  31. for i=1,#args[1] do
  32. a[i]=string.byte(string.upper(args[1]),i)-32
  33. if a[i]<1 or a[i]==64 or a[i]>93 or a[i]==3 or a[i]==4 or a[i]==32 then
  34. error(string.format("'%s' can not be printed!",string.sub(args[1],i,i)))
  35. end
  36. if a[i]==91 then
  37. a[i]=3
  38. end
  39. if a[i]==92 then
  40. a[i]=32
  41. end
  42. if a[i]==93 then
  43. a[i]=4
  44. end
  45. end
  46. m="333331113133333333113333333311331331131113331133311131133133113313313313311333333333333333333331133333333333333111313331133313111333333313133313331313331333111333133333333331133333331333313333133333333333133333113333111333311311131333131113333333133311111111311313113111131311313111111331113313311111131111313111131111111313111131113311313333311111111313111111131111313111111333333131333333333333131133333331333131313331313133131331313133313131333133333131331133113333331131133333111131313311113111111313131313311131333113331111111333131113111111313113331111111313333331311131333111331111113313311111333331111133333313311333131111111113131313331111113333113333111113133311111111111333311111111111333111111111111313333111311131331111113111111313311313131111313111131333311111133331111113333111111311113333131111111113331311111113113313311311333113311133311113311313113311333331111113331333113111311333133311111133333333131333333313133333333113333"
  47. local j=0
  48. local p=0
  49. for q=1,#a do
  50. for i=-14,0 do
  51. if tonumber(string.sub(m,a[q]*15+i,a[q]*15+i))==1 then
  52. j=j+1
  53. else
  54. p=p+1
  55. end
  56. end
  57. end
  58. print(string.format("You need %i letter- and %i backgroundblocks",j,p))
  59. print("starting to build...")
  60. while j<=128 and turtle.getItemCount(1)+turtle.getItemCount(2)>0 and turtle.getItemCount(1)+turtle.getItemCount(2)<j do
  61. x,xy=term.getCursorPos()
  62. xy=xy-1
  63. term.setCursorPos(1,xy)
  64. print(string.format("%i of %i materials... Insert more!",turtle.getItemCount(1)+turtle.getItemCount(2),j))
  65. sleep(1)
  66. end
  67. while p<=128 and turtle.getItemCount(3)+turtle.getItemCount(4)>0 and turtle.getItemCount(3)+turtle.getItemCount(4)<p do
  68. x,y=term.getCursorPos()
  69. y=y-1
  70. term.setCursorPos(1,y)
  71. print(string.format("%i of %i materials... Insert more!",turtle.getItemCount(3)+turtle.getItemCount(4),p))
  72. sleep(1)
  73. end
  74. for i=2,4 do
  75. if tonumber(args[i])==nil then
  76. args[i]=0
  77. end
  78. end
  79. for i=1,tonumber(args[3]) do
  80. repeat
  81. turtle.digUp()
  82. until turtle.up()
  83. end
  84. for i=tonumber(args[3]),-1 do
  85. repeat
  86. turtle.digDown()
  87. until turtle.down()
  88. end
  89. for i=1,tonumber(args[2]) do
  90. repeat
  91. turtle.dig()
  92. until turtle.forward()
  93. end
  94. if tonumber(args[2])<0 then
  95. turtle.turnLeft()
  96. turtle.turnLeft()
  97. for i=tonumber(args[2]),-1 do
  98. repeat
  99. turtle.dig()
  100. until turtle.forward()
  101. end
  102. turtle.turnLeft()
  103. turtle.turnLeft()
  104. end
  105. if tonumber(args[4])<0 then
  106. turtle.turnLeft()
  107. for i=tonumber(args[4]),-1 do
  108. repeat
  109. turtle.dig()
  110. until turtle.forward()
  111. end
  112. turtle.turnRight()
  113. end
  114. if tonumber(args[4])>0 then
  115. turtle.turnRight()
  116. for i=1,tonumber(args[4]) do
  117. repeat
  118. turtle.dig()
  119. until turtle.forward()
  120. end
  121. turtle.turnLeft()
  122. end
  123. for j=1,#a do
  124. for i=-14,-11 do
  125. pixel(j,i)
  126. repeat
  127. turtle.digUp()
  128. until turtle.up()
  129. end
  130. pixel(j,-10)
  131. turtle.turnRight()
  132. repeat
  133. turtle.dig()
  134. until turtle.forward()
  135. turtle.turnLeft()
  136. for i=-9,-6 do
  137. pixel(j,i)
  138. repeat
  139. turtle.digDown()
  140. until turtle.down()
  141. end
  142. pixel(j,-5)
  143. turtle.turnRight()
  144. repeat
  145. turtle.dig()
  146. until turtle.forward()
  147. turtle.turnLeft()
  148. for i=-4,-1 do
  149. pixel(j,i)
  150. repeat
  151. turtle.digUp()
  152. until turtle.up()
  153. end
  154. pixel(j,0)
  155. turtle.turnRight()
  156. repeat
  157. turtle.dig()
  158. until turtle.forward()
  159. turtle.turnLeft()
  160. for i=1,4 do
  161. turtle.select(5)
  162. turtle.dig()
  163. turtle.digDown()
  164. p=3
  165. if turtle.getItemCount(p)==0 then
  166. p=p+1
  167. end
  168. if turtle.getItemCount(p)~=0 then
  169. turtle.select(p)
  170. turtle.place()
  171. end
  172. repeat
  173. until turtle.down()
  174. end
  175. turtle.select(5)
  176. turtle.dig()
  177. p=3
  178. if turtle.getItemCount(p)==0 then
  179. p=p+1
  180. end
  181. if turtle.getItemCount(p)~=0 then
  182. turtle.select(p)
  183. turtle.place()
  184. end
  185. turtle.select(5)
  186. turtle.turnRight()
  187. repeat
  188. turtle.dig()
  189. until turtle.forward()
  190. turtle.turnLeft()
  191. end
  192. turtle.turnLeft()
  193. for i=1,4*#a do
  194. repeat
  195. until turtle.forward()
  196. end
  197. turtle.turnRight()
  198. for i=2,4 do
  199. args[i]=-tonumber(args[i])
  200. end
  201. for i=1,tonumber(args[2]) do
  202. repeat
  203. turtle.dig()
  204. until turtle.forward()
  205. end
  206. if tonumber(args[2])<0 then
  207. turtle.turnLeft()
  208. turtle.turnLeft()
  209. for i=tonumber(args[2]),-1 do
  210. repeat
  211. turtle.dig()
  212. until turtle.forward()
  213. end
  214. turtle.turnLeft()
  215. turtle.turnLeft()
  216. end
  217. if tonumber(args[4])<0 then
  218. turtle.turnLeft()
  219. for i=tonumber(args[4]),-1 do
  220. repeat
  221. turtle.dig()
  222. until turtle.forward()
  223. end
  224. turtle.turnRight()
  225. end
  226. if tonumber(args[4])>0 then
  227. turtle.turnRight()
  228. for i=1,tonumber(args[4]) do
  229. repeat
  230. turtle.dig()
  231. until turtle.forward()
  232. end
  233. turtle.turnLeft()
  234. end
  235. for i=1,tonumber(args[3]) do
  236. repeat
  237. turtle.digUp()
  238. until turtle.up()
  239. end
  240. for i=tonumber(args[3]),-1 do
  241. repeat
  242. turtle.digDown()
  243. until turtle.down()
  244. end
  245. a=nil
  246. m=nil
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement