??
There is a easy program with problem.
13
th is a error
local function prc(text, y)
local w = term.getSize()
local _, cy = term.getCursorPos()
term.setCursorPos(math.ceil((w-#text)/2), y or cy)
write(text)
end
function start ()
if fs.exists ("/system/RAM/test") then
local data = fs.open ("/system/RAM/test", "r")
funkce = data.readLine ()
data.close ()
(funkce.." ()")
else
menuc ()
end
end
function minimalizace ()
if fs.exists ("/system/RAM/test") then
fs.delete ("/system/RAM/test")
end
local data = fs.open ("/system/RAM/test", "w")
data.writeLine(funkce)
data.close ()
shell.run ("/system/desktop")
end
function ukonceni ()
if fs.exists ("/system/RAM/test") then
fs.delete ("/system/RAM/test")
end
shell.run ("/system/desktop")
end
function menuc ()
term.setBackgroundColor(colors.white)
term.setTextColor(colors.black)
term.clear ()
prc ("Choose a color", 2)
term.setCursorPos(5,5)
print "- Blue"
term.setCursorPos(5,7)
print "- Red"
term.setCursorPos(5,9)
print "- Orange"
term.setCursorPos(5,11)
print "- Magenta"
term.setCursorPos(5,13)
print "- Green"
while true do
local event, button, x, y = os.pullEvent("mouse_click")
xy = x..","..y
if x >= 5 and x <= 10 and y == 5 and button == 1 then
blue ()
elseif x >= 5 and x <= 10 and y == 7 and button == 1 then
red ()
elseif x >= 5 and x <= 10 and y == 9 and button == 1 then
orange ()
elseif x >= 5 and x <= 10 and y == 11 and button == 1 then
magenta ()
elseif x >= 5 and x <= 10 and y == 13 and button == 1 then
green ()
else
paintutils.drawLine(1, 1, 51, 1, colors.black)
paintutils.drawPixel (51,1, colors.red)
term.setTextColor(colors.white)
term.setCursorPos (51,1)
print "*"
while true do
local event, button, x, y = os.pullEvent("mouse_click")
xy = x..","..y
if x == 51 and y == 1 then
shell.run ("/system/desktop")
else
menuc()
end
end
end
end
end
function blue ()
funkce = "blue"
term.setBackgroundColor(colors.blue)
term.setTextColor(colors.white)
term.clear ()
term.setCursorPos(5,5)
print "- Blue"
term.setCursorPos(5,7)
print "- Red"
term.setCursorPos(5,9)
print "- Orange"
term.setCursorPos(5,11)
print "- Magenta"
term.setCursorPos(5,13)
print "- Green"
while true do
local event, button, x, y = os.pullEvent("mouse_click")
xy = x..","..y
if x >= 5 and x <= 10 and y == 5 and button == 1 then
blue ()
elseif x >= 5 and x <= 10 and y == 7 and button == 1 then
red ()
elseif x >= 5 and x <= 10 and y == 9 and button == 1 then
orange ()
elseif x >= 5 and x <= 10 and y == 11 and button == 1 then
magenta ()
elseif x >= 5 and x <= 10 and y == 13 and button == 1 then
green ()
else
paintutils.drawLine(1, 1, 51, 1, colors.black)
paintutils.drawPixel (51,1, colors.red)
term.setTextColor(colors.white)
term.setCursorPos (51,1)
print "*"
paintutils.drawPixel (50,1, colors.lightGray)
term.setCursorPos (50,1)
print "<"
paintutils.drawPixel (49,1, colors.lightGray)
term.setCursorPos (49,1)
print "_"
local event, button, x, y = os.pullEvent("mouse_click")
xy = x..","..y
if x == 51 and y == 1 then
shell.run ("/system/desktop")
elseif x == 50 and y == 1 then
menuc ()
elseif x == 49 and y == 1 then
minimalizace ()
else
blue ()
end
end
end
end
function red ()
funkce = "red"
term.setBackgroundColor(colors.red)
term.setTextColor(colors.white)
term.clear ()
term.setCursorPos(5,5)
print "- Blue"
term.setCursorPos(5,7)
print "- Red"
term.setCursorPos(5,9)
print "- Orange"
term.setCursorPos(5,11)
print "- Magenta"
term.setCursorPos(5,13)
print "- Green"
while true do
local event, button, x, y = os.pullEvent("mouse_click")
xy = x..","..y
if x >= 5 and x <= 10 and y == 5 and button == 1 then
blue ()
elseif x >= 5 and x <= 10 and y == 7 and button == 1 then
red ()
elseif x >= 5 and x <= 10 and y == 9 and button == 1 then
orange ()
elseif x >= 5 and x <= 10 and y == 11 and button == 1 then
magenta ()
elseif x >= 5 and x <= 10 and y == 13 and button == 1 then
green ()
else
paintutils.drawLine(1, 1, 51, 1, colors.black)
paintutils.drawPixel (51,1, colors.red)
term.setTextColor(colors.white)
term.setCursorPos (51,1)
print "*"
paintutils.drawPixel (50,1, colors.lightGray)
term.setCursorPos (50,1)
print "<"
paintutils.drawPixel (49,1, colors.lightGray)
term.setCursorPos (49,1)
print "_"
local event, button, x, y = os.pullEvent("mouse_click")
xy = x..","..y
if x == 51 and y == 1 then
shell.run ("/system/desktop")
elseif x == 50 and y == 1 then
menuc ()
elseif x == 49 and y == 1 then
minimalizace ()
else
red ()
end
end
end
end
function orange ()
funkce = "orange"
term.setBackgroundColor(colors.orange)
term.setTextColor(colors.white)
term.clear ()
term.setCursorPos(5,5)
print "- Blue"
term.setCursorPos(5,7)
print "- Red"
term.setCursorPos(5,9)
print "- Orange"
term.setCursorPos(5,11)
print "- Magenta"
term.setCursorPos(5,13)
print "- Green"
while true do
local event, button, x, y = os.pullEvent("mouse_click")
xy = x..","..y
if x >= 5 and x <= 10 and y == 5 and button == 1 then
blue ()
elseif x >= 5 and x <= 10 and y == 7 and button == 1 then
red ()
elseif x >= 5 and x <= 10 and y == 9 and button == 1 then
orange ()
elseif x >= 5 and x <= 10 and y == 11 and button == 1 then
magenta ()
elseif x >= 5 and x <= 10 and y == 13 and button == 1 then
green ()
else
paintutils.drawLine(1, 1, 51, 1, colors.black)
paintutils.drawPixel (51,1, colors.red)
term.setTextColor(colors.white)
term.setCursorPos (51,1)
print "*"
paintutils.drawPixel (50,1, colors.lightGray)
term.setCursorPos (50,1)
print "<"
paintutils.drawPixel (49,1, colors.lightGray)
term.setCursorPos (49,1)
print "_"
local event, button, x, y = os.pullEvent("mouse_click")
xy = x..","..y
if x == 51 and y == 1 then
shell.run ("/system/desktop")
elseif x == 50 and y == 1 then
menuc ()
elseif x == 49 and y == 1 then
minimalizace ()
else
orange ()
end
end
end
end
function magenta ()
funkce = "magenta"
term.setBackgroundColor(colors.magenta)
term.setTextColor(colors.white)
term.clear ()
term.setCursorPos(5,5)
print "- Blue"
term.setCursorPos(5,7)
print "- Red"
term.setCursorPos(5,9)
print "- Orange"
term.setCursorPos(5,11)
print "- Magenta"
term.setCursorPos(5,13)
print "- Green"
while true do
local event, button, x, y = os.pullEvent("mouse_click")
xy = x..","..y
if x >= 5 and x <= 10 and y == 5 and button == 1 then
blue ()
elseif x >= 5 and x <= 10 and y == 7 and button == 1 then
red ()
elseif x >= 5 and x <= 10 and y == 9 and button == 1 then
orange ()
elseif x >= 5 and x <= 10 and y == 11 and button == 1 then
magenta ()
elseif x >= 5 and x <= 10 and y == 13 and button == 1 then
green ()
else
paintutils.drawLine(1, 1, 51, 1, colors.black)
paintutils.drawPixel (51,1, colors.red)
term.setTextColor(colors.white)
term.setCursorPos (51,1)
print "*"
paintutils.drawPixel (50,1, colors.lightGray)
term.setCursorPos (50,1)
print "<"
paintutils.drawPixel (49,1, colors.lightGray)
term.setCursorPos (49,1)
print "_"
local event, button, x, y = os.pullEvent("mouse_click")
xy = x..","..y
if x == 51 and y == 1 then
shell.run ("/system/desktop")
elseif x == 50 and y == 1 then
menuc ()
elseif x == 49 and y == 1 then
minimalizace ()
else
magenta ()
end
end
end
end
function green ()
funkce = "green"
term.setBackgroundColor(colors.green)
term.setTextColor(colors.white)
term.clear ()
term.setCursorPos(5,5)
print "- Blue"
term.setCursorPos(5,7)
print "- Red"
term.setCursorPos(5,9)
print "- Orange"
term.setCursorPos(5,11)
print "- Magenta"
term.setCursorPos(5,13)
print "- Green"
while true do
local event, button, x, y = os.pullEvent("mouse_click")
xy = x..","..y
if x >= 5 and x <= 10 and y == 5 and button == 1 then
blue ()
elseif x >= 5 and x <= 10 and y == 7 and button == 1 then
red ()
elseif x >= 5 and x <= 10 and y == 9 and button == 1 then
orange ()
elseif x >= 5 and x <= 10 and y == 11 and button == 1 then
magenta ()
elseif x >= 5 and x <= 10 and y == 13 and button == 1 then
green ()
else
paintutils.drawLine(1, 1, 51, 1, colors.black)
paintutils.drawPixel (51,1, colors.red)
term.setTextColor(colors.white)
term.setCursorPos (51,1)
print "*"
paintutils.drawPixel (50,1, colors.lightGray)
term.setCursorPos (50,1)
print "<"
paintutils.drawPixel (49,1, colors.lightGray)
term.setCursorPos (49,1)
print "_"
local event, button, x, y = os.pullEvent("mouse_click")
xy = x..","..y
if x == 51 and y == 1 then
shell.run ("/system/desktop")
elseif x == 50 and y == 1 then
menuc ()
elseif x == 49 and y == 1 then
minimalizace ()
else
green ()
end
end
end
end
start ()