tomtrein

Untitled

Jul 20th, 2016
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ---- By: Goodle
  2.  
  3. -- Variables
  4.  
  5. width,height = term.getSize()
  6.  
  7. CnWidth = width / 2
  8. CnHeight = height / 2
  9.  
  10. time = os.time()
  11. formattedTime = textutils.formatTime( time, false)
  12.  
  13. isMenu = false
  14. isDesktop = false
  15. isStartup = false
  16.          
  17. -- Functions
  18. message = function()
  19.   term.clear()
  20.   messageis=true
  21.   term.setCursorPos(1,1)
  22.   term.setTextColor( colors.red )
  23.   local response = http.get("http://pastebin.com/raw.php?i=FWci8qcj")
  24.   local file = fs.open( "tiat", "w" )
  25.   file.write( sResponse )
  26.   file.close()
  27.   while messageis==true do
  28.     local event, keyPressed = os.pullEvent('key')
  29.     if keyPressed == 15 then
  30.       messageis=false
  31.     end
  32.   end
  33.   term.clear()
  34. end
  35.  
  36. startup = function()
  37.   isStartup = true
  38.   term.clear()
  39.   term.setCursorPos(CnWidth-5,height-1)
  40.   term.setTextColour( colours.blue )
  41.   term.write("GoCraftOS by")
  42.   term.setCursorPos(CnWidth-7,height)
  43.   term.write("Goodle Software")
  44.   term.setCursorPos(CnWidth-3,CnHeight-1)
  45.   term.setTextColour( colours.lightBlue )
  46.   term.write("Loading")
  47.   term.setCursorPos(CnWidth-6,CnHeight)
  48.   term.write(";")
  49.   term.setCursorPos(CnWidth+6,CnHeight)
  50.   term.write(";")
  51.   term.setBackgroundColour( colours.black )
  52.   term.setCursorPos(CnWidth,CnHeight+1)
  53.   term.write('0%')
  54.   sleep(1)
  55.   paintutils.drawLine(CnWidth-5,CnHeight, CnWidth,CnHeight, colours.green )
  56.   term.setBackgroundColour( colours.black )
  57.   term.setCursorPos(CnWidth-1,CnHeight+1)
  58.   term.write("50%")
  59.   sleep(0.5)
  60.   paintutils.drawLine(CnWidth,CnHeight, CnWidth+4,CnHeight, colours.green )
  61.   term.setBackgroundColour( colours.black )
  62.   term.setCursorPos(CnWidth-1,CnHeight+1)
  63.   term.clearLine()
  64.   term.write("78%")
  65.   sleep(0.3)
  66.   term.setCursorPos(CnWidth-1,CnHeight+1)
  67.   term.clearLine()
  68.   term.write("80%")
  69.   sleep(0.5)
  70.   paintutils.drawLine(CnWidth+4,CnHeight, CnWidth+5,CnHeight, colours.green )
  71.   term.setBackgroundColour( colours.black )
  72.   term.setCursorPos(CnWidth-1,CnHeight+1)
  73.   term.clearLine()
  74.   term.write("100%")
  75.   term.setCursorPos(CnWidth-3,CnHeight-1)
  76.   term.clearLine()
  77.   term.setBackgroundColour( colours.black )
  78.   term.write("Welcome!")
  79.   sleep(3)
  80.   isStartup = false
  81.   desktop()
  82. end
  83.  
  84.  
  85. desktop = function()
  86.  
  87.   isDesktop = true
  88.   term.clear()
  89.   pixelsDown = 1
  90.   pixelsDownLimit = height
  91.   -- Desktop drawing
  92.  
  93.   while pixelsDown ~= height
  94.     do paintutils.drawLine(1,pixelsDown, width,pixelsDown, colours.white )
  95.     pixelsDown = pixelsDown + 1
  96.     end
  97.   paintutils.drawLine(1,height, width,height, colours.blue )
  98.   term.setCursorPos(1,height)
  99.   term.setTextColour( colours.white )
  100.   term.setBackgroundColour( colours.lime )
  101.   term.write(' menu ')
  102.  
  103.   -- Clock Drawing
  104.  
  105.   term.setCursorPos(width-6,height)
  106.   term.setTextColour( colours.white )
  107.   term.setBackgroundColour( colours.blue )
  108.   term.write(formattedTime)
  109.  
  110.   -- Text Input Impeder
  111.  
  112.   while isDesktop == true do
  113.     term.setBackgroundColour( colours.white )
  114.     term.setCursorPos(1,1)
  115.     term.setTextColour( colours.white )
  116.     read(" ")
  117.     local event, keyPressed = os.pullEvent('key')
  118.     if keyPressed == 15 then
  119.       break
  120.       end
  121.   end
  122. end
  123.  
  124.  
  125. drawWindow = function()
  126.   term.clear()
  127. end
  128.  
  129.  
  130. drawMenu = function()
  131.   isMenu = true
  132.   local menuPD = 1 -- Menu pixels down
  133.   local menuPDL = height -- Menu pixels down limit
  134.   local menuPUL = height-10 -- Menu pixels up limit
  135.   -- Menu pixels right limit is = 15
  136.   while menuPD < menuPDL do
  137.     paintutils.drawLine(1, menuPUL, 15, menuPUL, colors.blue )
  138.     menuPUL = menuPUL + 1
  139.     menuPD = menuPD + 1
  140.     end
  141.   term.setCursorPos(1,height)
  142.   term.setTextColour( colours.white )
  143.   term.setBackgroundColour( colours.green )
  144.   term.write(" menu ")
  145.  
  146.   while isMenu == true do
  147.     local event, keyPressed2 = os.pullEvent("key")
  148.     if keyPressed2 == 15 then
  149.       isMenu = false
  150.       desktop()
  151.       break
  152.     end
  153.   end
  154.  
  155. end
  156. -- Program execution
  157.  
  158. message()
  159.  
  160. startup()
  161.  
  162. drawMenu()
  163.  
  164. while isDesktop == true do
  165.   drawMenu()
  166. end
Advertisement
Add Comment
Please, Sign In to add comment