Advertisement
XDjackieXD

ModderOSBeta-Einstellungen

Apr 15th, 2013
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.81 KB | None | 0 0
  1. local whoare = 1
  2.  
  3. shell.run(".modderOS/einstellungen")  --Einstellungsdatei Laden
  4.  
  5. local function centerPrint(text)
  6. local x,y = term.getSize()
  7. local x2,y2 = term.getCursorPos()
  8. term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
  9. write(text)
  10. end
  11.  
  12. function reset()
  13.     local x,y = term.getSize()
  14.     term.setBackgroundColor(einstellungen[1])  --Farbe abfragen
  15.  term.setTextColor(einstellungen[3])  --Farbe abfragen
  16.     term.clear()
  17.     term.setCursorPos(1, 1)
  18.     paintutils.drawLine(1, 1, x, 1, einstellungen[2])  --Farbe abfragen
  19.     term.setCursorPos(1, 1)
  20.     print("ModderOS Programme Softwares [FREE BETA VERSION]")
  21.     whoare = 1
  22. end
  23.  
  24. reset()
  25. while true do
  26.      local event, button, x, y = os.pullEvent("mouse_click")
  27.      if whoare == 1 then
  28.          if event == "mouse_click" then
  29.             if y == 1 and x > 0 and x < 10 then
  30.                 --term.setCursorPos(13, 2)
  31.                 term.setBackgroundColor(einstellungen[2])  --Farbe abfragen
  32.                 term.setCursorPos(1, 2)
  33.                 print("        ")
  34.                 print("exit    ")
  35.                 print("reboot  ")
  36.                 print("shutdown")
  37.                
  38.                 term.setBackgroundColor(colors.black)
  39.                 whoare = 2
  40.             end
  41.             if y == 1 and x > 10 and x < 20 then
  42.                 term.setBackgroundColor(einstellungen[2])  --Farbe abfragen
  43.                 term.setCursorPos(10, 2)
  44.                 print("        ")
  45.                 term.setCursorPos(10, 3)
  46.                 print("Firewolf")
  47.                 term.setCursorPos(10, 4)
  48.                 print("Paint   ")
  49.                 term.setCursorPos(10, 5)
  50.                 print("GPS     ")
  51.                 term.setCursorPos(10, 6)
  52.                 print("P.Liste ")
  53.                 term.setBackgroundColor(colors.black)
  54.                 whoare = 3
  55.             end
  56.             if y == 1 and x > 20 and x < 30 then
  57.                 term.setBackgroundColor(einstellungen[2])  --Farbe abfragen
  58.                 term.setCursorPos(20, 2)
  59.                 print("         ")
  60.                 term.setCursorPos(20, 3)
  61.                 print("Install  ")
  62.                 term.setCursorPos(20, 4)
  63.                 print("Start    ")
  64.                 term.setCursorPos(20, 5)
  65.                 print("Entfernen")
  66.                 term.setBackgroundColor(colors.black)
  67.                 whoare = 4
  68.             end
  69.          end
  70.      elseif whoare == 2 then
  71.          if event == "mouse_click" then
  72.             if y == 4 and x > 0 and x < 10 then
  73.                 os.reboot()
  74.             end
  75.             if y == 5 and x > 0 and x < 10 then
  76.                 os.shutdown()
  77.             end
  78.             if y == 3 and x > 0 and x < 10 then            
  79.                 term.clear()
  80.                 term.setCursorPos(1, 1)
  81.                 print("CraftOS 1.5 (start by ModderOS)")
  82.                 break
  83.             end
  84.             if y == 1 and x > 0 and x < 10 then
  85.                 reset()
  86.             end
  87.          end
  88.     elseif whoare == 3 then
  89.         if y == 1 and x > 10 and x < 20 then
  90.             reset()
  91.         end
  92.         if y == 3 and x > 10 and x < 20 then
  93.             shell.run(".modderOS/firewolf")
  94.             reset()
  95.         end
  96.         if y == 4 and x > 10 and x < 20 then
  97.             reset()
  98.             whoare=3
  99.             local sx,sy = term.getSize()
  100.             term.setCursorPos(1, sy)
  101.             write("FileName> ")
  102.             programm=read()
  103.             reset()
  104.             whoare=3
  105.             shell.run("paint "..programm)
  106.             reset()
  107.         end            
  108.         if y == 5 and x > 10 and x < 20 then   
  109.             shell.run(".modderOS/gps")
  110.             reset()
  111.         end            
  112.         if y == 6 and x > 10 and x < 20 then   
  113.             shell.run(".modderOS/programmliste")
  114.             reset()
  115.         end
  116.     elseif whoare == 4 then
  117.         if y == 1 and x > 20 and x < 30 then
  118.             reset()
  119.         end
  120.         if y == 3 and x > 20 and x < 30 then
  121.             reset()
  122.             whoare=4
  123.             local sx,sy = term.getSize()
  124.             term.setCursorPos(1, sy)
  125.             write("Pastebin> ")
  126.             programm=read()
  127.             reset()
  128.             whoare=4
  129.             term.setCursorPos(1, sy)
  130.             write("Installing ...")
  131.             local response = http.get(
  132.             "http://pastebin.com/raw.php?i="..textutils.urlEncode( programm )
  133.             )
  134.             reset()
  135.             whoare=4
  136.             term.setCursorPos(1, sy)
  137.             write("Programmname> ")
  138.             name=read()
  139.             if fs.exists( ".modderOS/programme/"..name ) then
  140.                 reset()
  141.                 term.setCursorPos(1, sy)
  142.                 write("Diese Datei gibt es schon.")
  143.             else           
  144.                 local sResponse = response.readAll()
  145.                 response.close()           
  146.                 local file = fs.open( ".modderOS/programme/"..name, "w" )
  147.                 file.write( sResponse )
  148.                 file.close()
  149.  
  150.     local file1 = fs.open( ".modderOS/programme/liste/"..name, "w" )
  151.     file1.close()
  152.                 reset()
  153.             end
  154.         end
  155.         if y == 4 and x > 20 and x < 30 then
  156.             reset()
  157.             whoare=4
  158.             local sx,sy = term.getSize()
  159.             term.setCursorPos(1, sy)
  160.             write("Programmname> ")
  161.             programm=read()
  162.             if fs.exists( ".modderOS/programme/"..programm ) then  
  163.                 shell.run(".modderOS/programme/"..programm)
  164.                 reset()
  165.             else
  166.                 reset()
  167.                 term.setCursorPos(1, sy)
  168.                 print("Diese datei gibt es nicht!")
  169.             end
  170.         end    
  171.         if y == 5 and x > 20 and x < 30 then       
  172.             reset()
  173.             whoare=4
  174.             local sx,sy = term.getSize()
  175.             term.setCursorPos(1, sy)
  176.             write("Programmname> ")
  177.             programm=read()
  178.             if fs.exists( ".modderOS/programme/"..programm ) then              
  179.                 shell.run("delete .modderOS/programme/"..programm)
  180.                 shell.run("delete .modderOS/programme/liste/"..programm) -- menüeintrag löschen
  181.                 reset()
  182.             else
  183.                 reset()
  184.                 term.setCursorPos(1, sy)
  185.                 print("Diese datei gibt es nicht!")
  186.             end
  187.         end
  188.      end
  189.  
  190. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement