Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("ocs/apis/sensor")
- local monSide = "back"
- local Bcol = colors.lightGray
- local Tcol = colors.white
- local senSide = "right"
- local Bcolstart = colors.lightGray
- local senX = -2
- local senY = 0
- local senZ = 0
- --nur bei kleinen Me-Systemen verwenden!
- local showAll = true
- mon = peripheral.wrap(monSide)
- sen = sensor.wrap(senSide)
- local xMax,yMax = mon.getSize()
- Items = {"Glass","UU-Matter","Cobblestone","Mycelium"}
- Item = {}
- for i = 1,#Items do
- Item[i] = {"_","_",Items[i]}
- end
- function Bg(xP1,yP1,xP2,yP2,col)
- mon.setBackgroundColor(col)
- for xPos = xP1,xP2 do
- for yPos = yP1,yP2 do
- mon.setCursorPos(xPos,yPos)
- mon.write(" ")
- end
- end
- end
- function monitorsp(text)
- for x=1,string.len(text) do
- char = string.sub(text,x,x)
- mon.write(char)
- sleep(0.2) -- change this to change the print delay
- end
- end
- function JoJa(xP,yP)
- mon.setCursorPos(xP,yP)
- mon.setBackgroundColor(colors.gray)
- mon.setTextColor(colors.cyan)
- mon.write("Jo")
- mon.setTextColor(colors.orange)
- mon.write("Ja ")
- mon.setTextColor(colors.lightGray)
- mon.write("Productions")
- mon.setBackgroundColor(colors.black)
- mon.setTextColor(colors.white)
- end
- function Bstart()
- Bg(1,1,xMax,yMax,Bcolstart)
- Bg(xMax/2-9,5,xMax/2+8,7,colors.gray)
- JoJa(xMax/2-8,6)
- mon.setCursorPos(xMax/2-7,10)
- mon.setBackgroundColor(Bcolstart)
- mon.setTextColor(colors.black)
- monitorsp("praesentiert:")
- mon.setTextColor(colors.white)
- Bg(xMax/2-9,9,xMax/2+8,11,colors.cyan)
- mon.setCursorPos(xMax/2-8,10)
- mon.setBackgroundColor(colors.cyan)
- mon.write("Me-System Reader")
- Bg(8,yMax-11,xMax-9,yMax-8,colors.red)
- mon.setCursorPos(9,yMax-10)
- mon.write("Copyright by JoJa Productions")
- mon.setCursorPos(9,yMax-9)
- mon.write("Weitergabe ist nicht gestattet!")
- event = os.pullEvent("monitor_touch")
- end
- Bstart()
- Page = 1
- while true do
- mon.setBackgroundColor(colors.black)
- mon.setTextColor(colors.white)
- mon.clear()
- Bg(1,1,xMax,yMax,Bcol)
- ziele = sen.getTargets()
- for k,v in pairs(ziele) do
- if v.Name == "ME Wireless Access Point"
- and v.Position.X== senX
- and v.Position.Y== senY
- and v.Position.Z== senZ
- then
- mon.setTextColor(Tcol)
- Bg(2,2,xMax-1,4,colors.gray)
- mon.setBackgroundColor(colors.gray)
- details = sen.getTargetDetails(k)
- mon.setCursorPos(2,2)
- mon.write("Benutzte Itemarten: "..details.UsedTypes.." Arten")
- mon.setCursorPos(2,3)
- mon.write("Freie Itemarten: "..details.FreeTypes.." Arten")
- mon.setCursorPos(2,4)
- mon.write("Freier Speicherplatz: "..details.FreeCount*(-1).." Items")
- if showAll then
- mon.setBackgroundColor(colors.red)
- mon.setCursorPos(xMax,8)
- mon.write("^")
- mon.setCursorPos(xMax,9)
- mon.write("|")
- mon.setCursorPos(xMax,yMax-2)
- mon.write("V")
- mon.setCursorPos(xMax,yMax-3)
- mon.write("|")
- mon.setBackgroundColor(colors.gray)
- if xPos >= xMax and xPos <= xMax and
- yPos >=8 and yPos <= 9 then
- Page = Page+1
- end
- if xPos >= xMax and xPos <= xMax and
- yPos >= yMax-3 and yPos <= yMax-2 then
- Page = Page-1
- end
- MaxPage = math.ceil(details.UsedTypes/19)
- if Page < 1 then
- Page = MaxPage
- elseif Page > MaxPage then
- Page =1
- end
- Bg(2,6,xMax-1,yMax-2,colors.gray)
- p = 1
- if Page == 1 then
- s1 = 1
- s2 = 19
- else
- s1 = Page*19-19
- s2 = Page*19
- end
- if s2 >= details.UsedTypes then
- s2 = details.UsedTypes
- end
- print(s1)
- print(s2)
- for i = s1,s2 do
- mon.setCursorPos(2,5+p)
- mon.write(details.Items[i].Name)
- mon.setCursorPos(30,5+p)
- mon.write("Anzahl: "..details.Items[i].Size)
- p = p+1
- end
- else
- Bg(2,7,30,6+#Item,colors.gray)
- Bg(40,7,40+7,6+#Item,colors.gray)
- for i = 1,details.UsedTypes do
- for b = 1,#Item do
- if details.Items[i].Name == Item[b][3] then
- if Item[b][1] ~= "_" then
- Item[b][2] = Item[b][1]
- end
- Item[b][1] = details.Items[i].Size
- end
- end
- end
- for i = 1,#Item do
- mon.setCursorPos(2,6+i)
- mon.write(Item[i][3])
- mon.setCursorPos(14,6+i)
- mon.write("Anzahl: "..Item[i][1])
- if Item[i][2] ~= "_" then
- mon.setCursorPos(41,6+i)
- mon.write(Item[i][1]-Item[i][2])
- else
- mon.setCursorPos(46,6+i)
- mon.write("-")
- end
- end
- end
- end
- end
- event,_,xPos,yPos = os.pullEvent("monitor_touch")
- end
Advertisement
Add Comment
Please, Sign In to add comment