Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- username = ""
- 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 #username + 1 <= nLimit then
- username = username .. p1
- write(replaceChar or p1)
- end
- elseif event == "key" and p1 == keys.backspace and #username >= 1 then
- -- Backspace
- username = string.sub(username, 1, #username-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
- shell.run("textedit2", "order", "menu")
- x,y = 1
- elseif x >= 13 and x <= 29 and y == 6 then
- x,y = limitRead(16)
- if username == "dark" then
- shell.run("fg", "jobs2")
- end
- elseif y == 16 and x >= 32 and x <= 50 then
- busy = false
- end
- end
- term.setBackgroundColor(colors.lime)
- term.clear()
- paintutils.drawImage(paintutils.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("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("jobs", "a")
- file.writeLine(username)
- file.close()
- shell.run("copy", "order", username)
- file = fs.open(username, "a")
- file.writeLine(username)
- file.close()
- shell.run("delete", "order")
- os.shutdown()
Advertisement
Add Comment
Please, Sign In to add comment