Jump to content

CreditCain

Member
  • Posts

    28
  • Joined

  • Last visited

Posts posted by CreditCain

  1. 52 minutes ago, virtualburn said:

    Thank you, This worked like a charm - thank you.  Is the intermittent screen flash normal?  And is there a way to stop the screen contents enlarging from a distance.

    Thirdly, sorry :D  Do you have a script that you can show content totals of 8 boxes for one screen?  With an alert (colour) if they fall beneath a specified amount?

     

    Thanks again, first script I got working.

    Pretty sure all of these questions have been asked and answered above...

  2. OK, no biggie if not but do you have a script that will monitor the volume of a certain material (i.e. Coal) in a certain container? The idea being I can display the quantity I have on a screen so I know when to top up. If I have above a certain value then green background, if I am running below a certain value then amber, and red if out. Cheeky to ask here rather than a new thread I know but worth a shot.

  3. Hey injurytoall, almost everything is working now. However, I have found an issue where the Status column is omitted on the screen if the situation of the machine is in a status of Pending due to the "Maintain" volume being reached. Is there a "If" statement that can be added for this scenario? 

  4. For anyone experiencing the refresh flash I have amended my unit loading tick to the following. Means the screens are only refreshed every 10 seconds but thats not an issue for me and it stops the annoyance of the screen flickering every second.

     

    unit.setTimer("refresh", 10)
    unit.stopTimer("loading")

     

    If there is a workaround to decrease the flicker then great, let me know, otherwise THANK YOU SO MUCH AGAIN!

  5. 1 hour ago, injurytoall said:

    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":[]}

     

    That works a treat THANKS!

     

    Is there anyway to reduce the impact of the screen refreshing? Every second it flickers (I assume when it is refreshing?). On my (in game) screen its quite significant (and annoying). Or is that something to put up with.

     

    Great work btw and thanks for sharing.

  6. OK so the line that is erroring is in the unit tick(refresh) script line 3

     

    number = string.format(fmtStr,number)

     

    Error says "bad argument #2 to 'format'(number expected, got nil)

     

    Also the LUA console states the following:

     

    Warning: method getElementName is deprecated, use getElementNameByID instead

    Warning: method getElementHitPoints is deprecated, use getElementHitPointsByID instead

    Warning: method getElementMaxHitPoints is deprecated, use getElementMaxHitPointsByID instead

    Warning: method getElementMass is deprecated, use getElementMassByID instead

    Warning: method getElementType is deprecated, use getElementTypeByID instead

     

     

  7. This looks awesome but states "Script Error!" when I try to run it. Have repeated the steps 3 times now and still same issue. Any obvious thing i may have overlooked when following these instructions? I have zero LUA knowledge so have no expectations of a resolution. When I activate the board the screen comes on (decreasing circles display) but bottom right states script error.

     

    When you say "Access to your base core (for linking purposes)" do i need to do anything other than link using 6 key? It is my personal core so assume i dont have to grant anything.

     

    Suggestions?

  8. 20 minutes ago, Samlow said:

    Watch a movie? Netflix, youtube videos, read up on locomotion physics and orbital physics, play other games, do your taxes, say I love you to your wife/husband/partner, write a will, go back to school

     

    What is this madness you speak of? No thank you....i'll sit here a stare at the log in error messages until i break through to the other side or until my eyes start to bleed. 

×
×
  • Create New...