Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
Leutech

OC ME Drive Information Panel

Question

Greetings dear oc community.

I have a big problem.

I have from applied energistics 2 a me network with 6 me drives cases and per case i have 10 cells.

I want them to show me stats from the cells on a computer screen, such like used bytes, stored items in the cell (but not what is exactly in the cell).

 

I have wrote an script that are working, but i want the list to be colorful.

 

This is my script

local component=require("component")
local component=require("component")
local os=require("os")
local term=require("term")

local gpu=component.gpu
local aw = require("adWrite")

local INV1 = component.proxy(component.get("6d4ec642"))
local INV2 = component.proxy(component.get("32cea986"))
local INV3 = component.proxy(component.get("703dad1e"))
local INV4 = component.proxy(component.get("a75045ea"))
local INV5 = component.proxy(component.get("29aa1a01"))
local INV6 = component.proxy(component.get("38c6659a"))

local color = {
  green = 0x00FF00,
  yellow = 0xFFFF00,
  orange = 0xFFA800,
  black = 0x000000,
  white = 0xFFFFFF,
  red = 0xFF0000,
  blue = 0x0000FF,
  cyan = 0x00FFFF,
  pink = 0xFF7CFF
}

local awcolors = {
  green = "0x00FF00",
  yellow = "0xFFFF00",
  orange = "0xFFA800",
  black = "0x000000",
  white = "0xFFFFFF",
  red = "0xFF0000",
  blue = "0x0000FF",
  cyan = "0x00FFFF",
  pink = "0xFF7CFF",
  gray =  "0xAAAAAA",
  lblue = "0x5555FF"
}

local dmg_colors = {[0] =
  "0x008421",
  "0x00FF00",
  "0xFFFF00",
  "0xFFA800",
  "0xFF6D00",
  "0xFF3A00",
  "0xFF2B00",
  "0xFF2B00",
  "0xFF0000"
}

function centerF(row, msg)
  w = gpu.getResolution()
  term.setCursor((w - #msg)/2, row)
  term.write(msg)
end

function getinv(variable, slot)
  local item = variable.getStackInSlot(5, slot)
  local label = item.label
  local usedBytes = item.usedBytes
  local totalBytes = item.totalBytes
  local storedItemCount = item.storedItemCount
  local storedItemTypes = item.storedItemTypes
  local totalItemTypes = item.getTotalItemTypes
  
  local bytesProzent = math.ceil(usedBytes / totalBytes * 8)
  local itemsProzent = math.ceil(storedItemTypes / totalItemTypes * 8)
  
  local bytesColor = dmg_colors[bytesProzent]
  local itemsColor = dmg_colors[itemsProzent]

  local isFull = 0
  
  local byteSpace = ""
  local itemSpace = ""
  local typeSpace = ""
  
  if usedBytes < totalBytes then
    if storedItemTypes < totalItemTypes then
      isFull = 0
    else
      isFull = 1
    end
  else
    if storedItemTypes < totalItemTypes then
      isFull = 2
    else
      isFull = 3
    end
  end
  
  if usedBytes >= 0 and usedBytes < 10 then
  byteSpace = "    "
  elseif usedBytes >= 10 and usedBytes < 100 then
  byteSpace = "   "
  elseif usedBytes >= 100 and usedBytes < 1000 then
  byteSpace = "  "
  elseif usedBytes >= 1000 and usedBytes < 10000 then
  byteSpace = " "
  elseif usedBytes >= 1000 then
  byteSpace = ""
  end
  
  if storedItemCount >= 0 and storedItemCount < 10 then
  itemSpace = "     "
  elseif storedItemCount >= 10 and storedItemCount < 100 then
  itemSpace = "    "
  elseif storedItemCount >= 100 and storedItemCount < 1000 then
  itemSpace = "   "
  elseif storedItemCount >= 1000 and storedItemCount < 10000 then
  itemSpace = "  "
  elseif storedItemCount >= 10000 and storedItemCount < 100000 then
  itemSpace = " "
  elseif storedItemCount >= 100000 then
  itemSpace = ""
  end
  
  if storedItemTypes >= 0 and storedItemTypes < 10 then
  typeSpace = " "
  elseif storedItemTypes >= 10 then
  typeSpace = ""
  end
  
  return {item, label, usedBytes, totalBytes, storedItemCount, storedItemTypes, bytesColor, itemsColor, isFull, byteSpace, itemSpace, typeSpace}
end

local me_slots = {
  1, 2, 3, 4, 5, 6, 7, 8, 9, 10
}

local MES1 = {}
local MES2 = {}
local MES3 = {}
local MES4 = {}
local MES5 = {}
local MES6 = {}

gpu.setResolution(110, 50)

--while true do

local headcolor1 = "0x000000"
local headcolor2 = "0x000000"
local headcolor3 = "0x000000"
local headcolor4 = "0x000000"
local headcolor5 = "0x000000"
local headcolor6 = "0x000000"
  
local keycode1 = 0
local keycode2 = 0
local keycode3 = 0
local keycode4 = 0
local keycode5 = 0
local keycode6 = 0
  
for i, slot in ipairs(me_slots) do
  MES1[i] = getinv(INV1, slot)
  MES2[i] = getinv(INV2, slot)
  MES3[i] = getinv(INV3, slot)
  MES4[i] = getinv(INV4, slot)
  MES5[i] = getinv(INV5, slot)
  MES6[i] = getinv(INV6, slot)
end

for a in ipairs(me_slots) do
  if MES1[a][9] == 3 then
    keycode1 = keycode1 + 3
  elseif MES1[a][9] == 2 then
    keycode1 = keycode1 + 2
  elseif MES1[a][9] == 1 then
    keycode1 = keycode1 + 1
  elseif MES1[a][9] == 0 then
    keycode1 = keycode1 + 0
  end
end

for b in ipairs(me_slots) do
  if MES2[b][9] == 3 then
    keycode2 = keycode2 + 3
  elseif MES2[b][9] == 2 then
    keycode2 = keycode2 + 2
  elseif MES2[b][9] == 1 then
    keycode2 = keycode2 + 1
  elseif MES2[b][9] == 0 then
    keycode2 = keycode2 + 0
  end
end

for c in ipairs(me_slots) do
  if MES3[c][9] == 3 then
    keycode3 = keycode3 + 3
  elseif MES3[c][9] == 2 then
    keycode3 = keycode3 + 2
  elseif MES3[c][9] == 1 then
    keycode3 = keycode3 + 1
  elseif MES3[c][9] == 0 then
    keycode3 = keycode3 + 0
  end
end

for d in ipairs(me_slots) do
  if MES4[d][9] == 3 then
    keycode4 = keycode4 + 3
  elseif MES4[d][9] == 2 then
    keycode4 = keycode4 + 2
  elseif MES4[d][9] == 1 then
    keycode4 = keycode4 + 1
  elseif MES4[d][9] == 0 then
    keycode4 = keycode4 + 0
  end
end

for e in ipairs(me_slots) do
  if MES5[e][9] == 3 then
    keycode5 = keycode5 + 3
  elseif MES5[e][9] == 2 then
    keycode5 = keycode5 + 2
  elseif MES5[e][9] == 1 then
    keycode5 = keycode5 + 1
  elseif MES5[e][9] == 0 then
    keycode5 = keycode5 + 0
  end
end

for f in ipairs(me_slots) do
  if MES6[f][9] == 3 then
    keycode6 = keycode6 + 3
  elseif MES6[f][9] == 2 then
    keycode6 = keycode6 + 2
  elseif MES6[f][9] == 1 then
    keycode6 = keycode6 + 1
  elseif MES6[f][9] == 0 then
    keycode6 = keycode6 + 0
  end
end

if keycode1 >= 0 and keycode1 < 10 then
  keycolor1 = "0x00FF00"
elseif keycode1 >= 10 and keycode1 < 20 then
  keycolor1 = "0xFFFF00"
elseif keycode1 >= 20 and keycode1 < 30 then
  keycolor1 = "0xFFA800"
elseif keycode1 == 30 then
  keycolor1 = "0xFF0000"
end

if keycode2 >= 0 and keycode2 < 10 then
  keycolor2 = "0x00FF00"
elseif keycode2 >= 10 and keycode2 < 20 then
  keycolor2 = "0xFFFF00"
elseif keycode2 >= 20 and keycode2 < 30 then
  keycolor2 = "0xFFA800"
elseif keycode2 == 30 then
  keycolor2 = "0xFF0000"
end

if keycode3 >= 0 and keycode3 < 10 then
  keycolor3 = "0x00FF00"
elseif keycode3 >= 10 and keycode3 < 20 then
  keycolor3 = "0xFFFF00"
elseif keycode3 >= 20 and keycode3 < 30 then
  keycolor3 = "0xFFA800"
elseif keycode3 == 30 then
  keycolor3 = "0xFF0000"
end

if keycode4 >= 0 and keycode4 < 10 then
  keycolor4 = "0x00FF00"
elseif keycode4 >= 10 and keycode4 < 20 then
  keycolor4 = "0xFFFF00"
elseif keycode4 >= 20 and keycode4 < 30 then
  keycolor4 = "0xFFA800"
elseif keycode4 == 30 then
  keycolor4 = "0xFF0000"
end

if keycode5 >= 0 and keycode5 < 10 then
  keycolor5 = "0x00FF00"
elseif keycode5 >= 10 and keycode5 < 20 then
  keycolor5 = "0xFFFF00"
elseif keycode5 >= 20 and keycode5 < 30 then
  keycolor5 = "0xFFA800"
elseif keycode5 == 30 then
  keycolor5 = "0xFF0000"
end

if keycode6 >= 0 and keycode6 < 10 then
  keycolor6 = "0x00FF00"
elseif keycode6 >= 10 and keycode6 < 20 then
  keycolor6 = "0xFFFF00"
elseif keycode6 >= 20 and keycode6 < 30 then
  keycolor6 = "0xFFA800"
elseif keycode6 == 30 then
  keycolor6 = "0xFF0000"
end

term.clear()
term.setCursor(1, 1)
gpu.setForeground(color.green)
local line = string.rep("-", 50)
centerF(1, line)
centerF(2, "-----     ME-Netzwerk Speicherkontingent     -----")
centerF(3, line)
gpu.setForeground(color.cyan)
centerF(5, "Speichereinheiten")
gpu.setForeground(color.white)
term.setCursor(46, 6)
aw.write("<color fg="..keycolor1..">01</color> <color fg="..keycolor2..">02</color> <color fg="..keycolor3..">03</color> <color fg="..keycolor4..">04</color> <color fg="..keycolor5..">05</color> <color fg="..keycolor6..">06</color>")
gpu.setForeground(color.pink)
centerF(7, "07 08 09 10 11 12")
centerF(8, "13 14 15 16 17 18")
centerF(9, "19 20 21 22 23 24")
centerF(10, "25 26 27 28 29 30")
centerF(11, "31 32 33 34 35 36")
gpu.setForeground(color.white)
term.setCursor(5, 13)
aw.write("<color fg="..awcolors.gray..">|</color>    <color fg="..awcolors.orange..">NAME</color>     <color fg="..awcolors.gray..">|</color>    <color fg="..awcolors.orange..">UB</color><color fg="..awcolors.gray..">/</color><color fg="..awcolors.orange..">TB</color>    <color fg="..awcolors.gray..">|</color>   <color fg="..awcolors.orange..">IT</color>   <color fg="..awcolors.gray..">|</color> <color fg="..awcolors.orange..">ST</color><color fg="..awcolors.gray..">/</color><color fg="..awcolors.orange..">TT</color> <color fg="..awcolors.gray..">|</color> <color fg="..awcolors.lblue.."><====></color> <color fg="..awcolors.gray..">|</color>    <color fg="..awcolors.orange..">NAME</color>     <color fg="..awcolors.gray..">|</color>    <color fg="..awcolors.orange..">UB</color><color fg="..awcolors.gray..">/</color><color fg="..awcolors.orange..">TB</color>    <color fg="..awcolors.gray..">|</color>   <color fg="..awcolors.orange..">IT</color>   <color fg="..awcolors.gray..">|</color> <color fg="..awcolors.orange..">ST</color><color fg="..awcolors.gray..">/</color><color fg="..awcolors.orange..">TT</color> <color fg="..awcolors.gray..">|</color>")
local rowselect1 = 14

for i in ipairs(me_slots) do
--  local str1 = string.format(
--    "<color fg=%d>|</color> <color fg=%d>%q</color> <color fg=%d>|</color> %q<color fg=%d>%d</color><color fg=%d>/</color><color fg=%d>%d</color> <color fg=%d>|</color> %q<color fg=%d>%d</color> <color fg=%d>|</color> %q<color fg=%d>%d</color><color fg=%d>/</color><color fg=%d>63</color> <color fg=%d>|</color>",
--    awcolors.gray, awcolors.orange, MES1[i][2], awcolors.orange, MES1[i][10], MES1[i][7], MES1[i][3], awcolors.gray, awcolors.orange, MES1[i][4], awcolors.gray, MES1[i][11], awcolors.cyan, MES1[i][5], awcolors.gray, MES1[i][12], MES1[i][8], awcolors.gray, awcolors.orange
--  )
  term.setCursor(5, rowselect1 + i)
--  aw.write("<color fg="..awcolors.gray..">|</color> <color fg="..awcolors.cyan..">"..MES1[i][2].."</color> <color fg="..awcolors.gray..">|</color> "..MES1[i][10].."<color fg="..MES1[i][7]..">"..MES1[i][3].."</color><color fg="..awcolors.gray..">/</color><color fg="..awcolors.cyan..">"..MES1[i][4].."</color> <color fg="..awcolors.gray..">|</color> "..MES1[i][11].."<color fg="..awcolors.cyan..">"..MES1[i][5].."</color> <color fg="..awcolors.gray..">|</color> "..MES1[i][12].."<color fg="..MES1[i][8]..">"..MES1[i][6].."</color><color fg="..awcolors.gray..">/</color><color fg="..awcolors.cyan..">63</color> <color fg="..awcolors.gray..">|</color> <color fg="..awcolors.lblue.."><====></color> <color fg="..awcolors.gray..">|</color> <color fg="..awcolors.cyan..">"..MES4[i][2].."</color> <color fg="..awcolors.gray..">|</color> "..MES4[i][10].."<color fg="..MES1[i][7]..">"..MES4[i][3].."</color><color fg="..awcolors.gray..">/</color><color fg="..awcolors.cyan..">"..MES4[i][4].."</color> <color fg="..awcolors.gray..">|</color> "..MES4[i][11].."<color fg="..awcolors.cyan..">"..MES4[i][5].."</color> <color fg="..awcolors.gray..">|</color> "..MES4[i][12].."<color fg="..MES4[i][8]..">"..MES4[i][6].."</color><color fg="..awcolors.gray..">/</color><color fg="..awcolors.cyan..">63</color> <color fg="..awcolors.gray..">|</color>")  
--  aw.write(str1)
  aw.write("| "..MES1[i][2].." | "..MES1[i][10]..""..MES1[i][3].."/"..MES1[i][4].." | "..MES1[i][11]..""..MES1[i][5].." | "..MES1[i][12]..""..MES1[i][6].."/63 | <====> | "..MES4[i][2].." | "..MES4[i][10]..""..MES4[i][3].."/"..MES4[i][4].." | "..MES4[i][11]..""..MES4[i][5].." | "..MES4[i][12]..""..MES4[i][6].."/63 |")
end

local rowselect2 = 25

for i in ipairs(me_slots) do
  term.setCursor(5, rowselect2 + i)
  aw.write("| "..MES2[i][2].." | "..MES2[i][10]..""..MES2[i][3].."/"..MES2[i][4].." | "..MES2[i][11]..""..MES2[i][5].." | "..MES2[i][12]..""..MES2[i][6].."/63 | <====> | "..MES5[i][2].." | "..MES5[i][10]..""..MES5[i][3].."/"..MES5[i][4].." | "..MES5[i][11]..""..MES5[i][5].." | "..MES5[i][12]..""..MES5[i][6].."/63 |")
end

local rowselect3 = 36

for i in ipairs(me_slots) do
  term.setCursor(5, rowselect3 + i)
  aw.write("| "..MES3[i][2].." | "..MES3[i][10]..""..MES3[i][3].."/"..MES3[i][4].." | "..MES3[i][11]..""..MES3[i][5].." | "..MES3[i][12]..""..MES3[i][6].."/63 | <====> | "..MES6[i][2].." | "..MES6[i][10]..""..MES6[i][3].."/"..MES6[i][4].." | "..MES6[i][11]..""..MES6[i][5].." | "..MES6[i][12]..""..MES6[i][6].."/63 |")
end

And here is the adWrite.lua script

local component = require "component"
local term = require "term"
-------------------------------------------------------------------------------
local gpu = component.gpu

local adWrite = {}

function adWrite.write(s)
  local cbg, cfg = gpu.getBackground(), gpu.getForeground()
  local i = 1
  s:gsub('()<color(.-)>(.-)</color>()', function(i1, tag, content, i2)
    local bg, fg
    if not i1 then return end
    term.write(s:sub(i, i1-1))
    tag = tag:gsub('%s', "")  -- remove whites paces
    for colortype, color in tag:gmatch '([bfg][bfg])=(0[xX]%x+)' do
      if colortype == "bg" and color then
        bg = tonumber(color)
      elseif colortype == "fg" and color then
        fg = tonumber(color)
      end
    end
    if bg and bg ~= cbg then
      gpu.setBackground(bg)
    end
    if fg and fg ~= color then
      gpu.setForeground(fg)
    end
    term.write(content)
    gpu.setBackground(cbg)
    gpu.setForeground(cfg)
    i = i2
  end)
  if i <= #s then
    term.write(s:sub(i, #s))
  end
end

-------------------------------------------------------------------------------
return adWrite

And if execute this script, he shows me this.

 

spacer.png

 

That the script shows me is correct but i want to have the information in color such like this

Zelle 01 01 | [65536]/65536 266240 [63]/63 <===> Zelle 04 01 | [65536]/65536 266240 [63]/63 |

.........

The colors of the values inside the [] are controlled by its percent of the function where i called the information from the cell.

But if want to do this he says me always an error.

Please help me, because im stuck.

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Okay i have it now.

The script shows like this now:

local component=require("component")
local component=require("component")
local os=require("os")
local term=require("term")

local gpu=component.gpu
local aw = require("adWrite")

local INV1 = component.proxy(component.get("6d4ec642"))
local INV2 = component.proxy(component.get("32cea986"))
local INV3 = component.proxy(component.get("703dad1e"))
local INV4 = component.proxy(component.get("a75045ea"))
local INV5 = component.proxy(component.get("29aa1a01"))
local INV6 = component.proxy(component.get("38c6659a"))

local color = {
  green = 0x00FF00,
  yellow = 0xFFFF00,
  orange = 0xFFA800,
  black = 0x000000,
  white = 0xFFFFFF,
  red = 0xFF0000,
  blue = 0x0000FF,
  cyan = 0x00FFFF,
  pink = 0xFF7CFF
}

local awcolors = {
  green = "0x00FF00",
  yellow = "0xFFFF00",
  orange = "0xFFA800",
  black = "0x000000",
  white = "0xFFFFFF",
  red = "0xFF0000",
  blue = "0x0000FF",
  cyan = "0x00FFFF",
  pink = "0xFF7CFF",
  gray =  "0xAAAAAA",
  lblue = "0x5555FF"
}

local dmg_colors = {[0] =
  "0x008421",
  "0x00FF00",
  "0xFFFF00",
  "0xFFA800",
  "0xFF6D00",
  "0xFF3A00",
  "0xFF2B00",
  "0xFF2B00",
  "0xFF0000"
}

function centerF(row, msg)
  w = gpu.getResolution()
  term.setCursor((w - #msg)/2, row)
  term.write(msg)
end

function getinv(variable, slot)
  local item = variable.getStackInSlot(5, slot)
  local label = item.label
  local usedBytes = math.floor(item.usedBytes)
  local totalBytes = math.floor(item.totalBytes)
  local storedItemCount = math.floor(item.storedItemCount)
  local storedItemTypes = math.floor(item.storedItemTypes)
  local totalItemTypes = math.floor(item.getTotalItemTypes)
  
  local bytesProzent = math.ceil(usedBytes / totalBytes * 8)
  local itemsProzent = math.ceil(storedItemTypes / totalItemTypes * 8)
  
  local bytesColor = dmg_colors[bytesProzent]
  local itemsColor = dmg_colors[itemsProzent]

  local isFull = 0
  
  local byteSpace = ""
  local itemSpace = ""
  local typeSpace = ""
  
  if usedBytes < totalBytes then
    if storedItemTypes < totalItemTypes then
      isFull = 0
    else
      isFull = 1
    end
  else
    if storedItemTypes < totalItemTypes then
      isFull = 2
    else
      isFull = 3
    end
  end
  
  if usedBytes >= 0 and usedBytes < 10 then
  byteSpace = "    "
  elseif usedBytes >= 10 and usedBytes < 100 then
  byteSpace = "   "
  elseif usedBytes >= 100 and usedBytes < 1000 then
  byteSpace = "  "
  elseif usedBytes >= 1000 and usedBytes < 10000 then
  byteSpace = " "
  elseif usedBytes >= 1000 then
  byteSpace = ""
  end
  
  if storedItemCount >= 0 and storedItemCount < 10 then
  itemSpace = "     "
  elseif storedItemCount >= 10 and storedItemCount < 100 then
  itemSpace = "    "
  elseif storedItemCount >= 100 and storedItemCount < 1000 then
  itemSpace = "   "
  elseif storedItemCount >= 1000 and storedItemCount < 10000 then
  itemSpace = "  "
  elseif storedItemCount >= 10000 and storedItemCount < 100000 then
  itemSpace = " "
  elseif storedItemCount >= 100000 then
  itemSpace = ""
  end
  
  if storedItemTypes >= 0 and storedItemTypes < 10 then
  typeSpace = " "
  elseif storedItemTypes >= 10 then
  typeSpace = ""
  end
  
  return {item, label, usedBytes, totalBytes, storedItemCount, storedItemTypes, bytesColor, itemsColor, isFull, byteSpace, itemSpace, typeSpace}
end

local me_slots = {
  1, 2, 3, 4, 5, 6, 7, 8, 9, 10
}

local MES1 = {}
local MES2 = {}
local MES3 = {}
local MES4 = {}
local MES5 = {}
local MES6 = {}

gpu.setResolution(110, 50)

--while true do

local headcolor1 = "0x000000"
local headcolor2 = "0x000000"
local headcolor3 = "0x000000"
local headcolor4 = "0x000000"
local headcolor5 = "0x000000"
local headcolor6 = "0x000000"
  
local keycode1 = 0
local keycode2 = 0
local keycode3 = 0
local keycode4 = 0
local keycode5 = 0
local keycode6 = 0
  
for i, slot in ipairs(me_slots) do
  MES1[i] = getinv(INV1, slot)
  MES2[i] = getinv(INV2, slot)
  MES3[i] = getinv(INV3, slot)
  MES4[i] = getinv(INV4, slot)
  MES5[i] = getinv(INV5, slot)
  MES6[i] = getinv(INV6, slot)
end

for a in ipairs(me_slots) do
  if MES1[a][9] == 3 then
    keycode1 = keycode1 + 3
  elseif MES1[a][9] == 2 then
    keycode1 = keycode1 + 2
  elseif MES1[a][9] == 1 then
    keycode1 = keycode1 + 1
  elseif MES1[a][9] == 0 then
    keycode1 = keycode1 + 0
  end
end

for b in ipairs(me_slots) do
  if MES2[b][9] == 3 then
    keycode2 = keycode2 + 3
  elseif MES2[b][9] == 2 then
    keycode2 = keycode2 + 2
  elseif MES2[b][9] == 1 then
    keycode2 = keycode2 + 1
  elseif MES2[b][9] == 0 then
    keycode2 = keycode2 + 0
  end
end

for c in ipairs(me_slots) do
  if MES3[c][9] == 3 then
    keycode3 = keycode3 + 3
  elseif MES3[c][9] == 2 then
    keycode3 = keycode3 + 2
  elseif MES3[c][9] == 1 then
    keycode3 = keycode3 + 1
  elseif MES3[c][9] == 0 then
    keycode3 = keycode3 + 0
  end
end

for d in ipairs(me_slots) do
  if MES4[d][9] == 3 then
    keycode4 = keycode4 + 3
  elseif MES4[d][9] == 2 then
    keycode4 = keycode4 + 2
  elseif MES4[d][9] == 1 then
    keycode4 = keycode4 + 1
  elseif MES4[d][9] == 0 then
    keycode4 = keycode4 + 0
  end
end

for e in ipairs(me_slots) do
  if MES5[e][9] == 3 then
    keycode5 = keycode5 + 3
  elseif MES5[e][9] == 2 then
    keycode5 = keycode5 + 2
  elseif MES5[e][9] == 1 then
    keycode5 = keycode5 + 1
  elseif MES5[e][9] == 0 then
    keycode5 = keycode5 + 0
  end
end

for f in ipairs(me_slots) do
  if MES6[f][9] == 3 then
    keycode6 = keycode6 + 3
  elseif MES6[f][9] == 2 then
    keycode6 = keycode6 + 2
  elseif MES6[f][9] == 1 then
    keycode6 = keycode6 + 1
  elseif MES6[f][9] == 0 then
    keycode6 = keycode6 + 0
  end
end

if keycode1 >= 0 and keycode1 < 10 then
  keycolor1 = "0x00FF00"
elseif keycode1 >= 10 and keycode1 < 20 then
  keycolor1 = "0xFFFF00"
elseif keycode1 >= 20 and keycode1 < 30 then
  keycolor1 = "0xFFA800"
elseif keycode1 == 30 then
  keycolor1 = "0xFF0000"
end

if keycode2 >= 0 and keycode2 < 10 then
  keycolor2 = "0x00FF00"
elseif keycode2 >= 10 and keycode2 < 20 then
  keycolor2 = "0xFFFF00"
elseif keycode2 >= 20 and keycode2 < 30 then
  keycolor2 = "0xFFA800"
elseif keycode2 == 30 then
  keycolor2 = "0xFF0000"
end

if keycode3 >= 0 and keycode3 < 10 then
  keycolor3 = "0x00FF00"
elseif keycode3 >= 10 and keycode3 < 20 then
  keycolor3 = "0xFFFF00"
elseif keycode3 >= 20 and keycode3 < 30 then
  keycolor3 = "0xFFA800"
elseif keycode3 == 30 then
  keycolor3 = "0xFF0000"
end

if keycode4 >= 0 and keycode4 < 10 then
  keycolor4 = "0x00FF00"
elseif keycode4 >= 10 and keycode4 < 20 then
  keycolor4 = "0xFFFF00"
elseif keycode4 >= 20 and keycode4 < 30 then
  keycolor4 = "0xFFA800"
elseif keycode4 == 30 then
  keycolor4 = "0xFF0000"
end

if keycode5 >= 0 and keycode5 < 10 then
  keycolor5 = "0x00FF00"
elseif keycode5 >= 10 and keycode5 < 20 then
  keycolor5 = "0xFFFF00"
elseif keycode5 >= 20 and keycode5 < 30 then
  keycolor5 = "0xFFA800"
elseif keycode5 == 30 then
  keycolor5 = "0xFF0000"
end

if keycode6 >= 0 and keycode6 < 10 then
  keycolor6 = "0x00FF00"
elseif keycode6 >= 10 and keycode6 < 20 then
  keycolor6 = "0xFFFF00"
elseif keycode6 >= 20 and keycode6 < 30 then
  keycolor6 = "0xFFA800"
elseif keycode6 == 30 then
  keycolor6 = "0xFF0000"
end

term.clear()
term.setCursor(1, 1)
gpu.setForeground(color.green)
local line = string.rep("-", 50)
centerF(1, line)
centerF(2, "-----    ME-Netzwerk Speicherkontingent #1   -----")
centerF(3, line)
gpu.setForeground(color.cyan)
centerF(5, "Speichereinheiten")
gpu.setForeground(color.white)
term.setCursor(46, 6)
aw.write("<color fg="..keycolor1..">01</color> <color fg="..keycolor2..">02</color> <color fg="..keycolor3..">03</color> <color fg="..keycolor4..">04</color> <color fg="..keycolor5..">05</color> <color fg="..keycolor6..">06</color>")
gpu.setForeground(color.pink)
centerF(7, "07 08 09 10 11 12")
centerF(8, "13 14 15 16 17 18")
centerF(9, "19 20 21 22 23 24")
centerF(10, "25 26 27 28 29 30")
centerF(11, "31 32 33 34 35 36")
gpu.setForeground(color.white)
term.setCursor(5, 13)
aw.write("<color fg="..awcolors.gray..">|</color>    <color fg="..awcolors.orange..">NAME</color>     <color fg="..awcolors.gray..">|</color>    <color fg="..awcolors.orange..">UB</color><color fg="..awcolors.gray..">/</color><color fg="..awcolors.orange..">TB</color>    <color fg="..awcolors.gray..">|</color>   <color fg="..awcolors.orange..">IT</color>   <color fg="..awcolors.gray..">|</color> <color fg="..awcolors.orange..">ST</color><color fg="..awcolors.gray..">/</color><color fg="..awcolors.orange..">TT</color> <color fg="..awcolors.gray..">|</color> <color fg="..awcolors.lblue.."><====></color> <color fg="..awcolors.gray..">|</color>    <color fg="..awcolors.orange..">NAME</color>     <color fg="..awcolors.gray..">|</color>    <color fg="..awcolors.orange..">UB</color><color fg="..awcolors.gray..">/</color><color fg="..awcolors.orange..">TB</color>    <color fg="..awcolors.gray..">|</color>   <color fg="..awcolors.orange..">IT</color>   <color fg="..awcolors.gray..">|</color> <color fg="..awcolors.orange..">ST</color><color fg="..awcolors.gray..">/</color><color fg="..awcolors.orange..">TT</color> <color fg="..awcolors.gray..">|</color>")
local rowselect1 = 14

for i in ipairs(me_slots) do
  local str = string.format(
	"<color fg=%s>|</color> <color fg=%s>%s</color> <color fg=%s>|</color> %s<color fg=%s>%s</color><color fg=%s>/</color><color fg=%s>%s</color> <color fg=%s>|</color> %s<color fg=%s>%s</color> <color fg=%s>|</color> %s<color fg=%s>%s</color><color fg=%s>/</color><color fg=%s>63</color> <color fg=%s>|</color> <color fg=%s><====></color> <color fg=%s>|</color> <color fg=%s>%s</color> <color fg=%s>|</color> %s<color fg=%s>%s</color><color fg=%s>/</color><color fg=%s>%s</color> <color fg=%s>|</color> %s<color fg=%s>%s</color> <color fg=%s>|</color> %s<color fg=%s>%s</color><color fg=%s>/</color><color fg=%s>63</color> <color fg=%s>|</color>",
	awcolors.gray, awcolors.orange, MES1[i][2], awcolors.gray, MES1[i][10], MES1[i][7], MES1[i][3], awcolors.gray, awcolors.orange, MES1[i][4], awcolors.gray, MES1[i][11], awcolors.cyan, MES1[i][5], awcolors.gray, MES1[i][12], MES1[i][8], MES1[i][6], awcolors.gray, awcolors.orange, awcolors.gray, awcolors.lblue,
	awcolors.gray, awcolors.orange, MES4[i][2], awcolors.gray, MES4[i][10], MES4[i][7], MES4[i][3], awcolors.gray, awcolors.orange, MES4[i][4], awcolors.gray, MES4[i][11], awcolors.cyan, MES4[i][5], awcolors.gray, MES4[i][12], MES4[i][8], MES4[i][6], awcolors.gray, awcolors.orange, awcolors.gray
  )
  term.setCursor(5, rowselect1 + i)
  aw.write(str)
end

local rowselect2 = 25

for i in ipairs(me_slots) do
  local str = string.format(
	"<color fg=%s>|</color> <color fg=%s>%s</color> <color fg=%s>|</color> %s<color fg=%s>%s</color><color fg=%s>/</color><color fg=%s>%s</color> <color fg=%s>|</color> %s<color fg=%s>%s</color> <color fg=%s>|</color> %s<color fg=%s>%s</color><color fg=%s>/</color><color fg=%s>63</color> <color fg=%s>|</color> <color fg=%s><====></color> <color fg=%s>|</color> <color fg=%s>%s</color> <color fg=%s>|</color> %s<color fg=%s>%s</color><color fg=%s>/</color><color fg=%s>%s</color> <color fg=%s>|</color> %s<color fg=%s>%s</color> <color fg=%s>|</color> %s<color fg=%s>%s</color><color fg=%s>/</color><color fg=%s>63</color> <color fg=%s>|</color>",
	awcolors.gray, awcolors.orange, MES2[i][2], awcolors.gray, MES2[i][10], MES2[i][7], MES2[i][3], awcolors.gray, awcolors.orange, MES2[i][4], awcolors.gray, MES2[i][11], awcolors.cyan, MES2[i][5], awcolors.gray, MES2[i][12], MES2[i][8], MES2[i][6], awcolors.gray, awcolors.orange, awcolors.gray, awcolors.lblue,
	awcolors.gray, awcolors.orange, MES5[i][2], awcolors.gray, MES5[i][10], MES5[i][7], MES5[i][3], awcolors.gray, awcolors.orange, MES5[i][4], awcolors.gray, MES5[i][11], awcolors.cyan, MES5[i][5], awcolors.gray, MES5[i][12], MES5[i][8], MES5[i][6], awcolors.gray, awcolors.orange, awcolors.gray
  )
  term.setCursor(5, rowselect2 + i)
  aw.write(str)
end

local rowselect3 = 36

for i in ipairs(me_slots) do
  local str = string.format(
	"<color fg=%s>|</color> <color fg=%s>%s</color> <color fg=%s>|</color> %s<color fg=%s>%s</color><color fg=%s>/</color><color fg=%s>%s</color> <color fg=%s>|</color> %s<color fg=%s>%s</color> <color fg=%s>|</color> %s<color fg=%s>%s</color><color fg=%s>/</color><color fg=%s>63</color> <color fg=%s>|</color> <color fg=%s><====></color> <color fg=%s>|</color> <color fg=%s>%s</color> <color fg=%s>|</color> %s<color fg=%s>%s</color><color fg=%s>/</color><color fg=%s>%s</color> <color fg=%s>|</color> %s<color fg=%s>%s</color> <color fg=%s>|</color> %s<color fg=%s>%s</color><color fg=%s>/</color><color fg=%s>63</color> <color fg=%s>|</color>",
	awcolors.gray, awcolors.orange, MES3[i][2], awcolors.gray, MES3[i][10], MES3[i][7], MES3[i][3], awcolors.gray, awcolors.orange, MES3[i][4], awcolors.gray, MES3[i][11], awcolors.cyan, MES3[i][5], awcolors.gray, MES3[i][12], MES3[i][8], MES3[i][6], awcolors.gray, awcolors.orange, awcolors.gray, awcolors.lblue,
	awcolors.gray, awcolors.orange, MES6[i][2], awcolors.gray, MES6[i][10], MES6[i][7], MES6[i][3], awcolors.gray, awcolors.orange, MES6[i][4], awcolors.gray, MES6[i][11], awcolors.cyan, MES6[i][5], awcolors.gray, MES6[i][12], MES6[i][8], MES6[i][6], awcolors.gray, awcolors.orange, awcolors.gray
  )
  term.setCursor(5, rowselect3 + i)
  aw.write(str)
end

And here is a picture how it looks like

spacer.png

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.