term.clear()
term.setCursorPos(1,1)
--Draw func
function draw(dx1,dy1,dx2,dy2,dcol)
for a=dx1,dx2 do
for b=dy1,dy2 do
term.setCursorPos(a,B)/>
term.setBackgroundColor(dcol)
term.write(" ")
end
end
end
--Text func
function text(tx,ty,tcol,tcolb,txt)
term.setCursorPos(tx,ty)
term.setTextColor(tcol)
term.setBackgroundColor(tcolb)
term.write(txt)
end
--Vars
cpX=1
cpY=1
--Loop
while true do
sleep(0)
local event, key, xpos, ypos = os.pullEvent("key")
if key == 57 then
if cpX < 51 then
cpX = cpX + 1
elseif cpX == 51 then
if cpY < 19 then
cpY = cpY + 1
cpX = 1
elseif cpY == 19 then
end
end
elseif key == 14 then
if cpX > 1 then
draw(cpX,cpY,cpX,cpY,colors.black)
cpX = cpX - 1
elseif cpX == 1 then
if cpY > 1 then
draw(cpX,cpY,cpX,cpY,colors.black)
cpY = cpY - 1
cpX = 51
elseif cpY == 1 then
end
end
else
term.setCursorPos(cpX,cpY)
term.write(tostring(k))
cpX = cpX + 1
end
end
Edit: updated code.