Guest User

pls help pls

a guest
Aug 19th, 2015
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. term.clear()
  2. term.setCursorPos(1, 1)
  3. print("Press O to switch to Object Layer")
  4. print("Press M to switch to Map Layer")
  5. print("Press up and down to switch colors")
  6. print("Press S to change brush to solid")
  7. print("Press F to change bruch to foreground")
  8. print("Left Click to place a block.")
  9. print("When you place an object it'll open up a code")
  10. print("editor.")
  11. print("Right Click to edit an object")
  12. print("Press A to save it.")
  13. print("Press any key to continue")
  14. os.pullEvent("key")
  15. term.clear()
  16. color = 1
  17. Pixels = {}
  18. rcolo = 1
  19. solid = 0
  20. foreg = 0
  21. while true do
  22.   ev, p1, p2, p3 = os.pullEvent()
  23.   if ev == "key" then
  24.     if p1 == keys.o then
  25.      
  26.     elseif p1 == keys.m then
  27.      
  28.     elseif p1 == keys.up then
  29.       if rcolo == colors.black then
  30.         rcolo = colors.white
  31.       else
  32.         rcolo = bit.blshift(rcolo, 1)
  33.       end
  34.     elseif p1 == keys.down then
  35.       if rcolo == colors.white then
  36.         rcolo = colors.black
  37.       else
  38.         rcolo = bit.brshift(rcolo, 1)
  39.       end
  40.     elseif p1 == keys.s then
  41.       if solid == 1 then solid = 0;
  42.       elseif solid == 0 then solid = 1; end
  43.     elseif p1 == keys.f then
  44.       if foreg == 1 then foreg = 0;
  45.       elseif foreg == 0 then foreg = 1; end
  46.     elseif p1 == keys.a then
  47.       term.setCursorPos(1, 1)
  48.       words = ""
  49.       term.write("File Name")
  50.       name = read()
  51.       file = fs.open(name, "w")
  52.       print(#Pixels)
  53.       for i = 1, #Pixels do
  54.         if Pixels[i].color == colors.white then
  55.           words = "1 "
  56.         elseif Pixels[i].color == colors.orange then
  57.           words = "2 "
  58.         elseif Pixels[i].color == colors.magenta then
  59.           words = "3 "
  60.         elseif Pixels[i].color == colors.lightBlue then
  61.           words = "4 "
  62.         elseif Pixels[i].color == colors.yellow then
  63.           words = "5 "
  64.         elseif Pixels[i].color == colors.lime then
  65.           words = "6 "
  66.         elseif Pixels[i].color == colors.pink then
  67.           words = "7 "
  68.         elseif Pixels[i].color == colors.gray then
  69.           words = "8 "
  70.         elseif Pixels[i].color == colors.lightGray then
  71.           words = "9 "
  72.         elseif Pixels[i].color == colors.cyan then
  73.           words = "A "
  74.         elseif Pixels[i].color == colors.purple then
  75.           words = "B "
  76.         elseif Pixels[i].color == colors.blue then
  77.           words = "C "
  78.         elseif Pixels[i].color == colors.brown then
  79.           words = "D "
  80.         elseif Pixels[i].color == colors.green then
  81.           words = "E "
  82.         elseif Pixels[i].color == colors.red then
  83.           words = "F "
  84.         elseif Pixels[i].color == colors.black then
  85.           words = "G "
  86.       end
  87.       words = words..tostring(Pixels[i].x).." "
  88.       words = words..tostring(Pixels[i].y).." "
  89.       words = words..tostring(Pixels[i].solid).." "
  90.       words = words..tostring(Pixels[i].foreg)
  91.       print(words)
  92.       file:writeLine(words)
  93.       sleep(0.5)
  94.       end
  95.       file:close()
  96.     end
  97.   elseif ev == "mouse_click" then
  98.    Pixels[#Pixels+1] = {}
  99.    Pixels[#Pixels].x = p2
  100.    Pixels[#Pixels].y = p3
  101.    Pixels[#Pixels].color = rcolo
  102.    Pixels[#Pixels].solid = solid
  103.    Pixels[#Pixels].foreg = foreg
  104.    paintutils.drawPixel(Pixels[#Pixels].x, Pixels[#Pixels].y, Pixels[#Pixels].color)
  105.   end
  106. end
Advertisement
Add Comment
Please, Sign In to add comment