Jump to content
NEWMidgetMAN

Basic Ore Monitor For Containers

Recommended Posts

Basic Ore Monitor.

Requires
3 Programming Boards
2 Databanks --two is needed to prevent weird code crossing bugs. later this may be less when they fix bug.
20 Containers of same Size
1 screen

1 switch

1 relay

 

PB1->switch-> relay-> PB2 PB3

Create Events in Lua Editor and Paste the Following as Instructed.

 

9/17 - Fixed parameter for single boards.Changed some names and Added more exports
 

 

Programming Board 1 -- Can do 9 Containers OR Read from Databanks
---screen
---databank-----only if your doing more than 9 items added last
---databank2-----only if your doing more than 9 items(using 2 helps code from being crossed from bugs)added last
---switch-----only if your doing more than 9 items


----Unit Start
if Morethan9slots == "On" then
switch.activate()
end


unit.setTimer("Live",1)
unit.hide()


----Unit Tick ---Name the Tick Live
Morethan9slots = "Off" --export:Off for 9 slots and On for more than 9 and requires databanks.
local containermax = 9600 --export:;Your max container holding.
local slot1item = "Bauxite" --export:;Slot1 Iten.
local slot1weight = 1.28 --export:;Slot1 weight.
local slot2item = "Coal" --export:;Slot2 Iten.
local slot2weight = 1.35 --export:;Slot2 weight.
local slot3item = "Hematite" --export:;Slot3 Iten.
local slot3weight = 5.04 --export:;Slot3 weight.
local slot4item = "Quartz" --export:;Slot4 Iten.
local slot4weight = 2.65 --export:;Slot4 weight.
local slot5item = "Chromite" --export:;Slot5 Iten.
local slot5weight = 4.54 --export:;Slot5 weight.
local slot6item = "Limestone" --export:;Slot6 Iten.
local slot6weight = 2.71 --export:;Slot6 weight.
local slot7item = "Malachite" --export:;Slot7 Iten.
local slot7weight = 4.0 --export:;Slot7 weight.
local slot8item = "Natron" --export:;Slot8 Iten.
local slot8weight = 1.55 --export:;Slot8 weight.
local slot9item = "Acanthite" --export:;Slot9 Iten.
local slot9weight = 7.2 --export:;Slot9 weight.

if Morethan9slots == "Off" then
local dbhtml = ""
local dhtml = ""
local index = {1, 2, 3, 4, 5, 6, 7, 8, 9} -- Row of Container?
local containers = {slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8, slot9} -- slot names
local weights = {slot1weight, slot2weight, slot3weight, slot4weight, slot5weight, slot6weight, slot7weight, slot8weight, slot9weight} -- inspected kg of item
local items = {slot1item, slot2item, slot3item, slot4item, slot5item, slot6item, slot7item, slot8item, slot9item} -- names to display
local htmlContent = ""
for i=1, #containers do
    htmlContent = htmlContent .. "<tr>".."<th>"..index[i].."</th><th>"..items[i].."</th><th>"..math.ceil(((math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5)/containermax)*100)).."%</th><th>"..math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5).."</th><tr>"
end
local html = [[
<table style="
margin-left: auto;
margin-right: auto;
width:30%;
font-size:1.25em;
text-align:left;">
  <tr style = "
background-color:Purple;
color:black !important;">
    <svg>
    <g>
    <text xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="30" id="svg_8" y="50" x="10" stroke="#ff0000" fill="#ff7f00">PB1</text> 
    </g></svg>
    <th>Row</th>
    <th>Product</th>
    <th>Container%</th>
    <th>Total Ore</th>
  </tr>
  ]]..htmlContent..[[
</table>]]

screen.setHTML(html)
elseif Morethan9slots == "On" then
switch.activate()
dbhtml = databank.getStringValue(OreMonitorTwo)
dhtml = databank2.getStringValue(OreMonitorThree)
local index = {1, 2, 3, 4, 5, 6} -- Row of Container?
local containers = {slot1, slot2, slot3, slot4, slot5, slot6} -- slot names
local weights = {slot1weight, slot2weight, slot3weight, slot4weight, slot5weight, slot6weight} -- inspected kg of item
local items = {slot1item, slot2item, slot3item, slot4item, slot5item, slot6item} -- names to display
local htmlContent = ""
for i=1, #containers do
    htmlContent = htmlContent .. "<tr>".."<th>"..index[i].."</th><th>"..items[i].."</th><th>"..math.ceil(((math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5)/containermax)*100)).."%</th><th>"..math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5).."</th><tr>"
end
local html = [[
<table style="
margin-left: auto;
margin-right: auto;
width:30%;
font-size:1.25em;
text-align:left;">
  <tr style = "
background-color:Purple;
color:black !important;">
    <svg>
    <g>
    <text xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="30" id="svg_8" y="50" x="10" stroke="#ff0000" fill="#ff7f00">PB1</text> 
    </g></svg>
    <th>Row</th>
    <th>Product</th>
    <th>Container%</th>
    <th>Total Ore</th>
  </tr>
  ]]..htmlContent..[[]]..dbhtml..[[]]..dhtml..[[
</table>]]

screen.setHTML(html)

end



---Unit Stop
if Morethan9slots == "On" then
switch.deactivate()
end

screen.clear()









Programming Board 2
--databank is last slot to add and named databank

---Unit Start
unit.setTimer("Live",1)
unit.hide()

----Unit Tick ---Name the Tick Live
--databank is last slot to add and named databank


local slot1item = "Malachite" --export:;Slot1 Iten.
local slot1weight = 4.0 --export:;Slot1 weight.
local slot2item = "Natron" --export:;Slot2 Iten.
local slot2weight = 1.55 --export:;Slot2 weight.
local slot3item = "Acanthite" --export:;Slot3 Iten.
local slot3weight = 7.2 --export:;Slot3 weight.
local slot4item = "Garnierite" --export:;Slot4 Iten.
local slot4weight = 2.60 --export:;Slot4 weight.
local slot5item = "Petalite" --export:;Slot5 Iten.
local slot5weight = 2.41 --export:;Slot5 weight.
local slot6item = "Pyrite" --export:;Slot6 Iten.
local slot6weight = 5.01 --export:;Slot6 weight.
local slot7item = "Colbaltite" --export:;Slot7 Iten.
local slot7weight = 6.33 --export:;Slot7 weight.
local slot8item = "Cryolite" --export:;Slot8 Iten.
local slot8weight = 2.95 --export:;Slot8 weight.
local slot9item = "Gold Nuggets" --export:;Slot9 Iten.
local slot9weight = 19.30 --export:;Slot9 weight.
local dbhtml = ""
local dhtml = ""
local index = {7, 8, 9, 10, 11, 12, 13, 14, 15} -- Row of Container?
local containers = {slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8, slot9} -- slot names
local weights = {slot1weight, slot2weight, slot3weight, slot4weight, slot5weight, slot6weight, slot7weight, slot8weight, slot9weight} -- inspected kg of item
local items = {slot1item, slot2item, slot3item, slot4item, slot5item, slot6item, slot7item, slot8item, slot9item} -- names to display
local htmlContent = ""
local containermax = 9600 --export:;Your max container holding.
for i=1, #containers do
    htmlContent = htmlContent .. "<tr>".."<th>"..index[i].."</th><th>"..items[i].."</th><th>"..math.ceil(((math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5)/containermax)*100)).."%</th><th>"..math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5).."</th><tr>"
end
local html = [[
<table style="
margin-left: auto;
margin-right: auto;
width:30%;
font-size:1.25em;
text-align:left;">
  <tr style = "
background-color:Purple;
color:black !important;">
    <svg>
    <g>
    <text xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="30" id="svg_8" y="50" x="10" stroke="#ff0000" fill="#ff7f00">PB2</text> 
    </g></svg>
    <th>Row</th>
    <th>Product</th>
    <th>Container%</th>
    <th>Total Ore</th>
  </tr>
  ]]..htmlContent..[[
</table>]]


databank.setStringValue(OreMonitorTwo,html)






Programming Board 3
--databank is last slot to add and named databank

---Unit Start
unit.setTimer("Live",1)
unit.hide()

----Unit Tick ---Name the Tick Live
--databank is last slot to add and named databank

local slot1item = "Kobelckite" --export:;Slot1 Iten.
local slot1weight = 2.37 --export:;Slot1 weight.
local slot2item = "Columbite" --export:;Slot2 Iten.
local slot2weight = 5.38 --export:;Slot2 weight.
local slot3item = "Illmenite" --export:;Slot3 Iten.
local slot3weight = 4.55 --export:;Slot3 weight.
local slot4item = "Rhodonite" --export:;Slot4 Iten.
local slot4weight = 3.76 --export:;Slot4 weight.
local slot5item = "Vanadinite" --export:;Slot5 Iten.
local slot5weight = 6.95 --export:;Slot5 weight.
local slot6item = "Not set" --export:;Slot6 Iten.
local slot6weight = 0 --export:;Slot6 weight.
local slot7item = "Not set" --export:;Slot7 Iten.
local slot7weight = 0 --export:;Slot7 weight.
local slot8item = "Not set" --export:;Slot8 Iten.
local slot8weight = 0 --export:;Slot8 weight.
local slot9item = "Not set" --export:;Slot9 Iten.
local slot9weight = 0 --export:;Slot9 weight.
local index = {16, 17, 18, 19, 20} -- Row of Container?
local containers = {slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8, slot9} -- slot names
local weights = {slot1weight, slot2weight, slot3weight, slot4weight, slot5weight, slot6weight, slot7weight, slot8weight, slot9weight} -- inspected kg of item
local items = {slot1item, slot2item, slot3item, slot4item, slot5item, slot6item, slot7item, slot8item, slot9item} -- names to display
local htmlContent = ""
local containermax = 1200 --export:;Your max container holding.
for i=1, #containers do
    htmlContent = htmlContent .. "<tr>".."<th>"..index[i].."</th><th>"..items[i].."</th><th>"..math.ceil(((math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5)/containermax)*100)).."%</th><th>"..math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5).."</th><tr>"
end
local html = [[
<table style="
margin-left: auto;
margin-right: auto;
width:30%;
font-size:1.25em;
text-align:left;">
  <tr style = "
background-color:Purple;
color:black !important;">
    <svg>
    <g>
    <text xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="30" id="svg_8" y="50" x="10" stroke="#ff0000" fill="#ff7f00">PB3</text> 
    </g></svg>
    <th>Row</th>
    <th>Product</th>
    <th>Container%</th>
    <th>Total Ore</th>
  </tr>
  ]]..htmlContent..[[
</table>]]
databank.setStringValue(OreMonitorThree,html)

 

 

Pasteable Config for Programming Board 1. Hook up all containers (Bauxite, Coal, Hematite, Quartz, Chromite, Limestone)first and then link switch, screen, databank, databank2 and named them accordingly in the Lua editor slot area. Leave containers slots alone.

{"slots":{"0":{"name":"slot1","type":{"events":[],"methods":[]}},"1":{"name":"slot2","type":{"events":[],"methods":[]}},"2":{"name":"slot3","type":{"events":[],"methods":[]}},"3":{"name":"slot4","type":{"events":[],"methods":[]}},"4":{"name":"slot5","type":{"events":[],"methods":[]}},"5":{"name":"slot6","type":{"events":[],"methods":[]}},"6":{"name":"switch","type":{"events":[],"methods":[]}},"7":{"name":"screen","type":{"events":[],"methods":[]}},"8":{"name":"databank","type":{"events":[],"methods":[]}},"9":{"name":"databank2","type":{"events":[],"methods":[]}},"-1":{"name":"unit","type":{"events":[],"methods":[]}},"-2":{"name":"system","type":{"events":[],"methods":[]}},"-3":{"name":"library","type":{"events":[],"methods":[]}}},"handlers":[{"code":"if Morethan9slots == \"On\" then\nswitch.activate()\nend\n\n\nunit.setTimer(\"Live\",1)\nunit.hide()","filter":{"args":[],"signature":"start()","slotKey":"-1"},"key":"0"},{"code":"if Morethan9slots == \"On\" then\nswitch.deactivate()\nend\n\nscreen.clear()\n","filter":{"args":[],"signature":"stop()","slotKey":"-1"},"key":"1"},{"code":"Morethan9slots = \"Off\" --export:Off for 9 slots and On for more than 9 and requires databanks.\nlocal containermax = 9600 --export:;Your max container holding.\nlocal slot1item = \"Bauxite\" --export:;Slot1 Iten.\nlocal slot1weight = 1.28 --export:;Slot1 weight.\nlocal slot2item = \"Coal\" --export:;Slot2 Iten.\nlocal slot2weight = 1.35 --export:;Slot2 weight.\nlocal slot3item = \"Hematite\" --export:;Slot3 Iten.\nlocal slot3weight = 5.04 --export:;Slot3 weight.\nlocal slot4item = \"Quartz\" --export:;Slot4 Iten.\nlocal slot4weight = 2.65 --export:;Slot4 weight.\nlocal slot5item = \"Chromite\" --export:;Slot5 Iten.\nlocal slot5weight = 4.54 --export:;Slot5 weight.\nlocal slot6item = \"Limestone\" --export:;Slot6 Iten.\nlocal slot6weight = 2.71 --export:;Slot6 weight.\nlocal slot7item = \"Malachite\" --export:;Slot7 Iten.\nlocal slot7weight = 4.0 --export:;Slot7 weight.\nlocal slot8item = \"Natron\" --export:;Slot8 Iten.\nlocal slot8weight = 1.55 --export:;Slot8 weight.\nlocal slot9item = \"Acanthite\" --export:;Slot9 Iten.\nlocal slot9weight = 7.2 --export:;Slot9 weight.\n\nif Morethan9slots == \"Off\" then\nlocal dbhtml = \"\"\nlocal dhtml = \"\"\nlocal index = {1, 2, 3, 4, 5, 6, 7, 8, 9} -- Row of Container?\nlocal containers = {slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8, slot9} -- slot names\nlocal weights = {slot1weight, slot2weight, slot3weight, slot4weight, slot5weight, slot6weight, slot7weight, slot8weight, slot9weight} -- inspected kg of item\nlocal items = {slot1item, slot2item, slot3item, slot4item, slot5item, slot6item, slot7item, slot8item, slot9item} -- names to display\nlocal htmlContent = \"\"\nfor i=1, #containers do\n    htmlContent = htmlContent .. \"<tr>\"..\"<th>\"..index[i]..\"</th><th>\"..items[i]..\"</th><th>\"..math.ceil(((math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5)/containermax)*100))..\"%</th><th>\"..math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5)..\"</th><tr>\"\nend\nlocal html = [[\n<table style=\"\nmargin-left: auto;\nmargin-right: auto;\nwidth:30%;\nfont-size:1.25em;\ntext-align:left;\">\n  <tr style = \"\nbackground-color:Purple;\ncolor:black !important;\">\n    <svg>\n    <g>\n    <text xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" id=\"svg_8\" y=\"50\" x=\"10\" stroke=\"#ff0000\" fill=\"#ff7f00\">PB1</text> \n    </g></svg>\n    <th>Row</th>\n    <th>Product</th>\n    <th>Container%</th>\n    <th>Total Ore</th>\n  </tr>\n  ]]..htmlContent..[[\n</table>]]\n\nscreen.setHTML(html)\nelseif Morethan9slots == \"On\" then\nswitch.activate()\ndbhtml = databank.getStringValue(OreMonitorTwo)\ndhtml = databank2.getStringValue(OreMonitorThree)\nlocal index = {1, 2, 3, 4, 5, 6} -- Row of Container?\nlocal containers = {slot1, slot2, slot3, slot4, slot5, slot6} -- slot names\nlocal weights = {slot1weight, slot2weight, slot3weight, slot4weight, slot5weight, slot6weight} -- inspected kg of item\nlocal items = {slot1item, slot2item, slot3item, slot4item, slot5item, slot6item} -- names to display\nlocal htmlContent = \"\"\nfor i=1, #containers do\n    htmlContent = htmlContent .. \"<tr>\"..\"<th>\"..index[i]..\"</th><th>\"..items[i]..\"</th><th>\"..math.ceil(((math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5)/containermax)*100))..\"%</th><th>\"..math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5)..\"</th><tr>\"\nend\nlocal html = [[\n<table style=\"\nmargin-left: auto;\nmargin-right: auto;\nwidth:30%;\nfont-size:1.25em;\ntext-align:left;\">\n  <tr style = \"\nbackground-color:Purple;\ncolor:black !important;\">\n    <svg>\n    <g>\n    <text xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" id=\"svg_8\" y=\"50\" x=\"10\" stroke=\"#ff0000\" fill=\"#ff7f00\">PB1</text> \n    </g></svg>\n    <th>Row</th>\n    <th>Product</th>\n    <th>Container%</th>\n    <th>Total Ore</th>\n  </tr>\n  ]]..htmlContent..[[]]..dbhtml..[[]]..dhtml..[[\n</table>]]\n\nscreen.setHTML(html)\n\nend\n\n\n","filter":{"args":[{"value":"Live"}],"signature":"tick(timerId)","slotKey":"-1"},"key":"2"},{"code":"dbhtmltwo = databank.getStringValue(OreMonitorTwo)\nscreen.setHTML(dbhtmltwo)","filter":{"args":[{"value":"option2"}],"signature":"actionStart(action)","slotKey":"-2"},"key":"3"},{"code":"local index = {1, 2, 3, 4, 5, 6, 7} -- Row of Container?\nlocal containers = {slot1, slot2, slot3, slot4, slot5, slot6, slot7}  -- slot names\nlocal weights = {1.28, 1.35, 5.04, 2.65, 4.54, 2.71, 4.0} -- inspected kg of item\nlocal items = {\"Bauxite\", \"Coal\", \"Hematite\", \"Quartz\", \"Chromite\", \"Limestone\", \"Malachite\"} -- names to display\nlocal htmlContent = \"\"\n\nfor i=1, #containers do\n    htmlContent = htmlContent .. \"<tr>\"..\"<th>\"..math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5)..\"</th><th>\"..items[i]..\"</th><th>\"..index[i]..\"</th></tr>\"\nend\nlocal html = [[\n<table style=\"\nmargin-left: auto;\nmargin-right: auto;\nwidth:25%;\nfont-size:1.25em;\ntext-align:left;\">\n  <tr style = \"\nbackground-color:Blue;\ncolor:black !important;\">\n    <th>Amount</th>\n    <th>Row</th>\n    <th>#</th>\n  </tr>\n  ]]..htmlContent..[[]]..dbhtmltwo..[[]]..dbhtml..[[\n</table>]]\n\nscreen.setHTML(html)\n","filter":{"args":[{"value":"option1"}],"signature":"actionStart(action)","slotKey":"-2"},"key":"4"},{"code":"dbhtmlthree = databank.getStringValue(fuck)\nscreen.setHTML(dbhtmlthree)","filter":{"args":[{"value":"option3"}],"signature":"actionStart(action)","slotKey":"-2"},"key":"5"}],"methods":[],"events":[]}

Programming Board 2   Link containers(Malachite, Natron, Acanthite, Garnieririte, Petalite, Pyrite, Cobaltite, Cryolite, Gold Nuggets First and then Last slot is databank and named like so.
 

{"slots":{"0":{"name":"slot1","type":{"events":[],"methods":[]}},"1":{"name":"slot2","type":{"events":[],"methods":[]}},"2":{"name":"slot3","type":{"events":[],"methods":[]}},"3":{"name":"slot4","type":{"events":[],"methods":[]}},"4":{"name":"slot5","type":{"events":[],"methods":[]}},"5":{"name":"slot6","type":{"events":[],"methods":[]}},"6":{"name":"slot7","type":{"events":[],"methods":[]}},"7":{"name":"slot8","type":{"events":[],"methods":[]}},"8":{"name":"slot9","type":{"events":[],"methods":[]}},"9":{"name":"databank","type":{"events":[],"methods":[]}},"-1":{"name":"unit","type":{"events":[],"methods":[]}},"-2":{"name":"system","type":{"events":[],"methods":[]}},"-3":{"name":"library","type":{"events":[],"methods":[]}}},"handlers":[{"code":"--databank is last slot to add and named databank\n\n\nlocal slot1item = \"Malachite\" --export:;Slot1 Iten.\nlocal slot1weight = 4.0 --export:;Slot1 weight.\nlocal slot2item = \"Natron\" --export:;Slot2 Iten.\nlocal slot2weight = 1.55 --export:;Slot2 weight.\nlocal slot3item = \"Acanthite\" --export:;Slot3 Iten.\nlocal slot3weight = 7.2 --export:;Slot3 weight.\nlocal slot4item = \"Garnierite\" --export:;Slot4 Iten.\nlocal slot4weight = 2.60 --export:;Slot4 weight.\nlocal slot5item = \"Petalite\" --export:;Slot5 Iten.\nlocal slot5weight = 2.41 --export:;Slot5 weight.\nlocal slot6item = \"Pyrite\" --export:;Slot6 Iten.\nlocal slot6weight = 5.01 --export:;Slot6 weight.\nlocal slot7item = \"Colbaltite\" --export:;Slot7 Iten.\nlocal slot7weight = 6.33 --export:;Slot7 weight.\nlocal slot8item = \"Cryolite\" --export:;Slot8 Iten.\nlocal slot8weight = 2.95 --export:;Slot8 weight.\nlocal slot9item = \"Gold Nuggets\" --export:;Slot9 Iten.\nlocal slot9weight = 19.30 --export:;Slot9 weight.\nlocal dbhtml = \"\"\nlocal dhtml = \"\"\nlocal index = {1, 2, 3, 4, 5, 6, 7, 8, 9} -- Row of Container?\nlocal containers = {slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8, slot9} -- slot names\nlocal weights = {slot1weight, slot2weight, slot3weight, slot4weight, slot5weight, slot6weight, slot7weight, slot8weight, slot9weight} -- inspected kg of item\nlocal items = {slot1item, slot2item, slot3item, slot4item, slot5item, slot6item, slot7item, slot8item, slot9item} -- names to display\nlocal htmlContent = \"\"\nlocal containermax = 9600 --export:;Your max container holding.\nfor i=1, #containers do\n    htmlContent = htmlContent .. \"<tr>\"..\"<th>\"..index[i]..\"</th><th>\"..items[i]..\"</th><th>\"..math.ceil(((math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5)/containermax)*100))..\"%</th><th>\"..math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5)..\"</th><tr>\"\nend\nlocal html = [[\n<table style=\"\nmargin-left: auto;\nmargin-right: auto;\nwidth:30%;\nfont-size:1.25em;\ntext-align:left;\">\n  <tr style = \"\nbackground-color:Purple;\ncolor:black !important;\">\n    <svg>\n    <g>\n    <text xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" id=\"svg_8\" y=\"50\" x=\"10\" stroke=\"#ff0000\" fill=\"#ff7f00\">PB2</text> \n    </g></svg>\n    <th>Row</th>\n    <th>Product</th>\n    <th>Container%</th>\n    <th>Total Ore</th>\n  </tr>\n  ]]..htmlContent..[[\n</table>]]\n\n\ndatabank.setStringValue(OreMonitorTwo,html)\n","filter":{"args":[{"value":"Live"}],"signature":"tick(timerId)","slotKey":"-1"},"key":"0"},{"code":"unit.setTimer(\"Live\",1)\nunit.hide()","filter":{"args":[],"signature":"start()","slotKey":"-1"},"key":"1"}],"methods":[],"events":[]}

Programming Board 3 Link containers(Kobelckite, Columbite, Illemnite, Rhodonite, Vanadinite) First and then Last slot is databank and named like so.

{"slots":{"0":{"name":"slot1","type":{"events":[],"methods":[]}},"1":{"name":"slot2","type":{"events":[],"methods":[]}},"2":{"name":"slot3","type":{"events":[],"methods":[]}},"3":{"name":"slot4","type":{"events":[],"methods":[]}},"4":{"name":"slot5","type":{"events":[],"methods":[]}},"5":{"name":"databank","type":{"events":[],"methods":[]}},"6":{"name":"slot7","type":{"events":[],"methods":[]}},"7":{"name":"slot8","type":{"events":[],"methods":[]}},"8":{"name":"slot9","type":{"events":[],"methods":[]}},"9":{"name":"slot10","type":{"events":[],"methods":[]}},"-1":{"name":"unit","type":{"events":[],"methods":[]}},"-2":{"name":"system","type":{"events":[],"methods":[]}},"-3":{"name":"library","type":{"events":[],"methods":[]}}},"handlers":[{"code":"--databank is last slot to add and named databank\n\nlocal slot1item = \"Kobelckite\" --export:;Slot1 Iten.\nlocal slot1weight = 2.37 --export:;Slot1 weight.\nlocal slot2item = \"Columbite\" --export:;Slot2 Iten.\nlocal slot2weight = 5.38 --export:;Slot2 weight.\nlocal slot3item = \"Illmenite\" --export:;Slot3 Iten.\nlocal slot3weight = 4.55 --export:;Slot3 weight.\nlocal slot4item = \"Rhodonite\" --export:;Slot4 Iten.\nlocal slot4weight = 3.76 --export:;Slot4 weight.\nlocal slot5item = \"Vanadinite\" --export:;Slot5 Iten.\nlocal slot5weight = 6.95 --export:;Slot5 weight.\nlocal slot6item = \"Not set\" --export:;Slot6 Iten.\nlocal slot6weight = 0 --export:;Slot6 weight.\nlocal slot7item = \"Not set\" --export:;Slot7 Iten.\nlocal slot7weight = 0 --export:;Slot7 weight.\nlocal slot8item = \"Not set\" --export:;Slot8 Iten.\nlocal slot8weight = 0 --export:;Slot8 weight.\nlocal slot9item = \"Not set\" --export:;Slot9 Iten.\nlocal slot9weight = 0 --export:;Slot9 weight.\nlocal index = {16, 17, 18, 19, 20} -- Row of Container?\nlocal containers = {slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8, slot9} -- slot names\nlocal weights = {slot1weight, slot2weight, slot3weight, slot4weight, slot5weight, slot6weight, slot7weight, slot8weight, slot9weight} -- inspected kg of item\nlocal items = {slot1item, slot2item, slot3item, slot4item, slot5item, slot6item, slot7item, slot8item, slot9item} -- names to display\nlocal htmlContent = \"\"\nlocal containermax = 1200 --export:;Your max container holding.\nfor i=1, #containers do\n    htmlContent = htmlContent .. \"<tr>\"..\"<th>\"..index[i]..\"</th><th>\"..items[i]..\"</th><th>\"..math.ceil(((math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5)/containermax)*100))..\"%</th><th>\"..math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5)..\"</th><tr>\"\nend\nlocal html = [[\n<table style=\"\nmargin-left: auto;\nmargin-right: auto;\nwidth:30%;\nfont-size:1.25em;\ntext-align:left;\">\n  <tr style = \"\nbackground-color:Purple;\ncolor:black !important;\">\n    <svg>\n    <g>\n    <text xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" id=\"svg_8\" y=\"50\" x=\"10\" stroke=\"#ff0000\" fill=\"#ff7f00\">PB3</text> \n    </g></svg>\n    <th>Row</th>\n    <th>Product</th>\n    <th>Container%</th>\n    <th>Total Ore</th>\n  </tr>\n  ]]..htmlContent..[[\n</table>]]\ndatabank.setStringValue(OreMonitorThree,html)\n\n","filter":{"args":[{"value":"Live"}],"signature":"tick(timerId)","slotKey":"-1"},"key":"0"},{"code":"unit.setTimer(\"Live\",1)\nunit.hide()","filter":{"args":[],"signature":"start()","slotKey":"-1"},"key":"1"}],"methods":[],"events":[]}

 

Share this post


Link to post
Share on other sites

I modified to suit using only on a single screen and 4 large containers (monitoring for aluminium, carbon, iron and silicon).

 

Works a treat!

 

Thank you, helped me understand something simple that i was forgetting. Though I did run into an error where you were running to end stops, removed one and working beautfully.

Share this post


Link to post
Share on other sites
On 9/16/2020 at 12:17 PM, mouflon said:

Thats for the above but doesn't work for me - keep getting nil value for the switch. 

 

Thats my bad. I forgot to set some parameters. The script has been updated with a Lua parameter set to work properly.

Share this post


Link to post
Share on other sites
On 9/16/2020 at 4:01 PM, Novatek said:

This is cool!

 

I know nothing about LUA. Let's say I only use 1 Large Container, or 4 Large Containers, how do I change the script to reflect this?

 

Thank you.

recopy PB1 and paste it. Then go inside of editor and change values for product names and weights in the tick.
then apply. and right click board set your max container hold weight and switch mopower to "Off"

Share this post


Link to post
Share on other sites
3 hours ago, NEWMidgetMAN said:

recopy PB1 and paste it. Then go inside of editor and change values for product names and weights in the tick.
then apply. and right click board set your max container hold weight and switch mopower to "Off"

Thank you. I have it working now. Cheers.

Share this post


Link to post
Share on other sites

I have followed these steps and I cannot seem to get PB2 and PB3 to show  anything on screen. PB1 works great, I have tried everything not sure what I did wrong. Please help.

Share this post


Link to post
Share on other sites

Hi, I'm just setting this for 8 [ S ] containers only that have refined ores.  I have copied just the PB1 code and tried to change 'Bauxite' to 'Pure Carbon' for example, but I get nothing on screen.

 

8 x containers > PB1 > Screen | Switch > PB1

 

Thanks so much.

Share this post


Link to post
Share on other sites
On 9/18/2020 at 10:59 AM, Novatek said:

Thank you. I have it working now. Cheers.

Greetings;

 

I was wanting to do the same thing on my setup with just running one large container. Any chance you can post the code that you used so the rest of us can see how it was done and what to do???

 

Thanks

Share this post


Link to post
Share on other sites
On 9/25/2020 at 1:45 PM, Deneriass said:

I have followed these steps and I cannot seem to get PB2 and PB3 to show  anything on screen. PB1 works great, I have tried everything not sure what I did wrong. Please help.

I had the same problem but fixed it.  If you go to "Edit Lua Script" on the first programming board, goto Unit and then on the first start() you need to change the Morethan9slots value at the top to "on" like this:

 

Morethan9slots = "On" --export:Off for 9 slots and On for more than 9 and requires databanks.

Share this post


Link to post
Share on other sites

Thanks I was figuring that was the issue and tried that and yes it worked, however, I think I am working on going in a different direction with the advice and a little knowledge from a different ORG, but i will still play with this one a bit.

Share this post


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.

Guest
Reply to this topic...

×   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...