Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rString = ""
- imagecount = 0
- prgmcount = 0
- Id = 0
- function loadimage(image)
- imagecount = imagecount + 1
- rednet.broadcast(image,"rimage")
- local senderId, message, protocol = rednet.receive()
- if message == "false" then
- print("page not found")
- else
- file = fs.open("image"..imagecount, "w")
- file.write(message)
- file.close()
- return "image"..imagecount
- end
- end
- function runserverside(file, args, arg2, arg3)
- rednet.broadcast(file,"runss")
- while not message == "sender" do
- Id, message, protocol = rednet.receive()
- end
- rednet.broadcast(args,"arg")
- os.sleep(0.1)
- rednet.broadcast(arg2,"arg")
- os.sleep(0.1)
- rednet.broadcast(arg3,"arg")
- end
- function loadprgm(program)
- prgmcount = prgmcount + 1
- rednet.broadcast(program,"rprgm")
- local senderId, message, protocol = rednet.receive()
- if message == "false" then
- print("page not found")
- else
- file = fs.open("prgm"..prgmcount, "w")
- file.write(message)
- file.close()
- return "prgm"..prgmcount
- end
- end
- function limitRead(nLimit, replaceChar)
- term.setCursorPos(13,6)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorBlink(true)
- local cX, cY = term.getCursorPos()
- working = true
- if replaceChar == "" then replaceChar = nil end
- while working do
- local event, p1, p2, p3 = os.pullEvent()
- if event == "char" then
- -- Character event
- if #rString + 1 <= nLimit then
- rString = rString .. p1
- write(replaceChar or p1)
- end
- elseif event == "key" and p1 == keys.backspace and #rString >= 1 then
- -- Backspace
- rString = string.sub(rString, 1, #rString-1)
- xPos, yPos = term.getCursorPos()
- term.setCursorPos(xPos-1, yPos)
- write(" ")
- term.setCursorPos(xPos-1, yPos)
- end
- if event == "key" and p1 == keys.enter then
- working = false
- elseif event == "mouse_click" then
- if p2 >= 13 and p2 <= 29 and p3 == 6 then
- os.sleep(0)
- else
- working = false
- return p2, p3
- end
- end
- end
- term.setCursorBlink(false)
- return 1,1
- end
- function testmouse()
- if busy == false then
- return
- end
- if x>= 13 and x<= 34 and y>=9 and y<=14 then
- textedit2 = loadprgm("textedit2")
- shell.run(textedit2, "order", "menu")
- x,y = 1
- elseif x >= 13 and x <= 29 and y == 6 then
- x,y = limitRead(16)
- username = rString
- if username == "dark" then
- shell.run("fg", "jobs2")
- end
- elseif y == 16 and x >= 32 and x <= 38 then
- busy = false
- end
- end
- term.setBackgroundColor(colors.lime)
- term.clear()
- paintutils.drawImage(paintutils.loadImage(loadimage("menupic")), 2, 1)
- for i=1, 51 do
- paintutils.drawLine(1, 19, i, 19,colors.green)
- os.sleep(0)
- end
- term.setBackgroundColor(colors.white)
- term.clear()
- paintutils.drawImage(paintutils.loadImage(loadimage("menupic2")), 9, 4)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.setCursorPos(13,5)
- term.write("Username")
- term.setCursorPos(13,8)
- term.write("order")
- term.setCursorPos(13,6)
- term.setBackgroundColor(colors.lightBlue)
- busy = true
- while busy do
- event, button, x, y = os.pullEvent( "mouse_click" )
- testmouse()
- testmouse()
- end
- file = fs.open("order", "r")
- order = file.readAll()
- file.close()
- runserverside("getorders", "dark", username, order)
Advertisement
Add Comment
Please, Sign In to add comment