Jump to content

injurytoall

Member
  • Posts

    8
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

injurytoall's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. HDD:\Dual Universe\Game\documentation And there are some LUA libraries that give more tidbits on what you can do in HDD:\Dual Universe\Game\data\lua
  2. If the screen ever gets wonky, just turn off the programming board and turn it back on. It is not saving any information, it simply updates the view every second. You can get rid of the loading screen too if you want by editing the start() filter in the unit. Change unit.setTimer("loading", 5) -> unit.setTimer("loading", 1) It is only there for fluff really.
  3. You can't query a container for it's contents sadly. You could however say container x contains a specific resource (eg. Coal) and then do all the calculations with the assumption that container only has coal in it. I don't have any scripts for that. I was doing some work on a fuel display next for others to see besides the pilot, but a nice one was posted to this board. I wanted to display the current item being processed and the time left for completion, but you cannot access that information from the API. I may revisit this script in the future as I had some ideas about including some touch features for starting/stopping machines which can be done via the API.
  4. Ah yes. I had fixed that locally on an installation at an org mate's machine and didn't update my code -- Fix has been added to the original post. You can manually add it if you'd like too. Just after the if for stopped if col2 == "PENDING" then status = status .. '<td style="background-color:orange">' col3 = '-' col4 = '-' col5 = '-' end
  5. Updated the original post with the better instructions and fixed the screen.clear() problem. Thanks CreditCain
  6. You got it right, the number in unit.setTimer("refresh", 1) is the number of seconds the refresh timer runs, so you can adjust accordingly.
  7. This may work better - I have copied the config from a proven working programming board - CTRL + C all this code, then in game right click the programming board > advanced > Paste lua config from clipboard. Also to note, if you didn't link the items in the correct order, these boards can be finnicky and you may have to create a new board and try it with a fresh one: {"slots":{"0":{"name":"core","type":{"events":[],"methods":[]}},"1":{"name":"screen","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":"slot10","type":{"events":[],"methods":[]}},"-1":{"name":"unit","type":{"events":[],"methods":[]}},"-2":{"name":"system","type":{"events":[],"methods":[]}},"-3":{"name":"library","type":{"events":[],"methods":[]}}},"handlers":[{"code":"screen.setHTML([[\n <svg width=\"100vw\" height=\"60vw\" viewBox=\"0 0 45 45\" xmlns=\"http://www.w3.org/2000/svg\" stroke=\"#fff\">\n <g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\" stroke-width=\"2\">\n <circle cx=\"22\" cy=\"22\" r=\"6\" stroke-opacity=\"0\">\n <animate attributeName=\"r\"\n begin=\"1.5s\" dur=\"3s\"\n values=\"6;22\"\n calcMode=\"linear\"\n repeatCount=\"indefinite\" />\n <animate attributeName=\"stroke-opacity\"\n begin=\"1.5s\" dur=\"3s\"\n values=\"1;0\" calcMode=\"linear\"\n repeatCount=\"indefinite\" />\n <animate attributeName=\"stroke-width\"\n begin=\"1.5s\" dur=\"3s\"\n values=\"2;0\" calcMode=\"linear\"\n repeatCount=\"indefinite\" />\n </circle>\n <circle cx=\"22\" cy=\"22\" r=\"6\" stroke-opacity=\"0\">\n <animate attributeName=\"r\"\n begin=\"3s\" dur=\"3s\"\n values=\"6;22\"\n calcMode=\"linear\"\n repeatCount=\"indefinite\" />\n <animate attributeName=\"stroke-opacity\"\n begin=\"3s\" dur=\"3s\"\n values=\"1;0\" calcMode=\"linear\"\n repeatCount=\"indefinite\" />\n <animate attributeName=\"stroke-width\"\n begin=\"3s\" dur=\"3s\"\n values=\"2;0\" calcMode=\"linear\"\n repeatCount=\"indefinite\" />\n </circle>\n <circle cx=\"22\" cy=\"22\" r=\"8\">\n <animate attributeName=\"r\"\n begin=\"0s\" dur=\"1.5s\"\n values=\"6;1;2;3;4;5;6\"\n calcMode=\"linear\"\n repeatCount=\"indefinite\" />\n </circle>\n </g>\n</svg>\n ]])","filter":{"args":[],"signature":"start()","slotKey":"1"},"key":"0"},{"code":"screen.clear","filter":{"args":[],"signature":"stop()","slotKey":"1"},"key":"1"},{"code":"unit.setTimer(\"loading\", 5)","filter":{"args":[],"signature":"start()","slotKey":"-1"},"key":"2"},{"code":"unit.setTimer(\"refresh\", 1)\nunit.stopTimer(\"loading\")","filter":{"args":[{"value":"loading"}],"signature":"tick(timerId)","slotKey":"-1"},"key":"3"},{"code":"function round(number, precision)\n local fmtStr = string.format('%%0.%sf',precision)\n number = string.format(fmtStr,number)\n return number\nend\n\nslots = {}\nif slot3 then \n table.insert(slots,{slot3.getId(),slot3.getStatus(),slot3.getUptime(),slot3.getEfficiency(),slot3.getCycleCountSinceStartup()})\nend\nif slot4 then\n table.insert(slots,{slot4.getId(),slot4.getStatus(),slot4.getUptime(),slot4.getEfficiency(),slot4.getCycleCountSinceStartup()})\nend\nif slot5 then\n table.insert(slots,{slot5.getId(),slot5.getStatus(),slot5.getUptime(),slot5.getEfficiency(),slot5.getCycleCountSinceStartup()})\nend\nif slot6 then\n table.insert(slots,{slot6.getId(),slot6.getStatus(),slot6.getUptime(),slot6.getEfficiency(),slot6.getCycleCountSinceStartup()})\nend\nif slot7 then\n table.insert(slots,{slot7.getId(),slot7.getStatus(),slot7.getUptime(),slot7.getEfficiency(),slot7.getCycleCountSinceStartup()})\nend\nif slot8 then\n table.insert(slots,{slot8.getId(),slot8.getStatus(),slot8.getUptime(),slot8.getEfficiency(),slot8.getCycleCountSinceStartup()})\nend\nif slot9 then\n table.insert(slots,{slot9.getId(),slot9.getStatus(),slot9.getUptime(),slot9.getEfficiency(),slot9.getCycleCountSinceStartup()})\nend\nif slot10 then\n table.insert(slots,{slot10.getId(),slot10.getStatus(),slot10.getUptime(),slot10.getEfficiency(),slot10.getCycleCountSinceStartup()})\nend\nlocal beginHtml = [[\n <style>table{width:100%;font-size:19px;color:#99CC00;border-collapse:collapse;}td{width:20vw;border-bottom: 1px solid;text-align:center}tr{height: 60px}</style>\n <body style=\"width:100%\">\n <table>\n <tr style=\"font-weight:bold;align-text:center;background-color:indigo;\">\n <td>Machine</td>\n <td>Status</td>\n <td>Uptime(sec)</td>\n <td>Efficiency</td>\n <td>Cycle Count</td>\n </tr>\n]]\nlocal endHtml = [[\n\t\n </table>\n\t<tr>v1.0 // created by: injurytoall</tr>\n </body>\n]]\nlocal dispHtml = '<tr>'\nfor i = 0,8 do\n if slots[i] == nil then\n else\n local id = slots[i][1]\n local col1 = database.getElement(core, id).name\n \t\n --status\n local col2 = slots[i][2]\n --uptime\n local col3 = ''\n local col4 = ''\n local col5 = ''\n\n local status = ''\n --if machine is stopped\n if col2 == \"RUNNING\" then\n status = status .. '<td style=\"background-color:DarkGreen\">'\n end\n if col2 == \"JAMMED_MISSING_INGREDIENT\" then\n status = status .. '<td style=\"background-color:tomato\">'\n end\n if col2 == \"JAMMED_OUTPUT_FULL\" then\n status = status .. '<td style=\"background-color:tomato\">'\n end\n if col2 == \"JAMMED_NO_OUTPUT_CONTAINER\" then\n status = status .. '<td style=\"background-color:tomato\">'\n end\n\n col3 = slots[i][3]\n col3 = round(col3, 0)\n col4 = round((slots[i][4] * 100),1)\n col5 = slots[i][5]\n\n if col2 == \"STOPPED\" then\n status = status .. '<td style=\"background-color:orange\">'\n col3 = '-'\n col4 = '-'\n col5 = '-'\n end\n --name td\n local name = '<td>' .. col1 .. '</td>'\n --status td\n local status = status .. col2 .. '</td>' \n --uptime td\n local uptime = '<td>' .. col3 .. '</td>'\n --efficiency td\n local eff = '<td>' .. col4 .. '</td>'\n --count td\n local count = '<td>' .. col5 .. '</td>'\n\n\n dispHtml = dispHtml .. name .. status .. uptime .. eff .. count .. '</tr>'\n end \nend\n\nlocal finalHtml = beginHtml .. dispHtml .. endHtml\n\nscreen.setHTML(finalHtml)","filter":{"args":[{"value":"refresh"}],"signature":"tick(timerId)","slotKey":"-1"},"key":"4"},{"code":"screen.activate()","filter":{"args":[],"signature":"start()","slotKey":"-2"},"key":"5"},{"code":"screen.deactivate()","filter":{"args":[],"signature":"stop()","slotKey":"-2"},"key":"6"}],"methods":[],"events":[]}
  8. I created this for my org and I thought I'd share as I found it useful to be able to see the status of your machines from a single screen Element Requirements: x1 Programming Board x1 Screen (Only got it working with a medium screen) Access to your base core (for linking purposes) 1-8 Industry units Linking Order of Elements: [1]Core [2]Screen [3-10] Industry Unit Setup: Copy the following code {"slots":{"0":{"name":"core","type":{"events":[],"methods":[]}},"1":{"name":"screen","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":"slot10","type":{"events":[],"methods":[]}},"-1":{"name":"unit","type":{"events":[],"methods":[]}},"-2":{"name":"system","type":{"events":[],"methods":[]}},"-3":{"name":"library","type":{"events":[],"methods":[]}}},"handlers":[{"code":"screen.setHTML([[\n <svg width=\"100vw\" height=\"60vw\" viewBox=\"0 0 45 45\" xmlns=\"http://www.w3.org/2000/svg\" stroke=\"#fff\">\n <g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\" stroke-width=\"2\">\n <circle cx=\"22\" cy=\"22\" r=\"6\" stroke-opacity=\"0\">\n <animate attributeName=\"r\"\n begin=\"1.5s\" dur=\"3s\"\n values=\"6;22\"\n calcMode=\"linear\"\n repeatCount=\"indefinite\" />\n <animate attributeName=\"stroke-opacity\"\n begin=\"1.5s\" dur=\"3s\"\n values=\"1;0\" calcMode=\"linear\"\n repeatCount=\"indefinite\" />\n <animate attributeName=\"stroke-width\"\n begin=\"1.5s\" dur=\"3s\"\n values=\"2;0\" calcMode=\"linear\"\n repeatCount=\"indefinite\" />\n </circle>\n <circle cx=\"22\" cy=\"22\" r=\"6\" stroke-opacity=\"0\">\n <animate attributeName=\"r\"\n begin=\"3s\" dur=\"3s\"\n values=\"6;22\"\n calcMode=\"linear\"\n repeatCount=\"indefinite\" />\n <animate attributeName=\"stroke-opacity\"\n begin=\"3s\" dur=\"3s\"\n values=\"1;0\" calcMode=\"linear\"\n repeatCount=\"indefinite\" />\n <animate attributeName=\"stroke-width\"\n begin=\"3s\" dur=\"3s\"\n values=\"2;0\" calcMode=\"linear\"\n repeatCount=\"indefinite\" />\n </circle>\n <circle cx=\"22\" cy=\"22\" r=\"8\">\n <animate attributeName=\"r\"\n begin=\"0s\" dur=\"1.5s\"\n values=\"6;1;2;3;4;5;6\"\n calcMode=\"linear\"\n repeatCount=\"indefinite\" />\n </circle>\n </g>\n</svg>\n ]])","filter":{"args":[],"signature":"start()","slotKey":"1"},"key":"0"},{"code":"screen.clear()","filter":{"args":[],"signature":"stop()","slotKey":"1"},"key":"1"},{"code":"unit.setTimer(\"loading\", 5)","filter":{"args":[],"signature":"start()","slotKey":"-1"},"key":"2"},{"code":"unit.setTimer(\"refresh\", 1)\nunit.stopTimer(\"loading\")","filter":{"args":[{"value":"loading"}],"signature":"tick(timerId)","slotKey":"-1"},"key":"3"},{"code":"function round(number, precision)\n local fmtStr = string.format('%%0.%sf',precision)\n number = string.format(fmtStr,number)\n return number\nend\n\nslots = {}\nif slot3 then \n table.insert(slots,{slot3.getId(),slot3.getStatus(),slot3.getUptime(),slot3.getEfficiency(),slot3.getCycleCountSinceStartup()})\nend\nif slot4 then\n table.insert(slots,{slot4.getId(),slot4.getStatus(),slot4.getUptime(),slot4.getEfficiency(),slot4.getCycleCountSinceStartup()})\nend\nif slot5 then\n table.insert(slots,{slot5.getId(),slot5.getStatus(),slot5.getUptime(),slot5.getEfficiency(),slot5.getCycleCountSinceStartup()})\nend\nif slot6 then\n table.insert(slots,{slot6.getId(),slot6.getStatus(),slot6.getUptime(),slot6.getEfficiency(),slot6.getCycleCountSinceStartup()})\nend\nif slot7 then\n table.insert(slots,{slot7.getId(),slot7.getStatus(),slot7.getUptime(),slot7.getEfficiency(),slot7.getCycleCountSinceStartup()})\nend\nif slot8 then\n table.insert(slots,{slot8.getId(),slot8.getStatus(),slot8.getUptime(),slot8.getEfficiency(),slot8.getCycleCountSinceStartup()})\nend\nif slot9 then\n table.insert(slots,{slot9.getId(),slot9.getStatus(),slot9.getUptime(),slot9.getEfficiency(),slot9.getCycleCountSinceStartup()})\nend\nif slot10 then\n table.insert(slots,{slot10.getId(),slot10.getStatus(),slot10.getUptime(),slot10.getEfficiency(),slot10.getCycleCountSinceStartup()})\nend\nlocal beginHtml = [[\n <style>table{width:100%;font-size:19px;color:#99CC00;border-collapse:collapse;}td{width:20vw;border-bottom: 1px solid;text-align:center}tr{height: 60px}</style>\n <body style=\"width:100%\">\n <table>\n <tr style=\"font-weight:bold;align-text:center;background-color:indigo;\">\n <td>Machine</td>\n <td>Status</td>\n <td>Uptime(sec)</td>\n <td>Efficiency</td>\n <td>Cycle Count</td>\n </tr>\n]]\nlocal endHtml = [[\n\t\n </table>\n\t<tr>v1.0 // created by: injurytoall</tr>\n </body>\n]]\nlocal dispHtml = '<tr>'\nfor i = 0,8 do\n if slots[i] == nil then\n else\n local id = slots[i][1]\n local col1 = database.getElement(core, id).name\n \t\n --status\n local col2 = slots[i][2]\n --uptime\n local col3 = ''\n local col4 = ''\n local col5 = ''\n\n local status = ''\n --if machine is stopped\n if col2 == \"RUNNING\" then\n status = status .. '<td style=\"background-color:DarkGreen\">'\n end\n if col2 == \"JAMMED_MISSING_INGREDIENT\" then\n status = status .. '<td style=\"background-color:tomato\">'\n end\n if col2 == \"JAMMED_OUTPUT_FULL\" then\n status = status .. '<td style=\"background-color:tomato\">'\n end\n if col2 == \"JAMMED_NO_OUTPUT_CONTAINER\" then\n status = status .. '<td style=\"background-color:tomato\">'\n end\n\n col3 = slots[i][3]\n col3 = round(col3, 0)\n col4 = round((slots[i][4] * 100),1)\n col5 = slots[i][5]\n\n if col2 == \"STOPPED\" then\n status = status .. '<td style=\"background-color:orange\">'\n col3 = '-'\n col4 = '-'\n col5 = '-'\n end\n \n if col2 == \"PENDING\" then\n status = status .. '<td style=\"background-color:orange\">'\n col3 = '-'\n col4 = '-'\n col5 = '-'\n end\n --name td\n local name = '<td>' .. col1 .. '</td>'\n --status td\n local status = status .. col2 .. '</td>' \n --uptime td\n local uptime = '<td>' .. col3 .. '</td>'\n --efficiency td\n local eff = '<td>' .. col4 .. '</td>'\n --count td\n local count = '<td>' .. col5 .. '</td>'\n\n\n dispHtml = dispHtml .. name .. status .. uptime .. eff .. count .. '</tr>'\n end \nend\n\nlocal finalHtml = beginHtml .. dispHtml .. endHtml\n\nscreen.setHTML(finalHtml)","filter":{"args":[{"value":"refresh"}],"signature":"tick(timerId)","slotKey":"-1"},"key":"4"},{"code":"screen.activate()","filter":{"args":[],"signature":"start()","slotKey":"-2"},"key":"5"},{"code":"screen.deactivate()","filter":{"args":[],"signature":"stop()","slotKey":"-2"},"key":"6"}],"methods":[],"events":[]} In-game, right click the programming board > Advanced > Paste lua config from clipboard Link from the programming board to your base core Link from the board to your screen Link from your board to an industry unit, up to 8 of them Activate the programming board Updates: 26 Sep - Added some logic to account for Pending status of the machines
×
×
  • Create New...