Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.run("/.modderOS/einstellungen")
- local FileList = fs.list("/.modderOS/programme/liste/")
- local xx,yy = term.getSize()
- local quit = 0
- menu_items = {}
- local select = 0
- function reset()
- local x,y = term.getSize()
- term.setBackgroundColor(einstellungen[1])
- term.setTextColor(einstellungen[3])
- term.clear()
- term.setCursorPos(1, 1)
- paintutils.drawLine(1, 1, x, 1, einstellungen[2])
- term.setCursorPos(1, 1)
- print("Programmliste")
- local x1 = x-6
- term.setCursorPos(x1,1)
- print("Zurück")
- term.setBackgroundColour(einstellungen[1])
- menu_items = {}
- for _, file in ipairs(FileList) do
- table.insert(menu_items, file)
- end
- for i=1, #menu_items, 1 do
- if i <= 17 then
- local ii = i+1
- term.setCursorPos(1,ii)
- elseif i >= 18 and i <= 34 then
- local ii = i-16
- term.setCursorPos(18,ii)
- elseif i >= 35 and i <= 51 then
- local ii = i-33
- term.setCursorPos(35,ii)
- end
- print(menu_items[i])
- end
- end
- reset()
- while quit == 0 do
- local event, button, x, y = os.pullEvent("mouse_click")
- if event == "mouse_click" then
- if y == 1 and x > xx-7 and x < xx then
- quit = 1
- end
- for iy=2,18,1 do
- if y == iy and x <= 17 then
- select = iy-1
- end
- end
- for iy=2,18,1 do
- if y == iy and x <= 34 and x >= 18 then
- select = iy+16
- end
- end
- for iy=2,18,1 do
- if y == iy and x >= 35 then
- select = iy+33
- end
- end
- end
- if select ~= 0 and select <= #menu_items then
- term.setBackgroundColor(einstellungen[1])
- term.setCursorPos(1, 1)
- term.clear()
- shell.run(".modderOS/programme/"..menu_items[select])
- reset()
- select = 0
- end
- end
- os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement