SHOW:
|
|
- or go back to the newest paste.
| 1 | - | username = "" |
| 1 | + | rString = "" |
| 2 | imagecount = 0 | |
| 3 | prgmcount = 0 | |
| 4 | Id = 0 | |
| 5 | ||
| 6 | function loadimage(image) | |
| 7 | imagecount = imagecount + 1 | |
| 8 | rednet.broadcast(image,"rimage") | |
| 9 | local senderId, message, protocol = rednet.receive() | |
| 10 | if message == "false" then | |
| 11 | print("page not found")
| |
| 12 | else | |
| 13 | file = fs.open("image"..imagecount, "w")
| |
| 14 | - | if #username + 1 <= nLimit then |
| 14 | + | file.write(message) |
| 15 | - | username = username .. p1 |
| 15 | + | file.close() |
| 16 | return "image"..imagecount | |
| 17 | end | |
| 18 | - | elseif event == "key" and p1 == keys.backspace and #username >= 1 then |
| 18 | + | |
| 19 | ||
| 20 | - | username = string.sub(username, 1, #username-1) |
| 20 | + | function runserverside(file, args, arg2, arg3) |
| 21 | rednet.broadcast(file,"runss") | |
| 22 | while not message == "sender" do | |
| 23 | Id, message, protocol = rednet.receive() | |
| 24 | end | |
| 25 | rednet.broadcast(args,"arg") | |
| 26 | os.sleep(0.1) | |
| 27 | rednet.broadcast(arg2,"arg") | |
| 28 | os.sleep(0.1) | |
| 29 | rednet.broadcast(arg3,"arg") | |
| 30 | end | |
| 31 | ||
| 32 | function loadprgm(program) | |
| 33 | prgmcount = prgmcount + 1 | |
| 34 | rednet.broadcast(program,"rprgm") | |
| 35 | local senderId, message, protocol = rednet.receive() | |
| 36 | if message == "false" then | |
| 37 | print("page not found")
| |
| 38 | else | |
| 39 | file = fs.open("prgm"..prgmcount, "w")
| |
| 40 | file.write(message) | |
| 41 | file.close() | |
| 42 | return "prgm"..prgmcount | |
| 43 | end | |
| 44 | end | |
| 45 | ||
| 46 | - | shell.run("textedit2", "order", "menu")
|
| 46 | + | |
| 47 | term.setCursorPos(13,6) | |
| 48 | term.setBackgroundColor(colors.lightBlue) | |
| 49 | term.setCursorBlink(true) | |
| 50 | local cX, cY = term.getCursorPos() | |
| 51 | working = true | |
| 52 | if replaceChar == "" then replaceChar = nil end | |
| 53 | - | elseif y == 16 and x >= 32 and x <= 50 then |
| 53 | + | |
| 54 | local event, p1, p2, p3 = os.pullEvent() | |
| 55 | if event == "char" then | |
| 56 | -- Character event | |
| 57 | if #rString + 1 <= nLimit then | |
| 58 | rString = rString .. p1 | |
| 59 | write(replaceChar or p1) | |
| 60 | - | paintutils.drawImage(paintutils.loadImage("menupic"), 2, 1)
|
| 60 | + | |
| 61 | elseif event == "key" and p1 == keys.backspace and #rString >= 1 then | |
| 62 | -- Backspace | |
| 63 | rString = string.sub(rString, 1, #rString-1) | |
| 64 | xPos, yPos = term.getCursorPos() | |
| 65 | term.setCursorPos(xPos-1, yPos) | |
| 66 | write(" ")
| |
| 67 | - | paintutils.drawImage(paintutils.loadImage("menupic2"), 9, 4)
|
| 67 | + | |
| 68 | end | |
| 69 | if event == "key" and p1 == keys.enter then | |
| 70 | working = false | |
| 71 | elseif event == "mouse_click" then | |
| 72 | if p2 >= 13 and p2 <= 29 and p3 == 6 then | |
| 73 | os.sleep(0) | |
| 74 | else | |
| 75 | working = false | |
| 76 | return p2, p3 | |
| 77 | end | |
| 78 | end | |
| 79 | end | |
| 80 | term.setCursorBlink(false) | |
| 81 | return 1,1 | |
| 82 | end | |
| 83 | ||
| 84 | - | file = fs.open("jobs", "a")
|
| 84 | + | |
| 85 | - | file.writeLine(username) |
| 85 | + | |
| 86 | return | |
| 87 | - | shell.run("copy", "order", username)
|
| 87 | + | |
| 88 | - | file = fs.open(username, "a") |
| 88 | + | |
| 89 | - | file.writeLine(username) |
| 89 | + | textedit2 = loadprgm("textedit2")
|
| 90 | shell.run(textedit2, "order", "menu") | |
| 91 | - | shell.run("delete", "order")
|
| 91 | + | |
| 92 | - | os.shutdown() |
| 92 | + | |
| 93 | x,y = limitRead(16) | |
| 94 | username = rString | |
| 95 | if username == "dark" then | |
| 96 | shell.run("fg", "jobs2")
| |
| 97 | end | |
| 98 | elseif y == 16 and x >= 32 and x <= 38 then | |
| 99 | busy = false | |
| 100 | end | |
| 101 | end | |
| 102 | ||
| 103 | ||
| 104 | term.setBackgroundColor(colors.lime) | |
| 105 | term.clear() | |
| 106 | paintutils.drawImage(paintutils.loadImage(loadimage("menupic")), 2, 1)
| |
| 107 | for i=1, 51 do | |
| 108 | paintutils.drawLine(1, 19, i, 19,colors.green) | |
| 109 | os.sleep(0) | |
| 110 | end | |
| 111 | term.setBackgroundColor(colors.white) | |
| 112 | term.clear() | |
| 113 | paintutils.drawImage(paintutils.loadImage(loadimage("menupic2")), 9, 4)
| |
| 114 | term.setBackgroundColor(colors.white) | |
| 115 | term.setTextColor(colors.black) | |
| 116 | term.setCursorPos(13,5) | |
| 117 | term.write("Username")
| |
| 118 | term.setCursorPos(13,8) | |
| 119 | term.write("order")
| |
| 120 | ||
| 121 | term.setCursorPos(13,6) | |
| 122 | term.setBackgroundColor(colors.lightBlue) | |
| 123 | ||
| 124 | busy = true | |
| 125 | while busy do | |
| 126 | event, button, x, y = os.pullEvent( "mouse_click" ) | |
| 127 | testmouse() | |
| 128 | testmouse() | |
| 129 | end | |
| 130 | file = fs.open("order", "r")
| |
| 131 | order = file.readAll() | |
| 132 | file.close() | |
| 133 | ||
| 134 | runserverside("getorders", "dark", username, order) |