View difference between Paste ID: K9L1EhB5 and ynNxWtrp
SHOW: | | - or go back to the newest paste.
1-
local FileList = fs.list(".modderOS/programme/liste/")
1+
shell.run("/.modderOS/einstellungen")
2
local FileList = fs.list("/.modderOS/programme/liste/")
3
local xx,yy = term.getSize()
4
local quit = 0
5
menu_items = {}
6
local select = 0
7
8
9
function reset()
10-
        term.setBackgroundColor(colors.blue)
10+
11
        term.setBackgroundColor(einstellungen[1])
12
	term.setTextColor(einstellungen[3])
13-
        paintutils.drawLine(1, 1, x, 1, colors.lightGray)
13+
14
        term.setCursorPos(1, 1)
15
        paintutils.drawLine(1, 1, x, 1, einstellungen[2])
16
        term.setCursorPos(1, 1)
17
        print("Programmliste")
18
	local x1 = x-6
19-
	term.setBackgroundColour(colors.blue)
19+
20
	print("Zurück")
21
	term.setBackgroundColour(einstellungen[1])
22
	menu_items = {}
23
	for _, file in ipairs(FileList) do
24
	  table.insert(menu_items, file)
25
	end
26
	for i=1, #menu_items, 1 do
27
 		if i <= 17 then
28
 			 local ii = i+1
29
 			 term.setCursorPos(1,ii)
30
 		elseif i >= 18 and i <= 34 then
31
 			 local ii = i-16
32
 			 term.setCursorPos(18,ii)
33
 		elseif i >= 35 and i <= 51 then
34
		local ii = i-33
35
 			 term.setCursorPos(35,ii)
36
 		end
37
 		print(menu_items[i])
38
	end
39
end
40
41
reset()
42
43
while quit == 0 do
44
45
 local event, button, x, y = os.pullEvent("mouse_click")
46
 	if event == "mouse_click" then
47
                        if y == 1 and x > xx-7 and x < xx then
48
				quit = 1
49
                        end
50
			for iy=2,18,1 do
51
                        	if y == iy and x <= 17 then
52
					select = iy-1
53
                        	end
54
			end
55
			for iy=2,18,1 do
56
                        	if y == iy and x <= 34 and x >= 18 then
57
					select = iy+16
58
                        	end
59
			end
60
			for iy=2,18,1 do
61
                        	if y == iy and x >= 35 then
62
					select = iy+33
63
                        	end
64
			end
65
66-
 term.setBackgroundColor(colors.blue)
66+
67
if select ~= 0 and select <= #menu_items then
68
 term.setBackgroundColor(einstellungen[1])
69
 term.setCursorPos(1, 1)
70
 term.clear()
71
 shell.run(".modderOS/programme/"..menu_items[select])
72
 reset()
73
 select = 0
74
end
75
end
76
77
os.reboot()