Advertisement
tima_gt

tde-photo 3.4-alpha

Aug 19th, 2014
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.54 KB | None | 0 0
  1. term.setBackgroundColor(colors.black)
  2. local camera = peripheral.wrap('back')
  3. local array = "387f70f7"
  4. term.clear()
  5. local yp = 1
  6. saved = false
  7. info = ''
  8. local ya = 1
  9. for j = -0.35,0.25,0.025 do
  10.  for i = -1,1,0.036 do
  11.   local d = camera.distance(i, 0-j)
  12.   local a = 1
  13.   if d > 0 then a = 2 + (8 - math.min(8, (d/1.2))) end
  14.   if yp == 1 then
  15.    ya = 1
  16.    end
  17.    if yp ~= ya then
  18.  
  19.    info = info..'\n'..string.sub(array, a, a)
  20.   ya = yp
  21.     else
  22.   info = info..string.sub(array, a, a)
  23.   end
  24. end
  25.   yp = yp + 1
  26.  term.setCursorPos(1, yp)
  27.  if yp == 17 then
  28.    file = fs.open('.tde-photo-cache', 'w')
  29.    file.write(info)
  30.    file.close()
  31.    picture = paintutils.loadImage('.tde-photo-cache')
  32.    paintutils.drawImage(picture, 1, 1)
  33.     break
  34.  end
  35. end
  36. term.setCursorPos(1, 18)
  37. term.setTextColor(colors.yellow)
  38. write('[Save]')
  39. write(' [Exit]')
  40. term.setTextColor(colors.blue)
  41. write(' TDE photos')
  42. while true do
  43. local event, button, x, y = os.pullEventRaw()
  44. if (event == 'mouse_click') and (x >= 1) and (x <= 6) and y == 18 then
  45. for i = 1, 100 do
  46. if not fs.exists('photos') then
  47. shell.run('mkdir /photos')
  48. end
  49. if (not fs.exists('photos/photo'..i)) and (saved == false) then
  50. file = fs.open('photos/photo'..i, 'w')
  51. file.writeLine(info)
  52. file.close()
  53. term.setCursorPos(1, 19)
  54. write('saved!')
  55. saved = true
  56. break
  57. end
  58. end
  59. elseif (event == 'mouse_click') and (x >= 7) and (x <= 7 + 6) and (y == 18) then
  60. term.clear()
  61. term.setCursorPos(1, 1)
  62. if fs.exists('.tde-photo-cache') then
  63. shell.run('rm /.tde-photo-cache')
  64. end
  65. break
  66. end
  67. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement