Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("EssentiaMonitor is running")
- mon = peripheral.wrap("monitor_0")
- mon.clear()
- -- Alle Essentia Namen
- Essentia = {"Aer", "Terra", "Ignis", "Aqua", "Ordo", "Perditio", "Vacuos", "Lux", "Tempestas", "Motus", "Gelum", "Vitreus", "Victus", "Venenum", "Potentia", "Permutatio", "Metallum", "Mortuus", "Volatus", "Tenebrae", "Spiritus", "Sano", "Iter", "Alienis", "Praecantatio", "Auram", "Vitium", "Limus", "Herba", "Arbor", "Bestia", "Corpus", "Exanimis", "Cognitio", "Sensus", "Humanus", "Messis", "Perfodio", "Instrumentum", "Meto", "Telum", "Tutamen", "Fames", "Lucrum", "Fabrico", "Pannus", "Machina", "Vinculum", "Luxuria", "Infernus", "Superbia", "Gula", "Invidia", "Desidia", "Ira", "Tempus"}
- Ess_status = {}
- -- Liest die Essentia Werte vom me aus
- function lText(txt)--gibt die textlaenge aus--
- zUp=0
- txt=tostring(txt)
- for i=1, #txt do
- txt:gsub(i,i)
- zUp=zUp+1
- end
- return zUp
- end
- function expandtext(txt, fzahl)
- --print(txt)
- stingzeichen=lText(txt)
- hinzu = fzahl -stingzeichen
- --print(hinzu)
- while hinzu > 0 do
- txt=txt.." "
- hinzu=hinzu-1
- end
- --txt=txt.." "
- --stringzeichen=stringzeichen+1
- --end
- return txt
- end
- function readessentiaValues(essentianame)
- essentia= peripheral.wrap("EssentiaProvider_2")
- return essentia.getAmount((essentianame))
- end
- function monitorrun()
- Ess_status["red"]={}
- Ess_status["green"]={}
- Ess_status["yellow"]={}
- Ess_status["greengold"]={}
- mindestwert= 64
- optimalwert= 500
- goldwert= 9999
- greengoldentry=1
- greenentry=1
- yellowentry=1
- redentry=1
- for i=1,#Essentia do
- value = readessentiaValues(Essentia[i])
- if value < mindestwert then
- Ess_status["red"][redentry]= " "..expandtext(tostring(Essentia[i]), 12).." ["..expandtext(tostring(value), 6).."] "
- redentry=redentry+1
- else
- if value > optimalwert then
- if value > goldwert then
- Ess_status["greengold"][greengoldentry]= " "..expandtext(tostring(Essentia[i]), 12).." ["..expandtext(tostring(value), 6).."] "
- greengoldentry=greengoldentry+1
- else
- Ess_status["green"][greenentry]= " "..expandtext(tostring(Essentia[i]), 12).." ["..expandtext(tostring(value), 6).."] "
- greenentry=greenentry+1
- end
- else
- Ess_status["yellow"][yellowentry]= " "..expandtext(tostring(Essentia[i]), 12).." ["..expandtext(tostring(value), 6).."] "
- yellowentry=yellowentry+1
- end
- end
- end
- mon.setTextScale(1)
- spalten={1,25,49}
- akt_spalte=1
- zeile=1
- for i=1,#Ess_status["greengold"] do
- if zeile==20 then
- akt_spalte=akt_spalte+1
- zeile=1
- end
- mon.setCursorPos(spalten[akt_spalte], zeile)
- mon.setBackgroundColor(colors.lime)
- mon.setTextColor(colors.orange)
- mon.write(Ess_status["greengold"][i])
- mon.setTextColor(colors.white)
- mon.setBackgroundColor(colors.black)
- zeile=zeile+1
- end
- for i=1,#Ess_status["green"] do
- if zeile==20 then
- akt_spalte=akt_spalte+1
- zeile=1
- end
- mon.setCursorPos(spalten[akt_spalte], zeile)
- mon.setBackgroundColor(colors.lime)
- mon.setTextColor(colors.black)
- mon.write(Ess_status["green"][i])
- mon.setTextColor(colors.white)
- mon.setBackgroundColor(colors.black)
- zeile=zeile+1
- end
- for i=1,#Ess_status["yellow"] do
- if zeile==20 then
- akt_spalte=akt_spalte+1
- zeile=1
- end
- mon.setCursorPos(spalten[akt_spalte], zeile)
- mon.setBackgroundColor(colors.yellow)
- mon.setTextColor(colors.black)
- mon.write(Ess_status["yellow"][i])
- mon.setTextColor(colors.white)
- mon.setBackgroundColor(colors.black)
- zeile=zeile+1
- end
- for i=1,#Ess_status["red"] do
- if zeile==20 then
- akt_spalte=akt_spalte+1
- zeile=1
- end
- mon.setCursorPos(spalten[akt_spalte], zeile)
- mon.setBackgroundColor(colors.red)
- mon.setTextColor(colors.black)
- mon.write(Ess_status["red"][i])
- mon.setTextColor(colors.white)
- mon.setBackgroundColor(colors.black)
- zeile=zeile+1
- end
- mon.setCursorPos(spalten[akt_spalte], zeile)
- mon.setBackgroundColor(colors.magenta)
- mon.setTextColor(colors.purple)
- mon.write(" Essentia Monitor V1.0 ")
- mon.setTextColor(colors.white)
- mon.setBackgroundColor(colors.black)
- end
- while true do
- monitorrun()
- os.sleep(3)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement