Advertisement
ecco7777

Glowstoneilluminator Anzeige

Mar 8th, 2017
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.12 KB | None | 0 0
  1. min=1000
  2. max=0
  3. args={...}
  4. if args[1]==nil then
  5. file="bild"
  6. else
  7. file=args[1]
  8. end
  9. shell.run(file)
  10. names=peripheral.getNames()
  11.  
  12. illuminator={}
  13.  
  14. for i=1, #names do
  15. if string.find(names[i],"glowstone_illuminator_") then
  16. illId=tonumber(string.sub(names[i],#"glowstone_illuminator_"+1))
  17. if illId<=min then
  18. min=illId
  19. end
  20. if illId>=max then
  21. max=illId
  22. end
  23. illuminator[illId]=names[i]
  24. end
  25. end
  26.  
  27. for i=1, max-min+1 do
  28. illuminator[i]=illuminator[min+i-1]
  29. end
  30.  
  31. function fileToTable(file)
  32. if fs.exists(file)~=true then
  33. print("file"..file.." not found")
  34. return(false)
  35. end
  36. fp=fs.open(file,"r")
  37. line={}
  38. i=1
  39. line[i]=fp.readLine()
  40. if line[i]==nil then return(false) end
  41. while line[i]~=nil do
  42. i=i+1
  43. line[i]=fp.readLine()
  44. end
  45. return(line)
  46. end
  47.  
  48. img=fileToTable(file)
  49.  
  50. i=1
  51. i2=1
  52. i3=1
  53. chars={}
  54. while img[i]~=nil do
  55. for i2=1, #img[i] do
  56. chars[i3]=string.sub(img[1],i2,i2)
  57. i3=i3+1
  58. end
  59. i=i+1
  60. end
  61. onechar=""
  62. for i=1, #img do
  63. onechar=onechar..img[i]
  64. end
  65. max=#color[1]
  66. i=1
  67. for y=1,max do
  68. for x=1,max do
  69. if illuminator[i]~=nil then
  70. peripheral.wrap(illuminator[i]).setColor(color[x][y])
  71. end
  72. i=i+1
  73. end
  74. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement