Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mon = peripheral.wrap("right")
- x,y = mon.getSize()
- colors = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768}
- function drawTitle()
- string = " C T - W o r d "
- xstart = math.floor((x-#string)/2)
- mon.setBackgroundColor(2048)
- mon.setTextColor(1)
- mon.setCursorPos(xstart,1)
- mon.write(string)
- mon.setBackgroundColor(32768)
- mon.setTextColor(1)
- end
- function drawPage()
- for i=3,26 do
- mon.setCursorPos(1,i)
- if i==3 or i==26 then
- mon.write("+")
- else
- mon.write("|")
- end
- sleep(0.1)
- end
- for i=3,26 do
- mon.setCursorPos(27,i)
- if i==3 or i==26 then
- mon.write("+")
- else
- mon.write("|")
- end
- sleep(0.1)
- end
- for i=1,27 do
- mon.setCursorPos(i,3)
- if i==1 or i==27 then
- mon.write("+")
- else
- mon.write("-")
- end
- sleep(0.1)
- end
- for i=1,27 do
- mon.setCursorPos(i,26)
- if i==1 or i==27 then
- mon.write("+")
- else
- mon.write("-")
- end
- sleep(0.1)
- end
- end
- function drawOptions()
- ystart = math.floor((y-16)/2)
- for i=1,#colors do
- mon.setCursorPos(x-1,ystart+i)
- mon.setBackgroundColor(colors[i])
- mon.write(" ")
- sleep(0.1)
- end
- mon.setBackgroundColor(32768)
- mon.setCursorPos(x-3,ystart+1)
- mon.setBackgroundColor(512)
- mon.write("T")
- end
- function drawInfo(ln1,ln2,ln3)
- ystart = math.floor((y-4)/2)
- mon.setTextColor(1)
- mon.setBackgroundColor(512)
- for i=ystart,ystart+4 do
- mon.setCursorPos(3,i)
- for j=3,x-3 do
- mon.write(" ")
- end
- end
- for i=ystart,ystart+4 do
- mon.setCursorPos(3,i)
- if i==ystart or i==ystart+4 then
- for j=3,x-3 do
- if j==3 or j==x-3 then
- mon.write("+")
- else
- mon.write("-")
- end
- end
- else
- mon.setCursorPos(3,i)
- mon.write("|")
- mon.setCursorPos(x-3,i)
- mon.write("|")
- end
- end
- xstart = math.floor(((x-6)-#ln1)/2)
- mon.setCursorPos(5+xstart,ystart+1)
- mon.write(ln1)
- xstart = math.floor(((x-6)-#ln2)/2)
- mon.setCursorPos(5+xstart,ystart+2)
- mon.write(ln2)
- xstart = math.floor(((x-6)-#ln3)/2)
- mon.setCursorPos(5+xstart,ystart+3)
- mon.write(ln3)
- end
- function drawWarning(ln1,ln2,ln3)
- ystart = math.floor((y-4)/2)
- mon.setTextColor(1)
- mon.setBackgroundColor(2)
- for i=ystart,ystart+4 do
- mon.setCursorPos(3,i)
- for j=3,x-3 do
- mon.write(" ")
- end
- end
- for i=ystart,ystart+4 do
- mon.setCursorPos(3,i)
- if i==ystart or i==ystart+4 then
- for j=3,x-3 do
- if j==3 or j==x-3 then
- mon.write("+")
- else
- mon.write("-")
- end
- end
- else
- mon.setCursorPos(3,i)
- mon.write("|")
- mon.setCursorPos(x-3,i)
- mon.write("|")
- end
- end
- xstart = math.floor(((x-6)-#ln1)/2)
- mon.setCursorPos(5+xstart,ystart+1)
- mon.write(ln1)
- xstart = math.floor(((x-6)-#ln2)/2)
- mon.setCursorPos(5+xstart,ystart+2)
- mon.write(ln2)
- xstart = math.floor(((x-6)-#ln3)/2)
- mon.setCursorPos(5+xstart,ystart+3)
- mon.write(ln3)
- end
- function drawError(ln1,ln2,ln3)
- ystart = math.floor((y-4)/2)
- mon.setTextColor(1)
- mon.setBackgroundColor(16384)
- for i=ystart,ystart+4 do
- mon.setCursorPos(3,i)
- for j=3,x-3 do
- mon.write(" ")
- end
- end
- for i=ystart,ystart+4 do
- mon.setCursorPos(3,i)
- if i==ystart or i==ystart+4 then
- for j=3,x-3 do
- if j==3 or j==x-3 then
- mon.write("+")
- else
- mon.write("-")
- end
- end
- else
- mon.setCursorPos(3,i)
- mon.write("|")
- mon.setCursorPos(x-3,i)
- mon.write("|")
- end
- end
- xstart = math.floor(((x-6)-#ln1)/2)
- mon.setCursorPos(5+xstart,ystart+1)
- mon.write(ln1)
- xstart = math.floor(((x-6)-#ln2)/2)
- mon.setCursorPos(5+xstart,ystart+2)
- mon.write(ln2)
- xstart = math.floor(((x-6)-#ln3)/2)
- mon.setCursorPos(5+xstart,ystart+3)
- mon.write(ln3)
- end
- --main program
- drawTitle()
- drawPage()
- drawOptions()
- drawInfo("Testinfo","Du kannst dich nun gut","informiert fuehlen.")
- sleep(2)
- drawWarning("Testwarnung","Dies ist ein Test","Bitte ruhig bleiben.")
- sleep(2)
- drawError("Testfehler","Dies ist ein Fehler! Vorsicht!",">> Explosionsgefahr <<")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement