Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- moni=peripheral.find("monitor")
- moni.setTextScale(2)
- testE=fs.exists("MoniNachricht")
- testZ=fs.exists("MoniFarbe")
- knopf={{1,3,"Neue Nachricht",colors.blue},
- {1,7,"F",colors.white,2},
- {5,7,"F",colors.orange,3},
- {9,7,"F",colors.magenta,4},
- {1,9,"F",colors.lightBlue,5},
- {5,9,"F",colors.yellow,6},
- {9,9,"F",colors.lime,7},
- {1,11,"F",colors.pink,8},
- {5,11,"F",colors.gray,9},
- {9,11,"F",colors.lightGray,10},
- {1,13,"F",colors.cyan,11},
- {5,13,"F",colors.purple,12},
- {9,13,"F",colors.blue,13},
- {1,15,"F",colors.brown,14},
- {5,15,"F",colors.green,15},
- {9,15,"F",colors.red,16}}
- if testE then
- else
- a=fs.open("MoniNachricht","w")
- a.write("Nachricht")
- a.close()
- end
- if testZ then
- else
- a=fs.open("MoniFarbe","w")
- a.write("2")
- a.close()
- end
- function button(tex,farb)
- term.setTextColor(colors.lightGray)
- term.write("[")
- term.setTextColor(farb)
- term.write(tex)
- term.setTextColor(colors.lightGray)
- term.write("]")
- end
- function start()
- while true do
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.white)
- write("Monitor-Schleifenprogramm")
- term.setCursorPos(1,5)
- write("Farben")
- for i=1, #knopf do
- term.setCursorPos(knopf[i][1],knopf[i][2])
- button(knopf[i][3],knopf[i][4])
- end
- eve={os.pullEvent()}
- if eve[1]=="mouse_click" then
- if eve[4]==3 and eve[3]>0 and eve[3]<17 then
- new()
- end
- for i=1, #knopf do
- anfang=knopf[i][1]
- ende=anfang+2
- if eve[4]==knopf[i][2] and eve[3]>anfang and eve[3]<ende then
- fa=fs.open("MoniFarbe","w")
- fa.write(knopf[i][5])
- fa.close()
- end
- end
- end
- end
- end
- function new()
- term.clear()
- term.setCursorPos(1,1)
- write("Neue Nachricht:")
- text=read()
- TX=fs.open("MoniNachricht","w")
- TX.write(text)
- TX.close()
- end
- function wait()
- sleep(30)
- end
- function mon()
- while true do
- moni.setTextScale(5)
- e,s=moni.getSize()
- e=e+1
- nach=fs.open("MoniNachricht","r")
- text=nach.readAll()
- nach.close()
- fa=fs.open("MoniFarbe","r")
- farbe=fa.readAll()
- fa.close()
- farbe=farbe+0
- te=text
- zahl=0
- for i=1, #te do
- te:gsub(i,i)
- zahl=zahl+1
- end
- s=s-zahl
- moni.setTextColor(knopf[farbe][4])
- while e>s do
- moni.clear()
- moni.setCursorPos(e,1)
- moni.write(text)
- e=e-1
- sleep(0.5)
- end
- end
- end
- parallel.waitForAll(start,mon)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement