Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Program by Lion4ever
- local args={...}
- function Usage()
- print("Usage: skywrite <text> <x> <y> <z>")
- print("<x> is the offset forward, <y> is up and")
- print("<z> is to its right (x,y,z are optional)")
- print("to remove a text: send an empty turtle")
- print("use '&' instead of space")
- print("slot 1&2 are for letters, 3&4 for background")
- end
- function pixel(y,z)
- if turtle.detect() then
- turtle.select(5)
- turtle.dig()
- end
- p=tonumber(string.sub(m,a[y]*15+z,a[y]*15+z))
- if turtle.getItemCount(p)==0 then
- p=p+1
- end
- if turtle.getItemCount(p)~=0 then
- turtle.select(p)
- turtle.place()
- end
- turtle.select(5)
- end
- if #args>4 or #args<1 then
- Usage()
- return
- end
- a={}
- for i=1,#args[1] do
- a[i]=string.byte(string.upper(args[1]),i)-32
- 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
- error(string.format("'%s' can not be printed!",string.sub(args[1],i,i)))
- end
- if a[i]==91 then
- a[i]=3
- end
- if a[i]==92 then
- a[i]=32
- end
- if a[i]==93 then
- a[i]=4
- end
- end
- m="333331113133333333113333333311331331131113331133311131133133113313313313311333333333333333333331133333333333333111313331133313111333333313133313331313331333111333133333333331133333331333313333133333333333133333113333111333311311131333131113333333133311111111311313113111131311313111111331113313311111131111313111131111111313111131113311313333311111111313111111131111313111111333333131333333333333131133333331333131313331313133131331313133313131333133333131331133113333331131133333111131313311113111111313131313311131333113331111111333131113111111313113331111111313333331311131333111331111113313311111333331111133333313311333131111111113131313331111113333113333111113133311111111111333311111111111333111111111111313333111311131331111113111111313311313131111313111131333311111133331111113333111111311113333131111111113331311111113113313311311333113311133311113311313113311333331111113331333113111311333133311111133333333131333333313133333333113333"
- local j=0
- local p=0
- for q=1,#a do
- for i=-14,0 do
- if tonumber(string.sub(m,a[q]*15+i,a[q]*15+i))==1 then
- j=j+1
- else
- p=p+1
- end
- end
- end
- print(string.format("You need %i letter- and %i backgroundblocks",j,p))
- print("starting to build...")
- while j<=128 and turtle.getItemCount(1)+turtle.getItemCount(2)>0 and turtle.getItemCount(1)+turtle.getItemCount(2)<j do
- x,xy=term.getCursorPos()
- xy=xy-1
- term.setCursorPos(1,xy)
- print(string.format("%i of %i materials... Insert more!",turtle.getItemCount(1)+turtle.getItemCount(2),j))
- sleep(1)
- end
- while p<=128 and turtle.getItemCount(3)+turtle.getItemCount(4)>0 and turtle.getItemCount(3)+turtle.getItemCount(4)<p do
- x,y=term.getCursorPos()
- y=y-1
- term.setCursorPos(1,y)
- print(string.format("%i of %i materials... Insert more!",turtle.getItemCount(3)+turtle.getItemCount(4),p))
- sleep(1)
- end
- for i=2,4 do
- if tonumber(args[i])==nil then
- args[i]=0
- end
- end
- for i=1,tonumber(args[3]) do
- repeat
- turtle.digUp()
- until turtle.up()
- end
- for i=tonumber(args[3]),-1 do
- repeat
- turtle.digDown()
- until turtle.down()
- end
- for i=1,tonumber(args[2]) do
- repeat
- turtle.dig()
- until turtle.forward()
- end
- if tonumber(args[2])<0 then
- turtle.turnLeft()
- turtle.turnLeft()
- for i=tonumber(args[2]),-1 do
- repeat
- turtle.dig()
- until turtle.forward()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- end
- if tonumber(args[4])<0 then
- turtle.turnLeft()
- for i=tonumber(args[4]),-1 do
- repeat
- turtle.dig()
- until turtle.forward()
- end
- turtle.turnRight()
- end
- if tonumber(args[4])>0 then
- turtle.turnRight()
- for i=1,tonumber(args[4]) do
- repeat
- turtle.dig()
- until turtle.forward()
- end
- turtle.turnLeft()
- end
- for j=1,#a do
- for i=-14,-11 do
- pixel(j,i)
- repeat
- turtle.digUp()
- until turtle.up()
- end
- pixel(j,-10)
- turtle.turnRight()
- repeat
- turtle.dig()
- until turtle.forward()
- turtle.turnLeft()
- for i=-9,-6 do
- pixel(j,i)
- repeat
- turtle.digDown()
- until turtle.down()
- end
- pixel(j,-5)
- turtle.turnRight()
- repeat
- turtle.dig()
- until turtle.forward()
- turtle.turnLeft()
- for i=-4,-1 do
- pixel(j,i)
- repeat
- turtle.digUp()
- until turtle.up()
- end
- pixel(j,0)
- turtle.turnRight()
- repeat
- turtle.dig()
- until turtle.forward()
- turtle.turnLeft()
- for i=1,4 do
- turtle.select(5)
- turtle.dig()
- turtle.digDown()
- p=3
- if turtle.getItemCount(p)==0 then
- p=p+1
- end
- if turtle.getItemCount(p)~=0 then
- turtle.select(p)
- turtle.place()
- end
- repeat
- until turtle.down()
- end
- turtle.select(5)
- turtle.dig()
- p=3
- if turtle.getItemCount(p)==0 then
- p=p+1
- end
- if turtle.getItemCount(p)~=0 then
- turtle.select(p)
- turtle.place()
- end
- turtle.select(5)
- turtle.turnRight()
- repeat
- turtle.dig()
- until turtle.forward()
- turtle.turnLeft()
- end
- turtle.turnLeft()
- for i=1,4*#a do
- repeat
- until turtle.forward()
- end
- turtle.turnRight()
- for i=2,4 do
- args[i]=-tonumber(args[i])
- end
- for i=1,tonumber(args[2]) do
- repeat
- turtle.dig()
- until turtle.forward()
- end
- if tonumber(args[2])<0 then
- turtle.turnLeft()
- turtle.turnLeft()
- for i=tonumber(args[2]),-1 do
- repeat
- turtle.dig()
- until turtle.forward()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- end
- if tonumber(args[4])<0 then
- turtle.turnLeft()
- for i=tonumber(args[4]),-1 do
- repeat
- turtle.dig()
- until turtle.forward()
- end
- turtle.turnRight()
- end
- if tonumber(args[4])>0 then
- turtle.turnRight()
- for i=1,tonumber(args[4]) do
- repeat
- turtle.dig()
- until turtle.forward()
- end
- turtle.turnLeft()
- end
- for i=1,tonumber(args[3]) do
- repeat
- turtle.digUp()
- until turtle.up()
- end
- for i=tonumber(args[3]),-1 do
- repeat
- turtle.digDown()
- until turtle.down()
- end
- a=nil
- m=nil
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement