SHOW:
|
|
- or go back to the newest paste.
| 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 | ||
| 19 | startup = function() | |
| 20 | isStartup = true | |
| 21 | term.clear() | |
| 22 | term.setCursorPos(CnWidth-5,height-1) | |
| 23 | term.setTextColour( colours.blue ) | |
| 24 | term.write("WaffgoOS by")
| |
| 25 | term.setCursorPos(CnWidth-20,height) | |
| 26 | term.write("Goodle Software - In cooperation with CPGGC")
| |
| 27 | term.setCursorPos(CnWidth-3,CnHeight-1) | |
| 28 | term.setTextColour( colours.lightBlue ) | |
| 29 | term.write("Loading")
| |
| 30 | term.setCursorPos(CnWidth-6,CnHeight) | |
| 31 | term.write(";")
| |
| 32 | term.setCursorPos(CnWidth+6,CnHeight) | |
| 33 | term.write(";")
| |
| 34 | term.setBackgroundColour( colours.black ) | |
| 35 | term.setCursorPos(CnWidth,CnHeight+1) | |
| 36 | term.write('0%')
| |
| 37 | sleep(1) | |
| 38 | paintutils.drawLine(CnWidth-5,CnHeight, CnWidth,CnHeight, colours.green ) | |
| 39 | term.setBackgroundColour( colours.black ) | |
| 40 | term.setCursorPos(CnWidth-1,CnHeight+1) | |
| 41 | term.write("50%")
| |
| 42 | sleep(0.5) | |
| 43 | paintutils.drawLine(CnWidth,CnHeight, CnWidth+4,CnHeight, colours.green ) | |
| 44 | term.setBackgroundColour( colours.black ) | |
| 45 | term.setCursorPos(CnWidth-1,CnHeight+1) | |
| 46 | term.clearLine() | |
| 47 | term.write("78%")
| |
| 48 | sleep(0.3) | |
| 49 | term.setCursorPos(CnWidth-1,CnHeight+1) | |
| 50 | term.clearLine() | |
| 51 | term.write("80%")
| |
| 52 | sleep(0.5) | |
| 53 | paintutils.drawLine(CnWidth+4,CnHeight, CnWidth+5,CnHeight, colours.green ) | |
| 54 | term.setBackgroundColour( colours.black ) | |
| 55 | term.setCursorPos(CnWidth-1,CnHeight+1) | |
| 56 | term.clearLine() | |
| 57 | term.write("100%")
| |
| 58 | term.setCursorPos(CnWidth-3,CnHeight-1) | |
| 59 | term.clearLine() | |
| 60 | term.setBackgroundColour( colours.black ) | |
| 61 | term.write("Welcome!")
| |
| 62 | sleep(3) | |
| 63 | isStartup = false | |
| 64 | desktop() | |
| 65 | end | |
| 66 | ||
| 67 | ||
| 68 | desktop = function() | |
| 69 | ||
| 70 | isDesktop = true | |
| 71 | term.clear() | |
| 72 | pixelsDown = 1 | |
| 73 | pixelsDownLimit = height | |
| 74 | -- Desktop drawing | |
| 75 | ||
| 76 | while pixelsDown ~= height | |
| 77 | do paintutils.drawLine(1,pixelsDown, width,pixelsDown, colours.white ) | |
| 78 | pixelsDown = pixelsDown + 1 | |
| 79 | end | |
| 80 | paintutils.drawLine(1,height, width,height, colours.blue ) | |
| 81 | term.setCursorPos(1,height) | |
| 82 | term.setTextColour( colours.white ) | |
| 83 | term.setBackgroundColour( colours.lime ) | |
| 84 | term.write(' @ menu ')
| |
| 85 | ||
| 86 | -- Clock Drawing | |
| 87 | ||
| 88 | term.setCursorPos(width-6,height) | |
| 89 | term.setTextColour( colours.white ) | |
| 90 | term.setBackgroundColour( colours.blue ) | |
| 91 | term.write(formattedTime) | |
| 92 | ||
| 93 | -- Text Input Impeder | |
| 94 | ||
| 95 | while isDesktop == true do | |
| 96 | term.setBackgroundColour( colours.white ) | |
| 97 | term.setCursorPos(0,0) | |
| 98 | term.setCursorBlink(false) | |
| 99 | local event, click, x, y = os.pullEvent("mouse_click")
| |
| 100 | if x == 2 then | |
| 101 | if y == height then | |
| 102 | break | |
| 103 | end | |
| 104 | end | |
| 105 | end | |
| 106 | end | |
| 107 | ||
| 108 | drawWindow = function() | |
| 109 | term.clear() | |
| 110 | end | |
| 111 | ||
| 112 | ||
| 113 | drawMenu = function() | |
| 114 | isMenu = true | |
| 115 | local menuPD = 2 -- Menu pixels down | |
| 116 | local menuPDL = height-1 -- Menu pixels down limit | |
| 117 | local menuPUL = height-10 -- Menu pixels up limit | |
| 118 | -- Menu pixels right limit is = 15 | |
| 119 | while menuPD < menuPDL do | |
| 120 | paintutils.drawLine(1, menuPUL, 15, menuPUL, 400 ) | |
| 121 | menuPUL = menuPUL + 1 | |
| 122 | menuPD = menuPD + 1 | |
| 123 | - | end -- Dimensions of menu: w-15 from left, h-9 from height - 1 |
| 123 | + | end -- Dimensions of menu: w-15 from left, h-9 from height - 1 |
| 124 | term.setCursorPos(1,height) | |
| 125 | term.setTextColour( colours.white ) | |
| 126 | term.setBackgroundColour( colours.green ) | |
| 127 | term.write(" @ menu ")
| |
| 128 | ||
| 129 | paintutils.drawLine(9,height, 15,height, colours.blue ) | |
| 130 | term.setCursorPos(2,height-1) | |
| 131 | term.setBackgroundColour( 400 ) | |
| 132 | term.setTextColour( colours.yellow ) | |
| 133 | term.write("@ Exit") -- Logoff button
| |
| 134 | term.setCursorPos(2,height-2) | |
| 135 | term.setTextColour( colours.red ) | |
| 136 | term.write("@ Shutdown") -- Shutdown button
| |
| 137 | term.setCursorPos(2,height-3) | |
| 138 | term.setTextColour( colours.green ) | |
| 139 | - | -- menuButtons() |
| 139 | + | term.write("@ TMNET") -- Shutdown button
|
| 140 | ||
| 141 | term.setBackgroundColour( colours.white ) | |
| 142 | while isMenu == true do | |
| 143 | - | if x == 2 then |
| 143 | + | |
| 144 | if x == 2 and y == height then | |
| 145 | isMenu = false | |
| 146 | desktop() | |
| 147 | break | |
| 148 | end | |
| 149 | if x == 2 then | |
| 150 | if y == height-1 then | |
| 151 | isMenu = false | |
| 152 | isStartup = false | |
| 153 | - | --menuButtons = function() |
| 153 | + | isDesktop = false |
| 154 | - | -- while isMenu == true do |
| 154 | + | exit() |
| 155 | - | -- local event, click3, x, y = os.pullEvent("mouse_click")
|
| 155 | + | |
| 156 | - | -- if x == 2 then |
| 156 | + | end |
| 157 | - | -- if y == height-1 then |
| 157 | + | if x == 2 then |
| 158 | - | -- isMenu = false |
| 158 | + | if y == height-2 then |
| 159 | - | -- isDesktop = false |
| 159 | + | os.shutdown() |
| 160 | - | -- isStartup = false |
| 160 | + | |
| 161 | - | -- exit() |
| 161 | + | end |
| 162 | - | -- elseif x == 2 then |
| 162 | + | if x == 2 then |
| 163 | - | -- if y == height-2 then |
| 163 | + | if y == height-3 then |
| 164 | - | -- term.clear() |
| 164 | + | shell.run("web")
|
| 165 | - | -- exit() |
| 165 | + | |
| 166 | - | -- os.shutdown() |
| 166 | + | |
| 167 | - | -- else |
| 167 | + | |
| 168 | - | -- break |
| 168 | + | |
| 169 | - | -- end -- What the hell? Cannot find error in "end" syntax |
| 169 | + | end |
| 170 | - | --end |
| 170 | + | |
| 171 | end | |
| 172 | ||
| 173 | exit = function() | |
| 174 | term.clear() | |
| 175 | term.setBackgroundColour(colours.black) | |
| 176 | term.setTextColour(colours.white) | |
| 177 | term.setCursorPos(1,1) | |
| 178 | term.clear() | |
| 179 | end | |
| 180 | -- Program execution | |
| 181 | ||
| 182 | startup() | |
| 183 | ||
| 184 | drawMenu() | |
| 185 | ||
| 186 | while isDesktop == true do | |
| 187 | - | menuButtons() |
| 187 | + | |
| 188 | end |