Jump to content

RONinja

Alpha Tester
  • Posts

    29
  • Joined

  • Last visited

Posts posted by RONinja

  1. 1. When will we actually see a player count?

    2. Why are their so much graphical updates over the course of Beta Rather than actual game play?

    3. When will the players who do pay a monthly have their voice heard over the huge amount of crashes?

     

    4. Will NQ be more honest on what the games outlook is rather than watching players argue in the discord due to the lack of communication provided by the Devs?

    5. When will decide that the game needs a fresh start and the engine redone so it don't crash on so many people?

    6. Why ban over bugs in game created by the games DEVS during what is supposed to be a test period?

    7. Why ban over talking about the bug in general? How else are you going to find out how to fix during the test period? Very counter productive.
    Banning should only be done during release. Otherwise you kill off your players who would promote your game........... Literally

    8. Why did the Devs focus on game play based around work (Farming) rather than fun such as AVA?

    9. If the game play doesn't exist now and you have severe bugs with this foundation how do you intend on adding new game play with that foundation?

    10. Will you ever answer any of these?


                                                                             Sincerely "An Alpha Player who wanted a 3rd person view for Cockpit"
     


  2. Emitter Terminal Console
    Requirements:
    1 emitter
    1 receiver
    1 screen
    1 program board

     

    LINK SCREEN FIRST   RECEIVER SECOND     EMITTER THIRD.
    Link All items FROM Program Board to Elements to ensure all links are green.

     

    Starts with Entering a Password       Default is PASS

    You can edit Lua Parameters by RCL the PB and finding the button Edit Lua Parameters
    You can turn off Password Lock by unchecking box in Lua Parameter.

     

     

    To Link Example Script Used in Video
    Link Receiver then Emitter then 1 Container then Link Switch FROM AND TO PB (turn light blue) then link door

     

     

    This console can change channel and send messages via Emitter.
    To Change channel you can edit Lua Parameter or Type In the console the Channel you want it to change to and hit the Bottom Right Channel Button.
    To Send after a desired channel is set Type your message and click Enter.

    Enjoy :) DU IT.

     

     

     

    Json Paste

     Emitter System------------------------------

    {"slots":{"0":{"name":"slot3","type":{"events":[],"methods":[]}},"1":{"name":"slot2","type":{"events":[],"methods":[]}},"2":{"name":"slot1","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":"MSMouseX = x\nMSMouseY = y\nMSMouseDown = true\nMSAttention = 0\nMSDislikeButton = 0\nMSLikeButton = 0\nMSButtonSelected = evaluateButtons()\nonButtonDown(MSButtonSelected)","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"mouseDown(x,y)","slotKey":"0"},"key":"0"},{"code":"MSMouseX = x\nMSMouseY = y\nMSMouseDown = false\nlocal buttonNo = evaluateButtons()\nif MSButtonSelected > 0 and MSButtonSelected == buttonNo then\n    onButtonUp(buttonNo)\n    onClick(buttonNo)\nend\nMSButtonSelected = -buttonNo","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"mouseUp(x,y)","slotKey":"0"},"key":"1"},{"code":"table.insert(lines, \"ID: \" .. channel .. \"/ MSG: \" .. message)\n","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"receive(channel,message)","slotKey":"1"},"key":"2"},{"code":"keybhidden = \"Goodbye\"\nunit.exit()","filter":{"args":[{"value":"exit"}],"signature":"tick(timerId)","slotKey":"-1"},"key":"3"},{"code":"function getSlots()\n    local slot={}\n    local self = self or unit or {} -- in-game, self is the active control unit\n    for key, value in pairs(self) do\n        if type(key) == \"string\" and type(value) == \"table\" and type(value.export) == \"table\" then\n            slot[key] = value\n        end\n    end\n    return slot\nend\n\nfunction getRequiredElements(slots)\n    local foundScreen=false\n    local foundEmitter=false\n    local foundReceiver=false\n    for slotName, slotElement in pairs(slots) do\n        if slotElement.setRawHTML then foundScreen = slotElement\n        elseif slotElement.send then foundEmitter = slotElement\n        elseif slotElement.getRange and not slotElement.send then foundReceiver = slotElement\n        end\n    end\n    return foundScreen,foundEmitter,foundReceiver\nend\n\n---\nscreen, emitter, receiver = getRequiredElements(getSlots())\nif not screen then\n    error('Setup Error: Missing important element: screen')\n    unit.exit()\nend\nif not emitter then\n    error('Setup Error: Missing important element: emitter')\n    unit.exit()\nend\nif not receiver then\n    error('Setup Error: Missing important element: receiver')\n    unit.exit()    \nend\n------------------------------\nunit.hide()\n-------------------------system start----------------------------------------------------------\n-- Internal variables\nkeyb=\"\"\nkeybhidden = \"\"\nLockonStart = true\n\nconsta=0\nMSButtons = {}\nMSMouseX = 0\nMSMouseY = 0\nMSMouseDown = false\nMSButtonSelected = 0\nMSAttention = 0\nMSDislikeButton = 0\nMSLikeButton = 0\nMSHintButton = 0\nMSAttentionMessage = \"\"\nMSAttentionVisible = false\nstartupnow = 1\nEnterPressed = false\npassword = \"PASS\"--export:\nLockonStart = true--export:\nCurChan = \"01\"--export:Channel on Start\nstartcount = 0\nlineIndex = 0\nlines = {}\n\nfunction CheckEnterButton()\nif LockonStart == true then\n    if EnterPressed == true then\n        if keyb == password then\n            keyb=\"\"\n            screen.addText(30,10,7,keyb)\n            consta=string.len(keyb)\n            keybhidden=\"Access Granted\"\n            EnterPressed = false            \n            LockonStart = false\n            CheckEnterButton()\n        elseif keyb ~= password then \n            keyb=\"\"\n            keybhidden=\"Access DENIED\"\n            screen.addText(30,10,7,keyb)\n            consta=string.len(keyb)\n            unit.setTimer(\"exit\",1)\n        end\n    end\nelseif LockonStart == false then   \n    if EnterPressed == true then\n        emitter.send(CurChan,(keyb))\n        EnterPressed = false\n        keyb = \"\"\n    end\nend\nend\nfunction updateScreen() \n\nif startupnow == 1 then    ----- engine stat end emitter start\n    tablex.clear(MSButtons, button)\n      for i = 1,1 do\n   local button = {id = (\"b\"..1), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=1/100, right=6.5/100}\n    table.insert(MSButtons, button)\nend\n  for i = 2,2 do\n   local button = {id = (\"b\"..2), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=8/100, right=14/100}\n    table.insert(MSButtons, button)\nend\n    for i = 3,3 do\n    local button = {id = (\"b\"..3), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=15/100, right=22/100}\n      table.insert(MSButtons, button)\nend\n    for i = 4,4 do   \n    local button = {id = (\"b\"..4), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=23/100, right=30/100}\n      table.insert(MSButtons, button)\nend\n    for i = 5,5 do   \n    local button = {id = (\"b\"..5), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=31/100, right=38/100}\n      table.insert(MSButtons, button)\nend\n    for i = 6,6 do   \n    local button = {id = (\"b\"..6), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=39/100, right=46/100}\n      table.insert(MSButtons, button)\nend\n    for i = 7,7 do   \n    local button = {id = (\"b\"..7), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=47/100, right=53/100}\n      table.insert(MSButtons, button)\nend\n    for i = 8,8 do   \n    local button = {id = (\"b\"..8), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=54/100, right=61/100}\n      table.insert(MSButtons, button)\nend\n    for i = 9,9 do   \n    local button = {id = (\"b\"..9), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=62/100, right=69/100}\n      table.insert(MSButtons, button)\nend\n    for i = 10,10 do   \n    local button = {id = (\"b\"..10), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=70/100, right=77/100}\n      table.insert(MSButtons, button)\nend\n    for i = 11,11 do   \n    local button = {id = (\"b\"..11), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=78/100, right=85/100}\n      table.insert(MSButtons, button)\nend\n    for i = 12,12 do   \n    local button = {id = (\"b\"..12), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=86/100, right=100/100}\n      table.insert(MSButtons, button)\nend\n\n\n\n    for i = 13,13 do   \n    local button = {id = (\"b\"..13), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=4/100, right=10/100}\n    table.insert(MSButtons, button)\nend\n      for i = 14,14 do\n   local button = {id = (\"b\"..14), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=11.5/100, right=18/100}\n    table.insert(MSButtons, button)\nend\n  for i = 15,15 do\n   local button = {id = (\"b\"..15), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=19/100, right=26/100}\n    table.insert(MSButtons, button)\nend\n    for i = 16,16 do\n    local button = {id = (\"b\"..16), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=27/100, right=34/100}\n      table.insert(MSButtons, button)\nend\n    for i = 17,17 do   \n    local button = {id = (\"b\"..17), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=35/100, right=42/100}\n      table.insert(MSButtons, button)\nend\n    for i = 18,18 do   \n    local button = {id = (\"b\"..18), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=43/100, right=50/100}\n      table.insert(MSButtons, button)\nend\n    for i = 19,19 do   \n    local button = {id = (\"b\"..19), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=51/100, right=58/100}\n      table.insert(MSButtons, button)\nend\n    for i = 20,20 do   \n    local button = {id = (\"b\"..20), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=59/100, right=65/100}\n      table.insert(MSButtons, button)\nend\n      for i = 21,21 do\n   local button = {id = (\"b\"..21), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=66.5/100, right=73/100}\n    table.insert(MSButtons, button)\nend\n  for i = 22,22 do\n   local button = {id = (\"b\"..22), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=74/100, right=89/100}\n    table.insert(MSButtons, button)\nend\n\n\n    for i = 23,23 do\n    local button = {id = (\"b\"..23), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=8/100, right=15/100}\n      table.insert(MSButtons, button)\nend\n    for i = 24,24 do   \n    local button = {id = (\"b\"..24), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=16/100, right=23/100}\n      table.insert(MSButtons, button)\nend\n    for i = 25,25 do   \n    local button = {id = (\"b\"..25), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=24/100, right=31/100}\n      table.insert(MSButtons, button)\nend\n    for i = 26,26 do   \n    local button = {id = (\"b\"..26), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=32/100, right=39/100}\n      table.insert(MSButtons, button)\nend\n    for i = 27,27 do   \n    local button = {id = (\"b\"..27), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=40/100, right=46/100}\n      table.insert(MSButtons, button)\nend\n    for i = 28,28 do   \n    local button = {id = (\"b\"..28), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=47/100, right=54/100}\n      table.insert(MSButtons, button)\nend\n    for i = 29,29 do   \n    local button = {id = (\"b\"..29), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=55/100, right=62/100}\n      table.insert(MSButtons, button)\nend\n    for i = 30,30 do   \n    local button = {id = (\"b\"..30), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=63/100, right=70/100}\n      table.insert(MSButtons, button)\nend\n    for i = 31,31 do   \n    local button = {id = (\"b\"..31), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=71/100, right=85/100}\n      table.insert(MSButtons, button)\nend\n\n\n    for i = 32,32 do   \n    local button = {id = (\"b\"..32), enabled=true, td=\"<td>\", top=88/100, bottom=98/100, left=30/100, right=59/100}\n      table.insert(MSButtons, button)\nend\n    for i = 33,33 do   \n    local button = {id = (\"b\"..33), enabled=true, td=\"<td>\", top=88/100, bottom=98/100, left=63/100, right=77/100}\n    table.insert(MSButtons, button)\nend\n      for i = 34,34 do\n   local button = {id = (\"b\"..34), enabled=true, td=\"<td>\", top=88/100, bottom=98/100, left=85/100, right=100/100}\n    table.insert(MSButtons, button)\nend\n    for i = 35,35 do   \n    local button = {id = (\"b\"..35), enabled=true, td=\"<td>\", top=90/100, bottom=100/100, left=1/100, right=18/100}\n    table.insert(MSButtons, button)\nend\nfunction evaluateButtons()\n  local selected = 0\n  \n  if #MSButtons >= 1 then\n\n         -- Set button styles\n       for i, button in ipairs(MSButtons) do\n            if button.left < MSMouseX and MSMouseX < button.right and button.top < MSMouseY and MSMouseY < button.bottom then\n                if MSMouseDown and MSButtonSelected == i then\n                end\n                selected = i\n            end\n            if not button.enabled then\n            end\n\n        end\n  end\n  return selected\nend\n\n\nfunction onButtonDown(buttonNo)\n  local button = MSButtons[buttonNo]    \n  if not button or not button.enabled then\n\treturn\n  end\nend\nfunction onButtonUp(buttonNo)\n  local button = MSButtons[buttonNo]    \n  if not button or not button.enabled then\n    return\n  end\n        \n\nfunction onClick(buttonNo)\n  local button = MSButtons[buttonNo]    \n  if not button or not button.enabled then\n    return\n  end\nend\n   if buttonNo == 1 then\n    keyb=keyb..\"Q\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 2 then\n    keyb=keyb..\"W\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 3 then\n    keyb=keyb..\"E\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 4 then\n    keyb=keyb..\"R\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 5 then\n    keyb=keyb..\"T\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 6 then\n    keyb=keyb..\"Y\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 7 then\n    keyb=keyb..\"U\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 8 then\n    keyb=keyb..\"I\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 9 then\n    keyb=keyb..\"O\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 10 then\n    keyb=keyb..\"P\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 11 then\n    tablex.clear(lines,html)\n  elseif buttonNo == 12 then\n    keyb = \"\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 13 then\n    keyb=keyb..\"A\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 14 then\n    keyb=keyb..\"S\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 15 then\n    keyb=keyb..\"D\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 16 then\n    keyb=keyb..\"F\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 17 then\n    keyb=keyb..\"G\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 18 then\n    keyb=keyb..\"H\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 19 then\n    keyb=keyb..\"J\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 20 then\n    keyb=keyb..\"K\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 21 then\n    keyb=keyb..\"L\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 22 then   ----enterbutton\n    EnterPressed = true\n    CheckEnterButton()\n  elseif buttonNo == 23 then\n    keyb=keyb..\"Z\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 24 then\n    keyb=keyb..\"X\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 25 then\n    keyb=keyb..\"C\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 26 then\n    keyb=keyb..\"V\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 27 then\n    keyb=keyb..\"B\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 28 then\n    keyb=keyb..\"N\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 29 then\n    keyb=keyb..\"M\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 30 then\n    keyb=keyb..\".\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 31 then\n    startupnow = 1.1\n  elseif buttonNo == 32 then\n    keyb=keyb..\" \"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 33 then\n    startupnow = 1.2\n  elseif buttonNo == 34 then\n    if LockonStart == false then\n        CurChan = keyb\n        keyb = \"\"\n    else\n        keybhidden = \"Buttons Are (LOCKED) ACCESS DENIED\"\n        unit.setTimer(\"exit\",1)\n    end\n  elseif buttonNo == 35 then\n\n  end\nend\n  \npage = [[\n<svg viewBox=\"0 0 1024 612\">\n<g>\n<title>background</title>\n<rect x=\"-1\" y=\"-1\" width=\"1026\" height=\"614\"/>\n<g display=\"none\">\n<rect width=\"100%\" height=\"100%\" fill=\"url(#gridpattern)\" stroke-width=\"0\"/>\n</g>\n</g>\n<g>\n<title>Layer 1</title>\n<rect x=\"7\" y=\"5\" width=\"1012\" height=\"290\" rx=\"20\" fill=\"#007f7f\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<rect x=\"1\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"14.997276\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">Q</text>\n<rect x=\"80\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"90\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">W</text>\n<rect x=\"160\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"178\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">E</text>\n<rect x=\"240\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"255\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">R</text>\n<rect x=\"320\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"337\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">T</text>\n<rect x=\"400\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"417\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">Y</text>\n<rect x=\"480\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"496\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">U</text>\n<rect x=\"560\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"586\" y=\"361.00001\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">I</text>\n<rect x=\"640\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"654\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">O</text>\n<rect x=\"720\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"740\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">P</text>\n<rect x=\"880\" y=\"306\" width=\"140\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"895\" y=\"350\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">CLEAR</text>\n<rect x=\"800\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"802\" y=\"350\" cursor=\"move\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\"></text>\n<rect x=\"41\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"59\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">A</text>\n<rect x=\"121\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"136\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">S</text>\n<rect x=\"201\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"218\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">D</text>\n<rect x=\"281\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"298\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">F</text>\n<rect x=\"361\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"377\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">G</text>\n<rect x=\"441\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"455\" y=\"440.00001\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">H</text>\n<rect x=\"521\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"540\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">J</text>\n<rect x=\"601\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"619\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">K</text>\n<rect x=\"761\" y=\"385\" width=\"140\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"785\" y=\"430\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" font-style=\"italic\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">Enter</text>\n<rect x=\"681\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"700\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">L</text>\n<rect x=\"86\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"101\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">Z</text>\n<rect x=\"166\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"183\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">X</text>\n<rect x=\"246\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"263\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">C</text>\n<rect x=\"326\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"342\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">V</text>\n<rect x=\"406\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"420\" y=\"521.00001\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">B</text>\n<rect x=\"486\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"500\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">N</text>\n<rect x=\"566\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"578\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">M</text>\n<rect x=\"646\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"656\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\"></text>\n<rect x=\"306\" y=\"545\" width=\"300\" height=\"55\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<rect x=\"726\" y=\"466\" width=\"140\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"750\" y=\"510\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">SHIFT</text>\n<rect x=\"650\" y=\"545\" width=\"140\" height=\"55\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"690\" y=\"585\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"28\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">?123</text>\n<rect x=\"880\" y=\"545\" width=\"140\" height=\"55\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"890\" y=\"585\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">CH:]]..CurChan..[[</text>\n<text x=\"674\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">.</text>\n\n<text x=\"50\" y=\"280\" fill=\"#0000ff\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"25\" font-style=\"italic\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">]]..keybhidden..[[</text>\n</g>]] \n    local buttonNo = evaluateButtons()\n    if MSMouseDown then\n      MSMouseX = screen.getMouseX()\n      MSMouseY = screen.getMouseY()\n      if buttonNo ~= MSButtonSelected or MSMouseX < 0.05 or MSMouseX > 0.95 or MSMouseY < 0.05 or MSMouseY > 0.95 then\n        if MSButtonSelected > 0 then\n          onButtonUp(MSButtonSelected)\n        end\n        MSButtonSelected = 0\n      end        \n    end\n\n    screen.setHTML(page)\n \n\n\n\n\n\n\n--------------------small letter keyboard\n\n\n\n\nelseif startupnow == 1.1 then\n\n               tablex.clear(MSButtons, button)\n      for i = 1,1 do\n   local button = {id = (\"b\"..1), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=1/100, right=6.5/100}\n    table.insert(MSButtons, button)\nend\n  for i = 2,2 do\n   local button = {id = (\"b\"..2), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=8/100, right=14/100}\n    table.insert(MSButtons, button)\nend\n    for i = 3,3 do\n    local button = {id = (\"b\"..3), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=15/100, right=22/100}\n      table.insert(MSButtons, button)\nend\n    for i = 4,4 do   \n    local button = {id = (\"b\"..4), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=23/100, right=30/100}\n      table.insert(MSButtons, button)\nend\n    for i = 5,5 do   \n    local button = {id = (\"b\"..5), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=31/100, right=38/100}\n      table.insert(MSButtons, button)\nend\n    for i = 6,6 do   \n    local button = {id = (\"b\"..6), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=39/100, right=46/100}\n      table.insert(MSButtons, button)\nend\n    for i = 7,7 do   \n    local button = {id = (\"b\"..7), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=47/100, right=53/100}\n      table.insert(MSButtons, button)\nend\n    for i = 8,8 do   \n    local button = {id = (\"b\"..8), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=54/100, right=61/100}\n      table.insert(MSButtons, button)\nend\n    for i = 9,9 do   \n    local button = {id = (\"b\"..9), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=62/100, right=69/100}\n      table.insert(MSButtons, button)\nend\n    for i = 10,10 do   \n    local button = {id = (\"b\"..10), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=70/100, right=77/100}\n      table.insert(MSButtons, button)\nend\n    for i = 11,11 do   \n    local button = {id = (\"b\"..11), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=78/100, right=85/100}\n      table.insert(MSButtons, button)\nend\n    for i = 12,12 do   \n    local button = {id = (\"b\"..12), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=86/100, right=100/100}\n      table.insert(MSButtons, button)\nend\n\n\n\n    for i = 13,13 do   \n    local button = {id = (\"b\"..13), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=4/100, right=10/100}\n    table.insert(MSButtons, button)\nend\n      for i = 14,14 do\n   local button = {id = (\"b\"..14), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=11.5/100, right=18/100}\n    table.insert(MSButtons, button)\nend\n  for i = 15,15 do\n   local button = {id = (\"b\"..15), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=19/100, right=26/100}\n    table.insert(MSButtons, button)\nend\n    for i = 16,16 do\n    local button = {id = (\"b\"..16), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=27/100, right=34/100}\n      table.insert(MSButtons, button)\nend\n    for i = 17,17 do   \n    local button = {id = (\"b\"..17), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=35/100, right=42/100}\n      table.insert(MSButtons, button)\nend\n    for i = 18,18 do   \n    local button = {id = (\"b\"..18), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=43/100, right=50/100}\n      table.insert(MSButtons, button)\nend\n    for i = 19,19 do   \n    local button = {id = (\"b\"..19), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=51/100, right=58/100}\n      table.insert(MSButtons, button)\nend\n    for i = 20,20 do   \n    local button = {id = (\"b\"..20), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=59/100, right=65/100}\n      table.insert(MSButtons, button)\nend\n      for i = 21,21 do\n   local button = {id = (\"b\"..21), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=66.5/100, right=73/100}\n    table.insert(MSButtons, button)\nend\n  for i = 22,22 do\n   local button = {id = (\"b\"..22), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=74/100, right=89/100}\n    table.insert(MSButtons, button)\nend\n\n\n    for i = 23,23 do\n    local button = {id = (\"b\"..23), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=8/100, right=15/100}\n      table.insert(MSButtons, button)\nend\n    for i = 24,24 do   \n    local button = {id = (\"b\"..24), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=16/100, right=23/100}\n      table.insert(MSButtons, button)\nend\n    for i = 25,25 do   \n    local button = {id = (\"b\"..25), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=24/100, right=31/100}\n      table.insert(MSButtons, button)\nend\n    for i = 26,26 do   \n    local button = {id = (\"b\"..26), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=32/100, right=39/100}\n      table.insert(MSButtons, button)\nend\n    for i = 27,27 do   \n    local button = {id = (\"b\"..27), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=40/100, right=46/100}\n      table.insert(MSButtons, button)\nend\n    for i = 28,28 do   \n    local button = {id = (\"b\"..28), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=47/100, right=54/100}\n      table.insert(MSButtons, button)\nend\n    for i = 29,29 do   \n    local button = {id = (\"b\"..29), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=55/100, right=62/100}\n      table.insert(MSButtons, button)\nend\n    for i = 30,30 do   \n    local button = {id = (\"b\"..30), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=63/100, right=70/100}\n      table.insert(MSButtons, button)\nend\n    for i = 31,31 do   \n    local button = {id = (\"b\"..31), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=71/100, right=85/100}\n      table.insert(MSButtons, button)\nend\n\n\n    for i = 32,32 do   \n    local button = {id = (\"b\"..32), enabled=true, td=\"<td>\", top=88/100, bottom=98/100, left=30/100, right=59/100}\n      table.insert(MSButtons, button)\nend\n    for i = 33,33 do   \n    local button = {id = (\"b\"..33), enabled=true, td=\"<td>\", top=88/100, bottom=98/100, left=63/100, right=77/100}\n    table.insert(MSButtons, button)\nend\n      for i = 34,34 do\n   local button = {id = (\"b\"..34), enabled=true, td=\"<td>\", top=88/100, bottom=98/100, left=85/100, right=100/100}\n    table.insert(MSButtons, button)\nend\n    for i = 35,35 do   \n    local button = {id = (\"b\"..35), enabled=true, td=\"<td>\", top=90/100, bottom=100/100, left=1/100, right=18/100}\n    table.insert(MSButtons, button)\nend\n\nfunction evaluateButtons()\n  local selected = 0\n  \n  if #MSButtons >= 1 then\n\n         -- Set button styles\n       for i, button in ipairs(MSButtons) do\n            if button.left < MSMouseX and MSMouseX < button.right and button.top < MSMouseY and MSMouseY < button.bottom then\n                if MSMouseDown and MSButtonSelected == i then\n                end\n                selected = i\n            end\n            if not button.enabled then\n            end\n\n        end\n  end\n  return selected\nend\n\nfunction onButtonDown(buttonNo)\n  local button = MSButtons[buttonNo]    \n  if not button or not button.enabled then\n\treturn\n  end\nend\nfunction onButtonUp(buttonNo)\n  local button = MSButtons[buttonNo]    \n  if not button or not button.enabled then\n    return\n  end\n        \n\nfunction onClick(buttonNo)\n  local button = MSButtons[buttonNo]    \n  if not button or not button.enabled then\n    return\n  end\nend\n  if buttonNo == 1 then\n    keyb=keyb..\"q\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 2 then\n    keyb=keyb..\"w\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 3 then\n    keyb=keyb..\"e\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 4 then\n    keyb=keyb..\"r\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 5 then\n    keyb=keyb..\"t\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 6 then\n    keyb=keyb..\"y\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 7 then\n    keyb=keyb..\"u\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 8 then\n    keyb=keyb..\"i\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 9 then\n    keyb=keyb..\"o\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 10 then\n    keyb=keyb..\"p\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 11 then\n    tablex.clear(lines,html)   \n  elseif buttonNo == 12 then\n    keyb = \"\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 13 then\n    keyb=keyb..\"a\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 14 then\n    keyb=keyb..\"s\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 15 then\n    keyb=keyb..\"d\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 16 then\n    keyb=keyb..\"f\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 17 then\n    keyb=keyb..\"g\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 18 then\n    keyb=keyb..\"h\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 19 then\n    keyb=keyb..\"j\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 20 then\n    keyb=keyb..\"k\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 21 then\n    keyb=keyb..\"l\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 22 then\n    EnterPressed = true\n    CheckEnterButton()\n  elseif buttonNo == 23 then\n    keyb=keyb..\"z\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 24 then\n    keyb=keyb..\"x\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 25 then\n    keyb=keyb..\"c\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 26 then\n    keyb=keyb..\"v\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 27 then\n    keyb=keyb..\"b\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 28 then\n    keyb=keyb..\"n\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 29 then\n    keyb=keyb..\"m\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 30 then\n    keyb=keyb..\".\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 31 then\n    startupnow = 1\n  elseif buttonNo == 32 then\n    keyb=keyb..\" \"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 33 then\n    startupnow = 1.2\n  elseif buttonNo == 34 then\n    if LockonStart == false then\n        CurChan = keyb\n        keyb = \"\"\n    else\n        keybhidden = \"Buttons Are (LOCKED) ACCESS DENIED\"\n        unit.setTimer(\"exit\",1)\n    end\n  elseif buttonNo == 35 then\n\n  end\nend\n\npage = [[\n<svg viewBox=\"0 0 1024 612\">\n<g>\n<title>background</title>\n<rect x=\"-1\" y=\"-1\" width=\"1026\" height=\"614\"/>\n<g display=\"none\">\n<rect width=\"100%\" height=\"100%\" fill=\"url(#gridpattern)\" stroke-width=\"0\"/>\n</g>\n</g>\n<g>\n<title>Layer 1</title>\n<rect x=\"7\" y=\"5\" width=\"1012\" height=\"290\" rx=\"20\" fill=\"#007f7f\" stroke=\"#0f0\" stroke-width=\"5\"/>\n\n<rect x=\"1\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"14.997276\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">q</text>\n<rect x=\"80\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"90\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">w</text>\n<rect x=\"160\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"178\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">e</text>\n<rect x=\"240\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"255\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">r</text>\n<rect x=\"320\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"337\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">t</text>\n<rect x=\"400\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"417\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">y</text>\n<rect x=\"480\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"496\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">u</text>\n<rect x=\"560\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"586\" y=\"361.00001\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">i</text>\n<rect x=\"640\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"654\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">o</text>\n<rect x=\"720\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"740\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">p</text>\n<rect x=\"880\" y=\"306\" width=\"140\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"895\" y=\"350\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">CLEAR</text>\n<rect x=\"800\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"802\" y=\"350\" cursor=\"move\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\"></text>\n<rect x=\"41\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"59\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">a</text>\n<rect x=\"121\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"136\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">s</text>\n<rect x=\"201\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"218\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">d</text>\n<rect x=\"281\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"298\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">f</text>\n<rect x=\"361\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"377\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">g</text>\n<rect x=\"441\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"455\" y=\"440.00001\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">h</text>\n<rect x=\"521\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"540\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">j</text>\n<rect x=\"601\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"619\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">k</text>\n<rect x=\"761\" y=\"385\" width=\"140\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"785\" y=\"430\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" font-style=\"italic\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">Enter</text>\n<rect x=\"681\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"700\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">l</text>\n<rect x=\"86\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"101\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">z</text>\n<rect x=\"166\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"183\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">x</text>\n<rect x=\"246\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"263\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">c</text>\n<rect x=\"326\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"342\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">v</text>\n<rect x=\"406\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"420\" y=\"521.00001\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">b</text>\n<rect x=\"486\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"500\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">n</text>\n<rect x=\"566\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"578\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">m</text>\n<rect x=\"646\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n\n<rect x=\"306\" y=\"545\" width=\"300\" height=\"55\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<rect x=\"726\" y=\"466\" width=\"140\" height=\"70\" rx=\"10\" fill=\"#00bfbf\" stroke=\"#00ff00\" stroke-width=\"5\"/>\n<text x=\"750\" y=\"510\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">SHIFT</text>\n<rect x=\"650\" y=\"545\" width=\"140\" height=\"55\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"690\" y=\"585\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"28\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">?123</text>\n<rect x=\"880\" y=\"545\" width=\"140\" height=\"55\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"890\" y=\"585\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">CH:]]..CurChan..[[</text>\n<text x=\"674\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">.</text>\n\n<text x=\"50\" y=\"280\" fill=\"#0000ff\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"25\" font-style=\"italic\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">]]..keybhidden..[[</text>\n</g>]] \n    local buttonNo = evaluateButtons()\n    if MSMouseDown then\n      MSMouseX = screen.getMouseX()\n      MSMouseY = screen.getMouseY()\n      if buttonNo ~= MSButtonSelected or MSMouseX < 0.05 or MSMouseX > 0.95 or MSMouseY < 0.05 or MSMouseY > 0.95 then\n        if MSButtonSelected > 0 then\n          onButtonUp(MSButtonSelected)\n        end\n        MSButtonSelected = 0\n      end        \n    end\n\n\n    screen.setHTML(page)\n\n\n\n\nelseif startupnow == 1.2 then    ----- emitter end\n               tablex.clear(MSButtons, button)\n      for i = 1,1 do\n   local button = {id = (\"b\"..1), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=1/100, right=6.5/100}\n    table.insert(MSButtons, button)\nend\n  for i = 2,2 do\n   local button = {id = (\"b\"..2), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=8/100, right=14/100}\n    table.insert(MSButtons, button)\nend\n    for i = 3,3 do\n    local button = {id = (\"b\"..3), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=15/100, right=22/100}\n      table.insert(MSButtons, button)\nend\n    for i = 4,4 do   \n    local button = {id = (\"b\"..4), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=23/100, right=30/100}\n      table.insert(MSButtons, button)\nend\n    for i = 5,5 do   \n    local button = {id = (\"b\"..5), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=31/100, right=38/100}\n      table.insert(MSButtons, button)\nend\n    for i = 6,6 do   \n    local button = {id = (\"b\"..6), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=39/100, right=46/100}\n      table.insert(MSButtons, button)\nend\n    for i = 7,7 do   \n    local button = {id = (\"b\"..7), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=47/100, right=53/100}\n      table.insert(MSButtons, button)\nend\n    for i = 8,8 do   \n    local button = {id = (\"b\"..8), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=54/100, right=61/100}\n      table.insert(MSButtons, button)\nend\n    for i = 9,9 do   \n    local button = {id = (\"b\"..9), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=62/100, right=69/100}\n      table.insert(MSButtons, button)\nend\n    for i = 10,10 do   \n    local button = {id = (\"b\"..10), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=70/100, right=77/100}\n      table.insert(MSButtons, button)\nend\n    for i = 11,11 do   \n    local button = {id = (\"b\"..11), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=78/100, right=85/100}\n      table.insert(MSButtons, button)\nend\n    for i = 12,12 do   \n    local button = {id = (\"b\"..12), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=86/100, right=93/100}\n      table.insert(MSButtons, button)\nend\n\n\n\n    for i = 13,13 do   \n    local button = {id = (\"b\"..13), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=4/100, right=10/100}\n    table.insert(MSButtons, button)\nend\n      for i = 14,14 do\n   local button = {id = (\"b\"..14), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=11.5/100, right=18/100}\n    table.insert(MSButtons, button)\nend\n  for i = 15,15 do\n   local button = {id = (\"b\"..15), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=19/100, right=26/100}\n    table.insert(MSButtons, button)\nend\n    for i = 16,16 do\n    local button = {id = (\"b\"..16), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=27/100, right=34/100}\n      table.insert(MSButtons, button)\nend\n    for i = 17,17 do   \n    local button = {id = (\"b\"..17), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=35/100, right=42/100}\n      table.insert(MSButtons, button)\nend\n    for i = 18,18 do   \n    local button = {id = (\"b\"..18), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=43/100, right=50/100}\n      table.insert(MSButtons, button)\nend\n    for i = 19,19 do   \n    local button = {id = (\"b\"..19), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=51/100, right=58/100}\n      table.insert(MSButtons, button)\nend\n    for i = 20,20 do   \n    local button = {id = (\"b\"..20), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=59/100, right=65/100}\n      table.insert(MSButtons, button)\nend\n    for i = 21,21 do\n   local button = {id = (\"b\"..21), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=66.5/100, right=73/100}\n    table.insert(MSButtons, button)\nend\n  for i = 22,22 do\n   local button = {id = (\"b\"..22), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=74/100, right=82/100}\n    table.insert(MSButtons, button)\nend\n  for i = 23,23 do\n   local button = {id = (\"b\"..23), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=82.5/100, right=90/100}\n    table.insert(MSButtons, button)\nend\n  for i = 24,24 do\n   local button = {id = (\"b\"..24), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=90/100, right=97/100}\n    table.insert(MSButtons, button)\nend\n\n\n    for i = 25,25 do\n    local button = {id = (\"b\"..23), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=8/100, right=15/100}\n      table.insert(MSButtons, button)\nend\n    for i = 26,26 do   \n    local button = {id = (\"b\"..26), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=16/100, right=23/100}\n      table.insert(MSButtons, button)\nend\n    for i = 27,27 do   \n    local button = {id = (\"b\"..27), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=24/100, right=31/100}\n      table.insert(MSButtons, button)\nend\n    for i = 28,28 do   \n    local button = {id = (\"b\"..28), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=32/100, right=39/100}\n      table.insert(MSButtons, button)\nend\n    for i = 29,29 do   \n    local button = {id = (\"b\"..29), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=40/100, right=46/100}\n      table.insert(MSButtons, button)\nend\n    for i = 30,30 do   \n    local button = {id = (\"b\"..30), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=47/100, right=54/100}\n      table.insert(MSButtons, button)\nend\n    for i = 31,31 do   \n    local button = {id = (\"b\"..31), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=55/100, right=62/100}\n      table.insert(MSButtons, button)\nend\n    for i = 32,32 do   \n    local button = {id = (\"b\"..32), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=63/100, right=70/100}\n      table.insert(MSButtons, button)\nend\n    for i = 33,33 do   \n    local button = {id = (\"b\"..33), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=71/100, right=78/100}\n      table.insert(MSButtons, button)\nend\n    for i = 34,34 do   \n    local button = {id = (\"b\"..34), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=79/100, right=86/100}\n      table.insert(MSButtons, button)\nend\n    for i = 35,35 do   \n    local button = {id = (\"b\"..35), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=86.5/100, right=94/100}\n      table.insert(MSButtons, button)\nend\n\n    for i = 36,36 do   \n    local button = {id = (\"b\"..36), enabled=true, td=\"<td>\", top=88/100, bottom=98/100, left=30/100, right=59/100}\n      table.insert(MSButtons, button)\nend\n    for i = 37,37 do   \n    local button = {id = (\"b\"..37), enabled=true, td=\"<td>\", top=88/100, bottom=98/100, left=63/100, right=77/100}\n    table.insert(MSButtons, button)\nend\n      for i = 38,38 do\n   local button = {id = (\"b\"..38), enabled=true, td=\"<td>\", top=88/100, bottom=98/100, left=85/100, right=100/100}\n    table.insert(MSButtons, button)\nend\n    for i = 39,39 do   \n    local button = {id = (\"b\"..39), enabled=true, td=\"<td>\", top=90/100, bottom=100/100, left=1/100, right=18/100}\n    table.insert(MSButtons, button)\nend\nfunction evaluateButtons()\n  local selected = 0\n  \n  if #MSButtons >= 1 then\n\n\n         -- Set button styles\n       for i, button in ipairs(MSButtons) do\n            if button.left < MSMouseX and MSMouseX < button.right and button.top < MSMouseY and MSMouseY < button.bottom then\n                if MSMouseDown and MSButtonSelected == i then\n                end\n                selected = i\n            end\n            if not button.enabled then\n            end\n\n        end\n  end\n  return selected\nend\n\n\nfunction onButtonDown(buttonNo)\n  local button = MSButtons[buttonNo]    \n  if not button or not button.enabled then\n\treturn\n  end\nend\nfunction onButtonUp(buttonNo)\n  local button = MSButtons[buttonNo]    \n  if not button or not button.enabled then\n    return\n  end\n        \n\nfunction onClick(buttonNo)\n  local button = MSButtons[buttonNo]    \n  if not button or not button.enabled then\n    return\n  end\nend\n  if buttonNo == 1 then\n    keyb=keyb..\"1\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 2 then\n    keyb=keyb..\"2\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 3 then\n    keyb=keyb..\"3\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 4 then\n    keyb=keyb..\"4\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 5 then\n    keyb=keyb..\"5\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n\t\thint(1, 5)\n  elseif buttonNo == 6 then\n    keyb=keyb..\"6\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 7 then\n    keyb=keyb..\"7\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 8 then\n    keyb=keyb..\"8\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 9 then\n    keyb=keyb..\"9\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 10 then\n    keyb=keyb..\"0\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 11 then\n    keyb=keyb..\",\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 12 then\n    keyb=keyb..\"?\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 13 then\n    keyb=keyb..\"!\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 14 then\n    keyb=keyb..\"@\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 15 then\n    keyb=keyb..\"#\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 16 then\n    keyb=keyb..\"$\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 17 then\n    keyb=keyb..\"%\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 18 then\n    keyb=keyb..\"^\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 19 then\n    keyb=keyb..\"&\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 20 then\n    keyb=keyb..\"*\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 21 then\n    keyb=keyb..\"~\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 22 then\n    keyb=keyb..\";\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 23 then\n    keyb=keyb..\":\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 24 then\n    keyb=keyb..\"'\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 25 then\n    keyb=keyb..\"(\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 26 then\n    keyb=keyb..\")\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 27 then\n    keyb=keyb..\"[\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 28 then\n    keyb=keyb..\"]\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 29 then\n    keyb=keyb..\"{\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 30 then\n    keyb=keyb..\"}\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 31 then\n    keyb=keyb..\"<\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 32 then\n    keyb=keyb..\">\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 33 then\n    keyb=keyb..\"+\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 34 then\n    keyb=\"-\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 35 then\n    keyb=keyb..\"=\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 36 then\n    keyb=keyb..\" \"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 37 then\n    startupnow = 1\n  elseif buttonNo == 38 then\n    keyb=\"\"\n    screen.addText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 39 then\n\n\n  end\nend\n\n\npage = [[\n<svg viewBox=\"0 0 1024 612\">\n<g>\n<title>background</title>\n<rect x=\"-1\" y=\"-1\" width=\"1026\" height=\"614\"/>\n<g display=\"none\">\n<rect width=\"100%\" height=\"100%\" fill=\"url(#gridpattern)\" stroke-width=\"0\"/>\n</g>\n</g>\n<g>\n<title>Layer 1</title>\n<rect x=\"7\" y=\"5\" width=\"1012\" height=\"290\" rx=\"20\" fill=\"#007f7f\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<g fill=\"#ffff00\" fill-opacity=\"null\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" font-weight=\"bold\" stroke=\"#00ff00\" stroke-width=\"0\">\n\n<text x=\"50\" y=\"280\" fill=\"#0000ff\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"25\" font-style=\"italic\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">]]..keybhidden..[[</text>\n</g>\n  <g id=\"svg_47\">\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"1\" y=\"305.999996\" width=\"70\" height=\"70\" id=\"svg_1\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"20\" y=\"360.999996\" id=\"svg_3\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">1</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"80\" y=\"305.999996\" width=\"70\" height=\"70\" id=\"svg_8\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"100\" y=\"360.999996\" id=\"svg_9\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">2</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"160\" y=\"305.999996\" width=\"70\" height=\"70\" id=\"svg_11\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"180\" y=\"360.999996\" id=\"svg_12\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">3</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"240\" y=\"305.999996\" width=\"70\" height=\"70\" id=\"svg_14\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"260\" y=\"360.999996\" id=\"svg_15\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">4</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"320\" y=\"305.999996\" width=\"70\" height=\"70\" id=\"svg_17\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"340\" y=\"360.999996\" id=\"svg_18\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">5</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"400\" y=\"305.999996\" width=\"70\" height=\"70\" id=\"svg_20\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"420\" y=\"360.999996\" id=\"svg_21\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">6</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"480\" y=\"305.999996\" width=\"70\" height=\"70\" id=\"svg_23\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"500\" y=\"360.999996\" id=\"svg_24\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">7</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"560\" y=\"306.00001\" width=\"70\" height=\"70\" id=\"svg_26\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"580\" y=\"361.00001\" id=\"svg_27\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">8</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"640\" y=\"305.999996\" width=\"70\" height=\"70\" id=\"svg_29\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"660\" y=\"360.999996\" id=\"svg_30\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">9</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"720\" y=\"305.999996\" width=\"70\" height=\"70\" id=\"svg_32\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"740\" y=\"360.999996\" id=\"svg_33\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">0</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"800\" y=\"305.999996\" width=\"70\" height=\"70\" id=\"svg_35\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"825\" y=\"350\" id=\"svg_36\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">,</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"880\" y=\"305.999996\" width=\"70\" height=\"70\" id=\"svg_38\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"900\" y=\"360\" id=\"svg_39\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">?</text>\n  </g>\n  <g id=\"svg_108\">\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"41\" y=\"384.999996\" width=\"70\" height=\"70\" id=\"svg_10\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"65\" y=\"439.999996\" id=\"svg_13\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">!</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"121\" y=\"384.999996\" width=\"70\" height=\"70\" id=\"svg_16\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"127\" y=\"439.999996\" id=\"svg_19\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">@</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"201\" y=\"384.999996\" width=\"70\" height=\"70\" id=\"svg_22\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"220\" y=\"439.999996\" id=\"svg_25\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">#</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"281\" y=\"384.999996\" width=\"70\" height=\"70\" id=\"svg_28\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"300\" y=\"439.999996\" id=\"svg_31\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">$</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"361\" y=\"384.999996\" width=\"70\" height=\"70\" id=\"svg_34\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"371\" y=\"439.999996\" id=\"svg_37\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">%</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"441\" y=\"385.00001\" width=\"70\" height=\"70\" id=\"svg_40\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"460\" y=\"440.00001\" id=\"svg_41\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">^</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"521\" y=\"384.999996\" width=\"70\" height=\"70\" id=\"svg_42\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"535\" y=\"439.999996\" id=\"svg_43\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">&amp;</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"601\" y=\"384.999996\" width=\"70\" height=\"70\" id=\"svg_44\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"625\" y=\"439.999996\" id=\"svg_45\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">*</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"681\" y=\"384.999996\" width=\"70\" height=\"70\" id=\"svg_48\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"700\" y=\"439.999996\" id=\"svg_49\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">~</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"761\" y=\"384.999996\" width=\"70\" height=\"70\" id=\"svg_118\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"785\" y=\"439.999996\" id=\"svg_119\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">;</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"841\" y=\"384.999996\" width=\"70\" height=\"70\" id=\"svg_121\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"865\" y=\"439.999996\" id=\"svg_122\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">:</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"921\" y=\"384.999996\" width=\"70\" height=\"70\" id=\"svg_127\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"950\" y=\"439.999996\" id=\"svg_128\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">'</text>\n  </g>\n  <g id=\"svg_112\">\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"86\" y=\"465.999996\" width=\"70\" height=\"70\" id=\"svg_52\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"110\" y=\"520.999996\" id=\"svg_53\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">(</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"166\" y=\"465.999996\" width=\"70\" height=\"70\" id=\"svg_54\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"195\" y=\"520.999996\" id=\"svg_55\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">)</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"246\" y=\"465.999996\" width=\"70\" height=\"70\" id=\"svg_56\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"270\" y=\"520.999996\" id=\"svg_57\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">[</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"326\" y=\"465.999996\" width=\"70\" height=\"70\" id=\"svg_58\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"350\" y=\"520.999996\" id=\"svg_59\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">]</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"406\" y=\"466.00001\" width=\"70\" height=\"70\" id=\"svg_60\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"430\" y=\"521.00001\" id=\"svg_61\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">{</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"486\" y=\"465.999996\" width=\"70\" height=\"70\" id=\"svg_62\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"515\" y=\"520.999996\" id=\"svg_63\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">}</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"566\" y=\"465.999996\" width=\"70\" height=\"70\" id=\"svg_64\" rx=\"10\"/>\n   <text style=\"cursor: move;\" fill=\"#bf0000\" stroke-width=\"0\" x=\"585\" y=\"520.999996\" id=\"svg_65\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">&lt;</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"646\" y=\"465.999996\" width=\"70\" height=\"70\" id=\"svg_68\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"656\" y=\"520.999996\" id=\"svg_69\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\"/>\n   <text style=\"cursor: move;\" fill=\"#bf0000\" stroke-width=\"0\" x=\"665\" y=\"520.999996\" id=\"svg_78\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">&gt;</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"726\" y=\"465.999996\" width=\"70\" height=\"70\" id=\"svg_66\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"736\" y=\"520.999996\" id=\"svg_67\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"755\" y=\"520.999996\" id=\"svg_107\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">+</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"806\" y=\"465.999996\" width=\"70\" height=\"70\" id=\"svg_109\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"830\" y=\"520.999996\" id=\"svg_111\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">-</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"886\" y=\"465.999996\" width=\"70\" height=\"70\" id=\"svg_113\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"908\" y=\"520.999996\" id=\"svg_115\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">=</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"306\" y=\"545\" width=\"300\" height=\"55\" id=\"svg_71\" rx=\"10\"/>\n  <rect fill=\"#00bfbf\" stroke=\"#ffff00\" stroke-width=\"5\" x=\"650\" y=\"544.999996\" width=\"140\" height=\"55\" id=\"svg_73\" rx=\"10\"/>\n  <text style=\"cursor: move;\" fill=\"#ffff00\" stroke-width=\"0\" x=\"690\" y=\"585\" id=\"svg_74\" font-size=\"28\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">?123</text>\n  <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"880\" y=\"545\" width=\"140\" height=\"55\" id=\"svg_76\" rx=\"10\"/>\n  <text fill=\"#bf0000\" stroke-width=\"0\" x=\"900\" y=\"585\" id=\"svg_77\" font-size=\"30\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">CLEAR</text>\n        </g>]] \n    local buttonNo = evaluateButtons()\n    if MSMouseDown then\n      MSMouseX = screen.getMouseX()\n      MSMouseY = screen.getMouseY()\n      if buttonNo ~= MSButtonSelected or MSMouseX < 0.05 or MSMouseX > 0.95 or MSMouseY < 0.05 or MSMouseY > 0.95 then\n        if MSButtonSelected > 0 then\n          onButtonUp(MSButtonSelected)\n        end\n        MSButtonSelected = 0\n      end        \n    end\n       \nend\n\nif LockonStart == true then\n        local charcount = string.len(keyb)\n        if charcount > startcount then\n            keybhidden = keybhidden..\"*\" \n            screen.addText(30,10,7,keybhidden)        \n            startcount = charcount\n        elseif keyb == \"\" then\n            keybhidden = \"\"\n            charcount = 0\n            startcount = 0\n        end\nelseif LockonStart == false then\n    keybhidden = keyb    \nend \nscreen.setHTML(page)\n    local html = {}\n    \n    for lineIndex = #lines,1,-1 do\n    \tlocal line = lines[lineIndex]\n        if lineIndex < 8 then\n            table.insert(html, \"<div style='font-size: 4.5vh; background-color: darkblue; color: white; border-radius: 2.5vw; text-align: left;'>\" .. line .. \"</div>\")\n        elseif lineIndex == 8 then\n            table.remove(lines,1)\n            lineIndex = 0\n            table.insert(html, \"<div style='font-size: 4.5vh; background-color: darkblue; color: white; border-radius: 2.5vw; text-align: left;'>\" .. line .. \"</div>\")            \n        end\n    end\n    \n     screen.addText(2,1,0,(table.concat(html))) \n\nend\n\n\n","filter":{"args":[],"signature":"start()","slotKey":"-1"},"key":"4"},{"code":"page = [[]]\nscreen.setHTML(page)\n","filter":{"args":[],"signature":"stop()","slotKey":"-2"},"key":"5"},{"code":"updateScreen()","filter":{"args":[],"signature":"update()","slotKey":"-2"},"key":"6"}],"methods":[],"events":[]}

     

    Example Used in Video Secondary Ship

    {"slots":{"0":{"name":"slot5","type":{"events":[],"methods":[]}},"1":{"name":"slot4","type":{"events":[],"methods":[]}},"2":{"name":"slot3","type":{"events":[],"methods":[]}},"3":{"name":"switch","type":{"events":[],"methods":[]}},"4":{"name":"airlock","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":"","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"receive(channel,message)","slotKey":"0"},"key":"0"},{"code":"function getSlots()\n    local slot={}\n    local self = self or unit or {} -- in-game, self is the active control unit\n    for key, value in pairs(self) do\n        if type(key) == \"string\" and type(value) == \"table\" and type(value.export) == \"table\" then\n            slot[key] = value\n        end\n    end\n    return slot\nend\n\nfunction getRequiredElements(slots)\n    local foundScreen=false\n    local foundEmitter=false\n    local foundReceiver=false\n\n    for slotName, slotElement in pairs(slots) do\n        if slotElement.getItemsMass then foundContainer = slotElement\n        elseif slotElement.send then foundEmitter = slotElement\n        elseif slotElement.getRange and not slotElement.send then foundReceiver = slotElement\n        end\n    end\n    return foundContainer,foundEmitter,foundReceiver\nend\n\n---\ncontainer, emitter, receiver = getRequiredElements(getSlots())\nif not container then\n    error('Setup Error: Missing important element: container')\n    unit.exit()\nend\nif not emitter then\n    error('Setup Error: Missing important element: emitter')\n    unit.exit()\nend\nif not receiver then\n    error('Setup Error: Missing important element: receiver')\n    unit.exit()    \nend\n\nItems = container.getMass()\nemitter.send(\"TR James Cargo Mass\",Items)\nairlockstatus = airlock.getState()\nif airlockstatus == 1 then\nemitter.send(\"TR James\",\"Airlock Open\")    \nelseif airlockstatus == 0 then\nemitter.send(\"TR James\",\"Airlock Closed\")  \nend\nswitch.deactivate()\n","filter":{"args":[],"signature":"start()","slotKey":"-1"},"key":"1"},{"code":"emitter.send(\"TR James PB\",\"Wireless Ended\")","filter":{"args":[],"signature":"stop()","slotKey":"-1"},"key":"2"}],"methods":[],"events":[]}

     

     

     

    
    
    ----------------------------UnitStart--------
    function getSlots()
        local slot={}
        local self = self or unit or {} -- in-game, self is the active control unit
        for key, value in pairs(self) do
            if type(key) == "string" and type(value) == "table" and type(value.export) == "table" then
                slot[key] = value
            end
        end
        return slot
    end
    
    function getRequiredElements(slots)
        local foundScreen=false
        local foundEmitter=false
        local foundReceiver=false
        for slotName, slotElement in pairs(slots) do
            if slotElement.setRawHTML then foundScreen = slotElement
            elseif slotElement.send then foundEmitter = slotElement
            elseif slotElement.getRange and not slotElement.send then foundReceiver = slotElement
            end
        end
        return foundScreen,foundEmitter,foundReceiver
    end
    
    ---
    screen, emitter, receiver = getRequiredElements(getSlots())
    if not screen then
        error('Setup Error: Missing important element: screen')
        unit.exit()
    end
    if not emitter then
        error('Setup Error: Missing important element: emitter')
        unit.exit()
    end
    if not receiver then
        error('Setup Error: Missing important element: receiver')
        unit.exit()    
    end
    
    unit.hide()
    -- Internal variables
    keyb=""
    keybhidden = ""
    LockonStart = true
    
    consta=0
    MSButtons = {}
    MSMouseX = 0
    MSMouseY = 0
    MSMouseDown = false
    MSButtonSelected = 0
    MSAttention = 0
    MSDislikeButton = 0
    MSLikeButton = 0
    MSHintButton = 0
    MSAttentionMessage = ""
    MSAttentionVisible = false
    startupnow = 1
    EnterPressed = false
    password = "P"--export:
    LockonStart = true--export:
    CurChan = "TR"--export:Channel on Start
    startcount = 0
    lineIndex = 0
    lines = {}
    
    function CheckEnterButton()
    if LockonStart == true then
        if EnterPressed == true then
            if keyb == password then
                keyb=""
                screen.addText(30,10,7,keyb)
                consta=string.len(keyb)
                keybhidden="Access Granted"
                EnterPressed = false            
                LockonStart = false
                CheckEnterButton()
            elseif keyb ~= password then 
                keyb=""
                keybhidden="Access DENIED"
                screen.addText(30,10,7,keyb)
                consta=string.len(keyb)
                unit.setTimer("exit",1)
            end
        end
    elseif LockonStart == false then   
        if EnterPressed == true then
            emitter.send(CurChan,(keyb))
            EnterPressed = false
            keyb = ""
        end
    end
    end
    function updateScreen() 
    
    if startupnow == 1 then    ----- engine stat end emitter start
        tablex.clear(MSButtons, button)
          for i = 1,1 do
       local button = {id = ("b"..1), enabled=true, td="<td>", top=49/100, bottom=60/100, left=1/100, right=6.5/100}
        table.insert(MSButtons, button)
    end
      for i = 2,2 do
       local button = {id = ("b"..2), enabled=true, td="<td>", top=49/100, bottom=60/100, left=8/100, right=14/100}
        table.insert(MSButtons, button)
    end
        for i = 3,3 do
        local button = {id = ("b"..3), enabled=true, td="<td>", top=49/100, bottom=60/100, left=15/100, right=22/100}
          table.insert(MSButtons, button)
    end
        for i = 4,4 do   
        local button = {id = ("b"..4), enabled=true, td="<td>", top=49/100, bottom=60/100, left=23/100, right=30/100}
          table.insert(MSButtons, button)
    end
        for i = 5,5 do   
        local button = {id = ("b"..5), enabled=true, td="<td>", top=49/100, bottom=60/100, left=31/100, right=38/100}
          table.insert(MSButtons, button)
    end
        for i = 6,6 do   
        local button = {id = ("b"..6), enabled=true, td="<td>", top=49/100, bottom=60/100, left=39/100, right=46/100}
          table.insert(MSButtons, button)
    end
        for i = 7,7 do   
        local button = {id = ("b"..7), enabled=true, td="<td>", top=49/100, bottom=60/100, left=47/100, right=53/100}
          table.insert(MSButtons, button)
    end
        for i = 8,8 do   
        local button = {id = ("b"..8), enabled=true, td="<td>", top=49/100, bottom=60/100, left=54/100, right=61/100}
          table.insert(MSButtons, button)
    end
        for i = 9,9 do   
        local button = {id = ("b"..9), enabled=true, td="<td>", top=49/100, bottom=60/100, left=62/100, right=69/100}
          table.insert(MSButtons, button)
    end
        for i = 10,10 do   
        local button = {id = ("b"..10), enabled=true, td="<td>", top=49/100, bottom=60/100, left=70/100, right=77/100}
          table.insert(MSButtons, button)
    end
        for i = 11,11 do   
        local button = {id = ("b"..11), enabled=true, td="<td>", top=49/100, bottom=60/100, left=78/100, right=85/100}
          table.insert(MSButtons, button)
    end
        for i = 12,12 do   
        local button = {id = ("b"..12), enabled=true, td="<td>", top=49/100, bottom=60/100, left=86/100, right=100/100}
          table.insert(MSButtons, button)
    end
    
    
    
        for i = 13,13 do   
        local button = {id = ("b"..13), enabled=true, td="<td>", top=62/100, bottom=73/100, left=4/100, right=10/100}
        table.insert(MSButtons, button)
    end
          for i = 14,14 do
       local button = {id = ("b"..14), enabled=true, td="<td>", top=62/100, bottom=73/100, left=11.5/100, right=18/100}
        table.insert(MSButtons, button)
    end
      for i = 15,15 do
       local button = {id = ("b"..15), enabled=true, td="<td>", top=62/100, bottom=73/100, left=19/100, right=26/100}
        table.insert(MSButtons, button)
    end
        for i = 16,16 do
        local button = {id = ("b"..16), enabled=true, td="<td>", top=62/100, bottom=73/100, left=27/100, right=34/100}
          table.insert(MSButtons, button)
    end
        for i = 17,17 do   
        local button = {id = ("b"..17), enabled=true, td="<td>", top=62/100, bottom=73/100, left=35/100, right=42/100}
          table.insert(MSButtons, button)
    end
        for i = 18,18 do   
        local button = {id = ("b"..18), enabled=true, td="<td>", top=62/100, bottom=73/100, left=43/100, right=50/100}
          table.insert(MSButtons, button)
    end
        for i = 19,19 do   
        local button = {id = ("b"..19), enabled=true, td="<td>", top=62/100, bottom=73/100, left=51/100, right=58/100}
          table.insert(MSButtons, button)
    end
        for i = 20,20 do   
        local button = {id = ("b"..20), enabled=true, td="<td>", top=62/100, bottom=73/100, left=59/100, right=65/100}
          table.insert(MSButtons, button)
    end
          for i = 21,21 do
       local button = {id = ("b"..21), enabled=true, td="<td>", top=62/100, bottom=73/100, left=66.5/100, right=73/100}
        table.insert(MSButtons, button)
    end
      for i = 22,22 do
       local button = {id = ("b"..22), enabled=true, td="<td>", top=62/100, bottom=73/100, left=74/100, right=89/100}
        table.insert(MSButtons, button)
    end
    
    
        for i = 23,23 do
        local button = {id = ("b"..23), enabled=true, td="<td>", top=75/100, bottom=87/100, left=8/100, right=15/100}
          table.insert(MSButtons, button)
    end
        for i = 24,24 do   
        local button = {id = ("b"..24), enabled=true, td="<td>", top=75/100, bottom=87/100, left=16/100, right=23/100}
          table.insert(MSButtons, button)
    end
        for i = 25,25 do   
        local button = {id = ("b"..25), enabled=true, td="<td>", top=75/100, bottom=87/100, left=24/100, right=31/100}
          table.insert(MSButtons, button)
    end
        for i = 26,26 do   
        local button = {id = ("b"..26), enabled=true, td="<td>", top=75/100, bottom=87/100, left=32/100, right=39/100}
          table.insert(MSButtons, button)
    end
        for i = 27,27 do   
        local button = {id = ("b"..27), enabled=true, td="<td>", top=75/100, bottom=87/100, left=40/100, right=46/100}
          table.insert(MSButtons, button)
    end
        for i = 28,28 do   
        local button = {id = ("b"..28), enabled=true, td="<td>", top=75/100, bottom=87/100, left=47/100, right=54/100}
          table.insert(MSButtons, button)
    end
        for i = 29,29 do   
        local button = {id = ("b"..29), enabled=true, td="<td>", top=75/100, bottom=87/100, left=55/100, right=62/100}
          table.insert(MSButtons, button)
    end
        for i = 30,30 do   
        local button = {id = ("b"..30), enabled=true, td="<td>", top=75/100, bottom=87/100, left=63/100, right=70/100}
          table.insert(MSButtons, button)
    end
        for i = 31,31 do   
        local button = {id = ("b"..31), enabled=true, td="<td>", top=75/100, bottom=87/100, left=71/100, right=85/100}
          table.insert(MSButtons, button)
    end
    
    
        for i = 32,32 do   
        local button = {id = ("b"..32), enabled=true, td="<td>", top=88/100, bottom=98/100, left=30/100, right=59/100}
          table.insert(MSButtons, button)
    end
        for i = 33,33 do   
        local button = {id = ("b"..33), enabled=true, td="<td>", top=88/100, bottom=98/100, left=63/100, right=77/100}
        table.insert(MSButtons, button)
    end
          for i = 34,34 do
       local button = {id = ("b"..34), enabled=true, td="<td>", top=88/100, bottom=98/100, left=85/100, right=100/100}
        table.insert(MSButtons, button)
    end
        for i = 35,35 do   
        local button = {id = ("b"..35), enabled=true, td="<td>", top=90/100, bottom=100/100, left=1/100, right=18/100}
        table.insert(MSButtons, button)
    end
    function evaluateButtons()
      local selected = 0
      
      if #MSButtons >= 1 then
    
             -- Set button styles
           for i, button in ipairs(MSButtons) do
                if button.left < MSMouseX and MSMouseX < button.right and button.top < MSMouseY and MSMouseY < button.bottom then
                    if MSMouseDown and MSButtonSelected == i then
                    end
                    selected = i
                end
                if not button.enabled then
                end
    
            end
      end
      return selected
    end
    
    
    function onButtonDown(buttonNo)
      local button = MSButtons[buttonNo]    
      if not button or not button.enabled then
    	return
      end
    end
    function onButtonUp(buttonNo)
      local button = MSButtons[buttonNo]    
      if not button or not button.enabled then
        return
      end
            
    
    function onClick(buttonNo)
      local button = MSButtons[buttonNo]    
      if not button or not button.enabled then
        return
      end
    end
       if buttonNo == 1 then
        keyb=keyb.."Q"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 2 then
        keyb=keyb.."W"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 3 then
        keyb=keyb.."E"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 4 then
        keyb=keyb.."R"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 5 then
        keyb=keyb.."T"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 6 then
        keyb=keyb.."Y"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 7 then
        keyb=keyb.."U"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 8 then
        keyb=keyb.."I"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 9 then
        keyb=keyb.."O"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 10 then
        keyb=keyb.."P"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 11 then
        tablex.clear(lines,html)
      elseif buttonNo == 12 then
        keyb = ""
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 13 then
        keyb=keyb.."A"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 14 then
        keyb=keyb.."S"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 15 then
        keyb=keyb.."D"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 16 then
        keyb=keyb.."F"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 17 then
        keyb=keyb.."G"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 18 then
        keyb=keyb.."H"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 19 then
        keyb=keyb.."J"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 20 then
        keyb=keyb.."K"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 21 then
        keyb=keyb.."L"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 22 then   ----enterbutton
        EnterPressed = true
        CheckEnterButton()
      elseif buttonNo == 23 then
        keyb=keyb.."Z"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 24 then
        keyb=keyb.."X"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 25 then
        keyb=keyb.."C"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 26 then
        keyb=keyb.."V"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 27 then
        keyb=keyb.."B"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 28 then
        keyb=keyb.."N"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 29 then
        keyb=keyb.."M"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 30 then
        keyb=keyb.."."
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 31 then
        startupnow = 1.1
      elseif buttonNo == 32 then
        keyb=keyb.." "
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 33 then
        startupnow = 1.2
      elseif buttonNo == 34 then
        if LockonStart == false then
            CurChan = keyb
            keyb = ""
        else
            keybhidden = "Buttons Are (LOCKED) ACCESS DENIED"
            unit.setTimer("exit",1)
        end
      elseif buttonNo == 35 then
    
      end
    end
      
    page = [[
    <svg viewBox="0 0 1024 612">
    <g>
    <title>background</title>
    <rect x="-1" y="-1" width="1026" height="614"/>
    <g display="none">
    <rect width="100%" height="100%" fill="url(#gridpattern)" stroke-width="0"/>
    </g>
    </g>
    <g>
    <title>Layer 1</title>
    <rect x="7" y="5" width="1012" height="290" rx="20" fill="#007f7f" stroke="#0f0" stroke-width="5"/>
    <rect x="1" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="14.997276" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">Q</text>
    <rect x="80" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="90" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">W</text>
    <rect x="160" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="178" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">E</text>
    <rect x="240" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="255" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">R</text>
    <rect x="320" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="337" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">T</text>
    <rect x="400" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="417" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">Y</text>
    <rect x="480" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="496" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">U</text>
    <rect x="560" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="586" y="361.00001" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">I</text>
    <rect x="640" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="654" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">O</text>
    <rect x="720" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="740" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">P</text>
    <rect x="880" y="306" width="140" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="895" y="350" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="30" font-weight="bold" stroke-width="0" xml:space="preserve">CLEAR</text>
    <rect x="800" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="802" y="350" cursor="move" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="30" font-weight="bold" stroke-width="0" xml:space="preserve"></text>
    <rect x="41" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="59" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">A</text>
    <rect x="121" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="136" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">S</text>
    <rect x="201" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="218" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">D</text>
    <rect x="281" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="298" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">F</text>
    <rect x="361" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="377" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">G</text>
    <rect x="441" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="455" y="440.00001" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">H</text>
    <rect x="521" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="540" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">J</text>
    <rect x="601" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="619" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">K</text>
    <rect x="761" y="385" width="140" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="785" y="430" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="30" font-style="italic" font-weight="bold" stroke-width="0" xml:space="preserve">Enter</text>
    <rect x="681" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="700" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">L</text>
    <rect x="86" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="101" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">Z</text>
    <rect x="166" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="183" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">X</text>
    <rect x="246" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="263" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">C</text>
    <rect x="326" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="342" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">V</text>
    <rect x="406" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="420" y="521.00001" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">B</text>
    <rect x="486" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="500" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">N</text>
    <rect x="566" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="578" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">M</text>
    <rect x="646" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="656" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve"></text>
    <rect x="306" y="545" width="300" height="55" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <rect x="726" y="466" width="140" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="750" y="510" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="30" font-weight="bold" stroke-width="0" xml:space="preserve">SHIFT</text>
    <rect x="650" y="545" width="140" height="55" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="690" y="585" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="28" font-weight="bold" stroke-width="0" xml:space="preserve">?123</text>
    <rect x="880" y="545" width="140" height="55" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="890" y="585" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="30" font-weight="bold" stroke-width="0" xml:space="preserve">CH:]]..CurChan..[[</text>
    <text x="674" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">.</text>
    
    <text x="50" y="280" fill="#0000ff" font-family="Helvetica, Arial, sans-serif" font-size="25" font-style="italic" font-weight="bold" stroke-width="0" xml:space="preserve">]]..keybhidden..[[</text>
    </g>]] 
        local buttonNo = evaluateButtons()
        if MSMouseDown then
          MSMouseX = screen.getMouseX()
          MSMouseY = screen.getMouseY()
          if buttonNo ~= MSButtonSelected or MSMouseX < 0.05 or MSMouseX > 0.95 or MSMouseY < 0.05 or MSMouseY > 0.95 then
            if MSButtonSelected > 0 then
              onButtonUp(MSButtonSelected)
            end
            MSButtonSelected = 0
          end        
        end
    
        screen.setHTML(page)
     
    
    
    
    
    
    
    --------------------small letter keyboard
    
    
    
    
    elseif startupnow == 1.1 then
    
                   tablex.clear(MSButtons, button)
          for i = 1,1 do
       local button = {id = ("b"..1), enabled=true, td="<td>", top=49/100, bottom=60/100, left=1/100, right=6.5/100}
        table.insert(MSButtons, button)
    end
      for i = 2,2 do
       local button = {id = ("b"..2), enabled=true, td="<td>", top=49/100, bottom=60/100, left=8/100, right=14/100}
        table.insert(MSButtons, button)
    end
        for i = 3,3 do
        local button = {id = ("b"..3), enabled=true, td="<td>", top=49/100, bottom=60/100, left=15/100, right=22/100}
          table.insert(MSButtons, button)
    end
        for i = 4,4 do   
        local button = {id = ("b"..4), enabled=true, td="<td>", top=49/100, bottom=60/100, left=23/100, right=30/100}
          table.insert(MSButtons, button)
    end
        for i = 5,5 do   
        local button = {id = ("b"..5), enabled=true, td="<td>", top=49/100, bottom=60/100, left=31/100, right=38/100}
          table.insert(MSButtons, button)
    end
        for i = 6,6 do   
        local button = {id = ("b"..6), enabled=true, td="<td>", top=49/100, bottom=60/100, left=39/100, right=46/100}
          table.insert(MSButtons, button)
    end
        for i = 7,7 do   
        local button = {id = ("b"..7), enabled=true, td="<td>", top=49/100, bottom=60/100, left=47/100, right=53/100}
          table.insert(MSButtons, button)
    end
        for i = 8,8 do   
        local button = {id = ("b"..8), enabled=true, td="<td>", top=49/100, bottom=60/100, left=54/100, right=61/100}
          table.insert(MSButtons, button)
    end
        for i = 9,9 do   
        local button = {id = ("b"..9), enabled=true, td="<td>", top=49/100, bottom=60/100, left=62/100, right=69/100}
          table.insert(MSButtons, button)
    end
        for i = 10,10 do   
        local button = {id = ("b"..10), enabled=true, td="<td>", top=49/100, bottom=60/100, left=70/100, right=77/100}
          table.insert(MSButtons, button)
    end
        for i = 11,11 do   
        local button = {id = ("b"..11), enabled=true, td="<td>", top=49/100, bottom=60/100, left=78/100, right=85/100}
          table.insert(MSButtons, button)
    end
        for i = 12,12 do   
        local button = {id = ("b"..12), enabled=true, td="<td>", top=49/100, bottom=60/100, left=86/100, right=100/100}
          table.insert(MSButtons, button)
    end
    
    
    
        for i = 13,13 do   
        local button = {id = ("b"..13), enabled=true, td="<td>", top=62/100, bottom=73/100, left=4/100, right=10/100}
        table.insert(MSButtons, button)
    end
          for i = 14,14 do
       local button = {id = ("b"..14), enabled=true, td="<td>", top=62/100, bottom=73/100, left=11.5/100, right=18/100}
        table.insert(MSButtons, button)
    end
      for i = 15,15 do
       local button = {id = ("b"..15), enabled=true, td="<td>", top=62/100, bottom=73/100, left=19/100, right=26/100}
        table.insert(MSButtons, button)
    end
        for i = 16,16 do
        local button = {id = ("b"..16), enabled=true, td="<td>", top=62/100, bottom=73/100, left=27/100, right=34/100}
          table.insert(MSButtons, button)
    end
        for i = 17,17 do   
        local button = {id = ("b"..17), enabled=true, td="<td>", top=62/100, bottom=73/100, left=35/100, right=42/100}
          table.insert(MSButtons, button)
    end
        for i = 18,18 do   
        local button = {id = ("b"..18), enabled=true, td="<td>", top=62/100, bottom=73/100, left=43/100, right=50/100}
          table.insert(MSButtons, button)
    end
        for i = 19,19 do   
        local button = {id = ("b"..19), enabled=true, td="<td>", top=62/100, bottom=73/100, left=51/100, right=58/100}
          table.insert(MSButtons, button)
    end
        for i = 20,20 do   
        local button = {id = ("b"..20), enabled=true, td="<td>", top=62/100, bottom=73/100, left=59/100, right=65/100}
          table.insert(MSButtons, button)
    end
          for i = 21,21 do
       local button = {id = ("b"..21), enabled=true, td="<td>", top=62/100, bottom=73/100, left=66.5/100, right=73/100}
        table.insert(MSButtons, button)
    end
      for i = 22,22 do
       local button = {id = ("b"..22), enabled=true, td="<td>", top=62/100, bottom=73/100, left=74/100, right=89/100}
        table.insert(MSButtons, button)
    end
    
    
        for i = 23,23 do
        local button = {id = ("b"..23), enabled=true, td="<td>", top=75/100, bottom=87/100, left=8/100, right=15/100}
          table.insert(MSButtons, button)
    end
        for i = 24,24 do   
        local button = {id = ("b"..24), enabled=true, td="<td>", top=75/100, bottom=87/100, left=16/100, right=23/100}
          table.insert(MSButtons, button)
    end
        for i = 25,25 do   
        local button = {id = ("b"..25), enabled=true, td="<td>", top=75/100, bottom=87/100, left=24/100, right=31/100}
          table.insert(MSButtons, button)
    end
        for i = 26,26 do   
        local button = {id = ("b"..26), enabled=true, td="<td>", top=75/100, bottom=87/100, left=32/100, right=39/100}
          table.insert(MSButtons, button)
    end
        for i = 27,27 do   
        local button = {id = ("b"..27), enabled=true, td="<td>", top=75/100, bottom=87/100, left=40/100, right=46/100}
          table.insert(MSButtons, button)
    end
        for i = 28,28 do   
        local button = {id = ("b"..28), enabled=true, td="<td>", top=75/100, bottom=87/100, left=47/100, right=54/100}
          table.insert(MSButtons, button)
    end
        for i = 29,29 do   
        local button = {id = ("b"..29), enabled=true, td="<td>", top=75/100, bottom=87/100, left=55/100, right=62/100}
          table.insert(MSButtons, button)
    end
        for i = 30,30 do   
        local button = {id = ("b"..30), enabled=true, td="<td>", top=75/100, bottom=87/100, left=63/100, right=70/100}
          table.insert(MSButtons, button)
    end
        for i = 31,31 do   
        local button = {id = ("b"..31), enabled=true, td="<td>", top=75/100, bottom=87/100, left=71/100, right=85/100}
          table.insert(MSButtons, button)
    end
    
    
        for i = 32,32 do   
        local button = {id = ("b"..32), enabled=true, td="<td>", top=88/100, bottom=98/100, left=30/100, right=59/100}
          table.insert(MSButtons, button)
    end
        for i = 33,33 do   
        local button = {id = ("b"..33), enabled=true, td="<td>", top=88/100, bottom=98/100, left=63/100, right=77/100}
        table.insert(MSButtons, button)
    end
          for i = 34,34 do
       local button = {id = ("b"..34), enabled=true, td="<td>", top=88/100, bottom=98/100, left=85/100, right=100/100}
        table.insert(MSButtons, button)
    end
        for i = 35,35 do   
        local button = {id = ("b"..35), enabled=true, td="<td>", top=90/100, bottom=100/100, left=1/100, right=18/100}
        table.insert(MSButtons, button)
    end
    
    function evaluateButtons()
      local selected = 0
      
      if #MSButtons >= 1 then
    
             -- Set button styles
           for i, button in ipairs(MSButtons) do
                if button.left < MSMouseX and MSMouseX < button.right and button.top < MSMouseY and MSMouseY < button.bottom then
                    if MSMouseDown and MSButtonSelected == i then
                    end
                    selected = i
                end
                if not button.enabled then
                end
    
            end
      end
      return selected
    end
    
    function onButtonDown(buttonNo)
      local button = MSButtons[buttonNo]    
      if not button or not button.enabled then
    	return
      end
    end
    function onButtonUp(buttonNo)
      local button = MSButtons[buttonNo]    
      if not button or not button.enabled then
        return
      end
            
    
    function onClick(buttonNo)
      local button = MSButtons[buttonNo]    
      if not button or not button.enabled then
        return
      end
    end
      if buttonNo == 1 then
        keyb=keyb.."q"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 2 then
        keyb=keyb.."w"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 3 then
        keyb=keyb.."e"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 4 then
        keyb=keyb.."r"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 5 then
        keyb=keyb.."t"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 6 then
        keyb=keyb.."y"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 7 then
        keyb=keyb.."u"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 8 then
        keyb=keyb.."i"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 9 then
        keyb=keyb.."o"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 10 then
        keyb=keyb.."p"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 11 then
        tablex.clear(lines,html)   
      elseif buttonNo == 12 then
        keyb = ""
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 13 then
        keyb=keyb.."a"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 14 then
        keyb=keyb.."s"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 15 then
        keyb=keyb.."d"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 16 then
        keyb=keyb.."f"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 17 then
        keyb=keyb.."g"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 18 then
        keyb=keyb.."h"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 19 then
        keyb=keyb.."j"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 20 then
        keyb=keyb.."k"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 21 then
        keyb=keyb.."l"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 22 then
        EnterPressed = true
        CheckEnterButton()
      elseif buttonNo == 23 then
        keyb=keyb.."z"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 24 then
        keyb=keyb.."x"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 25 then
        keyb=keyb.."c"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 26 then
        keyb=keyb.."v"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 27 then
        keyb=keyb.."b"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 28 then
        keyb=keyb.."n"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 29 then
        keyb=keyb.."m"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 30 then
        keyb=keyb.."."
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 31 then
        startupnow = 1
      elseif buttonNo == 32 then
        keyb=keyb.." "
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 33 then
        startupnow = 1.2
      elseif buttonNo == 34 then
        if LockonStart == false then
            CurChan = keyb
            keyb = ""
        else
            keybhidden = "Buttons Are (LOCKED) ACCESS DENIED"
            unit.setTimer("exit",1)
        end
      elseif buttonNo == 35 then
    
      end
    end
    
    page = [[
    <svg viewBox="0 0 1024 612">
    <g>
    <title>background</title>
    <rect x="-1" y="-1" width="1026" height="614"/>
    <g display="none">
    <rect width="100%" height="100%" fill="url(#gridpattern)" stroke-width="0"/>
    </g>
    </g>
    <g>
    <title>Layer 1</title>
    <rect x="7" y="5" width="1012" height="290" rx="20" fill="#007f7f" stroke="#0f0" stroke-width="5"/>
    
    <rect x="1" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="14.997276" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">q</text>
    <rect x="80" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="90" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">w</text>
    <rect x="160" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="178" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">e</text>
    <rect x="240" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="255" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">r</text>
    <rect x="320" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="337" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">t</text>
    <rect x="400" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="417" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">y</text>
    <rect x="480" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="496" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">u</text>
    <rect x="560" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="586" y="361.00001" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">i</text>
    <rect x="640" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="654" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">o</text>
    <rect x="720" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="740" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">p</text>
    <rect x="880" y="306" width="140" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="895" y="350" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="30" font-weight="bold" stroke-width="0" xml:space="preserve">CLEAR</text>
    <rect x="800" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="802" y="350" cursor="move" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="30" font-weight="bold" stroke-width="0" xml:space="preserve"></text>
    <rect x="41" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="59" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">a</text>
    <rect x="121" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="136" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">s</text>
    <rect x="201" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="218" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">d</text>
    <rect x="281" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="298" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">f</text>
    <rect x="361" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="377" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">g</text>
    <rect x="441" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="455" y="440.00001" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">h</text>
    <rect x="521" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="540" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">j</text>
    <rect x="601" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="619" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">k</text>
    <rect x="761" y="385" width="140" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="785" y="430" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="30" font-style="italic" font-weight="bold" stroke-width="0" xml:space="preserve">Enter</text>
    <rect x="681" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="700" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">l</text>
    <rect x="86" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="101" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">z</text>
    <rect x="166" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="183" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">x</text>
    <rect x="246" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="263" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">c</text>
    <rect x="326" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="342" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">v</text>
    <rect x="406" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="420" y="521.00001" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">b</text>
    <rect x="486" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="500" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">n</text>
    <rect x="566" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="578" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">m</text>
    <rect x="646" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    
    <rect x="306" y="545" width="300" height="55" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <rect x="726" y="466" width="140" height="70" rx="10" fill="#00bfbf" stroke="#00ff00" stroke-width="5"/>
    <text x="750" y="510" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="30" font-weight="bold" stroke-width="0" xml:space="preserve">SHIFT</text>
    <rect x="650" y="545" width="140" height="55" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="690" y="585" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="28" font-weight="bold" stroke-width="0" xml:space="preserve">?123</text>
    <rect x="880" y="545" width="140" height="55" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="890" y="585" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="30" font-weight="bold" stroke-width="0" xml:space="preserve">CH:]]..CurChan..[[</text>
    <text x="674" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">.</text>
    
    <text x="50" y="280" fill="#0000ff" font-family="Helvetica, Arial, sans-serif" font-size="25" font-style="italic" font-weight="bold" stroke-width="0" xml:space="preserve">]]..keybhidden..[[</text>
    </g>]] 
        local buttonNo = evaluateButtons()
        if MSMouseDown then
          MSMouseX = screen.getMouseX()
          MSMouseY = screen.getMouseY()
          if buttonNo ~= MSButtonSelected or MSMouseX < 0.05 or MSMouseX > 0.95 or MSMouseY < 0.05 or MSMouseY > 0.95 then
            if MSButtonSelected > 0 then
              onButtonUp(MSButtonSelected)
            end
            MSButtonSelected = 0
          end        
        end
    
    
        screen.setHTML(page)
    
    
    
    
    elseif startupnow == 1.2 then    ----- emitter end
                   tablex.clear(MSButtons, button)
          for i = 1,1 do
       local button = {id = ("b"..1), enabled=true, td="<td>", top=49/100, bottom=60/100, left=1/100, right=6.5/100}
        table.insert(MSButtons, button)
    end
      for i = 2,2 do
       local button = {id = ("b"..2), enabled=true, td="<td>", top=49/100, bottom=60/100, left=8/100, right=14/100}
        table.insert(MSButtons, button)
    end
        for i = 3,3 do
        local button = {id = ("b"..3), enabled=true, td="<td>", top=49/100, bottom=60/100, left=15/100, right=22/100}
          table.insert(MSButtons, button)
    end
        for i = 4,4 do   
        local button = {id = ("b"..4), enabled=true, td="<td>", top=49/100, bottom=60/100, left=23/100, right=30/100}
          table.insert(MSButtons, button)
    end
        for i = 5,5 do   
        local button = {id = ("b"..5), enabled=true, td="<td>", top=49/100, bottom=60/100, left=31/100, right=38/100}
          table.insert(MSButtons, button)
    end
        for i = 6,6 do   
        local button = {id = ("b"..6), enabled=true, td="<td>", top=49/100, bottom=60/100, left=39/100, right=46/100}
          table.insert(MSButtons, button)
    end
        for i = 7,7 do   
        local button = {id = ("b"..7), enabled=true, td="<td>", top=49/100, bottom=60/100, left=47/100, right=53/100}
          table.insert(MSButtons, button)
    end
        for i = 8,8 do   
        local button = {id = ("b"..8), enabled=true, td="<td>", top=49/100, bottom=60/100, left=54/100, right=61/100}
          table.insert(MSButtons, button)
    end
        for i = 9,9 do   
        local button = {id = ("b"..9), enabled=true, td="<td>", top=49/100, bottom=60/100, left=62/100, right=69/100}
          table.insert(MSButtons, button)
    end
        for i = 10,10 do   
        local button = {id = ("b"..10), enabled=true, td="<td>", top=49/100, bottom=60/100, left=70/100, right=77/100}
          table.insert(MSButtons, button)
    end
        for i = 11,11 do   
        local button = {id = ("b"..11), enabled=true, td="<td>", top=49/100, bottom=60/100, left=78/100, right=85/100}
          table.insert(MSButtons, button)
    end
        for i = 12,12 do   
        local button = {id = ("b"..12), enabled=true, td="<td>", top=49/100, bottom=60/100, left=86/100, right=93/100}
          table.insert(MSButtons, button)
    end
    
    
    
        for i = 13,13 do   
        local button = {id = ("b"..13), enabled=true, td="<td>", top=62/100, bottom=73/100, left=4/100, right=10/100}
        table.insert(MSButtons, button)
    end
          for i = 14,14 do
       local button = {id = ("b"..14), enabled=true, td="<td>", top=62/100, bottom=73/100, left=11.5/100, right=18/100}
        table.insert(MSButtons, button)
    end
      for i = 15,15 do
       local button = {id = ("b"..15), enabled=true, td="<td>", top=62/100, bottom=73/100, left=19/100, right=26/100}
        table.insert(MSButtons, button)
    end
        for i = 16,16 do
        local button = {id = ("b"..16), enabled=true, td="<td>", top=62/100, bottom=73/100, left=27/100, right=34/100}
          table.insert(MSButtons, button)
    end
        for i = 17,17 do   
        local button = {id = ("b"..17), enabled=true, td="<td>", top=62/100, bottom=73/100, left=35/100, right=42/100}
          table.insert(MSButtons, button)
    end
        for i = 18,18 do   
        local button = {id = ("b"..18), enabled=true, td="<td>", top=62/100, bottom=73/100, left=43/100, right=50/100}
          table.insert(MSButtons, button)
    end
        for i = 19,19 do   
        local button = {id = ("b"..19), enabled=true, td="<td>", top=62/100, bottom=73/100, left=51/100, right=58/100}
          table.insert(MSButtons, button)
    end
        for i = 20,20 do   
        local button = {id = ("b"..20), enabled=true, td="<td>", top=62/100, bottom=73/100, left=59/100, right=65/100}
          table.insert(MSButtons, button)
    end
        for i = 21,21 do
       local button = {id = ("b"..21), enabled=true, td="<td>", top=62/100, bottom=73/100, left=66.5/100, right=73/100}
        table.insert(MSButtons, button)
    end
      for i = 22,22 do
       local button = {id = ("b"..22), enabled=true, td="<td>", top=62/100, bottom=73/100, left=74/100, right=82/100}
        table.insert(MSButtons, button)
    end
      for i = 23,23 do
       local button = {id = ("b"..23), enabled=true, td="<td>", top=62/100, bottom=73/100, left=82.5/100, right=90/100}
        table.insert(MSButtons, button)
    end
      for i = 24,24 do
       local button = {id = ("b"..24), enabled=true, td="<td>", top=62/100, bottom=73/100, left=90/100, right=97/100}
        table.insert(MSButtons, button)
    end
    
    
        for i = 25,25 do
        local button = {id = ("b"..23), enabled=true, td="<td>", top=75/100, bottom=87/100, left=8/100, right=15/100}
          table.insert(MSButtons, button)
    end
        for i = 26,26 do   
        local button = {id = ("b"..26), enabled=true, td="<td>", top=75/100, bottom=87/100, left=16/100, right=23/100}
          table.insert(MSButtons, button)
    end
        for i = 27,27 do   
        local button = {id = ("b"..27), enabled=true, td="<td>", top=75/100, bottom=87/100, left=24/100, right=31/100}
          table.insert(MSButtons, button)
    end
        for i = 28,28 do   
        local button = {id = ("b"..28), enabled=true, td="<td>", top=75/100, bottom=87/100, left=32/100, right=39/100}
          table.insert(MSButtons, button)
    end
        for i = 29,29 do   
        local button = {id = ("b"..29), enabled=true, td="<td>", top=75/100, bottom=87/100, left=40/100, right=46/100}
          table.insert(MSButtons, button)
    end
        for i = 30,30 do   
        local button = {id = ("b"..30), enabled=true, td="<td>", top=75/100, bottom=87/100, left=47/100, right=54/100}
          table.insert(MSButtons, button)
    end
        for i = 31,31 do   
        local button = {id = ("b"..31), enabled=true, td="<td>", top=75/100, bottom=87/100, left=55/100, right=62/100}
          table.insert(MSButtons, button)
    end
        for i = 32,32 do   
        local button = {id = ("b"..32), enabled=true, td="<td>", top=75/100, bottom=87/100, left=63/100, right=70/100}
          table.insert(MSButtons, button)
    end
        for i = 33,33 do   
        local button = {id = ("b"..33), enabled=true, td="<td>", top=75/100, bottom=87/100, left=71/100, right=78/100}
          table.insert(MSButtons, button)
    end
        for i = 34,34 do   
        local button = {id = ("b"..34), enabled=true, td="<td>", top=75/100, bottom=87/100, left=79/100, right=86/100}
          table.insert(MSButtons, button)
    end
        for i = 35,35 do   
        local button = {id = ("b"..35), enabled=true, td="<td>", top=75/100, bottom=87/100, left=86.5/100, right=94/100}
          table.insert(MSButtons, button)
    end
    
        for i = 36,36 do   
        local button = {id = ("b"..36), enabled=true, td="<td>", top=88/100, bottom=98/100, left=30/100, right=59/100}
          table.insert(MSButtons, button)
    end
        for i = 37,37 do   
        local button = {id = ("b"..37), enabled=true, td="<td>", top=88/100, bottom=98/100, left=63/100, right=77/100}
        table.insert(MSButtons, button)
    end
          for i = 38,38 do
       local button = {id = ("b"..38), enabled=true, td="<td>", top=88/100, bottom=98/100, left=85/100, right=100/100}
        table.insert(MSButtons, button)
    end
        for i = 39,39 do   
        local button = {id = ("b"..39), enabled=true, td="<td>", top=90/100, bottom=100/100, left=1/100, right=18/100}
        table.insert(MSButtons, button)
    end
    function evaluateButtons()
      local selected = 0
      
      if #MSButtons >= 1 then
    
    
             -- Set button styles
           for i, button in ipairs(MSButtons) do
                if button.left < MSMouseX and MSMouseX < button.right and button.top < MSMouseY and MSMouseY < button.bottom then
                    if MSMouseDown and MSButtonSelected == i then
                    end
                    selected = i
                end
                if not button.enabled then
                end
    
            end
      end
      return selected
    end
    
    
    function onButtonDown(buttonNo)
      local button = MSButtons[buttonNo]    
      if not button or not button.enabled then
    	return
      end
    end
    function onButtonUp(buttonNo)
      local button = MSButtons[buttonNo]    
      if not button or not button.enabled then
        return
      end
            
    
    function onClick(buttonNo)
      local button = MSButtons[buttonNo]    
      if not button or not button.enabled then
        return
      end
    end
      if buttonNo == 1 then
        keyb=keyb.."1"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 2 then
        keyb=keyb.."2"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 3 then
        keyb=keyb.."3"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 4 then
        keyb=keyb.."4"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 5 then
        keyb=keyb.."5"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
    		hint(1, 5)
      elseif buttonNo == 6 then
        keyb=keyb.."6"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 7 then
        keyb=keyb.."7"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 8 then
        keyb=keyb.."8"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 9 then
        keyb=keyb.."9"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 10 then
        keyb=keyb.."0"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 11 then
        keyb=keyb..","
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 12 then
        keyb=keyb.."?"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 13 then
        keyb=keyb.."!"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 14 then
        keyb=keyb.."@"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 15 then
        keyb=keyb.."#"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 16 then
        keyb=keyb.."$"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 17 then
        keyb=keyb.."%"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 18 then
        keyb=keyb.."^"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 19 then
        keyb=keyb.."&"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 20 then
        keyb=keyb.."*"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 21 then
        keyb=keyb.."~"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 22 then
        keyb=keyb..";"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 23 then
        keyb=keyb..":"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 24 then
        keyb=keyb.."'"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 25 then
        keyb=keyb.."("
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 26 then
        keyb=keyb..")"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 27 then
        keyb=keyb.."["
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 28 then
        keyb=keyb.."]"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 29 then
        keyb=keyb.."{"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 30 then
        keyb=keyb.."}"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 31 then
        keyb=keyb.."<"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 32 then
        keyb=keyb..">"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 33 then
        keyb=keyb.."+"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 34 then
        keyb="-"
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 35 then
        keyb=keyb.."="
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 36 then
        keyb=keyb.." "
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 37 then
        startupnow = 1
      elseif buttonNo == 38 then
        keyb=""
        screen.addText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 39 then
    
    
      end
    end
    
    
    page = [[
    <svg viewBox="0 0 1024 612">
    <g>
    <title>background</title>
    <rect x="-1" y="-1" width="1026" height="614"/>
    <g display="none">
    <rect width="100%" height="100%" fill="url(#gridpattern)" stroke-width="0"/>
    </g>
    </g>
    <g>
    <title>Layer 1</title>
    <rect x="7" y="5" width="1012" height="290" rx="20" fill="#007f7f" stroke="#0f0" stroke-width="5"/>
    <g fill="#ffff00" fill-opacity="null" font-family="Helvetica, Arial, sans-serif" font-size="20" font-weight="bold" stroke="#00ff00" stroke-width="0">
    
    <text x="50" y="280" fill="#0000ff" font-family="Helvetica, Arial, sans-serif" font-size="25" font-style="italic" font-weight="bold" stroke-width="0" xml:space="preserve">]]..keybhidden..[[</text>
    </g>
      <g id="svg_47">
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="1" y="305.999996" width="70" height="70" id="svg_1" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="20" y="360.999996" id="svg_3" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">1</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="80" y="305.999996" width="70" height="70" id="svg_8" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="100" y="360.999996" id="svg_9" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">2</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="160" y="305.999996" width="70" height="70" id="svg_11" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="180" y="360.999996" id="svg_12" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">3</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="240" y="305.999996" width="70" height="70" id="svg_14" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="260" y="360.999996" id="svg_15" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">4</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="320" y="305.999996" width="70" height="70" id="svg_17" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="340" y="360.999996" id="svg_18" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">5</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="400" y="305.999996" width="70" height="70" id="svg_20" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="420" y="360.999996" id="svg_21" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">6</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="480" y="305.999996" width="70" height="70" id="svg_23" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="500" y="360.999996" id="svg_24" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">7</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="560" y="306.00001" width="70" height="70" id="svg_26" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="580" y="361.00001" id="svg_27" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">8</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="640" y="305.999996" width="70" height="70" id="svg_29" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="660" y="360.999996" id="svg_30" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">9</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="720" y="305.999996" width="70" height="70" id="svg_32" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="740" y="360.999996" id="svg_33" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">0</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="800" y="305.999996" width="70" height="70" id="svg_35" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="825" y="350" id="svg_36" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">,</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="880" y="305.999996" width="70" height="70" id="svg_38" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="900" y="360" id="svg_39" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">?</text>
      </g>
      <g id="svg_108">
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="41" y="384.999996" width="70" height="70" id="svg_10" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="65" y="439.999996" id="svg_13" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">!</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="121" y="384.999996" width="70" height="70" id="svg_16" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="127" y="439.999996" id="svg_19" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">@</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="201" y="384.999996" width="70" height="70" id="svg_22" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="220" y="439.999996" id="svg_25" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">#</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="281" y="384.999996" width="70" height="70" id="svg_28" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="300" y="439.999996" id="svg_31" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">$</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="361" y="384.999996" width="70" height="70" id="svg_34" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="371" y="439.999996" id="svg_37" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">%</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="441" y="385.00001" width="70" height="70" id="svg_40" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="460" y="440.00001" id="svg_41" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">^</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="521" y="384.999996" width="70" height="70" id="svg_42" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="535" y="439.999996" id="svg_43" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">&amp;</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="601" y="384.999996" width="70" height="70" id="svg_44" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="625" y="439.999996" id="svg_45" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">*</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="681" y="384.999996" width="70" height="70" id="svg_48" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="700" y="439.999996" id="svg_49" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">~</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="761" y="384.999996" width="70" height="70" id="svg_118" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="785" y="439.999996" id="svg_119" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">;</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="841" y="384.999996" width="70" height="70" id="svg_121" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="865" y="439.999996" id="svg_122" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">:</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="921" y="384.999996" width="70" height="70" id="svg_127" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="950" y="439.999996" id="svg_128" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">'</text>
      </g>
      <g id="svg_112">
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="86" y="465.999996" width="70" height="70" id="svg_52" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="110" y="520.999996" id="svg_53" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">(</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="166" y="465.999996" width="70" height="70" id="svg_54" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="195" y="520.999996" id="svg_55" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">)</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="246" y="465.999996" width="70" height="70" id="svg_56" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="270" y="520.999996" id="svg_57" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">[</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="326" y="465.999996" width="70" height="70" id="svg_58" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="350" y="520.999996" id="svg_59" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">]</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="406" y="466.00001" width="70" height="70" id="svg_60" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="430" y="521.00001" id="svg_61" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">{</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="486" y="465.999996" width="70" height="70" id="svg_62" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="515" y="520.999996" id="svg_63" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">}</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="566" y="465.999996" width="70" height="70" id="svg_64" rx="10"/>
       <text style="cursor: move;" fill="#bf0000" stroke-width="0" x="585" y="520.999996" id="svg_65" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">&lt;</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="646" y="465.999996" width="70" height="70" id="svg_68" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="656" y="520.999996" id="svg_69" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold"/>
       <text style="cursor: move;" fill="#bf0000" stroke-width="0" x="665" y="520.999996" id="svg_78" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">&gt;</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="726" y="465.999996" width="70" height="70" id="svg_66" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="736" y="520.999996" id="svg_67" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold"/>
       <text fill="#bf0000" stroke-width="0" x="755" y="520.999996" id="svg_107" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">+</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="806" y="465.999996" width="70" height="70" id="svg_109" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="830" y="520.999996" id="svg_111" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">-</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="886" y="465.999996" width="70" height="70" id="svg_113" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="908" y="520.999996" id="svg_115" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">=</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="306" y="545" width="300" height="55" id="svg_71" rx="10"/>
      <rect fill="#00bfbf" stroke="#ffff00" stroke-width="5" x="650" y="544.999996" width="140" height="55" id="svg_73" rx="10"/>
      <text style="cursor: move;" fill="#ffff00" stroke-width="0" x="690" y="585" id="svg_74" font-size="28" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">?123</text>
      <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="880" y="545" width="140" height="55" id="svg_76" rx="10"/>
      <text fill="#bf0000" stroke-width="0" x="900" y="585" id="svg_77" font-size="30" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">CLEAR</text>
            </g>]] 
        local buttonNo = evaluateButtons()
        if MSMouseDown then
          MSMouseX = screen.getMouseX()
          MSMouseY = screen.getMouseY()
          if buttonNo ~= MSButtonSelected or MSMouseX < 0.05 or MSMouseX > 0.95 or MSMouseY < 0.05 or MSMouseY > 0.95 then
            if MSButtonSelected > 0 then
              onButtonUp(MSButtonSelected)
            end
            MSButtonSelected = 0
          end        
        end
           
    end
    
    if LockonStart == true then
            local charcount = string.len(keyb)
            if charcount > startcount then
                keybhidden = keybhidden.."*" 
                screen.addText(30,10,7,keybhidden)        
                startcount = charcount
            elseif keyb == "" then
                keybhidden = ""
                charcount = 0
                startcount = 0
            end
    elseif LockonStart == false then
        keybhidden = keyb    
    end 
    screen.setHTML(page)
        local html = {}
        
        for lineIndex = #lines,1,-1 do
        	local line = lines[lineIndex]
            if lineIndex < 8 then
                table.insert(html, "<div style='font-size: 4.5vh; background-color: darkblue; color: white; border-radius: 2.5vw; text-align: left;'>" .. line .. "</div>")
            elseif lineIndex == 8 then
                table.remove(lines,1)
                lineIndex = 0
                table.insert(html, "<div style='font-size: 4.5vh; background-color: darkblue; color: white; border-radius: 2.5vw; text-align: left;'>" .. line .. "</div>")            
            end
        end
        
         screen.addText(2,1,0,(table.concat(html))) 
    
    end
    
    
    
    
    
    
    
    
    UnitTick exit--------------------------------------
    
    keybhidden = "Goodbye"
    unit.exit()
    
    System Update--------------------------------------
    
    updateScreen()
    
    System Stop----------------------------------------
    
    page = [[]]
    screen.setHTML(page)
    
    emitter----------------------------(*,*)
    table.insert(lines, "ID: " .. channel .. "/ MSG: " .. message)
    
    Screen Mouse UP --------------------(*,*)
    MSMouseX = x
    MSMouseY = y
    MSMouseDown = false
    local buttonNo = evaluateButtons()
    if MSButtonSelected > 0 and MSButtonSelected == buttonNo then
        onButtonUp(buttonNo)
        onClick(buttonNo)
    end
    MSButtonSelected = -buttonNo
    
    Screen Mouse Down --------------------(*,*)
    MSMouseX = x
    MSMouseY = y
    MSMouseDown = true
    MSAttention = 0
    MSDislikeButton = 0
    MSLikeButton = 0
    MSButtonSelected = evaluateButtons()
    onButtonDown(MSButtonSelected)

     

     

     

     

     

     

  3. Requirements:
    1 screen

    1 program board

    1 door


    ----------Script could be minified using pairs but for easy reading and alterations I have left script in basic if statements since most dont even understand the basics-------
    ----------Great example piece to demonstrate that Lua reads the scripts in Order of Operations as long as parameters are met--------------------

    Slots                       Hook up in this order and rename slots.

    slot1 --> screen
    slot2 --> door
     

    
    
    
    -------------------------mouse up-------------------------------------------------------------
    
    
    PWMouseX = x
    PWMouseY = y
    PWMouseDown = false
    local buttonNo = evaluateButtons()
    if PWButtonSelected > 0 and PWButtonSelected == buttonNo then
        onButtonUp(buttonNo)
        onClick(buttonNo)
    end
    PWButtonSelected = -buttonNo
    
    
    -------------------------mouse down-----------------------------------------------------------
    
    PWMouseX = x
    PWMouseY = y
    PWMouseDown = true
    PWAttention = 0
    PWDislikeButton = 0
    PWLikeButton = 0
    PWButtonSelected = evaluateButtons()
    onButtonDown(PWButtonSelected)
    
    
    -------------------------system update-----------------------------------------------------------------
    updateScreen()
    -------------------------unit tick exit-------------------------------------------------------------
    
    keyb = "Goodbye"
    unit.exit()
    
    
    
    
    
    
    -------------------------unit stop------------------------------------------------------------
    page = [[<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 600"><defs><style>.cls-1{fill:#fff;}.cls-2{fill:red;}</style></defs><rect class="cls-1" width="1024" height="600"/><rect class="cls-2" width="1024" height="281"/><path class="cls-1" d="M164.05,122.19V50.61h36.87q10.25,0,15.67,1.76a16.65,16.65,0,0,1,8.74,6.52,19.78,19.78,0,0,1,3.32,11.59,19.14,19.14,0,0,1-9.53,17.29,26.73,26.73,0,0,1-7.76,2.83,22,22,0,0,1,5.75,2.64A22,22,0,0,1,220.65,97a28.24,28.24,0,0,1,3.1,4.45l10.71,20.74h-25l-11.83-21.87c-1.49-2.83-2.83-4.67-4-5.52a9.24,9.24,0,0,0-5.42-1.66h-1.95v29.05Zm22.22-42.57h9.32a33.44,33.44,0,0,0,5.86-1A5.81,5.81,0,0,0,205,76.39a7.26,7.26,0,0,0-.8-9.47Q202,65.06,196,65.06h-9.71Z"/><path class="cls-1" d="M241.49,50.61h59.28V65.89H263.66V77.27h34.42v14.6H263.66V106h38.18v16.21H241.49Z"/><path class="cls-1" d="M309.9,98.51,331,97.19a16,16,0,0,0,2.78,7.82q3.42,4.33,9.76,4.34,4.74,0,7.3-2.22a6.66,6.66,0,0,0,2.57-5.15,6.58,6.58,0,0,0-2.44-5q-2.44-2.2-11.33-4.15Q325,89.58,318.84,84.16a17.48,17.48,0,0,1-6.25-13.82,18.79,18.79,0,0,1,3.19-10.43,21.25,21.25,0,0,1,9.62-7.71q6.42-2.81,17.61-2.81,13.71,0,20.92,5.1t8.57,16.24L351.65,72c-.56-3.22-1.72-5.57-3.49-7a11.21,11.21,0,0,0-7.35-2.2q-3.85,0-5.81,1.64a5,5,0,0,0-2,4,4,4,0,0,0,1.62,3.07q1.56,1.43,7.42,2.64,14.51,3.12,20.77,6.32A21.84,21.84,0,0,1,372,88.31a20.13,20.13,0,0,1,2.85,10.59A22.72,22.72,0,0,1,371,111.6a23.81,23.81,0,0,1-10.64,8.81q-6.84,3-17.24,3-18.25,0-25.29-7A27.7,27.7,0,0,1,309.9,98.51Z"/><path class="cls-1" d="M381,50.61h67.23V68.29H425.62v53.9H403.5V68.29H381Z"/><path class="cls-1" d="M458.48,122.19V50.61h36.87q10.26,0,15.67,1.76a16.61,16.61,0,0,1,8.74,6.52,19.71,19.71,0,0,1,3.32,11.59,19.16,19.16,0,0,1-9.52,17.29,26.81,26.81,0,0,1-7.77,2.83,22.21,22.21,0,0,1,5.76,2.64A22.46,22.46,0,0,1,515.08,97a28.24,28.24,0,0,1,3.1,4.45l10.71,20.74h-25l-11.82-21.87c-1.5-2.83-2.83-4.67-4-5.52a9.24,9.24,0,0,0-5.42-1.66H480.7v29.05ZM480.7,79.62H490a33.58,33.58,0,0,0,5.86-1,5.84,5.84,0,0,0,3.59-2.25,7.25,7.25,0,0,0-.81-9.47c-1.46-1.24-4.22-1.86-8.25-1.86H480.7Z"/><path class="cls-1" d="M536.85,50.61H559v71.58H536.85Z"/><path class="cls-1" d="M622.55,92.9l19.38,5.86a35.76,35.76,0,0,1-6.15,13.62,26.72,26.72,0,0,1-10.43,8.25q-6.23,2.79-15.84,2.78-11.67,0-19.07-3.39t-12.77-11.93q-5.37-8.53-5.37-21.86,0-17.76,9.45-27.3t26.73-9.54q13.53,0,21.27,5.47t11.5,16.8L621.72,76a16.85,16.85,0,0,0-2.15-4.78A12.68,12.68,0,0,0,615,67.31,14,14,0,0,0,597.5,72q-3,4.49-3,14.09,0,11.91,3.61,16.32t10.16,4.41q6.35,0,9.59-3.56T622.55,92.9Z"/><path class="cls-1" d="M647.64,50.61h67.24V68.29H692.32v53.9H670.2V68.29H647.64Z"/><path class="cls-1" d="M724.84,50.61h59.28V65.89H747V77.27h34.42v14.6H747V106h38.18v16.21H724.84Z"/><path class="cls-1" d="M797.4,50.61h32.86q9.72,0,15.7,2.64a25.56,25.56,0,0,1,9.89,7.57,31.3,31.3,0,0,1,5.66,11.47,53.35,53.35,0,0,1,1.76,13.87q0,11.48-2.61,17.8a29.51,29.51,0,0,1-7.25,10.59,23.69,23.69,0,0,1-10,5.69,51.48,51.48,0,0,1-13.19,2H797.4Zm22.12,16.21v39.11h5.42q6.93,0,9.86-1.53A10.39,10.39,0,0,0,839.39,99q1.67-3.83,1.66-12.42,0-11.38-3.71-15.58T825,66.82Z"/><path class="cls-1" d="M410.55,230.38H385.44L382,242.19H359.36l26.91-71.58h24.12l26.9,71.58H414.13ZM406,214.9l-7.9-25.73-7.82,25.73Z"/><path class="cls-1" d="M444.62,242.19V170.61h36.86q10.26,0,15.68,1.76a16.69,16.69,0,0,1,8.74,6.52,20.21,20.21,0,0,1-6.21,28.88,26.81,26.81,0,0,1-7.77,2.83,21.89,21.89,0,0,1,5.76,2.64,22.82,22.82,0,0,1,3.54,3.76,29,29,0,0,1,3.1,4.45L515,242.19H490l-11.82-21.87q-2.25-4.24-4-5.52a9.26,9.26,0,0,0-5.42-1.66h-2v29.05Zm22.21-42.57h9.33a33.58,33.58,0,0,0,5.86-1,5.84,5.84,0,0,0,3.59-2.25,7.25,7.25,0,0,0-.81-9.47q-2.19-1.86-8.25-1.86h-9.72Z"/><path class="cls-1" d="M522.06,170.61h59.28v15.28H544.23v11.38h34.42v14.6H544.23V226h38.18v16.21H522.06Z"/><path class="cls-1" d="M638.33,230.38H613.22l-3.49,11.81H587.15l26.9-71.58h24.13l26.9,71.58H641.91Zm-4.59-15.48-7.9-25.73L618,214.9Z"/><path d="M77.59,318.57H94.11l21.56,31.68V318.57h16.68v57.27H115.67L94.23,344.4v31.44H77.59Z"/><path d="M141.88,347.25q0-14,7.82-21.84t21.75-7.81q14.3,0,22,7.67t7.74,21.51q0,10-3.38,16.46a24,24,0,0,1-9.77,10q-6.37,3.57-15.91,3.58-9.69,0-16-3.09A24.13,24.13,0,0,1,145.83,364Q141.89,357.29,141.88,347.25Zm17.7.07q0,8.67,3.22,12.46a10.9,10.9,0,0,0,8.77,3.79q5.7,0,8.83-3.71t3.12-13.32q0-8.09-3.26-11.81a11.13,11.13,0,0,0-8.85-3.73,10.76,10.76,0,0,0-8.59,3.78Q159.58,338.58,159.58,347.32Z"/><path d="M274.7,318.57h17.65v34.12a28.82,28.82,0,0,1-1.58,9.58,20.77,20.77,0,0,1-5,7.89,19.8,19.8,0,0,1-7.09,4.74,35.58,35.58,0,0,1-12.38,1.92,78.23,78.23,0,0,1-9.13-.59,23.88,23.88,0,0,1-8.26-2.32,20.74,20.74,0,0,1-6.07-4.94,18.05,18.05,0,0,1-3.77-6.6,34.3,34.3,0,0,1-1.64-9.68V318.57h17.66V353.5a10,10,0,0,0,2.59,7.32,11.18,11.18,0,0,0,14.38,0q2.59-2.6,2.6-7.36Z"/><path d="M304.19,318.57h16.52l21.56,31.68V318.57H359v57.27H342.27L320.83,344.4v31.44H304.19Z"/><path d="M405.14,366.39H385.05l-2.8,9.45H364.19l21.52-57.27H405l21.52,57.27H408ZM401.47,354l-6.33-20.58L388.89,354Z"/><path d="M466.69,318.57h17.65v34.12a28.57,28.57,0,0,1-1.58,9.58,20.65,20.65,0,0,1-5,7.89,19.8,19.8,0,0,1-7.09,4.74,35.54,35.54,0,0,1-12.38,1.92,77.93,77.93,0,0,1-9.12-.59,23.75,23.75,0,0,1-8.26-2.32,20.78,20.78,0,0,1-6.08-4.94,18.2,18.2,0,0,1-3.77-6.6,34.3,34.3,0,0,1-1.64-9.68V318.57h17.66V353.5a10,10,0,0,0,2.59,7.32,11.18,11.18,0,0,0,14.38,0q2.6-2.6,2.6-7.36Z"/><path d="M492,318.57h53.79v14.14H527.78v43.13H510.09V332.71H492Z"/><path d="M553.91,318.57h17.7v20H591v-20h17.77v57.27H591V352.67H571.61v23.17h-17.7Z"/><path d="M618.25,347.25q0-14,7.81-21.84t21.76-7.81q14.29,0,22,7.67t7.74,21.51q0,10-3.38,16.46a24.08,24.08,0,0,1-9.77,10q-6.39,3.57-15.92,3.58-9.69,0-16-3.09A24.13,24.13,0,0,1,622.2,364Q618.24,357.29,618.25,347.25Zm17.7.07q0,8.67,3.22,12.46a10.9,10.9,0,0,0,8.77,3.79q5.7,0,8.83-3.71t3.12-13.32q0-8.09-3.26-11.81a11.16,11.16,0,0,0-8.85-3.73,10.75,10.75,0,0,0-8.59,3.78Q635.95,338.58,636,347.32Z"/><path d="M687.35,375.84V318.57h29.49q8.2,0,12.54,1.41a13.46,13.46,0,0,1,7,5.21,16.18,16.18,0,0,1-5,23.11,21.45,21.45,0,0,1-6.21,2.27,17.31,17.31,0,0,1,4.6,2.11,17.56,17.56,0,0,1,2.83,3,22.32,22.32,0,0,1,2.48,3.56l8.57,16.59h-20l-9.46-17.5a13.35,13.35,0,0,0-3.21-4.42,7.43,7.43,0,0,0-4.33-1.32h-1.56v23.24Zm17.78-34.06h7.46a26.65,26.65,0,0,0,4.68-.78,4.69,4.69,0,0,0,2.87-1.8,5.79,5.79,0,0,0-.64-7.58q-1.75-1.49-6.6-1.48h-7.77Z"/><path d="M750.05,318.57h17.73v57.27H750.05Z"/><path d="M779,318.57h50.08V330L797,363.53h33.32v12.31H776V364l31.8-33.16H779Z"/><path d="M838.21,318.57h47.42V330.8H856v9.1h27.53v11.68H856v11.29h30.54v13H838.21Z"/><path d="M896.26,318.57h26.29q7.77,0,12.56,2.11a20.52,20.52,0,0,1,7.91,6.06,25.15,25.15,0,0,1,4.53,9.18A42.44,42.44,0,0,1,949,347q0,9.18-2.09,14.24a23.5,23.5,0,0,1-5.8,8.48,19,19,0,0,1-8,4.55,41.07,41.07,0,0,1-10.54,1.56H896.26Zm17.69,13v31.29h4.34q5.55,0,7.89-1.23a8.31,8.31,0,0,0,3.67-4.3q1.33-3.06,1.33-9.94,0-9.11-3-12.46t-9.84-3.36Z"/><path d="M244.48,414.57h29.41q9.62,0,14.4,4.57t4.78,13q0,8.67-5.21,13.56t-15.92,4.88h-9.69v21.25H244.48ZM262.25,439h4.34q5.12,0,7.19-1.78a5.72,5.72,0,0,0,2.07-4.55,6.35,6.35,0,0,0-1.8-4.57q-1.8-1.87-6.76-1.88h-5Z"/><path d="M302.29,414.57h47.42V426.8H320v9.1h27.54v11.68H320v11.29h30.54v13H302.29Z"/><path d="M360.34,471.84V414.57h29.49q8.21,0,12.54,1.41a13.4,13.4,0,0,1,7,5.21,16.17,16.17,0,0,1-5,23.11,21.41,21.41,0,0,1-6.22,2.27,17.25,17.25,0,0,1,4.61,2.11,18,18,0,0,1,2.83,3,22.32,22.32,0,0,1,2.48,3.56l8.57,16.59h-20l-9.46-17.5a13.22,13.22,0,0,0-3.2-4.42,7.43,7.43,0,0,0-4.33-1.32h-1.57v23.24Zm17.77-34.06h7.46a26.71,26.71,0,0,0,4.69-.78,4.72,4.72,0,0,0,2.87-1.8,5.79,5.79,0,0,0-.64-7.58q-1.75-1.49-6.6-1.48h-7.78Z"/><path d="M419.25,452.89l16.83-1.05a12.9,12.9,0,0,0,2.23,6.25,9.35,9.35,0,0,0,7.81,3.48,8.67,8.67,0,0,0,5.84-1.78,5.32,5.32,0,0,0,2.05-4.12,5.26,5.26,0,0,0-1.95-4q-1.95-1.76-9.06-3.32-11.64-2.61-16.61-6.95a14,14,0,0,1-5-11.06A15.08,15.08,0,0,1,424,422a17,17,0,0,1,7.7-6.17q5.13-2.23,14.08-2.24,11,0,16.74,4.08t6.85,13l-16.68,1a7.79,7.79,0,0,0-8.67-7.38,7.14,7.14,0,0,0-4.65,1.31,4,4,0,0,0-1.56,3.18,3.16,3.16,0,0,0,1.29,2.46q1.24,1.14,5.94,2.11,11.6,2.51,16.62,5.06a17.42,17.42,0,0,1,7.3,6.35,16,16,0,0,1,2.29,8.48,18.16,18.16,0,0,1-3.05,10.15,19.06,19.06,0,0,1-8.51,7.05,34.47,34.47,0,0,1-13.79,2.41q-14.61,0-20.24-5.63A22.17,22.17,0,0,1,419.25,452.89Z"/><path d="M477.88,443.25q0-14,7.81-21.84t21.76-7.81q14.3,0,22,7.67t7.73,21.51q0,10-3.37,16.46a24.08,24.08,0,0,1-9.77,10q-6.39,3.57-15.92,3.58-9.69,0-16-3.09a24.1,24.1,0,0,1-10.3-9.77Q477.88,453.29,477.88,443.25Zm17.69.07q0,8.67,3.23,12.46a10.9,10.9,0,0,0,8.77,3.79q5.7,0,8.82-3.71t3.13-13.32q0-8.09-3.26-11.81a11.16,11.16,0,0,0-8.85-3.73,10.75,10.75,0,0,0-8.59,3.78Q495.56,434.58,495.57,443.32Z"/><path d="M546.86,414.57h16.53L585,446.25V414.57h16.68v57.27H585L563.5,440.4v31.44H546.86Z"/><path d="M613.5,414.57H630l21.56,31.68V414.57h16.68v57.27H651.59L630.14,440.4v31.44H613.5Z"/><path d="M680,414.57h47.42V426.8H697.72v9.1h27.54v11.68H697.72v11.29h30.55v13H680Z"/><path d="M737.8,414.57h17.7v43.17h27.61v14.1H737.8Z"/><path d="M58.11,510.57H91.24q8.28,0,12.71,4.1a13.28,13.28,0,0,1,4.44,10.16,12.8,12.8,0,0,1-3.17,8.71,14,14,0,0,1-6.17,3.83q6.18,1.49,9.08,5.1a14,14,0,0,1,2.91,9.08,15.62,15.62,0,0,1-2.07,8,15.26,15.26,0,0,1-5.66,5.62,18.73,18.73,0,0,1-6.72,1.88,77.57,77.57,0,0,1-7.93.78H58.11ZM76,533h7.7q4.14,0,5.76-1.42A5.2,5.2,0,0,0,91,527.49a4.91,4.91,0,0,0-1.62-3.91q-1.62-1.41-5.64-1.41H76Zm0,22.5h9c3.05,0,5.19-.54,6.44-1.62a5.46,5.46,0,0,0,1.88-4.35,5,5,0,0,0-1.86-4.08q-1.85-1.54-6.5-1.55H76Z"/><path d="M120.26,510.57h47.42V522.8H138v9.1h27.54v11.68H138v11.29h30.54v13H120.26Z"/><path d="M172.29,510.57H192l11.54,19.32,11.56-19.32H234.6l-22.27,33.28v24H194.6v-24Z"/><path d="M233.27,539.25q0-14,7.81-21.84t21.76-7.81q14.3,0,22,7.67t7.74,21.51q0,10-3.38,16.46a24.08,24.08,0,0,1-9.77,10q-6.39,3.57-15.92,3.58-9.69,0-16-3.09a24.15,24.15,0,0,1-10.3-9.77Q233.27,549.29,233.27,539.25Zm17.69.07q0,8.67,3.23,12.46a10.9,10.9,0,0,0,8.77,3.79q5.7,0,8.83-3.71t3.12-13.32q0-8.09-3.26-11.81A11.16,11.16,0,0,0,262.8,523a10.75,10.75,0,0,0-8.59,3.78Q251,530.57,251,539.32Z"/><path d="M302.25,510.57h16.53l21.56,31.68V510.57H357v57.27H340.34L318.89,536.4v31.44H302.25Z"/><path d="M369,510.57H395.3q7.77,0,12.56,2.11a20.44,20.44,0,0,1,7.91,6.06,25.15,25.15,0,0,1,4.53,9.18A42.44,42.44,0,0,1,421.71,539q0,9.18-2.09,14.24a23.75,23.75,0,0,1-5.8,8.48,19.1,19.1,0,0,1-8,4.55,41.14,41.14,0,0,1-10.55,1.56H369Zm17.7,13v31.29H391q5.55,0,7.89-1.23a8.33,8.33,0,0,0,3.68-4.3q1.32-3.06,1.32-9.94,0-9.11-3-12.46c-2-2.24-5.26-3.36-9.84-3.36Z"/><path d="M453.66,510.57h53.79v14.14H489.4v43.13H471.71V524.71h-18Z"/><path d="M515.54,510.57h17.69v20h19.34v-20h17.77v57.27H552.57V544.67H533.23v23.17H515.54Z"/><path d="M582.8,510.57h17.74v57.27H582.8Z"/><path d="M610.14,548.89l16.84-1a12.8,12.8,0,0,0,2.23,6.25,9.34,9.34,0,0,0,7.81,3.48,8.69,8.69,0,0,0,5.84-1.78,5.32,5.32,0,0,0,2-4.12,5.26,5.26,0,0,0-1.95-4q-2-1.75-9.07-3.32-11.64-2.61-16.6-7a14,14,0,0,1-5-11.06,15.08,15.08,0,0,1,2.56-8.34,17,17,0,0,1,7.7-6.17q5.13-2.23,14.08-2.24,11,0,16.74,4.08t6.85,13l-16.68,1a7.79,7.79,0,0,0-8.67-7.38,7.1,7.1,0,0,0-4.65,1.31,4,4,0,0,0-1.56,3.18,3.16,3.16,0,0,0,1.29,2.46q1.24,1.14,5.94,2.11,11.6,2.5,16.62,5.06a17.48,17.48,0,0,1,7.3,6.35,16,16,0,0,1,2.29,8.48,18.16,18.16,0,0,1-3.05,10.15,19.06,19.06,0,0,1-8.51,7,34.47,34.47,0,0,1-13.79,2.41q-14.61,0-20.24-5.63A22.23,22.23,0,0,1,610.14,548.89Z"/><path d="M697.61,510.57H727q9.62,0,14.39,4.57t4.79,13q0,8.67-5.22,13.56t-15.91,4.88h-9.69v21.25H697.61ZM715.38,535h4.33c3.42,0,5.81-.59,7.19-1.78a5.72,5.72,0,0,0,2.07-4.55,6.38,6.38,0,0,0-1.79-4.57c-1.2-1.25-3.46-1.88-6.76-1.88h-5Z"/><path d="M753.23,539.25q0-14,7.81-21.84t21.76-7.81q14.3,0,22,7.67t7.74,21.51q0,10-3.38,16.46a24.08,24.08,0,0,1-9.77,10q-6.39,3.57-15.92,3.58-9.69,0-16-3.09A24.13,24.13,0,0,1,757.18,556Q753.22,549.29,753.23,539.25Zm17.7.07q0,8.67,3.22,12.46a10.9,10.9,0,0,0,8.77,3.79q5.7,0,8.83-3.71t3.12-13.32q0-8.09-3.26-11.81a11.15,11.15,0,0,0-8.85-3.73,10.75,10.75,0,0,0-8.59,3.78Q770.93,530.57,770.93,539.32Z"/><path d="M822.8,510.57h17.74v57.27H822.8Z"/><path d="M853.35,510.57h16.52l21.56,31.68V510.57h16.68v57.27H891.43L870,536.4v31.44H853.35Z"/><path d="M915.85,510.57h53.79v14.14h-18v43.13H933.9V524.71h-18Z"/></svg>]]
    screen.setHTML(page)
    door.deactivate()
    
    
    
    
    
    -------------------------system start----------------------------------------------------------
    
    unit.hide()
    -- Internal variables
    keyb=""
    -- set variables so that there is no error at the start
    
    butcolclk1 = "#00ff00"
    butcolclk2 = "#00ff00"
    mousecolclk = "cyan"
    consta=0
    PWButtons = {}
    PWMouseX = 0
    PWMouseY = 0
    PWMouseDown = false
    PWButtonSelected = 0
    PWAttention = 0
    PWDislikeButton = 0
    PWLikeButton = 0
    PWHintButton = 0
    PWAttentionMessage = ""
    PWAttentionVisible = false
    startupnow = 1
    password = "Pass"--export:
    
    
    
    
    function updateScreen() 
    if startupnow == 1 then    ----- engine stat end emitter start
        tablex.clear(PWButtons, button)
          for i = 1,1 do
       local button = {id = ("b"..1), enabled=true, td="<td>", top=49/100, bottom=60/100, left=1/100, right=6.5/100}
        table.insert(PWButtons, button)
    end
      for i = 2,2 do
       local button = {id = ("b"..2), enabled=true, td="<td>", top=49/100, bottom=60/100, left=8/100, right=14/100}
        table.insert(PWButtons, button)
    end
        for i = 3,3 do
        local button = {id = ("b"..3), enabled=true, td="<td>", top=49/100, bottom=60/100, left=15/100, right=22/100}
          table.insert(PWButtons, button)
    end
        for i = 4,4 do   
        local button = {id = ("b"..4), enabled=true, td="<td>", top=49/100, bottom=60/100, left=23/100, right=30/100}
          table.insert(PWButtons, button)
    end
        for i = 5,5 do   
        local button = {id = ("b"..5), enabled=true, td="<td>", top=49/100, bottom=60/100, left=31/100, right=38/100}
          table.insert(PWButtons, button)
    end
        for i = 6,6 do   
        local button = {id = ("b"..6), enabled=true, td="<td>", top=49/100, bottom=60/100, left=39/100, right=46/100}
          table.insert(PWButtons, button)
    end
        for i = 7,7 do   
        local button = {id = ("b"..7), enabled=true, td="<td>", top=49/100, bottom=60/100, left=47/100, right=53/100}
          table.insert(PWButtons, button)
    end
        for i = 8,8 do   
        local button = {id = ("b"..8), enabled=true, td="<td>", top=49/100, bottom=60/100, left=54/100, right=61/100}
          table.insert(PWButtons, button)
    end
        for i = 9,9 do   
        local button = {id = ("b"..9), enabled=true, td="<td>", top=49/100, bottom=60/100, left=62/100, right=69/100}
          table.insert(PWButtons, button)
    end
        for i = 10,10 do   
        local button = {id = ("b"..10), enabled=true, td="<td>", top=49/100, bottom=60/100, left=70/100, right=77/100}
          table.insert(PWButtons, button)
    end
        for i = 11,11 do   
        local button = {id = ("b"..11), enabled=true, td="<td>", top=49/100, bottom=60/100, left=78/100, right=85/100}
          table.insert(PWButtons, button)
    end
        for i = 12,12 do   
        local button = {id = ("b"..12), enabled=true, td="<td>", top=49/100, bottom=60/100, left=86/100, right=100/100}
          table.insert(PWButtons, button)
    end
    
    
    
        for i = 13,13 do   
        local button = {id = ("b"..13), enabled=true, td="<td>", top=62/100, bottom=73/100, left=4/100, right=10/100}
        table.insert(PWButtons, button)
    end
          for i = 14,14 do
       local button = {id = ("b"..14), enabled=true, td="<td>", top=62/100, bottom=73/100, left=11.5/100, right=18/100}
        table.insert(PWButtons, button)
    end
      for i = 15,15 do
       local button = {id = ("b"..15), enabled=true, td="<td>", top=62/100, bottom=73/100, left=19/100, right=26/100}
        table.insert(PWButtons, button)
    end
        for i = 16,16 do
        local button = {id = ("b"..16), enabled=true, td="<td>", top=62/100, bottom=73/100, left=27/100, right=34/100}
          table.insert(PWButtons, button)
    end
        for i = 17,17 do   
        local button = {id = ("b"..17), enabled=true, td="<td>", top=62/100, bottom=73/100, left=35/100, right=42/100}
          table.insert(PWButtons, button)
    end
        for i = 18,18 do   
        local button = {id = ("b"..18), enabled=true, td="<td>", top=62/100, bottom=73/100, left=43/100, right=50/100}
          table.insert(PWButtons, button)
    end
        for i = 19,19 do   
        local button = {id = ("b"..19), enabled=true, td="<td>", top=62/100, bottom=73/100, left=51/100, right=58/100}
          table.insert(PWButtons, button)
    end
        for i = 20,20 do   
        local button = {id = ("b"..20), enabled=true, td="<td>", top=62/100, bottom=73/100, left=59/100, right=65/100}
          table.insert(PWButtons, button)
    end
          for i = 21,21 do
       local button = {id = ("b"..21), enabled=true, td="<td>", top=62/100, bottom=73/100, left=66.5/100, right=73/100}
        table.insert(PWButtons, button)
    end
      for i = 22,22 do
       local button = {id = ("b"..22), enabled=true, td="<td>", top=62/100, bottom=73/100, left=74/100, right=89/100}
        table.insert(PWButtons, button)
    end
    
    
        for i = 23,23 do
        local button = {id = ("b"..23), enabled=true, td="<td>", top=75/100, bottom=87/100, left=8/100, right=15/100}
          table.insert(PWButtons, button)
    end
        for i = 24,24 do   
        local button = {id = ("b"..24), enabled=true, td="<td>", top=75/100, bottom=87/100, left=16/100, right=23/100}
          table.insert(PWButtons, button)
    end
        for i = 25,25 do   
        local button = {id = ("b"..25), enabled=true, td="<td>", top=75/100, bottom=87/100, left=24/100, right=31/100}
          table.insert(PWButtons, button)
    end
        for i = 26,26 do   
        local button = {id = ("b"..26), enabled=true, td="<td>", top=75/100, bottom=87/100, left=32/100, right=39/100}
          table.insert(PWButtons, button)
    end
        for i = 27,27 do   
        local button = {id = ("b"..27), enabled=true, td="<td>", top=75/100, bottom=87/100, left=40/100, right=46/100}
          table.insert(PWButtons, button)
    end
        for i = 28,28 do   
        local button = {id = ("b"..28), enabled=true, td="<td>", top=75/100, bottom=87/100, left=47/100, right=54/100}
          table.insert(PWButtons, button)
    end
        for i = 29,29 do   
        local button = {id = ("b"..29), enabled=true, td="<td>", top=75/100, bottom=87/100, left=55/100, right=62/100}
          table.insert(PWButtons, button)
    end
        for i = 30,30 do   
        local button = {id = ("b"..30), enabled=true, td="<td>", top=75/100, bottom=87/100, left=63/100, right=70/100}
          table.insert(PWButtons, button)
    end
        for i = 31,31 do   
        local button = {id = ("b"..31), enabled=true, td="<td>", top=75/100, bottom=87/100, left=71/100, right=85/100}
          table.insert(PWButtons, button)
    end
    
    
        for i = 32,32 do   
        local button = {id = ("b"..32), enabled=true, td="<td>", top=88/100, bottom=98/100, left=30/100, right=59/100}
          table.insert(PWButtons, button)
    end
        for i = 33,33 do   
        local button = {id = ("b"..33), enabled=true, td="<td>", top=88/100, bottom=98/100, left=63/100, right=77/100}
        table.insert(PWButtons, button)
    end
          for i = 34,34 do
       local button = {id = ("b"..34), enabled=true, td="<td>", top=88/100, bottom=98/100, left=85/100, right=100/100}
        table.insert(PWButtons, button)
    end
        for i = 35,35 do   
        local button = {id = ("b"..35), enabled=true, td="<td>", top=90/100, bottom=100/100, left=1/100, right=18/100}
        table.insert(PWButtons, button)
    end
    function evaluateButtons()
      local selected = 0
      
      if #PWButtons >= 1 then
    
             -- Set button styles
           for i, button in ipairs(PWButtons) do
                if button.left < PWMouseX and PWMouseX < button.right and button.top < PWMouseY and PWMouseY < button.bottom then
                    if PWMouseDown and PWButtonSelected == i then
                    end
                    selected = i
                end
                if not button.enabled then
                end
    
            end
      end
      return selected
    end
    
    
    function onButtonDown(buttonNo)
      local button = PWButtons[buttonNo]    
      if not button or not button.enabled then
    	return
      end
    end
    function onButtonUp(buttonNo)
      local button = PWButtons[buttonNo]    
      if not button or not button.enabled then
        return
      end
            
    
    function onClick(buttonNo)
      local button = PWButtons[buttonNo]    
      if not button or not button.enabled then
        return
      end
    end
       if buttonNo == 1 then
        keyb=keyb.."Q"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 2 then
        keyb=keyb.."W"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 3 then
        keyb=keyb.."E"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 4 then
        keyb=keyb.."R"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 5 then
        keyb=keyb.."T"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 6 then
        keyb=keyb.."Y"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 7 then
        keyb=keyb.."U"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 8 then
        keyb=keyb.."I"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 9 then
        keyb=keyb.."O"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 10 then
        keyb=keyb.."P"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 11 then
    
      elseif buttonNo == 12 then
        keyb = ""
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 13 then
        keyb=keyb.."A"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 14 then
        keyb=keyb.."S"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 15 then
        keyb=keyb.."D"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 16 then
        keyb=keyb.."F"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 17 then
        keyb=keyb.."G"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 18 then
        keyb=keyb.."H"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 19 then
        keyb=keyb.."J"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 20 then
        keyb=keyb.."K"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 21 then
        keyb=keyb.."L"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 22 then   ----enterbutton
        if keyb == password then
        keyb=""
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
        door.activate()
        keyb="Access Granted"
        unit.setTimer("exit",5)       
        elseif keyb ~= password then 
        keyb=""
        keyb="Access DENIED"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
        unit.setTimer("exit",1)
        door.deactivate()
        end
        
      elseif buttonNo == 23 then
        keyb=keyb.."Z"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 24 then
        keyb=keyb.."X"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 25 then
        keyb=keyb.."C"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 26 then
        keyb=keyb.."V"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 27 then
        keyb=keyb.."B"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 28 then
        keyb=keyb.."N"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 29 then
        keyb=keyb.."M"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 30 then
        keyb=keyb.."."
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 31 then
        startupnow = 1.1
      elseif buttonNo == 32 then
        keyb=keyb.." "
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 33 then
        startupnow = 1.2
      elseif buttonNo == 34 then
    
      elseif buttonNo == 35 then
    
      end
    end
    
    if screen.getMouseState() == 1 then
            mousecolclk = "purple"
            else
            mousecolclk = "cyan"
            end
        
    if screen.getMouseState() == 1 and butselectclk1 == 1 then
            butcolclk1 = "purple"
            elseif screen.getMouseState() == 0 and butselectclk1 == 1 then
            butcolclk1 = "limegreen"
            butselectclk1 = 0 
    
    elseif screen.getMouseState() == 1 and butselectclk1 == 2 then
            butcolclk2 = "purple"
            elseif screen.getMouseState() == 0 and butselectclk1 == 2 then
            butcolclk2 = "limegreen"
            butselectclk2 = 0 
            end
        
        
      local page = [[
    <svg viewBox="0 0 1024 612">
    <g>
    <title>background</title>
    <rect x="-1" y="-1" width="1026" height="614"/>
    <g display="none">
    <rect width="100%" height="100%" fill="url(#gridpattern)" stroke-width="0"/>
    </g>
    </g>
    <g>
    <title>Layer 1</title>
    <rect x="7" y="5" width="1012" height="290" rx="20" fill="#007f7f" stroke="#0f0" stroke-width="5"/>
    <rect x="1" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="14.997276" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">Q</text>
    <rect x="80" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="90" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">W</text>
    <rect x="160" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="178" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">E</text>
    <rect x="240" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="255" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">R</text>
    <rect x="320" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="337" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">T</text>
    <rect x="400" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="417" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">Y</text>
    <rect x="480" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="496" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">U</text>
    <rect x="560" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="586" y="361.00001" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">I</text>
    <rect x="640" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="654" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">O</text>
    <rect x="720" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="740" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">P</text>
    <rect x="880" y="306" width="140" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="895" y="350" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="30" font-weight="bold" stroke-width="0" xml:space="preserve">CLEAR</text>
    <rect x="800" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="802" y="350" cursor="move" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="30" font-weight="bold" stroke-width="0" xml:space="preserve"></text>
    <rect x="41" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="59" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">A</text>
    <rect x="121" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="136" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">S</text>
    <rect x="201" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="218" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">D</text>
    <rect x="281" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="298" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">F</text>
    <rect x="361" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="377" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">G</text>
    <rect x="441" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="455" y="440.00001" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">H</text>
    <rect x="521" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="540" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">J</text>
    <rect x="601" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="619" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">K</text>
    <rect x="761" y="385" width="140" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="785" y="430" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="30" font-style="italic" font-weight="bold" stroke-width="0" xml:space="preserve">Enter</text>
    <rect x="681" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="700" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">L</text>
    <rect x="86" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="101" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">Z</text>
    <rect x="166" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="183" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">X</text>
    <rect x="246" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="263" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">C</text>
    <rect x="326" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="342" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">V</text>
    <rect x="406" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="420" y="521.00001" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">B</text>
    <rect x="486" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="500" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">N</text>
    <rect x="566" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="578" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">M</text>
    <rect x="646" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="656" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve"/>
    <rect x="306" y="545" width="300" height="55" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <rect x="726" y="466" width="140" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="750" y="510" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="30" font-weight="bold" stroke-width="0" xml:space="preserve">SHIFT</text>
    <rect x="650" y="545" width="140" height="55" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="690" y="585" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="28" font-weight="bold" stroke-width="0" xml:space="preserve">?123</text>
    <rect x="880" y="545" width="140" height="55" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="882" y="585" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="30" font-weight="bold" stroke-width="0" xml:space="preserve"></text>
    <text x="674" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">.</text>
    
    <text x="50" y="280" fill="#0000ff" font-family="Helvetica, Arial, sans-serif" font-size="25" font-style="italic" font-weight="bold" stroke-width="0" xml:space="preserve">]]..keyb..[[</text>
    </g>
    
    
    <text stroke="null" fill="]]..mousecolclk..[[" stroke-width="10" x="]]..(screen.getMouseX()*(1024)-35)..[[" y="]]..(screen.getMouseY()*(612)+40)..[[" id="svg_6" font-size="100" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold" font-style="italic">+</text>
    
        </svg>]] 
        local buttonNo = evaluateButtons()
        if PWMouseDown then
          PWMouseX = screen.getMouseX()
          PWMouseY = screen.getMouseY()
          if buttonNo ~= PWButtonSelected or PWMouseX < 0.05 or PWMouseX > 0.95 or PWMouseY < 0.05 or PWMouseY > 0.95 then
            if PWButtonSelected > 0 then
              onButtonUp(PWButtonSelected)
            end
            PWButtonSelected = 0
          end        
        end
    
    
    
        page = page .. [[</div></body></html>]]
        screen.setHTML(page)
     
    
    
    
    
    
    
    --------------------small letter keyboard
    
    
    
    
    elseif startupnow == 1.1 then
    
                   tablex.clear(PWButtons, button)
          for i = 1,1 do
       local button = {id = ("b"..1), enabled=true, td="<td>", top=49/100, bottom=60/100, left=1/100, right=6.5/100}
        table.insert(PWButtons, button)
    end
      for i = 2,2 do
       local button = {id = ("b"..2), enabled=true, td="<td>", top=49/100, bottom=60/100, left=8/100, right=14/100}
        table.insert(PWButtons, button)
    end
        for i = 3,3 do
        local button = {id = ("b"..3), enabled=true, td="<td>", top=49/100, bottom=60/100, left=15/100, right=22/100}
          table.insert(PWButtons, button)
    end
        for i = 4,4 do   
        local button = {id = ("b"..4), enabled=true, td="<td>", top=49/100, bottom=60/100, left=23/100, right=30/100}
          table.insert(PWButtons, button)
    end
        for i = 5,5 do   
        local button = {id = ("b"..5), enabled=true, td="<td>", top=49/100, bottom=60/100, left=31/100, right=38/100}
          table.insert(PWButtons, button)
    end
        for i = 6,6 do   
        local button = {id = ("b"..6), enabled=true, td="<td>", top=49/100, bottom=60/100, left=39/100, right=46/100}
          table.insert(PWButtons, button)
    end
        for i = 7,7 do   
        local button = {id = ("b"..7), enabled=true, td="<td>", top=49/100, bottom=60/100, left=47/100, right=53/100}
          table.insert(PWButtons, button)
    end
        for i = 8,8 do   
        local button = {id = ("b"..8), enabled=true, td="<td>", top=49/100, bottom=60/100, left=54/100, right=61/100}
          table.insert(PWButtons, button)
    end
        for i = 9,9 do   
        local button = {id = ("b"..9), enabled=true, td="<td>", top=49/100, bottom=60/100, left=62/100, right=69/100}
          table.insert(PWButtons, button)
    end
        for i = 10,10 do   
        local button = {id = ("b"..10), enabled=true, td="<td>", top=49/100, bottom=60/100, left=70/100, right=77/100}
          table.insert(PWButtons, button)
    end
        for i = 11,11 do   
        local button = {id = ("b"..11), enabled=true, td="<td>", top=49/100, bottom=60/100, left=78/100, right=85/100}
          table.insert(PWButtons, button)
    end
        for i = 12,12 do   
        local button = {id = ("b"..12), enabled=true, td="<td>", top=49/100, bottom=60/100, left=86/100, right=100/100}
          table.insert(PWButtons, button)
    end
    
    
    
        for i = 13,13 do   
        local button = {id = ("b"..13), enabled=true, td="<td>", top=62/100, bottom=73/100, left=4/100, right=10/100}
        table.insert(PWButtons, button)
    end
          for i = 14,14 do
       local button = {id = ("b"..14), enabled=true, td="<td>", top=62/100, bottom=73/100, left=11.5/100, right=18/100}
        table.insert(PWButtons, button)
    end
      for i = 15,15 do
       local button = {id = ("b"..15), enabled=true, td="<td>", top=62/100, bottom=73/100, left=19/100, right=26/100}
        table.insert(PWButtons, button)
    end
        for i = 16,16 do
        local button = {id = ("b"..16), enabled=true, td="<td>", top=62/100, bottom=73/100, left=27/100, right=34/100}
          table.insert(PWButtons, button)
    end
        for i = 17,17 do   
        local button = {id = ("b"..17), enabled=true, td="<td>", top=62/100, bottom=73/100, left=35/100, right=42/100}
          table.insert(PWButtons, button)
    end
        for i = 18,18 do   
        local button = {id = ("b"..18), enabled=true, td="<td>", top=62/100, bottom=73/100, left=43/100, right=50/100}
          table.insert(PWButtons, button)
    end
        for i = 19,19 do   
        local button = {id = ("b"..19), enabled=true, td="<td>", top=62/100, bottom=73/100, left=51/100, right=58/100}
          table.insert(PWButtons, button)
    end
        for i = 20,20 do   
        local button = {id = ("b"..20), enabled=true, td="<td>", top=62/100, bottom=73/100, left=59/100, right=65/100}
          table.insert(PWButtons, button)
    end
          for i = 21,21 do
       local button = {id = ("b"..21), enabled=true, td="<td>", top=62/100, bottom=73/100, left=66.5/100, right=73/100}
        table.insert(PWButtons, button)
    end
      for i = 22,22 do
       local button = {id = ("b"..22), enabled=true, td="<td>", top=62/100, bottom=73/100, left=74/100, right=89/100}
        table.insert(PWButtons, button)
    end
    
    
        for i = 23,23 do
        local button = {id = ("b"..23), enabled=true, td="<td>", top=75/100, bottom=87/100, left=8/100, right=15/100}
          table.insert(PWButtons, button)
    end
        for i = 24,24 do   
        local button = {id = ("b"..24), enabled=true, td="<td>", top=75/100, bottom=87/100, left=16/100, right=23/100}
          table.insert(PWButtons, button)
    end
        for i = 25,25 do   
        local button = {id = ("b"..25), enabled=true, td="<td>", top=75/100, bottom=87/100, left=24/100, right=31/100}
          table.insert(PWButtons, button)
    end
        for i = 26,26 do   
        local button = {id = ("b"..26), enabled=true, td="<td>", top=75/100, bottom=87/100, left=32/100, right=39/100}
          table.insert(PWButtons, button)
    end
        for i = 27,27 do   
        local button = {id = ("b"..27), enabled=true, td="<td>", top=75/100, bottom=87/100, left=40/100, right=46/100}
          table.insert(PWButtons, button)
    end
        for i = 28,28 do   
        local button = {id = ("b"..28), enabled=true, td="<td>", top=75/100, bottom=87/100, left=47/100, right=54/100}
          table.insert(PWButtons, button)
    end
        for i = 29,29 do   
        local button = {id = ("b"..29), enabled=true, td="<td>", top=75/100, bottom=87/100, left=55/100, right=62/100}
          table.insert(PWButtons, button)
    end
        for i = 30,30 do   
        local button = {id = ("b"..30), enabled=true, td="<td>", top=75/100, bottom=87/100, left=63/100, right=70/100}
          table.insert(PWButtons, button)
    end
        for i = 31,31 do   
        local button = {id = ("b"..31), enabled=true, td="<td>", top=75/100, bottom=87/100, left=71/100, right=85/100}
          table.insert(PWButtons, button)
    end
    
    
        for i = 32,32 do   
        local button = {id = ("b"..32), enabled=true, td="<td>", top=88/100, bottom=98/100, left=30/100, right=59/100}
          table.insert(PWButtons, button)
    end
        for i = 33,33 do   
        local button = {id = ("b"..33), enabled=true, td="<td>", top=88/100, bottom=98/100, left=63/100, right=77/100}
        table.insert(PWButtons, button)
    end
          for i = 34,34 do
       local button = {id = ("b"..34), enabled=true, td="<td>", top=88/100, bottom=98/100, left=85/100, right=100/100}
        table.insert(PWButtons, button)
    end
        for i = 35,35 do   
        local button = {id = ("b"..35), enabled=true, td="<td>", top=90/100, bottom=100/100, left=1/100, right=18/100}
        table.insert(PWButtons, button)
    end
    
    function evaluateButtons()
      local selected = 0
      
      if #PWButtons >= 1 then
    
             -- Set button styles
           for i, button in ipairs(PWButtons) do
                if button.left < PWMouseX and PWMouseX < button.right and button.top < PWMouseY and PWMouseY < button.bottom then
                    if PWMouseDown and PWButtonSelected == i then
                    end
                    selected = i
                end
                if not button.enabled then
                end
    
            end
      end
      return selected
    end
    
    function onButtonDown(buttonNo)
      local button = PWButtons[buttonNo]    
      if not button or not button.enabled then
    	return
      end
    end
    function onButtonUp(buttonNo)
      local button = PWButtons[buttonNo]    
      if not button or not button.enabled then
        return
      end
            
    
    function onClick(buttonNo)
      local button = PWButtons[buttonNo]    
      if not button or not button.enabled then
        return
      end
    end
      if buttonNo == 1 then
        keyb=keyb.."q"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 2 then
        keyb=keyb.."w"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 3 then
        keyb=keyb.."e"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 4 then
        keyb=keyb.."r"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 5 then
        keyb=keyb.."t"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 6 then
        keyb=keyb.."y"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 7 then
        keyb=keyb.."u"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 8 then
        keyb=keyb.."i"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 9 then
        keyb=keyb.."o"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 10 then
        keyb=keyb.."p"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 11 then
    
      elseif buttonNo == 12 then
        keyb = ""
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 13 then
        keyb=keyb.."a"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 14 then
        keyb=keyb.."s"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 15 then
        keyb=keyb.."d"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 16 then
        keyb=keyb.."f"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 17 then
        keyb=keyb.."g"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 18 then
        keyb=keyb.."h"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 19 then
        keyb=keyb.."j"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 20 then
        keyb=keyb.."k"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 21 then
        keyb=keyb.."l"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 22 then
        if keyb == password then
        keyb=""
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
        door.activate()
        keyb="Access Granted"
        unit.setTimer("exit",5)       
        elseif keyb ~= password then 
        keyb=""
        keyb="Access DENIED"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
        unit.setTimer("exit",1)
        door.deactivate()
        end
      elseif buttonNo == 23 then
        keyb=keyb.."z"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 24 then
        keyb=keyb.."x"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 25 then
        keyb=keyb.."c"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 26 then
        keyb=keyb.."v"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 27 then
        keyb=keyb.."b"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 28 then
        keyb=keyb.."n"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 29 then
        keyb=keyb.."m"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 30 then
        keyb=keyb.."."
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 31 then
        startupnow = 1
      elseif buttonNo == 32 then
        keyb=keyb.." "
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 33 then
        startupnow = 1.2
      elseif buttonNo == 34 then
    
      elseif buttonNo == 35 then
    
      end
    end
    
    
    if screen.getMouseState() == 1 then
            mousecolclk = "purple"
            else
            mousecolclk = "cyan"
            end
    
    if screen.getMouseState() == 1 and butselectclk1 == 1 then
            butcolclk1 = "purple"
            elseif screen.getMouseState() == 0 and butselectclk1 == 1 then
            butcolclk1 = "limegreen"
            butselectclk1 = 0 
    
    elseif screen.getMouseState() == 1 and butselectclk1 == 2 then
            butcolclk2 = "purple"
            elseif screen.getMouseState() == 0 and butselectclk1 == 2 then
            butcolclk2 = "limegreen"
            butselectclk2 = 0 
            end
        
        
      local page = [[
    <svg viewBox="0 0 1024 612">
    <g>
    <title>background</title>
    <rect x="-1" y="-1" width="1026" height="614"/>
    <g display="none">
    <rect width="100%" height="100%" fill="url(#gridpattern)" stroke-width="0"/>
    </g>
    </g>
    <g>
    <title>Layer 1</title>
    <rect x="7" y="5" width="1012" height="290" rx="20" fill="#007f7f" stroke="#0f0" stroke-width="5"/>
    
    <rect x="1" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="14.997276" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">q</text>
    <rect x="80" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="90" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">w</text>
    <rect x="160" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="178" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">e</text>
    <rect x="240" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="255" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">r</text>
    <rect x="320" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="337" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">t</text>
    <rect x="400" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="417" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">y</text>
    <rect x="480" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="496" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">u</text>
    <rect x="560" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="586" y="361.00001" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">i</text>
    <rect x="640" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="654" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">o</text>
    <rect x="720" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="740" y="360.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">p</text>
    <rect x="880" y="306" width="140" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="895" y="350" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="30" font-weight="bold" stroke-width="0" xml:space="preserve">CLEAR</text>
    <rect x="800" y="306" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="802" y="350" cursor="move" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="30" font-weight="bold" stroke-width="0" xml:space="preserve"></text>
    <rect x="41" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="59" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">a</text>
    <rect x="121" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="136" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">s</text>
    <rect x="201" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="218" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">d</text>
    <rect x="281" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="298" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">f</text>
    <rect x="361" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="377" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">g</text>
    <rect x="441" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="455" y="440.00001" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">h</text>
    <rect x="521" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="540" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">j</text>
    <rect x="601" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="619" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">k</text>
    <rect x="761" y="385" width="140" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="785" y="430" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="30" font-style="italic" font-weight="bold" stroke-width="0" xml:space="preserve">Enter</text>
    <rect x="681" y="385" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="700" y="439.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">l</text>
    <rect x="86" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="101" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">z</text>
    <rect x="166" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="183" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">x</text>
    <rect x="246" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="263" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">c</text>
    <rect x="326" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="342" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">v</text>
    <rect x="406" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="420" y="521.00001" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">b</text>
    <rect x="486" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="500" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">n</text>
    <rect x="566" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="578" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">m</text>
    <rect x="646" y="466" width="70" height="70" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    
    <rect x="306" y="545" width="300" height="55" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <rect x="726" y="466" width="140" height="70" rx="10" fill="#00bfbf" stroke="#00ff00" stroke-width="5"/>
    <text x="750" y="510" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="30" font-weight="bold" stroke-width="0" xml:space="preserve">SHIFT</text>
    <rect x="650" y="545" width="140" height="55" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="690" y="585" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="28" font-weight="bold" stroke-width="0" xml:space="preserve">?123</text>
    <rect x="880" y="545" width="140" height="55" rx="10" fill="#56ffff" stroke="#0f0" stroke-width="5"/>
    <text x="882" y="585" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="30" font-weight="bold" stroke-width="0" xml:space="preserve"></text>
    <text x="674" y="520.999996" fill="#bf0000" font-family="Helvetica, Arial, sans-serif" font-size="55" font-weight="bold" stroke-width="0" xml:space="preserve">.</text>
    
    <text x="50" y="280" fill="#0000ff" font-family="Helvetica, Arial, sans-serif" font-size="25" font-style="italic" font-weight="bold" stroke-width="0" xml:space="preserve">]]..keyb..[[</text>
    </g>
    
    
    <text stroke="null" fill="]]..mousecolclk..[[" stroke-width="10" x="]]..(screen.getMouseX()*(1024)-35)..[[" y="]]..(screen.getMouseY()*(612)+40)..[[" id="svg_6" font-size="100" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold" font-style="italic">+</text>
    
        </svg>]] 
        local buttonNo = evaluateButtons()
        if PWMouseDown then
          PWMouseX = screen.getMouseX()
          PWMouseY = screen.getMouseY()
          if buttonNo ~= PWButtonSelected or PWMouseX < 0.05 or PWMouseX > 0.95 or PWMouseY < 0.05 or PWMouseY > 0.95 then
            if PWButtonSelected > 0 then
              onButtonUp(PWButtonSelected)
            end
            PWButtonSelected = 0
          end        
        end
    
    
    
        page = page .. [[</div></body></html>]]
        screen.setHTML(page)
    
    
    
    
    elseif startupnow == 1.2 then    ----- emitter end
                   tablex.clear(PWButtons, button)
          for i = 1,1 do
       local button = {id = ("b"..1), enabled=true, td="<td>", top=49/100, bottom=60/100, left=1/100, right=6.5/100}
        table.insert(PWButtons, button)
    end
      for i = 2,2 do
       local button = {id = ("b"..2), enabled=true, td="<td>", top=49/100, bottom=60/100, left=8/100, right=14/100}
        table.insert(PWButtons, button)
    end
        for i = 3,3 do
        local button = {id = ("b"..3), enabled=true, td="<td>", top=49/100, bottom=60/100, left=15/100, right=22/100}
          table.insert(PWButtons, button)
    end
        for i = 4,4 do   
        local button = {id = ("b"..4), enabled=true, td="<td>", top=49/100, bottom=60/100, left=23/100, right=30/100}
          table.insert(PWButtons, button)
    end
        for i = 5,5 do   
        local button = {id = ("b"..5), enabled=true, td="<td>", top=49/100, bottom=60/100, left=31/100, right=38/100}
          table.insert(PWButtons, button)
    end
        for i = 6,6 do   
        local button = {id = ("b"..6), enabled=true, td="<td>", top=49/100, bottom=60/100, left=39/100, right=46/100}
          table.insert(PWButtons, button)
    end
        for i = 7,7 do   
        local button = {id = ("b"..7), enabled=true, td="<td>", top=49/100, bottom=60/100, left=47/100, right=53/100}
          table.insert(PWButtons, button)
    end
        for i = 8,8 do   
        local button = {id = ("b"..8), enabled=true, td="<td>", top=49/100, bottom=60/100, left=54/100, right=61/100}
          table.insert(PWButtons, button)
    end
        for i = 9,9 do   
        local button = {id = ("b"..9), enabled=true, td="<td>", top=49/100, bottom=60/100, left=62/100, right=69/100}
          table.insert(PWButtons, button)
    end
        for i = 10,10 do   
        local button = {id = ("b"..10), enabled=true, td="<td>", top=49/100, bottom=60/100, left=70/100, right=77/100}
          table.insert(PWButtons, button)
    end
        for i = 11,11 do   
        local button = {id = ("b"..11), enabled=true, td="<td>", top=49/100, bottom=60/100, left=78/100, right=85/100}
          table.insert(PWButtons, button)
    end
        for i = 12,12 do   
        local button = {id = ("b"..12), enabled=true, td="<td>", top=49/100, bottom=60/100, left=86/100, right=93/100}
          table.insert(PWButtons, button)
    end
    
    
    
        for i = 13,13 do   
        local button = {id = ("b"..13), enabled=true, td="<td>", top=62/100, bottom=73/100, left=4/100, right=10/100}
        table.insert(PWButtons, button)
    end
          for i = 14,14 do
       local button = {id = ("b"..14), enabled=true, td="<td>", top=62/100, bottom=73/100, left=11.5/100, right=18/100}
        table.insert(PWButtons, button)
    end
      for i = 15,15 do
       local button = {id = ("b"..15), enabled=true, td="<td>", top=62/100, bottom=73/100, left=19/100, right=26/100}
        table.insert(PWButtons, button)
    end
        for i = 16,16 do
        local button = {id = ("b"..16), enabled=true, td="<td>", top=62/100, bottom=73/100, left=27/100, right=34/100}
          table.insert(PWButtons, button)
    end
        for i = 17,17 do   
        local button = {id = ("b"..17), enabled=true, td="<td>", top=62/100, bottom=73/100, left=35/100, right=42/100}
          table.insert(PWButtons, button)
    end
        for i = 18,18 do   
        local button = {id = ("b"..18), enabled=true, td="<td>", top=62/100, bottom=73/100, left=43/100, right=50/100}
          table.insert(PWButtons, button)
    end
        for i = 19,19 do   
        local button = {id = ("b"..19), enabled=true, td="<td>", top=62/100, bottom=73/100, left=51/100, right=58/100}
          table.insert(PWButtons, button)
    end
        for i = 20,20 do   
        local button = {id = ("b"..20), enabled=true, td="<td>", top=62/100, bottom=73/100, left=59/100, right=65/100}
          table.insert(PWButtons, button)
    end
        for i = 21,21 do
       local button = {id = ("b"..21), enabled=true, td="<td>", top=62/100, bottom=73/100, left=66.5/100, right=73/100}
        table.insert(PWButtons, button)
    end
      for i = 22,22 do
       local button = {id = ("b"..22), enabled=true, td="<td>", top=62/100, bottom=73/100, left=74/100, right=82/100}
        table.insert(PWButtons, button)
    end
      for i = 23,23 do
       local button = {id = ("b"..23), enabled=true, td="<td>", top=62/100, bottom=73/100, left=82.5/100, right=90/100}
        table.insert(PWButtons, button)
    end
      for i = 24,24 do
       local button = {id = ("b"..24), enabled=true, td="<td>", top=62/100, bottom=73/100, left=90/100, right=97/100}
        table.insert(PWButtons, button)
    end
    
    
        for i = 25,25 do
        local button = {id = ("b"..23), enabled=true, td="<td>", top=75/100, bottom=87/100, left=8/100, right=15/100}
          table.insert(PWButtons, button)
    end
        for i = 26,26 do   
        local button = {id = ("b"..26), enabled=true, td="<td>", top=75/100, bottom=87/100, left=16/100, right=23/100}
          table.insert(PWButtons, button)
    end
        for i = 27,27 do   
        local button = {id = ("b"..27), enabled=true, td="<td>", top=75/100, bottom=87/100, left=24/100, right=31/100}
          table.insert(PWButtons, button)
    end
        for i = 28,28 do   
        local button = {id = ("b"..28), enabled=true, td="<td>", top=75/100, bottom=87/100, left=32/100, right=39/100}
          table.insert(PWButtons, button)
    end
        for i = 29,29 do   
        local button = {id = ("b"..29), enabled=true, td="<td>", top=75/100, bottom=87/100, left=40/100, right=46/100}
          table.insert(PWButtons, button)
    end
        for i = 30,30 do   
        local button = {id = ("b"..30), enabled=true, td="<td>", top=75/100, bottom=87/100, left=47/100, right=54/100}
          table.insert(PWButtons, button)
    end
        for i = 31,31 do   
        local button = {id = ("b"..31), enabled=true, td="<td>", top=75/100, bottom=87/100, left=55/100, right=62/100}
          table.insert(PWButtons, button)
    end
        for i = 32,32 do   
        local button = {id = ("b"..32), enabled=true, td="<td>", top=75/100, bottom=87/100, left=63/100, right=70/100}
          table.insert(PWButtons, button)
    end
        for i = 33,33 do   
        local button = {id = ("b"..33), enabled=true, td="<td>", top=75/100, bottom=87/100, left=71/100, right=78/100}
          table.insert(PWButtons, button)
    end
        for i = 34,34 do   
        local button = {id = ("b"..34), enabled=true, td="<td>", top=75/100, bottom=87/100, left=79/100, right=86/100}
          table.insert(PWButtons, button)
    end
        for i = 35,35 do   
        local button = {id = ("b"..35), enabled=true, td="<td>", top=75/100, bottom=87/100, left=86.5/100, right=94/100}
          table.insert(PWButtons, button)
    end
    
        for i = 36,36 do   
        local button = {id = ("b"..36), enabled=true, td="<td>", top=88/100, bottom=98/100, left=30/100, right=59/100}
          table.insert(PWButtons, button)
    end
        for i = 37,37 do   
        local button = {id = ("b"..37), enabled=true, td="<td>", top=88/100, bottom=98/100, left=63/100, right=77/100}
        table.insert(PWButtons, button)
    end
          for i = 38,38 do
       local button = {id = ("b"..38), enabled=true, td="<td>", top=88/100, bottom=98/100, left=85/100, right=100/100}
        table.insert(PWButtons, button)
    end
        for i = 39,39 do   
        local button = {id = ("b"..39), enabled=true, td="<td>", top=90/100, bottom=100/100, left=1/100, right=18/100}
        table.insert(PWButtons, button)
    end
    function evaluateButtons()
      local selected = 0
      
      if #PWButtons >= 1 then
    
    
             -- Set button styles
           for i, button in ipairs(PWButtons) do
                if button.left < PWMouseX and PWMouseX < button.right and button.top < PWMouseY and PWMouseY < button.bottom then
                    if PWMouseDown and PWButtonSelected == i then
                    end
                    selected = i
                end
                if not button.enabled then
                end
    
            end
      end
      return selected
    end
    
    
    function onButtonDown(buttonNo)
      local button = PWButtons[buttonNo]    
      if not button or not button.enabled then
    	return
      end
    end
    function onButtonUp(buttonNo)
      local button = PWButtons[buttonNo]    
      if not button or not button.enabled then
        return
      end
            
    
    function onClick(buttonNo)
      local button = PWButtons[buttonNo]    
      if not button or not button.enabled then
        return
      end
    end
      if buttonNo == 1 then
        keyb=keyb.."1"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 2 then
        keyb=keyb.."2"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 3 then
        keyb=keyb.."3"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 4 then
        keyb=keyb.."4"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 5 then
        keyb=keyb.."5"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
    		hint(1, 5)
      elseif buttonNo == 6 then
        keyb=keyb.."6"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 7 then
        keyb=keyb.."7"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 8 then
        keyb=keyb.."8"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 9 then
        keyb=keyb.."9"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 10 then
        keyb=keyb.."0"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 11 then
        keyb=keyb..","
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 12 then
        keyb=keyb.."?"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 13 then
        keyb=keyb.."!"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 14 then
        keyb=keyb.."@"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 15 then
        keyb=keyb.."#"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 16 then
        keyb=keyb.."$"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 17 then
        keyb=keyb.."%"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 18 then
        keyb=keyb.."^"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 19 then
        keyb=keyb.."&"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 20 then
        keyb=keyb.."*"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 21 then
        keyb=keyb.."~"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 22 then
        keyb=keyb..";"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 23 then
        keyb=keyb..":"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 24 then
        keyb=keyb.."'"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 25 then
        keyb=keyb.."("
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 26 then
        keyb=keyb..")"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 27 then
        keyb=keyb.."["
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 28 then
        keyb=keyb.."]"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 29 then
        keyb=keyb.."{"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 30 then
        keyb=keyb.."}"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 31 then
        keyb=keyb.."<"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 32 then
        keyb=keyb..">"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 33 then
        keyb=keyb.."+"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 34 then
        keyb="-"
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 35 then
        keyb=keyb.."="
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 36 then
        keyb=keyb.." "
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 37 then
        startupnow = 1
      elseif buttonNo == 38 then
        keyb=""
        screen.setText(30,10,7,keyb)
        consta=string.len(keyb)
      elseif buttonNo == 39 then
    
    
      end
    end
    
    if screen.getMouseState() == 1 then
            mousecolclk = "purple"
            else
            mousecolclk = "cyan"
            end
    
    if screen.getMouseState() == 1 and butselectclk1 == 1 then
            butcolclk1 = "purple"
            elseif screen.getMouseState() == 0 and butselectclk1 == 1 then
            butcolclk1 = "limegreen"
            butselectclk1 = 0 
    
    elseif screen.getMouseState() == 1 and butselectclk1 == 2 then
            butcolclk2 = "purple"
            elseif screen.getMouseState() == 0 and butselectclk1 == 2 then
            butcolclk2 = "limegreen"
            butselectclk2 = 0 
            end
        
        
      local page = [[
    <svg viewBox="0 0 1024 612">
    <g>
    <title>background</title>
    <rect x="-1" y="-1" width="1026" height="614"/>
    <g display="none">
    <rect width="100%" height="100%" fill="url(#gridpattern)" stroke-width="0"/>
    </g>
    </g>
    <g>
    <title>Layer 1</title>
    <rect x="7" y="5" width="1012" height="290" rx="20" fill="#007f7f" stroke="#0f0" stroke-width="5"/>
    <g fill="#ffff00" fill-opacity="null" font-family="Helvetica, Arial, sans-serif" font-size="20" font-weight="bold" stroke="#00ff00" stroke-width="0">
    
    <text x="50" y="280" fill="#0000ff" font-family="Helvetica, Arial, sans-serif" font-size="25" font-style="italic" font-weight="bold" stroke-width="0" xml:space="preserve">]]..keyb..[[</text>
    </g>
      <g id="svg_47">
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="1" y="305.999996" width="70" height="70" id="svg_1" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="20" y="360.999996" id="svg_3" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">1</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="80" y="305.999996" width="70" height="70" id="svg_8" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="100" y="360.999996" id="svg_9" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">2</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="160" y="305.999996" width="70" height="70" id="svg_11" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="180" y="360.999996" id="svg_12" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">3</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="240" y="305.999996" width="70" height="70" id="svg_14" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="260" y="360.999996" id="svg_15" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">4</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="320" y="305.999996" width="70" height="70" id="svg_17" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="340" y="360.999996" id="svg_18" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">5</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="400" y="305.999996" width="70" height="70" id="svg_20" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="420" y="360.999996" id="svg_21" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">6</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="480" y="305.999996" width="70" height="70" id="svg_23" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="500" y="360.999996" id="svg_24" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">7</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="560" y="306.00001" width="70" height="70" id="svg_26" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="580" y="361.00001" id="svg_27" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">8</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="640" y="305.999996" width="70" height="70" id="svg_29" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="660" y="360.999996" id="svg_30" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">9</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="720" y="305.999996" width="70" height="70" id="svg_32" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="740" y="360.999996" id="svg_33" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">0</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="800" y="305.999996" width="70" height="70" id="svg_35" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="825" y="350" id="svg_36" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">,</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="880" y="305.999996" width="70" height="70" id="svg_38" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="900" y="360" id="svg_39" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">?</text>
      </g>
      <g id="svg_108">
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="41" y="384.999996" width="70" height="70" id="svg_10" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="65" y="439.999996" id="svg_13" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">!</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="121" y="384.999996" width="70" height="70" id="svg_16" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="127" y="439.999996" id="svg_19" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">@</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="201" y="384.999996" width="70" height="70" id="svg_22" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="220" y="439.999996" id="svg_25" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">#</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="281" y="384.999996" width="70" height="70" id="svg_28" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="300" y="439.999996" id="svg_31" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">$</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="361" y="384.999996" width="70" height="70" id="svg_34" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="371" y="439.999996" id="svg_37" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">%</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="441" y="385.00001" width="70" height="70" id="svg_40" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="460" y="440.00001" id="svg_41" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">^</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="521" y="384.999996" width="70" height="70" id="svg_42" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="535" y="439.999996" id="svg_43" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">&amp;</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="601" y="384.999996" width="70" height="70" id="svg_44" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="625" y="439.999996" id="svg_45" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">*</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="681" y="384.999996" width="70" height="70" id="svg_48" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="700" y="439.999996" id="svg_49" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">~</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="761" y="384.999996" width="70" height="70" id="svg_118" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="785" y="439.999996" id="svg_119" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">;</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="841" y="384.999996" width="70" height="70" id="svg_121" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="865" y="439.999996" id="svg_122" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">:</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="921" y="384.999996" width="70" height="70" id="svg_127" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="950" y="439.999996" id="svg_128" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">'</text>
      </g>
      <g id="svg_112">
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="86" y="465.999996" width="70" height="70" id="svg_52" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="110" y="520.999996" id="svg_53" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">(</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="166" y="465.999996" width="70" height="70" id="svg_54" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="195" y="520.999996" id="svg_55" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">)</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="246" y="465.999996" width="70" height="70" id="svg_56" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="270" y="520.999996" id="svg_57" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">[</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="326" y="465.999996" width="70" height="70" id="svg_58" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="350" y="520.999996" id="svg_59" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">]</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="406" y="466.00001" width="70" height="70" id="svg_60" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="430" y="521.00001" id="svg_61" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">{</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="486" y="465.999996" width="70" height="70" id="svg_62" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="515" y="520.999996" id="svg_63" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">}</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="566" y="465.999996" width="70" height="70" id="svg_64" rx="10"/>
       <text style="cursor: move;" fill="#bf0000" stroke-width="0" x="585" y="520.999996" id="svg_65" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">&lt;</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="646" y="465.999996" width="70" height="70" id="svg_68" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="656" y="520.999996" id="svg_69" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold"/>
       <text style="cursor: move;" fill="#bf0000" stroke-width="0" x="665" y="520.999996" id="svg_78" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">&gt;</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="726" y="465.999996" width="70" height="70" id="svg_66" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="736" y="520.999996" id="svg_67" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold"/>
       <text fill="#bf0000" stroke-width="0" x="755" y="520.999996" id="svg_107" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">+</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="806" y="465.999996" width="70" height="70" id="svg_109" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="816" y="520.999996" id="svg_110" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold"/>
       <text fill="#bf0000" stroke-width="0" x="830" y="520.999996" id="svg_111" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">-</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="886" y="465.999996" width="70" height="70" id="svg_113" rx="10"/>
       <text fill="#bf0000" stroke-width="0" x="896" y="520.999996" id="svg_114" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold"/>
       <text fill="#bf0000" stroke-width="0" x="908" y="520.999996" id="svg_115" font-size="55" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">=</text>
       <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="306" y="545" width="300" height="55" id="svg_71" rx="10"/>
      <rect fill="#00bfbf" stroke="#ffff00" stroke-width="5" x="650" y="544.999996" width="140" height="55" id="svg_73" rx="10"/>
      <text style="cursor: move;" fill="#ffff00" stroke-width="0" x="690" y="585" id="svg_74" font-size="28" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">?123</text>
      <rect fill="#56ffff" stroke="#00ff00" stroke-width="5" x="880" y="545" width="140" height="55" id="svg_76" rx="10"/>
      <text fill="#bf0000" stroke-width="0" x="900" y="585" id="svg_77" font-size="30" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold">CLEAR</text>
            </g>
    
    <text stroke="null" fill="]]..mousecolclk..[[" stroke-width="10" x="]]..(screen.getMouseX()*(1024)-35)..[[" y="]]..(screen.getMouseY()*(612)+40)..[[" id="svg_6" font-size="100" font-family="Helvetica, Arial, sans-serif" text-anchor="start" xml:space="preserve" font-weight="bold" font-style="italic">+</text>
    
        </svg>]] 
        local buttonNo = evaluateButtons()
        if PWMouseDown then
          PWMouseX = screen.getMouseX()
          PWMouseY = screen.getMouseY()
          if buttonNo ~= PWButtonSelected or PWMouseX < 0.05 or PWMouseX > 0.95 or PWMouseY < 0.05 or PWMouseY > 0.95 then
            if PWButtonSelected > 0 then
              onButtonUp(PWButtonSelected)
            end
            PWButtonSelected = 0
          end        
        end
    
    
    
        page = page .. [[</div></body></html>]]
        screen.setHTML(page)
           
    end
    end

    Json Paste
     

    {"slots":{"0":{"name":"screen","type":{"events":[],"methods":[]}},"1":{"name":"door","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":"PWMouseX = x\nPWMouseY = y\nPWMouseDown = true\nPWAttention = 0\nPWDislikeButton = 0\nPWLikeButton = 0\nPWButtonSelected = evaluateButtons()\nonButtonDown(PWButtonSelected)","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"mouseDown(x,y)","slotKey":"0"},"key":"0"},{"code":"\nPWMouseX = x\nPWMouseY = y\nPWMouseDown = false\nlocal buttonNo = evaluateButtons()\nif PWButtonSelected > 0 and PWButtonSelected == buttonNo then\n    onButtonUp(buttonNo)\n    onClick(buttonNo)\nend\nPWButtonSelected = -buttonNo","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"mouseUp(x,y)","slotKey":"0"},"key":"1"},{"code":"keyb = \"Goodbye\"\nunit.exit()","filter":{"args":[{"value":"exit"}],"signature":"tick(timerId)","slotKey":"-1"},"key":"2"},{"code":"unit.hide()\n-------------------------system start----------------------------------------------------------\n-- Internal variables\nkeyb=\"\"\n-- set variables so that there is no error at the start\n\nbutcolclk1 = \"#00ff00\"\nbutcolclk2 = \"#00ff00\"\nmousecolclk = \"cyan\"\nconsta=0\nPWButtons = {}\nPWMouseX = 0\nPWMouseY = 0\nPWMouseDown = false\nPWButtonSelected = 0\nPWAttention = 0\nPWDislikeButton = 0\nPWLikeButton = 0\nPWHintButton = 0\nPWAttentionMessage = \"\"\nPWAttentionVisible = false\nstartupnow = 1\npassword = \"Pass\"--export:\n\n\n\n\nfunction updateScreen() \nif startupnow == 1 then    ----- engine stat end emitter start\n    tablex.clear(PWButtons, button)\n      for i = 1,1 do\n   local button = {id = (\"b\"..1), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=1/100, right=6.5/100}\n    table.insert(PWButtons, button)\nend\n  for i = 2,2 do\n   local button = {id = (\"b\"..2), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=8/100, right=14/100}\n    table.insert(PWButtons, button)\nend\n    for i = 3,3 do\n    local button = {id = (\"b\"..3), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=15/100, right=22/100}\n      table.insert(PWButtons, button)\nend\n    for i = 4,4 do   \n    local button = {id = (\"b\"..4), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=23/100, right=30/100}\n      table.insert(PWButtons, button)\nend\n    for i = 5,5 do   \n    local button = {id = (\"b\"..5), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=31/100, right=38/100}\n      table.insert(PWButtons, button)\nend\n    for i = 6,6 do   \n    local button = {id = (\"b\"..6), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=39/100, right=46/100}\n      table.insert(PWButtons, button)\nend\n    for i = 7,7 do   \n    local button = {id = (\"b\"..7), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=47/100, right=53/100}\n      table.insert(PWButtons, button)\nend\n    for i = 8,8 do   \n    local button = {id = (\"b\"..8), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=54/100, right=61/100}\n      table.insert(PWButtons, button)\nend\n    for i = 9,9 do   \n    local button = {id = (\"b\"..9), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=62/100, right=69/100}\n      table.insert(PWButtons, button)\nend\n    for i = 10,10 do   \n    local button = {id = (\"b\"..10), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=70/100, right=77/100}\n      table.insert(PWButtons, button)\nend\n    for i = 11,11 do   \n    local button = {id = (\"b\"..11), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=78/100, right=85/100}\n      table.insert(PWButtons, button)\nend\n    for i = 12,12 do   \n    local button = {id = (\"b\"..12), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=86/100, right=100/100}\n      table.insert(PWButtons, button)\nend\n\n\n\n    for i = 13,13 do   \n    local button = {id = (\"b\"..13), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=4/100, right=10/100}\n    table.insert(PWButtons, button)\nend\n      for i = 14,14 do\n   local button = {id = (\"b\"..14), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=11.5/100, right=18/100}\n    table.insert(PWButtons, button)\nend\n  for i = 15,15 do\n   local button = {id = (\"b\"..15), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=19/100, right=26/100}\n    table.insert(PWButtons, button)\nend\n    for i = 16,16 do\n    local button = {id = (\"b\"..16), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=27/100, right=34/100}\n      table.insert(PWButtons, button)\nend\n    for i = 17,17 do   \n    local button = {id = (\"b\"..17), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=35/100, right=42/100}\n      table.insert(PWButtons, button)\nend\n    for i = 18,18 do   \n    local button = {id = (\"b\"..18), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=43/100, right=50/100}\n      table.insert(PWButtons, button)\nend\n    for i = 19,19 do   \n    local button = {id = (\"b\"..19), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=51/100, right=58/100}\n      table.insert(PWButtons, button)\nend\n    for i = 20,20 do   \n    local button = {id = (\"b\"..20), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=59/100, right=65/100}\n      table.insert(PWButtons, button)\nend\n      for i = 21,21 do\n   local button = {id = (\"b\"..21), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=66.5/100, right=73/100}\n    table.insert(PWButtons, button)\nend\n  for i = 22,22 do\n   local button = {id = (\"b\"..22), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=74/100, right=89/100}\n    table.insert(PWButtons, button)\nend\n\n\n    for i = 23,23 do\n    local button = {id = (\"b\"..23), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=8/100, right=15/100}\n      table.insert(PWButtons, button)\nend\n    for i = 24,24 do   \n    local button = {id = (\"b\"..24), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=16/100, right=23/100}\n      table.insert(PWButtons, button)\nend\n    for i = 25,25 do   \n    local button = {id = (\"b\"..25), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=24/100, right=31/100}\n      table.insert(PWButtons, button)\nend\n    for i = 26,26 do   \n    local button = {id = (\"b\"..26), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=32/100, right=39/100}\n      table.insert(PWButtons, button)\nend\n    for i = 27,27 do   \n    local button = {id = (\"b\"..27), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=40/100, right=46/100}\n      table.insert(PWButtons, button)\nend\n    for i = 28,28 do   \n    local button = {id = (\"b\"..28), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=47/100, right=54/100}\n      table.insert(PWButtons, button)\nend\n    for i = 29,29 do   \n    local button = {id = (\"b\"..29), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=55/100, right=62/100}\n      table.insert(PWButtons, button)\nend\n    for i = 30,30 do   \n    local button = {id = (\"b\"..30), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=63/100, right=70/100}\n      table.insert(PWButtons, button)\nend\n    for i = 31,31 do   \n    local button = {id = (\"b\"..31), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=71/100, right=85/100}\n      table.insert(PWButtons, button)\nend\n\n\n    for i = 32,32 do   \n    local button = {id = (\"b\"..32), enabled=true, td=\"<td>\", top=88/100, bottom=98/100, left=30/100, right=59/100}\n      table.insert(PWButtons, button)\nend\n    for i = 33,33 do   \n    local button = {id = (\"b\"..33), enabled=true, td=\"<td>\", top=88/100, bottom=98/100, left=63/100, right=77/100}\n    table.insert(PWButtons, button)\nend\n      for i = 34,34 do\n   local button = {id = (\"b\"..34), enabled=true, td=\"<td>\", top=88/100, bottom=98/100, left=85/100, right=100/100}\n    table.insert(PWButtons, button)\nend\n    for i = 35,35 do   \n    local button = {id = (\"b\"..35), enabled=true, td=\"<td>\", top=90/100, bottom=100/100, left=1/100, right=18/100}\n    table.insert(PWButtons, button)\nend\nfunction evaluateButtons()\n  local selected = 0\n  \n  if #PWButtons >= 1 then\n\n         -- Set button styles\n       for i, button in ipairs(PWButtons) do\n            if button.left < PWMouseX and PWMouseX < button.right and button.top < PWMouseY and PWMouseY < button.bottom then\n                if PWMouseDown and PWButtonSelected == i then\n                end\n                selected = i\n            end\n            if not button.enabled then\n            end\n\n        end\n  end\n  return selected\nend\n\n\nfunction onButtonDown(buttonNo)\n  local button = PWButtons[buttonNo]    \n  if not button or not button.enabled then\n\treturn\n  end\nend\nfunction onButtonUp(buttonNo)\n  local button = PWButtons[buttonNo]    \n  if not button or not button.enabled then\n    return\n  end\n        \n\nfunction onClick(buttonNo)\n  local button = PWButtons[buttonNo]    \n  if not button or not button.enabled then\n    return\n  end\nend\n   if buttonNo == 1 then\n    keyb=keyb..\"Q\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 2 then\n    keyb=keyb..\"W\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 3 then\n    keyb=keyb..\"E\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 4 then\n    keyb=keyb..\"R\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 5 then\n    keyb=keyb..\"T\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 6 then\n    keyb=keyb..\"Y\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 7 then\n    keyb=keyb..\"U\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 8 then\n    keyb=keyb..\"I\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 9 then\n    keyb=keyb..\"O\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 10 then\n    keyb=keyb..\"P\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 11 then\n\n  elseif buttonNo == 12 then\n    keyb = \"\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 13 then\n    keyb=keyb..\"A\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 14 then\n    keyb=keyb..\"S\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 15 then\n    keyb=keyb..\"D\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 16 then\n    keyb=keyb..\"F\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 17 then\n    keyb=keyb..\"G\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 18 then\n    keyb=keyb..\"H\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 19 then\n    keyb=keyb..\"J\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 20 then\n    keyb=keyb..\"K\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 21 then\n    keyb=keyb..\"L\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 22 then   ----enterbutton\n    if keyb == password then\n    keyb=\"\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n    door.activate()\n    keyb=\"Access Granted\"\n    unit.setTimer(\"exit\",5)       \n    elseif keyb ~= password then \n    keyb=\"\"\n    keyb=\"Access DENIED\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n    unit.setTimer(\"exit\",1)\n    door.deactivate()\n    end\n    \n  elseif buttonNo == 23 then\n    keyb=keyb..\"Z\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 24 then\n    keyb=keyb..\"X\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 25 then\n    keyb=keyb..\"C\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 26 then\n    keyb=keyb..\"V\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 27 then\n    keyb=keyb..\"B\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 28 then\n    keyb=keyb..\"N\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 29 then\n    keyb=keyb..\"M\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 30 then\n    keyb=keyb..\".\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 31 then\n    startupnow = 1.1\n  elseif buttonNo == 32 then\n    keyb=keyb..\" \"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 33 then\n    startupnow = 1.2\n  elseif buttonNo == 34 then\n\n  elseif buttonNo == 35 then\n\n  end\nend\n\nif screen.getMouseState() == 1 then\n        mousecolclk = \"purple\"\n        else\n        mousecolclk = \"cyan\"\n        end\n    \nif screen.getMouseState() == 1 and butselectclk1 == 1 then\n        butcolclk1 = \"purple\"\n        elseif screen.getMouseState() == 0 and butselectclk1 == 1 then\n        butcolclk1 = \"limegreen\"\n        butselectclk1 = 0 \n\nelseif screen.getMouseState() == 1 and butselectclk1 == 2 then\n        butcolclk2 = \"purple\"\n        elseif screen.getMouseState() == 0 and butselectclk1 == 2 then\n        butcolclk2 = \"limegreen\"\n        butselectclk2 = 0 \n        end\n    \n    \n  local page = [[\n<svg viewBox=\"0 0 1024 612\">\n<g>\n<title>background</title>\n<rect x=\"-1\" y=\"-1\" width=\"1026\" height=\"614\"/>\n<g display=\"none\">\n<rect width=\"100%\" height=\"100%\" fill=\"url(#gridpattern)\" stroke-width=\"0\"/>\n</g>\n</g>\n<g>\n<title>Layer 1</title>\n<rect x=\"7\" y=\"5\" width=\"1012\" height=\"290\" rx=\"20\" fill=\"#007f7f\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<rect x=\"1\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"14.997276\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">Q</text>\n<rect x=\"80\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"90\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">W</text>\n<rect x=\"160\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"178\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">E</text>\n<rect x=\"240\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"255\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">R</text>\n<rect x=\"320\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"337\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">T</text>\n<rect x=\"400\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"417\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">Y</text>\n<rect x=\"480\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"496\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">U</text>\n<rect x=\"560\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"586\" y=\"361.00001\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">I</text>\n<rect x=\"640\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"654\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">O</text>\n<rect x=\"720\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"740\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">P</text>\n<rect x=\"880\" y=\"306\" width=\"140\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"895\" y=\"350\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">CLEAR</text>\n<rect x=\"800\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"802\" y=\"350\" cursor=\"move\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\"></text>\n<rect x=\"41\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"59\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">A</text>\n<rect x=\"121\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"136\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">S</text>\n<rect x=\"201\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"218\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">D</text>\n<rect x=\"281\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"298\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">F</text>\n<rect x=\"361\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"377\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">G</text>\n<rect x=\"441\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"455\" y=\"440.00001\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">H</text>\n<rect x=\"521\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"540\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">J</text>\n<rect x=\"601\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"619\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">K</text>\n<rect x=\"761\" y=\"385\" width=\"140\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"785\" y=\"430\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" font-style=\"italic\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">Enter</text>\n<rect x=\"681\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"700\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">L</text>\n<rect x=\"86\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"101\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">Z</text>\n<rect x=\"166\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"183\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">X</text>\n<rect x=\"246\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"263\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">C</text>\n<rect x=\"326\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"342\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">V</text>\n<rect x=\"406\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"420\" y=\"521.00001\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">B</text>\n<rect x=\"486\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"500\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">N</text>\n<rect x=\"566\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"578\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">M</text>\n<rect x=\"646\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"656\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\"/>\n<rect x=\"306\" y=\"545\" width=\"300\" height=\"55\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<rect x=\"726\" y=\"466\" width=\"140\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"750\" y=\"510\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">SHIFT</text>\n<rect x=\"650\" y=\"545\" width=\"140\" height=\"55\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"690\" y=\"585\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"28\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">?123</text>\n<rect x=\"880\" y=\"545\" width=\"140\" height=\"55\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"882\" y=\"585\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\"></text>\n<text x=\"674\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">.</text>\n\n<text x=\"50\" y=\"280\" fill=\"#0000ff\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"25\" font-style=\"italic\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">]]..keyb..[[</text>\n</g>\n\n\n<text stroke=\"null\" fill=\"]]..mousecolclk..[[\" stroke-width=\"10\" x=\"]]..(screen.getMouseX()*(1024)-35)..[[\" y=\"]]..(screen.getMouseY()*(612)+40)..[[\" id=\"svg_6\" font-size=\"100\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\" font-style=\"italic\">+</text>\n\n    </svg>]] \n    local buttonNo = evaluateButtons()\n    if PWMouseDown then\n      PWMouseX = screen.getMouseX()\n      PWMouseY = screen.getMouseY()\n      if buttonNo ~= PWButtonSelected or PWMouseX < 0.05 or PWMouseX > 0.95 or PWMouseY < 0.05 or PWMouseY > 0.95 then\n        if PWButtonSelected > 0 then\n          onButtonUp(PWButtonSelected)\n        end\n        PWButtonSelected = 0\n      end        \n    end\n\n\n\n    page = page .. [[</div></body></html>]]\n    screen.setHTML(page)\n \n\n\n\n\n\n\n--------------------small letter keyboard\n\n\n\n\nelseif startupnow == 1.1 then\n\n               tablex.clear(PWButtons, button)\n      for i = 1,1 do\n   local button = {id = (\"b\"..1), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=1/100, right=6.5/100}\n    table.insert(PWButtons, button)\nend\n  for i = 2,2 do\n   local button = {id = (\"b\"..2), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=8/100, right=14/100}\n    table.insert(PWButtons, button)\nend\n    for i = 3,3 do\n    local button = {id = (\"b\"..3), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=15/100, right=22/100}\n      table.insert(PWButtons, button)\nend\n    for i = 4,4 do   \n    local button = {id = (\"b\"..4), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=23/100, right=30/100}\n      table.insert(PWButtons, button)\nend\n    for i = 5,5 do   \n    local button = {id = (\"b\"..5), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=31/100, right=38/100}\n      table.insert(PWButtons, button)\nend\n    for i = 6,6 do   \n    local button = {id = (\"b\"..6), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=39/100, right=46/100}\n      table.insert(PWButtons, button)\nend\n    for i = 7,7 do   \n    local button = {id = (\"b\"..7), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=47/100, right=53/100}\n      table.insert(PWButtons, button)\nend\n    for i = 8,8 do   \n    local button = {id = (\"b\"..8), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=54/100, right=61/100}\n      table.insert(PWButtons, button)\nend\n    for i = 9,9 do   \n    local button = {id = (\"b\"..9), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=62/100, right=69/100}\n      table.insert(PWButtons, button)\nend\n    for i = 10,10 do   \n    local button = {id = (\"b\"..10), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=70/100, right=77/100}\n      table.insert(PWButtons, button)\nend\n    for i = 11,11 do   \n    local button = {id = (\"b\"..11), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=78/100, right=85/100}\n      table.insert(PWButtons, button)\nend\n    for i = 12,12 do   \n    local button = {id = (\"b\"..12), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=86/100, right=100/100}\n      table.insert(PWButtons, button)\nend\n\n\n\n    for i = 13,13 do   \n    local button = {id = (\"b\"..13), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=4/100, right=10/100}\n    table.insert(PWButtons, button)\nend\n      for i = 14,14 do\n   local button = {id = (\"b\"..14), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=11.5/100, right=18/100}\n    table.insert(PWButtons, button)\nend\n  for i = 15,15 do\n   local button = {id = (\"b\"..15), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=19/100, right=26/100}\n    table.insert(PWButtons, button)\nend\n    for i = 16,16 do\n    local button = {id = (\"b\"..16), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=27/100, right=34/100}\n      table.insert(PWButtons, button)\nend\n    for i = 17,17 do   \n    local button = {id = (\"b\"..17), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=35/100, right=42/100}\n      table.insert(PWButtons, button)\nend\n    for i = 18,18 do   \n    local button = {id = (\"b\"..18), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=43/100, right=50/100}\n      table.insert(PWButtons, button)\nend\n    for i = 19,19 do   \n    local button = {id = (\"b\"..19), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=51/100, right=58/100}\n      table.insert(PWButtons, button)\nend\n    for i = 20,20 do   \n    local button = {id = (\"b\"..20), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=59/100, right=65/100}\n      table.insert(PWButtons, button)\nend\n      for i = 21,21 do\n   local button = {id = (\"b\"..21), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=66.5/100, right=73/100}\n    table.insert(PWButtons, button)\nend\n  for i = 22,22 do\n   local button = {id = (\"b\"..22), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=74/100, right=89/100}\n    table.insert(PWButtons, button)\nend\n\n\n    for i = 23,23 do\n    local button = {id = (\"b\"..23), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=8/100, right=15/100}\n      table.insert(PWButtons, button)\nend\n    for i = 24,24 do   \n    local button = {id = (\"b\"..24), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=16/100, right=23/100}\n      table.insert(PWButtons, button)\nend\n    for i = 25,25 do   \n    local button = {id = (\"b\"..25), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=24/100, right=31/100}\n      table.insert(PWButtons, button)\nend\n    for i = 26,26 do   \n    local button = {id = (\"b\"..26), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=32/100, right=39/100}\n      table.insert(PWButtons, button)\nend\n    for i = 27,27 do   \n    local button = {id = (\"b\"..27), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=40/100, right=46/100}\n      table.insert(PWButtons, button)\nend\n    for i = 28,28 do   \n    local button = {id = (\"b\"..28), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=47/100, right=54/100}\n      table.insert(PWButtons, button)\nend\n    for i = 29,29 do   \n    local button = {id = (\"b\"..29), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=55/100, right=62/100}\n      table.insert(PWButtons, button)\nend\n    for i = 30,30 do   \n    local button = {id = (\"b\"..30), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=63/100, right=70/100}\n      table.insert(PWButtons, button)\nend\n    for i = 31,31 do   \n    local button = {id = (\"b\"..31), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=71/100, right=85/100}\n      table.insert(PWButtons, button)\nend\n\n\n    for i = 32,32 do   \n    local button = {id = (\"b\"..32), enabled=true, td=\"<td>\", top=88/100, bottom=98/100, left=30/100, right=59/100}\n      table.insert(PWButtons, button)\nend\n    for i = 33,33 do   \n    local button = {id = (\"b\"..33), enabled=true, td=\"<td>\", top=88/100, bottom=98/100, left=63/100, right=77/100}\n    table.insert(PWButtons, button)\nend\n      for i = 34,34 do\n   local button = {id = (\"b\"..34), enabled=true, td=\"<td>\", top=88/100, bottom=98/100, left=85/100, right=100/100}\n    table.insert(PWButtons, button)\nend\n    for i = 35,35 do   \n    local button = {id = (\"b\"..35), enabled=true, td=\"<td>\", top=90/100, bottom=100/100, left=1/100, right=18/100}\n    table.insert(PWButtons, button)\nend\n\nfunction evaluateButtons()\n  local selected = 0\n  \n  if #PWButtons >= 1 then\n\n         -- Set button styles\n       for i, button in ipairs(PWButtons) do\n            if button.left < PWMouseX and PWMouseX < button.right and button.top < PWMouseY and PWMouseY < button.bottom then\n                if PWMouseDown and PWButtonSelected == i then\n                end\n                selected = i\n            end\n            if not button.enabled then\n            end\n\n        end\n  end\n  return selected\nend\n\nfunction onButtonDown(buttonNo)\n  local button = PWButtons[buttonNo]    \n  if not button or not button.enabled then\n\treturn\n  end\nend\nfunction onButtonUp(buttonNo)\n  local button = PWButtons[buttonNo]    \n  if not button or not button.enabled then\n    return\n  end\n        \n\nfunction onClick(buttonNo)\n  local button = PWButtons[buttonNo]    \n  if not button or not button.enabled then\n    return\n  end\nend\n  if buttonNo == 1 then\n    keyb=keyb..\"q\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 2 then\n    keyb=keyb..\"w\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 3 then\n    keyb=keyb..\"e\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 4 then\n    keyb=keyb..\"r\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 5 then\n    keyb=keyb..\"t\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 6 then\n    keyb=keyb..\"y\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 7 then\n    keyb=keyb..\"u\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 8 then\n    keyb=keyb..\"i\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 9 then\n    keyb=keyb..\"o\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 10 then\n    keyb=keyb..\"p\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 11 then\n\n  elseif buttonNo == 12 then\n    keyb = \"\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 13 then\n    keyb=keyb..\"a\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 14 then\n    keyb=keyb..\"s\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 15 then\n    keyb=keyb..\"d\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 16 then\n    keyb=keyb..\"f\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 17 then\n    keyb=keyb..\"g\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 18 then\n    keyb=keyb..\"h\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 19 then\n    keyb=keyb..\"j\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 20 then\n    keyb=keyb..\"k\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 21 then\n    keyb=keyb..\"l\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 22 then\n    if keyb == password then\n    keyb=\"\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n    door.activate()\n    keyb=\"Access Granted\"\n    unit.setTimer(\"exit\",5)       \n    elseif keyb ~= password then \n    keyb=\"\"\n    keyb=\"Access DENIED\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n    unit.setTimer(\"exit\",1)\n    door.deactivate()\n    end\n  elseif buttonNo == 23 then\n    keyb=keyb..\"z\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 24 then\n    keyb=keyb..\"x\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 25 then\n    keyb=keyb..\"c\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 26 then\n    keyb=keyb..\"v\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 27 then\n    keyb=keyb..\"b\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 28 then\n    keyb=keyb..\"n\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 29 then\n    keyb=keyb..\"m\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 30 then\n    keyb=keyb..\".\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 31 then\n    startupnow = 1\n  elseif buttonNo == 32 then\n    keyb=keyb..\" \"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 33 then\n    startupnow = 1.2\n  elseif buttonNo == 34 then\n\n  elseif buttonNo == 35 then\n\n  end\nend\n\n\nif screen.getMouseState() == 1 then\n        mousecolclk = \"purple\"\n        else\n        mousecolclk = \"cyan\"\n        end\n\nif screen.getMouseState() == 1 and butselectclk1 == 1 then\n        butcolclk1 = \"purple\"\n        elseif screen.getMouseState() == 0 and butselectclk1 == 1 then\n        butcolclk1 = \"limegreen\"\n        butselectclk1 = 0 \n\nelseif screen.getMouseState() == 1 and butselectclk1 == 2 then\n        butcolclk2 = \"purple\"\n        elseif screen.getMouseState() == 0 and butselectclk1 == 2 then\n        butcolclk2 = \"limegreen\"\n        butselectclk2 = 0 \n        end\n    \n    \n  local page = [[\n<svg viewBox=\"0 0 1024 612\">\n<g>\n<title>background</title>\n<rect x=\"-1\" y=\"-1\" width=\"1026\" height=\"614\"/>\n<g display=\"none\">\n<rect width=\"100%\" height=\"100%\" fill=\"url(#gridpattern)\" stroke-width=\"0\"/>\n</g>\n</g>\n<g>\n<title>Layer 1</title>\n<rect x=\"7\" y=\"5\" width=\"1012\" height=\"290\" rx=\"20\" fill=\"#007f7f\" stroke=\"#0f0\" stroke-width=\"5\"/>\n\n<rect x=\"1\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"14.997276\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">q</text>\n<rect x=\"80\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"90\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">w</text>\n<rect x=\"160\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"178\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">e</text>\n<rect x=\"240\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"255\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">r</text>\n<rect x=\"320\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"337\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">t</text>\n<rect x=\"400\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"417\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">y</text>\n<rect x=\"480\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"496\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">u</text>\n<rect x=\"560\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"586\" y=\"361.00001\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">i</text>\n<rect x=\"640\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"654\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">o</text>\n<rect x=\"720\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"740\" y=\"360.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">p</text>\n<rect x=\"880\" y=\"306\" width=\"140\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"895\" y=\"350\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">CLEAR</text>\n<rect x=\"800\" y=\"306\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"802\" y=\"350\" cursor=\"move\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\"></text>\n<rect x=\"41\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"59\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">a</text>\n<rect x=\"121\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"136\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">s</text>\n<rect x=\"201\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"218\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">d</text>\n<rect x=\"281\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"298\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">f</text>\n<rect x=\"361\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"377\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">g</text>\n<rect x=\"441\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"455\" y=\"440.00001\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">h</text>\n<rect x=\"521\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"540\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">j</text>\n<rect x=\"601\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"619\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">k</text>\n<rect x=\"761\" y=\"385\" width=\"140\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"785\" y=\"430\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" font-style=\"italic\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">Enter</text>\n<rect x=\"681\" y=\"385\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"700\" y=\"439.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">l</text>\n<rect x=\"86\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"101\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">z</text>\n<rect x=\"166\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"183\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">x</text>\n<rect x=\"246\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"263\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">c</text>\n<rect x=\"326\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"342\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">v</text>\n<rect x=\"406\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"420\" y=\"521.00001\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">b</text>\n<rect x=\"486\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"500\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">n</text>\n<rect x=\"566\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"578\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">m</text>\n<rect x=\"646\" y=\"466\" width=\"70\" height=\"70\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n\n<rect x=\"306\" y=\"545\" width=\"300\" height=\"55\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<rect x=\"726\" y=\"466\" width=\"140\" height=\"70\" rx=\"10\" fill=\"#00bfbf\" stroke=\"#00ff00\" stroke-width=\"5\"/>\n<text x=\"750\" y=\"510\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">SHIFT</text>\n<rect x=\"650\" y=\"545\" width=\"140\" height=\"55\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"690\" y=\"585\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"28\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">?123</text>\n<rect x=\"880\" y=\"545\" width=\"140\" height=\"55\" rx=\"10\" fill=\"#56ffff\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<text x=\"882\" y=\"585\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\"></text>\n<text x=\"674\" y=\"520.999996\" fill=\"#bf0000\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"55\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">.</text>\n\n<text x=\"50\" y=\"280\" fill=\"#0000ff\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"25\" font-style=\"italic\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">]]..keyb..[[</text>\n</g>\n\n\n<text stroke=\"null\" fill=\"]]..mousecolclk..[[\" stroke-width=\"10\" x=\"]]..(screen.getMouseX()*(1024)-35)..[[\" y=\"]]..(screen.getMouseY()*(612)+40)..[[\" id=\"svg_6\" font-size=\"100\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\" font-style=\"italic\">+</text>\n\n    </svg>]] \n    local buttonNo = evaluateButtons()\n    if PWMouseDown then\n      PWMouseX = screen.getMouseX()\n      PWMouseY = screen.getMouseY()\n      if buttonNo ~= PWButtonSelected or PWMouseX < 0.05 or PWMouseX > 0.95 or PWMouseY < 0.05 or PWMouseY > 0.95 then\n        if PWButtonSelected > 0 then\n          onButtonUp(PWButtonSelected)\n        end\n        PWButtonSelected = 0\n      end        \n    end\n\n\n\n    page = page .. [[</div></body></html>]]\n    screen.setHTML(page)\n\n\n\n\nelseif startupnow == 1.2 then    ----- emitter end\n               tablex.clear(PWButtons, button)\n      for i = 1,1 do\n   local button = {id = (\"b\"..1), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=1/100, right=6.5/100}\n    table.insert(PWButtons, button)\nend\n  for i = 2,2 do\n   local button = {id = (\"b\"..2), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=8/100, right=14/100}\n    table.insert(PWButtons, button)\nend\n    for i = 3,3 do\n    local button = {id = (\"b\"..3), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=15/100, right=22/100}\n      table.insert(PWButtons, button)\nend\n    for i = 4,4 do   \n    local button = {id = (\"b\"..4), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=23/100, right=30/100}\n      table.insert(PWButtons, button)\nend\n    for i = 5,5 do   \n    local button = {id = (\"b\"..5), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=31/100, right=38/100}\n      table.insert(PWButtons, button)\nend\n    for i = 6,6 do   \n    local button = {id = (\"b\"..6), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=39/100, right=46/100}\n      table.insert(PWButtons, button)\nend\n    for i = 7,7 do   \n    local button = {id = (\"b\"..7), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=47/100, right=53/100}\n      table.insert(PWButtons, button)\nend\n    for i = 8,8 do   \n    local button = {id = (\"b\"..8), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=54/100, right=61/100}\n      table.insert(PWButtons, button)\nend\n    for i = 9,9 do   \n    local button = {id = (\"b\"..9), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=62/100, right=69/100}\n      table.insert(PWButtons, button)\nend\n    for i = 10,10 do   \n    local button = {id = (\"b\"..10), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=70/100, right=77/100}\n      table.insert(PWButtons, button)\nend\n    for i = 11,11 do   \n    local button = {id = (\"b\"..11), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=78/100, right=85/100}\n      table.insert(PWButtons, button)\nend\n    for i = 12,12 do   \n    local button = {id = (\"b\"..12), enabled=true, td=\"<td>\", top=49/100, bottom=60/100, left=86/100, right=93/100}\n      table.insert(PWButtons, button)\nend\n\n\n\n    for i = 13,13 do   \n    local button = {id = (\"b\"..13), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=4/100, right=10/100}\n    table.insert(PWButtons, button)\nend\n      for i = 14,14 do\n   local button = {id = (\"b\"..14), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=11.5/100, right=18/100}\n    table.insert(PWButtons, button)\nend\n  for i = 15,15 do\n   local button = {id = (\"b\"..15), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=19/100, right=26/100}\n    table.insert(PWButtons, button)\nend\n    for i = 16,16 do\n    local button = {id = (\"b\"..16), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=27/100, right=34/100}\n      table.insert(PWButtons, button)\nend\n    for i = 17,17 do   \n    local button = {id = (\"b\"..17), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=35/100, right=42/100}\n      table.insert(PWButtons, button)\nend\n    for i = 18,18 do   \n    local button = {id = (\"b\"..18), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=43/100, right=50/100}\n      table.insert(PWButtons, button)\nend\n    for i = 19,19 do   \n    local button = {id = (\"b\"..19), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=51/100, right=58/100}\n      table.insert(PWButtons, button)\nend\n    for i = 20,20 do   \n    local button = {id = (\"b\"..20), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=59/100, right=65/100}\n      table.insert(PWButtons, button)\nend\n    for i = 21,21 do\n   local button = {id = (\"b\"..21), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=66.5/100, right=73/100}\n    table.insert(PWButtons, button)\nend\n  for i = 22,22 do\n   local button = {id = (\"b\"..22), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=74/100, right=82/100}\n    table.insert(PWButtons, button)\nend\n  for i = 23,23 do\n   local button = {id = (\"b\"..23), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=82.5/100, right=90/100}\n    table.insert(PWButtons, button)\nend\n  for i = 24,24 do\n   local button = {id = (\"b\"..24), enabled=true, td=\"<td>\", top=62/100, bottom=73/100, left=90/100, right=97/100}\n    table.insert(PWButtons, button)\nend\n\n\n    for i = 25,25 do\n    local button = {id = (\"b\"..23), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=8/100, right=15/100}\n      table.insert(PWButtons, button)\nend\n    for i = 26,26 do   \n    local button = {id = (\"b\"..26), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=16/100, right=23/100}\n      table.insert(PWButtons, button)\nend\n    for i = 27,27 do   \n    local button = {id = (\"b\"..27), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=24/100, right=31/100}\n      table.insert(PWButtons, button)\nend\n    for i = 28,28 do   \n    local button = {id = (\"b\"..28), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=32/100, right=39/100}\n      table.insert(PWButtons, button)\nend\n    for i = 29,29 do   \n    local button = {id = (\"b\"..29), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=40/100, right=46/100}\n      table.insert(PWButtons, button)\nend\n    for i = 30,30 do   \n    local button = {id = (\"b\"..30), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=47/100, right=54/100}\n      table.insert(PWButtons, button)\nend\n    for i = 31,31 do   \n    local button = {id = (\"b\"..31), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=55/100, right=62/100}\n      table.insert(PWButtons, button)\nend\n    for i = 32,32 do   \n    local button = {id = (\"b\"..32), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=63/100, right=70/100}\n      table.insert(PWButtons, button)\nend\n    for i = 33,33 do   \n    local button = {id = (\"b\"..33), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=71/100, right=78/100}\n      table.insert(PWButtons, button)\nend\n    for i = 34,34 do   \n    local button = {id = (\"b\"..34), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=79/100, right=86/100}\n      table.insert(PWButtons, button)\nend\n    for i = 35,35 do   \n    local button = {id = (\"b\"..35), enabled=true, td=\"<td>\", top=75/100, bottom=87/100, left=86.5/100, right=94/100}\n      table.insert(PWButtons, button)\nend\n\n    for i = 36,36 do   \n    local button = {id = (\"b\"..36), enabled=true, td=\"<td>\", top=88/100, bottom=98/100, left=30/100, right=59/100}\n      table.insert(PWButtons, button)\nend\n    for i = 37,37 do   \n    local button = {id = (\"b\"..37), enabled=true, td=\"<td>\", top=88/100, bottom=98/100, left=63/100, right=77/100}\n    table.insert(PWButtons, button)\nend\n      for i = 38,38 do\n   local button = {id = (\"b\"..38), enabled=true, td=\"<td>\", top=88/100, bottom=98/100, left=85/100, right=100/100}\n    table.insert(PWButtons, button)\nend\n    for i = 39,39 do   \n    local button = {id = (\"b\"..39), enabled=true, td=\"<td>\", top=90/100, bottom=100/100, left=1/100, right=18/100}\n    table.insert(PWButtons, button)\nend\nfunction evaluateButtons()\n  local selected = 0\n  \n  if #PWButtons >= 1 then\n\n\n         -- Set button styles\n       for i, button in ipairs(PWButtons) do\n            if button.left < PWMouseX and PWMouseX < button.right and button.top < PWMouseY and PWMouseY < button.bottom then\n                if PWMouseDown and PWButtonSelected == i then\n                end\n                selected = i\n            end\n            if not button.enabled then\n            end\n\n        end\n  end\n  return selected\nend\n\n\nfunction onButtonDown(buttonNo)\n  local button = PWButtons[buttonNo]    \n  if not button or not button.enabled then\n\treturn\n  end\nend\nfunction onButtonUp(buttonNo)\n  local button = PWButtons[buttonNo]    \n  if not button or not button.enabled then\n    return\n  end\n        \n\nfunction onClick(buttonNo)\n  local button = PWButtons[buttonNo]    \n  if not button or not button.enabled then\n    return\n  end\nend\n  if buttonNo == 1 then\n    keyb=keyb..\"1\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 2 then\n    keyb=keyb..\"2\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 3 then\n    keyb=keyb..\"3\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 4 then\n    keyb=keyb..\"4\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 5 then\n    keyb=keyb..\"5\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n\t\thint(1, 5)\n  elseif buttonNo == 6 then\n    keyb=keyb..\"6\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 7 then\n    keyb=keyb..\"7\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 8 then\n    keyb=keyb..\"8\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 9 then\n    keyb=keyb..\"9\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 10 then\n    keyb=keyb..\"0\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 11 then\n    keyb=keyb..\",\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 12 then\n    keyb=keyb..\"?\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 13 then\n    keyb=keyb..\"!\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 14 then\n    keyb=keyb..\"@\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 15 then\n    keyb=keyb..\"#\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 16 then\n    keyb=keyb..\"$\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 17 then\n    keyb=keyb..\"%\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 18 then\n    keyb=keyb..\"^\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 19 then\n    keyb=keyb..\"&\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 20 then\n    keyb=keyb..\"*\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 21 then\n    keyb=keyb..\"~\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 22 then\n    keyb=keyb..\";\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 23 then\n    keyb=keyb..\":\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 24 then\n    keyb=keyb..\"'\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 25 then\n    keyb=keyb..\"(\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 26 then\n    keyb=keyb..\")\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 27 then\n    keyb=keyb..\"[\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 28 then\n    keyb=keyb..\"]\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 29 then\n    keyb=keyb..\"{\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 30 then\n    keyb=keyb..\"}\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 31 then\n    keyb=keyb..\"<\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 32 then\n    keyb=keyb..\">\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 33 then\n    keyb=keyb..\"+\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 34 then\n    keyb=\"-\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 35 then\n    keyb=keyb..\"=\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 36 then\n    keyb=keyb..\" \"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 37 then\n    startupnow = 1\n  elseif buttonNo == 38 then\n    keyb=\"\"\n    screen.setText(30,10,7,keyb)\n    consta=string.len(keyb)\n  elseif buttonNo == 39 then\n\n\n  end\nend\n\nif screen.getMouseState() == 1 then\n        mousecolclk = \"purple\"\n        else\n        mousecolclk = \"cyan\"\n        end\n\nif screen.getMouseState() == 1 and butselectclk1 == 1 then\n        butcolclk1 = \"purple\"\n        elseif screen.getMouseState() == 0 and butselectclk1 == 1 then\n        butcolclk1 = \"limegreen\"\n        butselectclk1 = 0 \n\nelseif screen.getMouseState() == 1 and butselectclk1 == 2 then\n        butcolclk2 = \"purple\"\n        elseif screen.getMouseState() == 0 and butselectclk1 == 2 then\n        butcolclk2 = \"limegreen\"\n        butselectclk2 = 0 \n        end\n    \n    \n  local page = [[\n<svg viewBox=\"0 0 1024 612\">\n<g>\n<title>background</title>\n<rect x=\"-1\" y=\"-1\" width=\"1026\" height=\"614\"/>\n<g display=\"none\">\n<rect width=\"100%\" height=\"100%\" fill=\"url(#gridpattern)\" stroke-width=\"0\"/>\n</g>\n</g>\n<g>\n<title>Layer 1</title>\n<rect x=\"7\" y=\"5\" width=\"1012\" height=\"290\" rx=\"20\" fill=\"#007f7f\" stroke=\"#0f0\" stroke-width=\"5\"/>\n<g fill=\"#ffff00\" fill-opacity=\"null\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" font-weight=\"bold\" stroke=\"#00ff00\" stroke-width=\"0\">\n\n<text x=\"50\" y=\"280\" fill=\"#0000ff\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"25\" font-style=\"italic\" font-weight=\"bold\" stroke-width=\"0\" xml:space=\"preserve\">]]..keyb..[[</text>\n</g>\n  <g id=\"svg_47\">\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"1\" y=\"305.999996\" width=\"70\" height=\"70\" id=\"svg_1\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"20\" y=\"360.999996\" id=\"svg_3\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">1</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"80\" y=\"305.999996\" width=\"70\" height=\"70\" id=\"svg_8\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"100\" y=\"360.999996\" id=\"svg_9\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">2</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"160\" y=\"305.999996\" width=\"70\" height=\"70\" id=\"svg_11\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"180\" y=\"360.999996\" id=\"svg_12\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">3</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"240\" y=\"305.999996\" width=\"70\" height=\"70\" id=\"svg_14\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"260\" y=\"360.999996\" id=\"svg_15\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">4</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"320\" y=\"305.999996\" width=\"70\" height=\"70\" id=\"svg_17\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"340\" y=\"360.999996\" id=\"svg_18\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">5</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"400\" y=\"305.999996\" width=\"70\" height=\"70\" id=\"svg_20\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"420\" y=\"360.999996\" id=\"svg_21\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">6</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"480\" y=\"305.999996\" width=\"70\" height=\"70\" id=\"svg_23\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"500\" y=\"360.999996\" id=\"svg_24\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">7</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"560\" y=\"306.00001\" width=\"70\" height=\"70\" id=\"svg_26\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"580\" y=\"361.00001\" id=\"svg_27\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">8</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"640\" y=\"305.999996\" width=\"70\" height=\"70\" id=\"svg_29\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"660\" y=\"360.999996\" id=\"svg_30\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">9</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"720\" y=\"305.999996\" width=\"70\" height=\"70\" id=\"svg_32\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"740\" y=\"360.999996\" id=\"svg_33\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">0</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"800\" y=\"305.999996\" width=\"70\" height=\"70\" id=\"svg_35\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"825\" y=\"350\" id=\"svg_36\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">,</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"880\" y=\"305.999996\" width=\"70\" height=\"70\" id=\"svg_38\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"900\" y=\"360\" id=\"svg_39\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">?</text>\n  </g>\n  <g id=\"svg_108\">\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"41\" y=\"384.999996\" width=\"70\" height=\"70\" id=\"svg_10\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"65\" y=\"439.999996\" id=\"svg_13\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">!</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"121\" y=\"384.999996\" width=\"70\" height=\"70\" id=\"svg_16\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"127\" y=\"439.999996\" id=\"svg_19\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">@</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"201\" y=\"384.999996\" width=\"70\" height=\"70\" id=\"svg_22\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"220\" y=\"439.999996\" id=\"svg_25\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">#</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"281\" y=\"384.999996\" width=\"70\" height=\"70\" id=\"svg_28\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"300\" y=\"439.999996\" id=\"svg_31\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">$</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"361\" y=\"384.999996\" width=\"70\" height=\"70\" id=\"svg_34\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"371\" y=\"439.999996\" id=\"svg_37\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">%</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"441\" y=\"385.00001\" width=\"70\" height=\"70\" id=\"svg_40\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"460\" y=\"440.00001\" id=\"svg_41\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">^</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"521\" y=\"384.999996\" width=\"70\" height=\"70\" id=\"svg_42\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"535\" y=\"439.999996\" id=\"svg_43\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">&amp;</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"601\" y=\"384.999996\" width=\"70\" height=\"70\" id=\"svg_44\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"625\" y=\"439.999996\" id=\"svg_45\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">*</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"681\" y=\"384.999996\" width=\"70\" height=\"70\" id=\"svg_48\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"700\" y=\"439.999996\" id=\"svg_49\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">~</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"761\" y=\"384.999996\" width=\"70\" height=\"70\" id=\"svg_118\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"785\" y=\"439.999996\" id=\"svg_119\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">;</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"841\" y=\"384.999996\" width=\"70\" height=\"70\" id=\"svg_121\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"865\" y=\"439.999996\" id=\"svg_122\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">:</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"921\" y=\"384.999996\" width=\"70\" height=\"70\" id=\"svg_127\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"950\" y=\"439.999996\" id=\"svg_128\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">'</text>\n  </g>\n  <g id=\"svg_112\">\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"86\" y=\"465.999996\" width=\"70\" height=\"70\" id=\"svg_52\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"110\" y=\"520.999996\" id=\"svg_53\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">(</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"166\" y=\"465.999996\" width=\"70\" height=\"70\" id=\"svg_54\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"195\" y=\"520.999996\" id=\"svg_55\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">)</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"246\" y=\"465.999996\" width=\"70\" height=\"70\" id=\"svg_56\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"270\" y=\"520.999996\" id=\"svg_57\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">[</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"326\" y=\"465.999996\" width=\"70\" height=\"70\" id=\"svg_58\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"350\" y=\"520.999996\" id=\"svg_59\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">]</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"406\" y=\"466.00001\" width=\"70\" height=\"70\" id=\"svg_60\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"430\" y=\"521.00001\" id=\"svg_61\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">{</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"486\" y=\"465.999996\" width=\"70\" height=\"70\" id=\"svg_62\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"515\" y=\"520.999996\" id=\"svg_63\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">}</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"566\" y=\"465.999996\" width=\"70\" height=\"70\" id=\"svg_64\" rx=\"10\"/>\n   <text style=\"cursor: move;\" fill=\"#bf0000\" stroke-width=\"0\" x=\"585\" y=\"520.999996\" id=\"svg_65\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">&lt;</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"646\" y=\"465.999996\" width=\"70\" height=\"70\" id=\"svg_68\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"656\" y=\"520.999996\" id=\"svg_69\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\"/>\n   <text style=\"cursor: move;\" fill=\"#bf0000\" stroke-width=\"0\" x=\"665\" y=\"520.999996\" id=\"svg_78\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">&gt;</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"726\" y=\"465.999996\" width=\"70\" height=\"70\" id=\"svg_66\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"736\" y=\"520.999996\" id=\"svg_67\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"755\" y=\"520.999996\" id=\"svg_107\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">+</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"806\" y=\"465.999996\" width=\"70\" height=\"70\" id=\"svg_109\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"816\" y=\"520.999996\" id=\"svg_110\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"830\" y=\"520.999996\" id=\"svg_111\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">-</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"886\" y=\"465.999996\" width=\"70\" height=\"70\" id=\"svg_113\" rx=\"10\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"896\" y=\"520.999996\" id=\"svg_114\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\"/>\n   <text fill=\"#bf0000\" stroke-width=\"0\" x=\"908\" y=\"520.999996\" id=\"svg_115\" font-size=\"55\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">=</text>\n   <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"306\" y=\"545\" width=\"300\" height=\"55\" id=\"svg_71\" rx=\"10\"/>\n  <rect fill=\"#00bfbf\" stroke=\"#ffff00\" stroke-width=\"5\" x=\"650\" y=\"544.999996\" width=\"140\" height=\"55\" id=\"svg_73\" rx=\"10\"/>\n  <text style=\"cursor: move;\" fill=\"#ffff00\" stroke-width=\"0\" x=\"690\" y=\"585\" id=\"svg_74\" font-size=\"28\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">?123</text>\n  <rect fill=\"#56ffff\" stroke=\"#00ff00\" stroke-width=\"5\" x=\"880\" y=\"545\" width=\"140\" height=\"55\" id=\"svg_76\" rx=\"10\"/>\n  <text fill=\"#bf0000\" stroke-width=\"0\" x=\"900\" y=\"585\" id=\"svg_77\" font-size=\"30\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\">CLEAR</text>\n        </g>\n\n<text stroke=\"null\" fill=\"]]..mousecolclk..[[\" stroke-width=\"10\" x=\"]]..(screen.getMouseX()*(1024)-35)..[[\" y=\"]]..(screen.getMouseY()*(612)+40)..[[\" id=\"svg_6\" font-size=\"100\" font-family=\"Helvetica, Arial, sans-serif\" text-anchor=\"start\" xml:space=\"preserve\" font-weight=\"bold\" font-style=\"italic\">+</text>\n\n    </svg>]] \n    local buttonNo = evaluateButtons()\n    if PWMouseDown then\n      PWMouseX = screen.getMouseX()\n      PWMouseY = screen.getMouseY()\n      if buttonNo ~= PWButtonSelected or PWMouseX < 0.05 or PWMouseX > 0.95 or PWMouseY < 0.05 or PWMouseY > 0.95 then\n        if PWButtonSelected > 0 then\n          onButtonUp(PWButtonSelected)\n        end\n        PWButtonSelected = 0\n      end        \n    end\n\n\n\n    page = page .. [[</div></body></html>]]\n    screen.setHTML(page)\n       \nend\nend\n\n\n\n\n\n\n\n\n","filter":{"args":[],"signature":"start()","slotKey":"-2"},"key":"3"},{"code":"updateScreen()\n","filter":{"args":[],"signature":"update()","slotKey":"-2"},"key":"4"},{"code":"page = [[<svg id=\"Layer_1\" data-name=\"Layer 1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 1024 600\"><defs><style>.cls-1{fill:#fff;}.cls-2{fill:red;}</style></defs><rect class=\"cls-1\" width=\"1024\" height=\"600\"/><rect class=\"cls-2\" width=\"1024\" height=\"281\"/><path class=\"cls-1\" d=\"M164.05,122.19V50.61h36.87q10.25,0,15.67,1.76a16.65,16.65,0,0,1,8.74,6.52,19.78,19.78,0,0,1,3.32,11.59,19.14,19.14,0,0,1-9.53,17.29,26.73,26.73,0,0,1-7.76,2.83,22,22,0,0,1,5.75,2.64A22,22,0,0,1,220.65,97a28.24,28.24,0,0,1,3.1,4.45l10.71,20.74h-25l-11.83-21.87c-1.49-2.83-2.83-4.67-4-5.52a9.24,9.24,0,0,0-5.42-1.66h-1.95v29.05Zm22.22-42.57h9.32a33.44,33.44,0,0,0,5.86-1A5.81,5.81,0,0,0,205,76.39a7.26,7.26,0,0,0-.8-9.47Q202,65.06,196,65.06h-9.71Z\"/><path class=\"cls-1\" d=\"M241.49,50.61h59.28V65.89H263.66V77.27h34.42v14.6H263.66V106h38.18v16.21H241.49Z\"/><path class=\"cls-1\" d=\"M309.9,98.51,331,97.19a16,16,0,0,0,2.78,7.82q3.42,4.33,9.76,4.34,4.74,0,7.3-2.22a6.66,6.66,0,0,0,2.57-5.15,6.58,6.58,0,0,0-2.44-5q-2.44-2.2-11.33-4.15Q325,89.58,318.84,84.16a17.48,17.48,0,0,1-6.25-13.82,18.79,18.79,0,0,1,3.19-10.43,21.25,21.25,0,0,1,9.62-7.71q6.42-2.81,17.61-2.81,13.71,0,20.92,5.1t8.57,16.24L351.65,72c-.56-3.22-1.72-5.57-3.49-7a11.21,11.21,0,0,0-7.35-2.2q-3.85,0-5.81,1.64a5,5,0,0,0-2,4,4,4,0,0,0,1.62,3.07q1.56,1.43,7.42,2.64,14.51,3.12,20.77,6.32A21.84,21.84,0,0,1,372,88.31a20.13,20.13,0,0,1,2.85,10.59A22.72,22.72,0,0,1,371,111.6a23.81,23.81,0,0,1-10.64,8.81q-6.84,3-17.24,3-18.25,0-25.29-7A27.7,27.7,0,0,1,309.9,98.51Z\"/><path class=\"cls-1\" d=\"M381,50.61h67.23V68.29H425.62v53.9H403.5V68.29H381Z\"/><path class=\"cls-1\" d=\"M458.48,122.19V50.61h36.87q10.26,0,15.67,1.76a16.61,16.61,0,0,1,8.74,6.52,19.71,19.71,0,0,1,3.32,11.59,19.16,19.16,0,0,1-9.52,17.29,26.81,26.81,0,0,1-7.77,2.83,22.21,22.21,0,0,1,5.76,2.64A22.46,22.46,0,0,1,515.08,97a28.24,28.24,0,0,1,3.1,4.45l10.71,20.74h-25l-11.82-21.87c-1.5-2.83-2.83-4.67-4-5.52a9.24,9.24,0,0,0-5.42-1.66H480.7v29.05ZM480.7,79.62H490a33.58,33.58,0,0,0,5.86-1,5.84,5.84,0,0,0,3.59-2.25,7.25,7.25,0,0,0-.81-9.47c-1.46-1.24-4.22-1.86-8.25-1.86H480.7Z\"/><path class=\"cls-1\" d=\"M536.85,50.61H559v71.58H536.85Z\"/><path class=\"cls-1\" d=\"M622.55,92.9l19.38,5.86a35.76,35.76,0,0,1-6.15,13.62,26.72,26.72,0,0,1-10.43,8.25q-6.23,2.79-15.84,2.78-11.67,0-19.07-3.39t-12.77-11.93q-5.37-8.53-5.37-21.86,0-17.76,9.45-27.3t26.73-9.54q13.53,0,21.27,5.47t11.5,16.8L621.72,76a16.85,16.85,0,0,0-2.15-4.78A12.68,12.68,0,0,0,615,67.31,14,14,0,0,0,597.5,72q-3,4.49-3,14.09,0,11.91,3.61,16.32t10.16,4.41q6.35,0,9.59-3.56T622.55,92.9Z\"/><path class=\"cls-1\" d=\"M647.64,50.61h67.24V68.29H692.32v53.9H670.2V68.29H647.64Z\"/><path class=\"cls-1\" d=\"M724.84,50.61h59.28V65.89H747V77.27h34.42v14.6H747V106h38.18v16.21H724.84Z\"/><path class=\"cls-1\" d=\"M797.4,50.61h32.86q9.72,0,15.7,2.64a25.56,25.56,0,0,1,9.89,7.57,31.3,31.3,0,0,1,5.66,11.47,53.35,53.35,0,0,1,1.76,13.87q0,11.48-2.61,17.8a29.51,29.51,0,0,1-7.25,10.59,23.69,23.69,0,0,1-10,5.69,51.48,51.48,0,0,1-13.19,2H797.4Zm22.12,16.21v39.11h5.42q6.93,0,9.86-1.53A10.39,10.39,0,0,0,839.39,99q1.67-3.83,1.66-12.42,0-11.38-3.71-15.58T825,66.82Z\"/><path class=\"cls-1\" d=\"M410.55,230.38H385.44L382,242.19H359.36l26.91-71.58h24.12l26.9,71.58H414.13ZM406,214.9l-7.9-25.73-7.82,25.73Z\"/><path class=\"cls-1\" d=\"M444.62,242.19V170.61h36.86q10.26,0,15.68,1.76a16.69,16.69,0,0,1,8.74,6.52,20.21,20.21,0,0,1-6.21,28.88,26.81,26.81,0,0,1-7.77,2.83,21.89,21.89,0,0,1,5.76,2.64,22.82,22.82,0,0,1,3.54,3.76,29,29,0,0,1,3.1,4.45L515,242.19H490l-11.82-21.87q-2.25-4.24-4-5.52a9.26,9.26,0,0,0-5.42-1.66h-2v29.05Zm22.21-42.57h9.33a33.58,33.58,0,0,0,5.86-1,5.84,5.84,0,0,0,3.59-2.25,7.25,7.25,0,0,0-.81-9.47q-2.19-1.86-8.25-1.86h-9.72Z\"/><path class=\"cls-1\" d=\"M522.06,170.61h59.28v15.28H544.23v11.38h34.42v14.6H544.23V226h38.18v16.21H522.06Z\"/><path class=\"cls-1\" d=\"M638.33,230.38H613.22l-3.49,11.81H587.15l26.9-71.58h24.13l26.9,71.58H641.91Zm-4.59-15.48-7.9-25.73L618,214.9Z\"/><path d=\"M77.59,318.57H94.11l21.56,31.68V318.57h16.68v57.27H115.67L94.23,344.4v31.44H77.59Z\"/><path d=\"M141.88,347.25q0-14,7.82-21.84t21.75-7.81q14.3,0,22,7.67t7.74,21.51q0,10-3.38,16.46a24,24,0,0,1-9.77,10q-6.37,3.57-15.91,3.58-9.69,0-16-3.09A24.13,24.13,0,0,1,145.83,364Q141.89,357.29,141.88,347.25Zm17.7.07q0,8.67,3.22,12.46a10.9,10.9,0,0,0,8.77,3.79q5.7,0,8.83-3.71t3.12-13.32q0-8.09-3.26-11.81a11.13,11.13,0,0,0-8.85-3.73,10.76,10.76,0,0,0-8.59,3.78Q159.58,338.58,159.58,347.32Z\"/><path d=\"M274.7,318.57h17.65v34.12a28.82,28.82,0,0,1-1.58,9.58,20.77,20.77,0,0,1-5,7.89,19.8,19.8,0,0,1-7.09,4.74,35.58,35.58,0,0,1-12.38,1.92,78.23,78.23,0,0,1-9.13-.59,23.88,23.88,0,0,1-8.26-2.32,20.74,20.74,0,0,1-6.07-4.94,18.05,18.05,0,0,1-3.77-6.6,34.3,34.3,0,0,1-1.64-9.68V318.57h17.66V353.5a10,10,0,0,0,2.59,7.32,11.18,11.18,0,0,0,14.38,0q2.59-2.6,2.6-7.36Z\"/><path d=\"M304.19,318.57h16.52l21.56,31.68V318.57H359v57.27H342.27L320.83,344.4v31.44H304.19Z\"/><path d=\"M405.14,366.39H385.05l-2.8,9.45H364.19l21.52-57.27H405l21.52,57.27H408ZM401.47,354l-6.33-20.58L388.89,354Z\"/><path d=\"M466.69,318.57h17.65v34.12a28.57,28.57,0,0,1-1.58,9.58,20.65,20.65,0,0,1-5,7.89,19.8,19.8,0,0,1-7.09,4.74,35.54,35.54,0,0,1-12.38,1.92,77.93,77.93,0,0,1-9.12-.59,23.75,23.75,0,0,1-8.26-2.32,20.78,20.78,0,0,1-6.08-4.94,18.2,18.2,0,0,1-3.77-6.6,34.3,34.3,0,0,1-1.64-9.68V318.57h17.66V353.5a10,10,0,0,0,2.59,7.32,11.18,11.18,0,0,0,14.38,0q2.6-2.6,2.6-7.36Z\"/><path d=\"M492,318.57h53.79v14.14H527.78v43.13H510.09V332.71H492Z\"/><path d=\"M553.91,318.57h17.7v20H591v-20h17.77v57.27H591V352.67H571.61v23.17h-17.7Z\"/><path d=\"M618.25,347.25q0-14,7.81-21.84t21.76-7.81q14.29,0,22,7.67t7.74,21.51q0,10-3.38,16.46a24.08,24.08,0,0,1-9.77,10q-6.39,3.57-15.92,3.58-9.69,0-16-3.09A24.13,24.13,0,0,1,622.2,364Q618.24,357.29,618.25,347.25Zm17.7.07q0,8.67,3.22,12.46a10.9,10.9,0,0,0,8.77,3.79q5.7,0,8.83-3.71t3.12-13.32q0-8.09-3.26-11.81a11.16,11.16,0,0,0-8.85-3.73,10.75,10.75,0,0,0-8.59,3.78Q635.95,338.58,636,347.32Z\"/><path d=\"M687.35,375.84V318.57h29.49q8.2,0,12.54,1.41a13.46,13.46,0,0,1,7,5.21,16.18,16.18,0,0,1-5,23.11,21.45,21.45,0,0,1-6.21,2.27,17.31,17.31,0,0,1,4.6,2.11,17.56,17.56,0,0,1,2.83,3,22.32,22.32,0,0,1,2.48,3.56l8.57,16.59h-20l-9.46-17.5a13.35,13.35,0,0,0-3.21-4.42,7.43,7.43,0,0,0-4.33-1.32h-1.56v23.24Zm17.78-34.06h7.46a26.65,26.65,0,0,0,4.68-.78,4.69,4.69,0,0,0,2.87-1.8,5.79,5.79,0,0,0-.64-7.58q-1.75-1.49-6.6-1.48h-7.77Z\"/><path d=\"M750.05,318.57h17.73v57.27H750.05Z\"/><path d=\"M779,318.57h50.08V330L797,363.53h33.32v12.31H776V364l31.8-33.16H779Z\"/><path d=\"M838.21,318.57h47.42V330.8H856v9.1h27.53v11.68H856v11.29h30.54v13H838.21Z\"/><path d=\"M896.26,318.57h26.29q7.77,0,12.56,2.11a20.52,20.52,0,0,1,7.91,6.06,25.15,25.15,0,0,1,4.53,9.18A42.44,42.44,0,0,1,949,347q0,9.18-2.09,14.24a23.5,23.5,0,0,1-5.8,8.48,19,19,0,0,1-8,4.55,41.07,41.07,0,0,1-10.54,1.56H896.26Zm17.69,13v31.29h4.34q5.55,0,7.89-1.23a8.31,8.31,0,0,0,3.67-4.3q1.33-3.06,1.33-9.94,0-9.11-3-12.46t-9.84-3.36Z\"/><path d=\"M244.48,414.57h29.41q9.62,0,14.4,4.57t4.78,13q0,8.67-5.21,13.56t-15.92,4.88h-9.69v21.25H244.48ZM262.25,439h4.34q5.12,0,7.19-1.78a5.72,5.72,0,0,0,2.07-4.55,6.35,6.35,0,0,0-1.8-4.57q-1.8-1.87-6.76-1.88h-5Z\"/><path d=\"M302.29,414.57h47.42V426.8H320v9.1h27.54v11.68H320v11.29h30.54v13H302.29Z\"/><path d=\"M360.34,471.84V414.57h29.49q8.21,0,12.54,1.41a13.4,13.4,0,0,1,7,5.21,16.17,16.17,0,0,1-5,23.11,21.41,21.41,0,0,1-6.22,2.27,17.25,17.25,0,0,1,4.61,2.11,18,18,0,0,1,2.83,3,22.32,22.32,0,0,1,2.48,3.56l8.57,16.59h-20l-9.46-17.5a13.22,13.22,0,0,0-3.2-4.42,7.43,7.43,0,0,0-4.33-1.32h-1.57v23.24Zm17.77-34.06h7.46a26.71,26.71,0,0,0,4.69-.78,4.72,4.72,0,0,0,2.87-1.8,5.79,5.79,0,0,0-.64-7.58q-1.75-1.49-6.6-1.48h-7.78Z\"/><path d=\"M419.25,452.89l16.83-1.05a12.9,12.9,0,0,0,2.23,6.25,9.35,9.35,0,0,0,7.81,3.48,8.67,8.67,0,0,0,5.84-1.78,5.32,5.32,0,0,0,2.05-4.12,5.26,5.26,0,0,0-1.95-4q-1.95-1.76-9.06-3.32-11.64-2.61-16.61-6.95a14,14,0,0,1-5-11.06A15.08,15.08,0,0,1,424,422a17,17,0,0,1,7.7-6.17q5.13-2.23,14.08-2.24,11,0,16.74,4.08t6.85,13l-16.68,1a7.79,7.79,0,0,0-8.67-7.38,7.14,7.14,0,0,0-4.65,1.31,4,4,0,0,0-1.56,3.18,3.16,3.16,0,0,0,1.29,2.46q1.24,1.14,5.94,2.11,11.6,2.51,16.62,5.06a17.42,17.42,0,0,1,7.3,6.35,16,16,0,0,1,2.29,8.48,18.16,18.16,0,0,1-3.05,10.15,19.06,19.06,0,0,1-8.51,7.05,34.47,34.47,0,0,1-13.79,2.41q-14.61,0-20.24-5.63A22.17,22.17,0,0,1,419.25,452.89Z\"/><path d=\"M477.88,443.25q0-14,7.81-21.84t21.76-7.81q14.3,0,22,7.67t7.73,21.51q0,10-3.37,16.46a24.08,24.08,0,0,1-9.77,10q-6.39,3.57-15.92,3.58-9.69,0-16-3.09a24.1,24.1,0,0,1-10.3-9.77Q477.88,453.29,477.88,443.25Zm17.69.07q0,8.67,3.23,12.46a10.9,10.9,0,0,0,8.77,3.79q5.7,0,8.82-3.71t3.13-13.32q0-8.09-3.26-11.81a11.16,11.16,0,0,0-8.85-3.73,10.75,10.75,0,0,0-8.59,3.78Q495.56,434.58,495.57,443.32Z\"/><path d=\"M546.86,414.57h16.53L585,446.25V414.57h16.68v57.27H585L563.5,440.4v31.44H546.86Z\"/><path d=\"M613.5,414.57H630l21.56,31.68V414.57h16.68v57.27H651.59L630.14,440.4v31.44H613.5Z\"/><path d=\"M680,414.57h47.42V426.8H697.72v9.1h27.54v11.68H697.72v11.29h30.55v13H680Z\"/><path d=\"M737.8,414.57h17.7v43.17h27.61v14.1H737.8Z\"/><path d=\"M58.11,510.57H91.24q8.28,0,12.71,4.1a13.28,13.28,0,0,1,4.44,10.16,12.8,12.8,0,0,1-3.17,8.71,14,14,0,0,1-6.17,3.83q6.18,1.49,9.08,5.1a14,14,0,0,1,2.91,9.08,15.62,15.62,0,0,1-2.07,8,15.26,15.26,0,0,1-5.66,5.62,18.73,18.73,0,0,1-6.72,1.88,77.57,77.57,0,0,1-7.93.78H58.11ZM76,533h7.7q4.14,0,5.76-1.42A5.2,5.2,0,0,0,91,527.49a4.91,4.91,0,0,0-1.62-3.91q-1.62-1.41-5.64-1.41H76Zm0,22.5h9c3.05,0,5.19-.54,6.44-1.62a5.46,5.46,0,0,0,1.88-4.35,5,5,0,0,0-1.86-4.08q-1.85-1.54-6.5-1.55H76Z\"/><path d=\"M120.26,510.57h47.42V522.8H138v9.1h27.54v11.68H138v11.29h30.54v13H120.26Z\"/><path d=\"M172.29,510.57H192l11.54,19.32,11.56-19.32H234.6l-22.27,33.28v24H194.6v-24Z\"/><path d=\"M233.27,539.25q0-14,7.81-21.84t21.76-7.81q14.3,0,22,7.67t7.74,21.51q0,10-3.38,16.46a24.08,24.08,0,0,1-9.77,10q-6.39,3.57-15.92,3.58-9.69,0-16-3.09a24.15,24.15,0,0,1-10.3-9.77Q233.27,549.29,233.27,539.25Zm17.69.07q0,8.67,3.23,12.46a10.9,10.9,0,0,0,8.77,3.79q5.7,0,8.83-3.71t3.12-13.32q0-8.09-3.26-11.81A11.16,11.16,0,0,0,262.8,523a10.75,10.75,0,0,0-8.59,3.78Q251,530.57,251,539.32Z\"/><path d=\"M302.25,510.57h16.53l21.56,31.68V510.57H357v57.27H340.34L318.89,536.4v31.44H302.25Z\"/><path d=\"M369,510.57H395.3q7.77,0,12.56,2.11a20.44,20.44,0,0,1,7.91,6.06,25.15,25.15,0,0,1,4.53,9.18A42.44,42.44,0,0,1,421.71,539q0,9.18-2.09,14.24a23.75,23.75,0,0,1-5.8,8.48,19.1,19.1,0,0,1-8,4.55,41.14,41.14,0,0,1-10.55,1.56H369Zm17.7,13v31.29H391q5.55,0,7.89-1.23a8.33,8.33,0,0,0,3.68-4.3q1.32-3.06,1.32-9.94,0-9.11-3-12.46c-2-2.24-5.26-3.36-9.84-3.36Z\"/><path d=\"M453.66,510.57h53.79v14.14H489.4v43.13H471.71V524.71h-18Z\"/><path d=\"M515.54,510.57h17.69v20h19.34v-20h17.77v57.27H552.57V544.67H533.23v23.17H515.54Z\"/><path d=\"M582.8,510.57h17.74v57.27H582.8Z\"/><path d=\"M610.14,548.89l16.84-1a12.8,12.8,0,0,0,2.23,6.25,9.34,9.34,0,0,0,7.81,3.48,8.69,8.69,0,0,0,5.84-1.78,5.32,5.32,0,0,0,2-4.12,5.26,5.26,0,0,0-1.95-4q-2-1.75-9.07-3.32-11.64-2.61-16.6-7a14,14,0,0,1-5-11.06,15.08,15.08,0,0,1,2.56-8.34,17,17,0,0,1,7.7-6.17q5.13-2.23,14.08-2.24,11,0,16.74,4.08t6.85,13l-16.68,1a7.79,7.79,0,0,0-8.67-7.38,7.1,7.1,0,0,0-4.65,1.31,4,4,0,0,0-1.56,3.18,3.16,3.16,0,0,0,1.29,2.46q1.24,1.14,5.94,2.11,11.6,2.5,16.62,5.06a17.48,17.48,0,0,1,7.3,6.35,16,16,0,0,1,2.29,8.48,18.16,18.16,0,0,1-3.05,10.15,19.06,19.06,0,0,1-8.51,7,34.47,34.47,0,0,1-13.79,2.41q-14.61,0-20.24-5.63A22.23,22.23,0,0,1,610.14,548.89Z\"/><path d=\"M697.61,510.57H727q9.62,0,14.39,4.57t4.79,13q0,8.67-5.22,13.56t-15.91,4.88h-9.69v21.25H697.61ZM715.38,535h4.33c3.42,0,5.81-.59,7.19-1.78a5.72,5.72,0,0,0,2.07-4.55,6.38,6.38,0,0,0-1.79-4.57c-1.2-1.25-3.46-1.88-6.76-1.88h-5Z\"/><path d=\"M753.23,539.25q0-14,7.81-21.84t21.76-7.81q14.3,0,22,7.67t7.74,21.51q0,10-3.38,16.46a24.08,24.08,0,0,1-9.77,10q-6.39,3.57-15.92,3.58-9.69,0-16-3.09A24.13,24.13,0,0,1,757.18,556Q753.22,549.29,753.23,539.25Zm17.7.07q0,8.67,3.22,12.46a10.9,10.9,0,0,0,8.77,3.79q5.7,0,8.83-3.71t3.12-13.32q0-8.09-3.26-11.81a11.15,11.15,0,0,0-8.85-3.73,10.75,10.75,0,0,0-8.59,3.78Q770.93,530.57,770.93,539.32Z\"/><path d=\"M822.8,510.57h17.74v57.27H822.8Z\"/><path d=\"M853.35,510.57h16.52l21.56,31.68V510.57h16.68v57.27H891.43L870,536.4v31.44H853.35Z\"/><path d=\"M915.85,510.57h53.79v14.14h-18v43.13H933.9V524.71h-18Z\"/></svg>]]\nscreen.setHTML(page)\ndoor.deactivate()","filter":{"args":[],"signature":"stop()","slotKey":"-2"},"key":"5"}],"methods":[],"events":[]}

     

  4. ---This script uses program board to read player name who activated it and check to see if they have permission to enter a door while recording the name on the second screen and making sure its not a duplicate before writing to inside screen. If list exceeds screen you can right click screen and copy html and view elsewhere such as notepad


    Requires:

    1 databank

    2 screens

    1 detector unit

    1 door

    How to Install

     

    Paste config and install links in order.

    Edit Lua Parameter and Put Player name in parenthesis.
    To add more players go into Lua editor and duplicate the line containing "Enter Name Here"

     

    Slots                       Hook up in this order and rename slots.

    slot1 --> databank
    slot2 --> screenIN
    slot3 --> detection
    slot4 --> screenOUT
    slot5 --> fdoor

     

    Basic Security Fix 11/30/2020

    Json Paste

    {"slots":{"0":{"name":"databank","type":{"events":[],"methods":[]}},"1":{"name":"screenIN","type":{"events":[],"methods":[]}},"2":{"name":"detection","type":{"events":[],"methods":[]}},"3":{"name":"screenOUT","type":{"events":[],"methods":[]}},"4":{"name":"fdoor","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":"known_players = {}\ntable.insert(known_players,database.getPlayer(id).name..[[]]..database.getPlayer(id).id)\nlocal Detectedhtml = \"\"\nfor _, name in pairs(known_players) do\n\ndatabank.setStringValue(\"Detected\",\"<div style=font-size:5vh>ID\"..\"&nbsp;\"..database.getPlayer(id).id..\"&nbsp;\".. database.getPlayer(id).name..\"<p>\")\ndatabank.setStringValue(\"ChkDet\",database.getPlayer(id).name)\n\nend \nfdoor.deactivate()\ndoorhtml= ([[<svg class=\"bootstrap\" viewBox=\"0 0 1920 1080\" style=\"width:100%; height:100%\" <svg width=\"1920\" height=\"1080\">\n <g>\n  <title>background</title>\n  <rect x=\"-1\" y=\"-1\" width=\"1922\" height=\"1082\" id=\"canvas_background\" fill=\"#000000\"/>\n </g>\n\n <g>\n  <title>Layer 1</title>\n  <text font-weight=\"bold\" font-style=\"italic\" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"'Courier New', Courier, monospace\" font-size=\"100\" id=\"svg_18\" y=\"500\" x=\"668.233333\" stroke-width=\"0\" stroke=\"#000\" fill=]]..OrgColor..[[>]]..OrgName..[[</text>\n  <text font-weight=\"bold\" font-style=\"italic\" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"'Courier New', Courier, monospace\" font-size=\"100\" id=\"svg_19\" y=\"600\" x=\"426.333278\" stroke-width=\"0\" stroke=\"#000\" fill=]]..SecondaryTitleColor..[[>]]..SecondaryTitle..[[</text>\n </g>\n</svg>]])\nscreenOUT.setHTML(doorhtml)\n\n\n","filter":{"args":[{"variable":"*"}],"signature":"leave(id)","slotKey":"2"},"key":"0"},{"code":"playerna = unit.getMasterPlayerId()\nplayernamesdoor = system.getPlayerName(playerna)\n---Basic Security Fix(Player Requested)---\nOwner = \"NEWMidgetMAN\" --export:Main Owner\n\n\nPlayersOnList = {Owner,\"PrincessKitty\",\"Enter Name Here\", \"Enter Name Here\"} --Enter Name Here are Examples.\nlocal function contains(table, val)\n   for i=1,#table do\n      if table[i] == val then \n         return true\n      end\n   end\n   return false\nend\n\nif contains(PlayersOnList, playernamesdoor) then\n\tdoorhtml = \"\"\n\tdoorhtml = doorhtml .. \"<div style=font-size:10vh> Access Granted <br> Welcome Back : <br><p><div style=font-size:15vh>\" ..playernamesdoor..\"\\n\"\n\tscreenOUT.setHTML(doorhtml)\n\tfdoor.activate()\nelse\n   \t  doorhtml = ([[<svg id=\"Layer_1\" data-name=\"Layer 1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 1024 600\"><defs><style>.cls-1{fill:#fff;}.cls-2{fill:red;}</style></defs><rect class=\"cls-1\" width=\"1024\" height=\"600\"/><rect class=\"cls-2\" width=\"1024\" height=\"281\"/><path class=\"cls-1\" d=\"M164.05,122.19V50.61h36.87q10.25,0,15.67,1.76a16.65,16.65,0,0,1,8.74,6.52,19.78,19.78,0,0,1,3.32,11.59,19.14,19.14,0,0,1-9.53,17.29,26.73,26.73,0,0,1-7.76,2.83,22,22,0,0,1,5.75,2.64A22,22,0,0,1,220.65,97a28.24,28.24,0,0,1,3.1,4.45l10.71,20.74h-25l-11.83-21.87c-1.49-2.83-2.83-4.67-4-5.52a9.24,9.24,0,0,0-5.42-1.66h-1.95v29.05Zm22.22-42.57h9.32a33.44,33.44,0,0,0,5.86-1A5.81,5.81,0,0,0,205,76.39a7.26,7.26,0,0,0-.8-9.47Q202,65.06,196,65.06h-9.71Z\"/><path class=\"cls-1\" d=\"M241.49,50.61h59.28V65.89H263.66V77.27h34.42v14.6H263.66V106h38.18v16.21H241.49Z\"/><path class=\"cls-1\" d=\"M309.9,98.51,331,97.19a16,16,0,0,0,2.78,7.82q3.42,4.33,9.76,4.34,4.74,0,7.3-2.22a6.66,6.66,0,0,0,2.57-5.15,6.58,6.58,0,0,0-2.44-5q-2.44-2.2-11.33-4.15Q325,89.58,318.84,84.16a17.48,17.48,0,0,1-6.25-13.82,18.79,18.79,0,0,1,3.19-10.43,21.25,21.25,0,0,1,9.62-7.71q6.42-2.81,17.61-2.81,13.71,0,20.92,5.1t8.57,16.24L351.65,72c-.56-3.22-1.72-5.57-3.49-7a11.21,11.21,0,0,0-7.35-2.2q-3.85,0-5.81,1.64a5,5,0,0,0-2,4,4,4,0,0,0,1.62,3.07q1.56,1.43,7.42,2.64,14.51,3.12,20.77,6.32A21.84,21.84,0,0,1,372,88.31a20.13,20.13,0,0,1,2.85,10.59A22.72,22.72,0,0,1,371,111.6a23.81,23.81,0,0,1-10.64,8.81q-6.84,3-17.24,3-18.25,0-25.29-7A27.7,27.7,0,0,1,309.9,98.51Z\"/><path class=\"cls-1\" d=\"M381,50.61h67.23V68.29H425.62v53.9H403.5V68.29H381Z\"/><path class=\"cls-1\" d=\"M458.48,122.19V50.61h36.87q10.26,0,15.67,1.76a16.61,16.61,0,0,1,8.74,6.52,19.71,19.71,0,0,1,3.32,11.59,19.16,19.16,0,0,1-9.52,17.29,26.81,26.81,0,0,1-7.77,2.83,22.21,22.21,0,0,1,5.76,2.64A22.46,22.46,0,0,1,515.08,97a28.24,28.24,0,0,1,3.1,4.45l10.71,20.74h-25l-11.82-21.87c-1.5-2.83-2.83-4.67-4-5.52a9.24,9.24,0,0,0-5.42-1.66H480.7v29.05ZM480.7,79.62H490a33.58,33.58,0,0,0,5.86-1,5.84,5.84,0,0,0,3.59-2.25,7.25,7.25,0,0,0-.81-9.47c-1.46-1.24-4.22-1.86-8.25-1.86H480.7Z\"/><path class=\"cls-1\" d=\"M536.85,50.61H559v71.58H536.85Z\"/><path class=\"cls-1\" d=\"M622.55,92.9l19.38,5.86a35.76,35.76,0,0,1-6.15,13.62,26.72,26.72,0,0,1-10.43,8.25q-6.23,2.79-15.84,2.78-11.67,0-19.07-3.39t-12.77-11.93q-5.37-8.53-5.37-21.86,0-17.76,9.45-27.3t26.73-9.54q13.53,0,21.27,5.47t11.5,16.8L621.72,76a16.85,16.85,0,0,0-2.15-4.78A12.68,12.68,0,0,0,615,67.31,14,14,0,0,0,597.5,72q-3,4.49-3,14.09,0,11.91,3.61,16.32t10.16,4.41q6.35,0,9.59-3.56T622.55,92.9Z\"/><path class=\"cls-1\" d=\"M647.64,50.61h67.24V68.29H692.32v53.9H670.2V68.29H647.64Z\"/><path class=\"cls-1\" d=\"M724.84,50.61h59.28V65.89H747V77.27h34.42v14.6H747V106h38.18v16.21H724.84Z\"/><path class=\"cls-1\" d=\"M797.4,50.61h32.86q9.72,0,15.7,2.64a25.56,25.56,0,0,1,9.89,7.57,31.3,31.3,0,0,1,5.66,11.47,53.35,53.35,0,0,1,1.76,13.87q0,11.48-2.61,17.8a29.51,29.51,0,0,1-7.25,10.59,23.69,23.69,0,0,1-10,5.69,51.48,51.48,0,0,1-13.19,2H797.4Zm22.12,16.21v39.11h5.42q6.93,0,9.86-1.53A10.39,10.39,0,0,0,839.39,99q1.67-3.83,1.66-12.42,0-11.38-3.71-15.58T825,66.82Z\"/><path class=\"cls-1\" d=\"M410.55,230.38H385.44L382,242.19H359.36l26.91-71.58h24.12l26.9,71.58H414.13ZM406,214.9l-7.9-25.73-7.82,25.73Z\"/><path class=\"cls-1\" d=\"M444.62,242.19V170.61h36.86q10.26,0,15.68,1.76a16.69,16.69,0,0,1,8.74,6.52,20.21,20.21,0,0,1-6.21,28.88,26.81,26.81,0,0,1-7.77,2.83,21.89,21.89,0,0,1,5.76,2.64,22.82,22.82,0,0,1,3.54,3.76,29,29,0,0,1,3.1,4.45L515,242.19H490l-11.82-21.87q-2.25-4.24-4-5.52a9.26,9.26,0,0,0-5.42-1.66h-2v29.05Zm22.21-42.57h9.33a33.58,33.58,0,0,0,5.86-1,5.84,5.84,0,0,0,3.59-2.25,7.25,7.25,0,0,0-.81-9.47q-2.19-1.86-8.25-1.86h-9.72Z\"/><path class=\"cls-1\" d=\"M522.06,170.61h59.28v15.28H544.23v11.38h34.42v14.6H544.23V226h38.18v16.21H522.06Z\"/><path class=\"cls-1\" d=\"M638.33,230.38H613.22l-3.49,11.81H587.15l26.9-71.58h24.13l26.9,71.58H641.91Zm-4.59-15.48-7.9-25.73L618,214.9Z\"/><path d=\"M77.59,318.57H94.11l21.56,31.68V318.57h16.68v57.27H115.67L94.23,344.4v31.44H77.59Z\"/><path d=\"M141.88,347.25q0-14,7.82-21.84t21.75-7.81q14.3,0,22,7.67t7.74,21.51q0,10-3.38,16.46a24,24,0,0,1-9.77,10q-6.37,3.57-15.91,3.58-9.69,0-16-3.09A24.13,24.13,0,0,1,145.83,364Q141.89,357.29,141.88,347.25Zm17.7.07q0,8.67,3.22,12.46a10.9,10.9,0,0,0,8.77,3.79q5.7,0,8.83-3.71t3.12-13.32q0-8.09-3.26-11.81a11.13,11.13,0,0,0-8.85-3.73,10.76,10.76,0,0,0-8.59,3.78Q159.58,338.58,159.58,347.32Z\"/><path d=\"M274.7,318.57h17.65v34.12a28.82,28.82,0,0,1-1.58,9.58,20.77,20.77,0,0,1-5,7.89,19.8,19.8,0,0,1-7.09,4.74,35.58,35.58,0,0,1-12.38,1.92,78.23,78.23,0,0,1-9.13-.59,23.88,23.88,0,0,1-8.26-2.32,20.74,20.74,0,0,1-6.07-4.94,18.05,18.05,0,0,1-3.77-6.6,34.3,34.3,0,0,1-1.64-9.68V318.57h17.66V353.5a10,10,0,0,0,2.59,7.32,11.18,11.18,0,0,0,14.38,0q2.59-2.6,2.6-7.36Z\"/><path d=\"M304.19,318.57h16.52l21.56,31.68V318.57H359v57.27H342.27L320.83,344.4v31.44H304.19Z\"/><path d=\"M405.14,366.39H385.05l-2.8,9.45H364.19l21.52-57.27H405l21.52,57.27H408ZM401.47,354l-6.33-20.58L388.89,354Z\"/><path d=\"M466.69,318.57h17.65v34.12a28.57,28.57,0,0,1-1.58,9.58,20.65,20.65,0,0,1-5,7.89,19.8,19.8,0,0,1-7.09,4.74,35.54,35.54,0,0,1-12.38,1.92,77.93,77.93,0,0,1-9.12-.59,23.75,23.75,0,0,1-8.26-2.32,20.78,20.78,0,0,1-6.08-4.94,18.2,18.2,0,0,1-3.77-6.6,34.3,34.3,0,0,1-1.64-9.68V318.57h17.66V353.5a10,10,0,0,0,2.59,7.32,11.18,11.18,0,0,0,14.38,0q2.6-2.6,2.6-7.36Z\"/><path d=\"M492,318.57h53.79v14.14H527.78v43.13H510.09V332.71H492Z\"/><path d=\"M553.91,318.57h17.7v20H591v-20h17.77v57.27H591V352.67H571.61v23.17h-17.7Z\"/><path d=\"M618.25,347.25q0-14,7.81-21.84t21.76-7.81q14.29,0,22,7.67t7.74,21.51q0,10-3.38,16.46a24.08,24.08,0,0,1-9.77,10q-6.39,3.57-15.92,3.58-9.69,0-16-3.09A24.13,24.13,0,0,1,622.2,364Q618.24,357.29,618.25,347.25Zm17.7.07q0,8.67,3.22,12.46a10.9,10.9,0,0,0,8.77,3.79q5.7,0,8.83-3.71t3.12-13.32q0-8.09-3.26-11.81a11.16,11.16,0,0,0-8.85-3.73,10.75,10.75,0,0,0-8.59,3.78Q635.95,338.58,636,347.32Z\"/><path d=\"M687.35,375.84V318.57h29.49q8.2,0,12.54,1.41a13.46,13.46,0,0,1,7,5.21,16.18,16.18,0,0,1-5,23.11,21.45,21.45,0,0,1-6.21,2.27,17.31,17.31,0,0,1,4.6,2.11,17.56,17.56,0,0,1,2.83,3,22.32,22.32,0,0,1,2.48,3.56l8.57,16.59h-20l-9.46-17.5a13.35,13.35,0,0,0-3.21-4.42,7.43,7.43,0,0,0-4.33-1.32h-1.56v23.24Zm17.78-34.06h7.46a26.65,26.65,0,0,0,4.68-.78,4.69,4.69,0,0,0,2.87-1.8,5.79,5.79,0,0,0-.64-7.58q-1.75-1.49-6.6-1.48h-7.77Z\"/><path d=\"M750.05,318.57h17.73v57.27H750.05Z\"/><path d=\"M779,318.57h50.08V330L797,363.53h33.32v12.31H776V364l31.8-33.16H779Z\"/><path d=\"M838.21,318.57h47.42V330.8H856v9.1h27.53v11.68H856v11.29h30.54v13H838.21Z\"/><path d=\"M896.26,318.57h26.29q7.77,0,12.56,2.11a20.52,20.52,0,0,1,7.91,6.06,25.15,25.15,0,0,1,4.53,9.18A42.44,42.44,0,0,1,949,347q0,9.18-2.09,14.24a23.5,23.5,0,0,1-5.8,8.48,19,19,0,0,1-8,4.55,41.07,41.07,0,0,1-10.54,1.56H896.26Zm17.69,13v31.29h4.34q5.55,0,7.89-1.23a8.31,8.31,0,0,0,3.67-4.3q1.33-3.06,1.33-9.94,0-9.11-3-12.46t-9.84-3.36Z\"/><path d=\"M244.48,414.57h29.41q9.62,0,14.4,4.57t4.78,13q0,8.67-5.21,13.56t-15.92,4.88h-9.69v21.25H244.48ZM262.25,439h4.34q5.12,0,7.19-1.78a5.72,5.72,0,0,0,2.07-4.55,6.35,6.35,0,0,0-1.8-4.57q-1.8-1.87-6.76-1.88h-5Z\"/><path d=\"M302.29,414.57h47.42V426.8H320v9.1h27.54v11.68H320v11.29h30.54v13H302.29Z\"/><path d=\"M360.34,471.84V414.57h29.49q8.21,0,12.54,1.41a13.4,13.4,0,0,1,7,5.21,16.17,16.17,0,0,1-5,23.11,21.41,21.41,0,0,1-6.22,2.27,17.25,17.25,0,0,1,4.61,2.11,18,18,0,0,1,2.83,3,22.32,22.32,0,0,1,2.48,3.56l8.57,16.59h-20l-9.46-17.5a13.22,13.22,0,0,0-3.2-4.42,7.43,7.43,0,0,0-4.33-1.32h-1.57v23.24Zm17.77-34.06h7.46a26.71,26.71,0,0,0,4.69-.78,4.72,4.72,0,0,0,2.87-1.8,5.79,5.79,0,0,0-.64-7.58q-1.75-1.49-6.6-1.48h-7.78Z\"/><path d=\"M419.25,452.89l16.83-1.05a12.9,12.9,0,0,0,2.23,6.25,9.35,9.35,0,0,0,7.81,3.48,8.67,8.67,0,0,0,5.84-1.78,5.32,5.32,0,0,0,2.05-4.12,5.26,5.26,0,0,0-1.95-4q-1.95-1.76-9.06-3.32-11.64-2.61-16.61-6.95a14,14,0,0,1-5-11.06A15.08,15.08,0,0,1,424,422a17,17,0,0,1,7.7-6.17q5.13-2.23,14.08-2.24,11,0,16.74,4.08t6.85,13l-16.68,1a7.79,7.79,0,0,0-8.67-7.38,7.14,7.14,0,0,0-4.65,1.31,4,4,0,0,0-1.56,3.18,3.16,3.16,0,0,0,1.29,2.46q1.24,1.14,5.94,2.11,11.6,2.51,16.62,5.06a17.42,17.42,0,0,1,7.3,6.35,16,16,0,0,1,2.29,8.48,18.16,18.16,0,0,1-3.05,10.15,19.06,19.06,0,0,1-8.51,7.05,34.47,34.47,0,0,1-13.79,2.41q-14.61,0-20.24-5.63A22.17,22.17,0,0,1,419.25,452.89Z\"/><path d=\"M477.88,443.25q0-14,7.81-21.84t21.76-7.81q14.3,0,22,7.67t7.73,21.51q0,10-3.37,16.46a24.08,24.08,0,0,1-9.77,10q-6.39,3.57-15.92,3.58-9.69,0-16-3.09a24.1,24.1,0,0,1-10.3-9.77Q477.88,453.29,477.88,443.25Zm17.69.07q0,8.67,3.23,12.46a10.9,10.9,0,0,0,8.77,3.79q5.7,0,8.82-3.71t3.13-13.32q0-8.09-3.26-11.81a11.16,11.16,0,0,0-8.85-3.73,10.75,10.75,0,0,0-8.59,3.78Q495.56,434.58,495.57,443.32Z\"/><path d=\"M546.86,414.57h16.53L585,446.25V414.57h16.68v57.27H585L563.5,440.4v31.44H546.86Z\"/><path d=\"M613.5,414.57H630l21.56,31.68V414.57h16.68v57.27H651.59L630.14,440.4v31.44H613.5Z\"/><path d=\"M680,414.57h47.42V426.8H697.72v9.1h27.54v11.68H697.72v11.29h30.55v13H680Z\"/><path d=\"M737.8,414.57h17.7v43.17h27.61v14.1H737.8Z\"/><path d=\"M58.11,510.57H91.24q8.28,0,12.71,4.1a13.28,13.28,0,0,1,4.44,10.16,12.8,12.8,0,0,1-3.17,8.71,14,14,0,0,1-6.17,3.83q6.18,1.49,9.08,5.1a14,14,0,0,1,2.91,9.08,15.62,15.62,0,0,1-2.07,8,15.26,15.26,0,0,1-5.66,5.62,18.73,18.73,0,0,1-6.72,1.88,77.57,77.57,0,0,1-7.93.78H58.11ZM76,533h7.7q4.14,0,5.76-1.42A5.2,5.2,0,0,0,91,527.49a4.91,4.91,0,0,0-1.62-3.91q-1.62-1.41-5.64-1.41H76Zm0,22.5h9c3.05,0,5.19-.54,6.44-1.62a5.46,5.46,0,0,0,1.88-4.35,5,5,0,0,0-1.86-4.08q-1.85-1.54-6.5-1.55H76Z\"/><path d=\"M120.26,510.57h47.42V522.8H138v9.1h27.54v11.68H138v11.29h30.54v13H120.26Z\"/><path d=\"M172.29,510.57H192l11.54,19.32,11.56-19.32H234.6l-22.27,33.28v24H194.6v-24Z\"/><path d=\"M233.27,539.25q0-14,7.81-21.84t21.76-7.81q14.3,0,22,7.67t7.74,21.51q0,10-3.38,16.46a24.08,24.08,0,0,1-9.77,10q-6.39,3.57-15.92,3.58-9.69,0-16-3.09a24.15,24.15,0,0,1-10.3-9.77Q233.27,549.29,233.27,539.25Zm17.69.07q0,8.67,3.23,12.46a10.9,10.9,0,0,0,8.77,3.79q5.7,0,8.83-3.71t3.12-13.32q0-8.09-3.26-11.81A11.16,11.16,0,0,0,262.8,523a10.75,10.75,0,0,0-8.59,3.78Q251,530.57,251,539.32Z\"/><path d=\"M302.25,510.57h16.53l21.56,31.68V510.57H357v57.27H340.34L318.89,536.4v31.44H302.25Z\"/><path d=\"M369,510.57H395.3q7.77,0,12.56,2.11a20.44,20.44,0,0,1,7.91,6.06,25.15,25.15,0,0,1,4.53,9.18A42.44,42.44,0,0,1,421.71,539q0,9.18-2.09,14.24a23.75,23.75,0,0,1-5.8,8.48,19.1,19.1,0,0,1-8,4.55,41.14,41.14,0,0,1-10.55,1.56H369Zm17.7,13v31.29H391q5.55,0,7.89-1.23a8.33,8.33,0,0,0,3.68-4.3q1.32-3.06,1.32-9.94,0-9.11-3-12.46c-2-2.24-5.26-3.36-9.84-3.36Z\"/><path d=\"M453.66,510.57h53.79v14.14H489.4v43.13H471.71V524.71h-18Z\"/><path d=\"M515.54,510.57h17.69v20h19.34v-20h17.77v57.27H552.57V544.67H533.23v23.17H515.54Z\"/><path d=\"M582.8,510.57h17.74v57.27H582.8Z\"/><path d=\"M610.14,548.89l16.84-1a12.8,12.8,0,0,0,2.23,6.25,9.34,9.34,0,0,0,7.81,3.48,8.69,8.69,0,0,0,5.84-1.78,5.32,5.32,0,0,0,2-4.12,5.26,5.26,0,0,0-1.95-4q-2-1.75-9.07-3.32-11.64-2.61-16.6-7a14,14,0,0,1-5-11.06,15.08,15.08,0,0,1,2.56-8.34,17,17,0,0,1,7.7-6.17q5.13-2.23,14.08-2.24,11,0,16.74,4.08t6.85,13l-16.68,1a7.79,7.79,0,0,0-8.67-7.38,7.1,7.1,0,0,0-4.65,1.31,4,4,0,0,0-1.56,3.18,3.16,3.16,0,0,0,1.29,2.46q1.24,1.14,5.94,2.11,11.6,2.5,16.62,5.06a17.48,17.48,0,0,1,7.3,6.35,16,16,0,0,1,2.29,8.48,18.16,18.16,0,0,1-3.05,10.15,19.06,19.06,0,0,1-8.51,7,34.47,34.47,0,0,1-13.79,2.41q-14.61,0-20.24-5.63A22.23,22.23,0,0,1,610.14,548.89Z\"/><path d=\"M697.61,510.57H727q9.62,0,14.39,4.57t4.79,13q0,8.67-5.22,13.56t-15.91,4.88h-9.69v21.25H697.61ZM715.38,535h4.33c3.42,0,5.81-.59,7.19-1.78a5.72,5.72,0,0,0,2.07-4.55,6.38,6.38,0,0,0-1.79-4.57c-1.2-1.25-3.46-1.88-6.76-1.88h-5Z\"/><path d=\"M753.23,539.25q0-14,7.81-21.84t21.76-7.81q14.3,0,22,7.67t7.74,21.51q0,10-3.38,16.46a24.08,24.08,0,0,1-9.77,10q-6.39,3.57-15.92,3.58-9.69,0-16-3.09A24.13,24.13,0,0,1,757.18,556Q753.22,549.29,753.23,539.25Zm17.7.07q0,8.67,3.22,12.46a10.9,10.9,0,0,0,8.77,3.79q5.7,0,8.83-3.71t3.12-13.32q0-8.09-3.26-11.81a11.15,11.15,0,0,0-8.85-3.73,10.75,10.75,0,0,0-8.59,3.78Q770.93,530.57,770.93,539.32Z\"/><path d=\"M822.8,510.57h17.74v57.27H822.8Z\"/><path d=\"M853.35,510.57h16.52l21.56,31.68V510.57h16.68v57.27H891.43L870,536.4v31.44H853.35Z\"/><path d=\"M915.85,510.57h53.79v14.14h-18v43.13H933.9V524.71h-18Z\"/></svg>]])\n      screenOUT.setHTML(doorhtml) \n   \t  fdoor.deactivate()\nend\n","filter":{"args":[],"signature":"start()","slotKey":"2"},"key":"1"},{"code":"data = databank.getStringValue(\"dlist\")  \nDetectedhtml = \"\"\nDetectedhtml = Detectedhtml ..data.. \"\\n\"\nscreenIN.setHTML(Detectedhtml)\nfdoor.deactivate()\n","filter":{"args":[],"signature":"stop()","slotKey":"-1"},"key":"2"},{"code":"unit.hide()\nOrgName = \"Team Rocket\"--export:Org name\nOrgColor = \"Purple\" --export:color for Org\nSecondaryTitle = \"Edit Lua Parameters\"--export:Seccondary Title\nSecondaryTitleColor = \"Blue\" --export: color for Secondary Title\nDetectedhtml = \"\"\nplayerna = unit.getMasterPlayerId()\nplayernames = system.getPlayerName(playerna)\ndatabank.setStringValue(\"ProgBnamechk\",\"<div style=font-size:5vh>ID&nbsp;\"..playerna..\"&nbsp;\".. playernames ..\"<p>\")\ndatabank.setStringValue(\"ProgBnamechklist\",playernames)\n\nknown_players = {}\n\nplayercheckstr = databank.getStringValue(\"Detected\")\nplayerlist = databank.getStringValue(\"dlist\")\nchkdet = databank.getStringValue(\"ChkDet\")\n\n\nif string.find(playerlist, chkdet) == nil then\n    finalplayerlist = playerlist..playercheckstr\n    databank.setStringValue(\"dlist\",playerlist..playercheckstr)    \n    elseif string.find(playerlist, chkdet) ~= nil then \nend\n\nunit.setTimer(\"DoorChecker\",0.08)\n","filter":{"args":[],"signature":"start()","slotKey":"-1"},"key":"3"},{"code":"playercheckstr = databank.getStringValue(\"Detected\")\nplayerlist = databank.getStringValue(\"dlist\")\nchkdet = databank.getStringValue(\"ChkDet\")\n\n\nif string.find(playerlist, chkdet) == nil then\n    finalplayerlist = playerlist..playercheckstr\n    databank.setStringValue(\"dlist\",playerlist..playercheckstr)        \n    elseif string.find(playerlist, chkdet) ~= nil then \nend\n\n\n\n","filter":{"args":[{"value":"DoorrChecker"}],"signature":"tick(timerId)","slotKey":"-1"},"key":"4"},{"code":"databank.clear()","filter":{"args":[{"value":"option1"}],"signature":"actionStart(action)","slotKey":"-2"},"key":"5"}],"methods":[],"events":[]}

     

  5. ---------- How to Use-------------------------------------

     

    Requirements:

    Program Board

    Databank

     

     


    Activate Program Board anytime you want to activate the 3rd person HUD, but data only updates while your in the Cockpit.

     


    This is a fix using elements and Lua for 3rd person Cockpit.
    ----------How to Install:

     

    Add Unit tick Up3rd to any cockpit. It will not affect the program used in the cockpit so any HUD can be used with this.
    Just add databank to cockpit.


    Then paste Json to ProgramBoard and link with the correct slots.
    ----------
    ----This is setup to use:
    1 space fuel tank
    1 atmo fuel tank
    2 weapons
    1 radar
    1 cockpit
    -----If you do not use all the elements then delete any lines using that element.
    For ex. if no weapons or radar then delete entire widget area and any lines containing the words weapons or radars from both cockpit and PB.

     

     

     

    Slots                       Hook up in this order and rename slots ONLY FOR THE ProgamBoard.

    Cockpit Add on
    slot? --> databank

     

     

    Program Board
    slot1 --> databank

     

    
    --------Cockpit ONLY -------------------------------------------------------------------------
    ------Cockpit Unit Start ADD----------------
    
    unit.setTimer("Up3rd",0.08)
    
    ------Cockpit Unit Tick Up3rd------------
    
    databank.setStringValue("cockpit",unit.getData())
    databank.setStringValue("atmofueltank",atmofueltank_1.getData())
    databank.setStringValue("spacefueltank",spacefueltank_1.getData())
    databank.setStringValue("radar",radar_1.getData())
    databank.setStringValue("weapon",weapon_1.getData())
    databank.setStringValue("weapon2",weapon_2.getData())
    
    --------Program Board ONLY---------------------------------------------------------------------------
    
    
    
    
    
    
    ------Unit Start----------------
    
    unit.setTimer("pbcp",0.08)
    
    
    --unittick pbcp ------------------
    
    cockpit= databank.getStringValue("cockpit")
    system.updateData(dataValuemain, cockpit) 
    cockpitatmo= databank.getStringValue("atmofueltank")
    system.updateData(dataValueatmo, cockpitatmo) 
    cockpitatmo= databank.getStringValue("spacefueltank")
    system.updateData(dataValueatmo, cockpitspace) 
    cockpitradar= databank.getStringValue("radar")
    system.updateData(dataValueradar, cockpitradar) 
    
    cockpitweapon= databank.getStringValue("weapon")
    system.updateData(dataValueweapon, cockpitweapon) 
    cockpitweapon2= databank.getStringValue("weapon2")
    system.updateData(dataValueweapon2, cockpitweapon2)
    
    --unitstart
    
    
    
    ----cockpit main-----
    cockpit= databank.getStringValue("cockpit")
    panelmain = system.createWidgetPanel("CockPit PB")
    
    widgetValuemain = system.createWidget(panelmain, "cockpit")
    dataValuemain = system.createData(cockpit) 
    system.addDataToWidget(dataValuemain, widgetValuemain)
    
    
    
    
    ----atmos widget-----
    cockpitatmo= databank.getStringValue("atmofueltank")
    panelatmo = system.createWidgetPanel("Nitron")
    
    widgetValueatmo = system.createWidget(panelatmo, "fuel_container")
    dataValueatmo = system.createData(cockpitatmo) 
    system.addDataToWidget(dataValueatmo, widgetValueatmo)
    
    
    
    
    ----spaces widget-----
    cockpitspace= databank.getStringValue("spacefueltank")
    panelspace = system.createWidgetPanel("Kergon")
    
    widgetValuespace = system.createWidget(panelspace, "fuel_container")
    dataValuespace = system.createData(cockpitspace) 
    system.addDataToWidget(dataValuespace, widgetValuespace)
    
    ----radars widget-----
    cockpitradar= databank.getStringValue("radar")
    panelradar = system.createWidgetPanel("Radar")
    
    widgetValueradar = system.createWidget(panelradar, "radar")
    dataValueradar = system.createData(cockpitradar) 
    system.addDataToWidget(dataValueradar, widgetValueradar)
    
    
    
    
    
    ----radarperiscopes widget-----
    cockpitradarperiscope= databank.getStringValue("radarperiscope")
    panelradarperiscope = system.createWidgetPanel("Periscope")
    
    widgetValueradarperiscope = system.createWidget(panelradarperiscope, "periscope")
    dataValueradarperiscope = system.createData(cockpitradarperiscope) 
    system.addDataToWidget(dataValueradarperiscope, widgetValueradarperiscope)
    
    cockpitradarperiscope= databank.getStringValue("radarperiscope")
    system.updateData(dataValueradarperiscope, cockpitradarperiscope) 
    
    
    
    
    
    ----weapon widget-----
    cockpitweapon= databank.getStringValue("weapon")
    panelweapon = system.createWidgetPanel("weapon")
    
    widgetValueweapon = system.createWidget(panelweapon, "weapon")
    dataValueweapon = system.createData(cockpitweapon) 
    system.addDataToWidget(dataValueweapon, widgetValueweapon)
    
    
    
    
    
    ----weapon2 widget-----
    cockpitweapon2= databank.getStringValue("weapon2")
    widgetValueweapon2 = system.createWidget(panelweapon, "weapon2")   ---adds to same panel
    dataValueweapon2 = system.createData(cockpitweapon2) 
    system.addDataToWidget(dataValueweapon2, widgetValueweapon)
    
    unit.hide()
    unit.setTimer("pbcp",0.08)

    Json Paste Program Board ONLY

    {"slots":{"0":{"name":"databank","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":"slot10","type":{"events":[],"methods":[]}},"-1":{"name":"unit","type":{"events":[],"methods":[]}},"-2":{"name":"system","type":{"events":[],"methods":[]}},"-3":{"name":"library","type":{"events":[],"methods":[]}}},"handlers":[{"code":"\n----cockpit main-----\ncockpit= databank.getStringValue(\"cockpit\")\npanelmain = system.createWidgetPanel(\"CockPit PB\")\n\nwidgetValuemain = system.createWidget(panelmain, \"cockpit\")\ndataValuemain = system.createData(cockpit) \nsystem.addDataToWidget(dataValuemain, widgetValuemain)\n\n----atmos widget-----\ncockpitatmo= databank.getStringValue(\"atmofueltank\")\npanelatmo = system.createWidgetPanel(\"Nitron\")\n\nwidgetValueatmo = system.createWidget(panelatmo, \"fuel_container\")\ndataValueatmo = system.createData(cockpitatmo) \nsystem.addDataToWidget(dataValueatmo, widgetValueatmo)\n\n----spaces widget-----\ncockpitspace= databank.getStringValue(\"spacefueltank\")\npanelspace = system.createWidgetPanel(\"Kergon\")\n\nwidgetValuespace = system.createWidget(panelspace, \"fuel_container\")\ndataValuespace = system.createData(cockpitspace) \nsystem.addDataToWidget(dataValuespace, widgetValuespace)\n\n----radars widget-----\ncockpitradar= databank.getStringValue(\"radar\")\npanelradar = system.createWidgetPanel(\"Radar\")\n\nwidgetValueradar = system.createWidget(panelradar, \"radar\")\ndataValueradar = system.createData(cockpitradar) \nsystem.addDataToWidget(dataValueradar, widgetValueradar)\n\n----radarperiscopes widget-----\ncockpitradarperiscope= databank.getStringValue(\"radarperiscope\")\npanelradarperiscope = system.createWidgetPanel(\"Periscope\")\n\nwidgetValueradarperiscope = system.createWidget(panelradarperiscope, \"periscope\")\ndataValueradarperiscope = system.createData(cockpitradarperiscope) \nsystem.addDataToWidget(dataValueradarperiscope, widgetValueradarperiscope)\n\ncockpitradarperiscope= databank.getStringValue(\"radarperiscope\")\nsystem.updateData(dataValueradarperiscope, cockpitradarperiscope) \n\n----weapons widget-----\ncockpitweapon= databank.getStringValue(\"weapon\")\npanelweapon = system.createWidgetPanel(\"weapon\")\n\nwidgetValueweapon = system.createWidget(panelweapon, \"weapon\")\ndataValueweapon = system.createData(cockpitweapon) \nsystem.addDataToWidget(dataValueweapon, widgetValueweapon)\n\n\n----weapon2s widget-----\ncockpitweapon2= databank.getStringValue(\"weapon2\")\nwidgetValueweapon2 = system.createWidget(panelweapon, \"weapon2\")   ---adds to same panel\ndataValueweapon2 = system.createData(cockpitweapon2) \nsystem.addDataToWidget(dataValueweapon2, widgetValueweapon)\n\n\nunit.hide()\nunit.setTimer(\"pbcp\",0.08)\n","filter":{"args":[],"signature":"start()","slotKey":"-1"},"key":"0"},{"code":"cockpit= databank.getStringValue(\"cockpit\")\nsystem.updateData(dataValuemain, cockpit) \ncockpitatmo= databank.getStringValue(\"atmofueltank\")\nsystem.updateData(dataValueatmo, cockpitatmo) \ncockpitatmo= databank.getStringValue(\"spacefueltank\")\nsystem.updateData(dataValueatmo, cockpitspace) \ncockpitradar= databank.getStringValue(\"radar\")\nsystem.updateData(dataValueradar, cockpitradar) \n\ncockpitweapon= databank.getStringValue(\"weapon\")\nsystem.updateData(dataValueweapon, cockpitweapon) \ncockpitweapon2= databank.getStringValue(\"weapon2\")\nsystem.updateData(dataValueweapon2, cockpitweapon2) ","filter":{"args":[{"value":"pbcp"}],"signature":"tick(timerId)","slotKey":"-1"},"key":"1"}],"methods":[],"events":[]}

     

  6. ----Edits

    09/27      Changed math from U.S. tons to tonnes.  907.185 -> 1000
    10/07      Updated svg bootstrap and ADDED MasterOfAll's Newer Version.


    NEW VERSION MADE BY
    MasterOfAll  
    dualuniverse_2020-10-07t21h05m53s.png
    Features
    Time till Destination   = TTD
    Displays Destination that was chosen.
    Does Speed displayed as Velocity
    Comes with Sleek White Buttons.

    Pasteable Form Here Just Paste to PB and Link Screen and Core.

    {"slots":{"0":{"name":"screen","type":{"events":[],"methods":[]}},"1":{"name":"core","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":"MapScreenMouseX = x\nMapScreenMouseY = y\nMapScreenMouseDown = false\nlocal buttonNo = evaluateButtons()\nif MapScreenButtonSelected > 0 and MapScreenButtonSelected == buttonNo then\n    onButtonUp(buttonNo)\n    onClick(buttonNo)\nend\nMapScreenButtonSelected = -buttonNo","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"mouseUp(x,y)","slotKey":"0"},"key":"0"},{"code":"MapScreenMouseX = x\nMapScreenMouseY = y\nMapScreenMouseDown = true\nMapScreenButtonSelected = evaluateButtons()\nonButtonDown(MapScreenButtonSelected)\n","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"mouseDown(x,y)","slotKey":"0"},"key":"1"},{"code":"function Atlas()\n        return {\n    [0] = {\n      [1]={\n        GM=6930729684,\n        bodyId=1,\n        center={x=17465536.000,y=22665536.000,z=-34464.000},\n        name='Madis',\n        planetarySystemId=0,\n        radius=44300\n      },\n      [2]={\n        GM=157470826617,\n        bodyId=2,\n        center={x=-8.000,y=-8.000,z=-126303.000},\n        name='Alioth',\n        planetarySystemId=0,\n        radius=126068\n      },\n      [3]={\n        GM=11776905000,\n        bodyId=3,\n        center={x=29165536.000,y=10865536.000,z=65536.000},\n        name='Thades',\n        planetarySystemId=0,\n        radius=49000\n      },\n      [4]={\n        GM=14893847582,\n        bodyId=4,\n        center={x=-13234464.000,y=55765536.000,z=465536.000},\n        name='Talemai',\n        planetarySystemId=0,\n        radius=57450\n      },\n      [5]={\n        GM=16951680000,\n        bodyId=5,\n        center={x=-43534464.000,y=22565536.000,z=-48934464.000},\n        name='Feli',\n        planetarySystemId=0,\n        radius=60000\n      },\n      [6]={\n        GM=10502547741,\n        bodyId=6,\n        center={x=52765536.000,y=27165538.000,z=52065535.000},\n        name='Sicari',\n        planetarySystemId=0,\n        radius=51100\n      },\n      [7]={\n        GM=13033380591,\n        bodyId=7,\n        center={x=58665538.000,y=29665535.000,z=58165535.000},\n        name='Sinnen',\n        planetarySystemId=0,\n        radius=54950\n      },\n      [8]={\n        GM=18477723600,\n        bodyId=8,\n        center={x=80865538.000,y=54665536.000,z=-934463.940},\n        name='Teoma',\n        planetarySystemId=0,\n        radius=62000\n      },\n      [9]={\n        GM=18606274330,\n        bodyId=9,\n        center={x=-94134462.000,y=12765534.000,z=-3634464.000},\n        name='Jago',\n        planetarySystemId=0,\n        radius=61590\n      },\n      [10]={\n        GM=78480000,\n        bodyId=10,\n        center={x=17448118.224,y=22966846.286,z=143078.820},\n        name='Madis Moon 1',\n        planetarySystemId=0,\n        radius=10000\n      },\n      [11]={\n        GM=237402000,\n        bodyId=11,\n        center={x=17194626.000,y=22243633.880,z=-214962.810},\n        name='Madis Moon 2',\n        planetarySystemId=0,\n        radius=11000\n      },\n      [12]={\n        GM=265046609,\n        bodyId=12,\n        center={x=17520614.000,y=22184730.000,z=-309989.990},\n        name='Madis Moon 3',\n        planetarySystemId=0,\n        radius=15005\n      },\n      [21]={\n        GM=2118960000,\n        bodyId=21,\n        center={x=457933.000,y=-1509011.000,z=115524.000},\n        name='Alioth Moon 1',\n        planetarySystemId=0,\n        radius=30000\n      },\n      [22]={\n        GM=2165833514,\n        bodyId=22,\n        center={x=-1692694.000,y=729681.000,z=-411464.000},\n        name='Alioth Moon 4',\n        planetarySystemId=0,\n        radius=30330\n      },\n      [26]={\n        GM=68234043600,\n        bodyId=26,\n        center={x=-1404835.000,y=562655.000,z=-285074.000},\n        name='Sanctuary',\n        planetarySystemId=0,\n        radius=83400\n      },\n      [30]={\n        GM=211564034,\n        bodyId=30,\n        center={x=29214402.000,y=10907080.695,z=433858.200},\n        name='Thades Moon 1',\n        planetarySystemId=0,\n        radius=14002\n      },\n      [31]={\n        GM=264870000,\n        bodyId=31,\n        center={x=29404193.000,y=10432768.000,z=19554.131},\n        name='Thades Moon 2',\n        planetarySystemId=0,\n        radius=15000\n      },\n      [40]={\n        GM=141264000,\n        bodyId=40,\n        center={x=-13503090.000,y=55594325.000,z=769838.640},\n        name='Talemai Moon 2',\n        planetarySystemId=0,\n        radius=12000\n      },\n      [41]={\n        GM=106830900,\n        bodyId=41,\n        center={x=-12800515.000,y=55700259.000,z=325207.840},\n        name='Talemai Moon 3',\n        planetarySystemId=0,\n        radius=11000\n      },\n      [42]={\n        GM=264870000,\n        bodyId=42,\n        center={x=-13058408.000,y=55781856.000,z=740177.760},\n        name='Talemai Moon 1',\n        planetarySystemId=0,\n        radius=15000\n      },\n      [50]={\n        GM=499917600,\n        bodyId=50,\n        center={x=-43902841.780,y=22261034.700,z=-48862386.000},\n        name='Feli Moon 1',\n        planetarySystemId=0,\n        radius=14000\n      },\n      [70]={\n        GM=396912600,\n        bodyId=70,\n        center={x=58969616.000,y=29797945.000,z=57969449.000},\n        name='Sinnen Moon 1',\n        planetarySystemId=0,\n        radius=17000\n      },\n      [100]={\n        GM=13975172474,\n        bodyId=100,\n        center={x=98865536.000,y=-13534464.000,z=-934461.990},\n        name='Lacobus',\n        planetarySystemId=0,\n        radius=55650\n      },\n      [101]={\n        GM=264870000,\n        bodyId=101,\n        center={x=98905288.170,y=-13950921.100,z=-647589.530},\n        name='Lacobus Moon 3',\n        planetarySystemId=0,\n        radius=15000\n      },\n      [102]={\n        GM=444981600,\n        bodyId=102,\n        center={x=99180968.000,y=-13783862.000,z=-926156.400},\n        name='Lacobus Moon 1',\n        planetarySystemId=0,\n        radius=18000\n      },\n      [103]={\n        GM=211503600,\n        bodyId=103,\n        center={x=99250052.000,y=-13629215.000,z=-1059341.400},\n        name='Lacobus Moon 2',\n        planetarySystemId=0,\n        radius=14000\n      },\n      [110]={\n        GM=9204742375,\n        bodyId=110,\n        center={x=14165536.000,y=-85634465.000,z=-934464.300},\n        name='Symeon',\n        planetarySystemId=0,\n        radius=49050\n      },\n      [120]={\n        GM=7135606629,\n        bodyId=120,\n        center={x=2865536.700,y=-99034464.000,z=-934462.020},\n        name='Ion',\n        planetarySystemId=0,\n        radius=44950\n      },\n      [121]={\n        GM=106830900,\n        bodyId=121,\n        center={x=2472916.800,y=-99133747.000,z=-1133582.800},\n        name='Ion Moon 1',\n        planetarySystemId=0,\n        radius=11000\n      },\n      [122]={\n        GM=176580000,\n        bodyId=122,\n        center={x=2995424.500,y=-99275010.000,z=-1378480.700},\n        name='Ion Moon 2',\n        planetarySystemId=0,\n        radius=15000\n      }\n     }\n    }\n    end\nfunction PlanetRef()\n--[[\n  Provide coordinate transforms and access to kinematic related parameters\n  Author: JayleBreak\n  Usage (unit.start):\n  PlanetaryReference = require('planetref')\n  galaxyReference = PlanetaryReference(referenceTableSource)\n  helios = galaxyReference[0] -- PlanetaryReference.PlanetarySystem instance\n  alioth = helios[2]          -- PlanetaryReference.BodyParameters instance\n  Methods:\n    PlanetaryReference:getPlanetarySystem - based on planetary system ID.\n    PlanetaryReference.isMapPosition - 'true' if an instance of 'MapPosition'\n    PlanetaryReference.createBodyParameters - for entry into reference table\n    PlanetaryReference.BodyParameters - a class containing a body's information.\n    PlanetaryReference.MapPosition - a class for map coordinates\n    PlanetaryReference.PlanetarySystem - a container for planetary system info.\n    PlanetarySystem:castIntersections - from a position in a given direction.\n    PlanetarySystem:closestBody - to the specified coordinates.\n    PlanetarySystem:convertToBodyIdAndWorldCoordinates - from map coordinates.\n    PlanetarySystem:getBodyParameters - from reference table.\n    PlanetarySystem:getPlanetarySystemId - for the instance.\n    BodyParameters:convertToWorldCoordinates - from map coordinates\n    BodyParameters:convertToMapPosition - from world coordinates\n    BodyParameters:getAltitude - of world coordinates\n    BodyParameters:getDistance - from center to world coordinates\n    BodyParameters:getGravity - at a given position in world coordinates.\n  Description\n  An instance of the 'PlanetaryReference' \"class\" can contain transform and\n  kinematic reference information for all planetary systems in DualUniverse.\n  Each planetary system is identified by a numeric identifier. Currently,\n  the only planetary system, Helios, has the identifier: zero. This \"class\"\n  supports the indexing ('[]') operation which is equivalent to the\n  use of the 'getPlanetarySystem' method. It also supports the 'pairs()'\n  method for iterating over planetary systems.\n\n  An instance of the 'PlanetarySystem' \"class\" contains all reference\n  information for a specific system. It supports the indexing ('[]') and\n  'pairs()' functions which allows iteration over each \"body\" in the\n  system where the key is the numeric body ID. It also supports the\n  'tostring()' method.\n  An instance of the 'BodyParameters' \"class\" contains all reference\n  information for a single celestial \"body\" (a moon or planet). It supports\n  the 'tostring()' method, and contains the data members:\n          planetarySystemId - numeric planetary system ID\n          bodyId            - numeric body ID\n          radius            - radius of the body in meters (zero altitude)\n          center            - world coordinates of the body's center position\n          GM                - the gravitation parameter (g = GM/radius^2)\n  Note that the user is allowed to add custom fields (e.g. body name), but\n  should insure that complex table values have the '__tostring' metamethod\n  implemented.\n  Transform and Kinematics:\n  \"World\" coordinates is a cartesian coordinate system with an origin at an\n  arbitrary fixed point in a planetary system and with distances measured in\n  meters. The coordinates are expressible either as a simple table of 3 values\n  or an instance of the 'vec3' class.  In either case, the planetary system\n  identity is implicit.\n  \"Map\" coordinates is a geographic coordinate system with an origin at the\n  center of an identified (by a numeric value) celestial body which is a\n  member of an identified (also a numeric value) planetary system. Note that\n  the convention that latitude, longitude, and altitude values will be the\n  position's x, y, and z world coordinates in the special case of body ID 0.\n  The kinematic parameters in the reference data permit calculations of the\n  gravitational attraction of the celestial body on other objects.\n  Reference Data:\n  This is an example of reference data with a single entry assigned to\n  planetary system ID 0, and body ID 2 ('Alioth'):\n    referenceTable = {\n          [0] = { [2] = { planetarySystemId = 0,\n                          bodyId = 2,\n                          radius = 126068,\n                          center = vec3({x=-8, y=-8, z=-126303}),\n                          GM = 1.572199+11 } -- as in F=-GMm/r^2\n          }\n      }\n    ref=PlanetaryReference(referenceTable)\n  Collecting Reference Data:\n  A combination of information from the \"Map\" screen in the DU user interface,\n  and values reported by the DU Lua API can be the source of the reference\n  table's data (planetarySystemId, bodyId, and surfaceArea is from the user\n  interface):\n    referenceTable = {}\n    referenceTable[planetarySystemId][bodyId] =\n         PlanetaryReference.createBodyParameters(planetarySystemId,\n                                                 bodyId,\n                                                 surfaceArea,\n                                                 core.getConstructWorldPos(),\n                                                 core.getWorldVertical(),\n                                                 core.getAltitude(),\n                                                 core.g())\n  Adapting Data Sources:\n  Other sources of data can be adapted or converted. An example of adapting a\n  table, defined in the file: 'planets.lua', containing information on a single\n  planetary system and using celestial body name as the key follows (note that\n  a 'name' field is added to the BodyParameters instance transparently after\n  construction, and the '__pairs' meta function is required to support the\n  'closestBody' and '__tostring' methods):\n    ref=PlanetaryReference(\n        {[0] = setmetatable(require('planets'),\n                        { __index = function(bodies, bodyId)\n                             for _,v in pairs(bodies) do\n                                 if v and v.bodyId == bodyId then return v end\n                             end\n                             return nil\n                           end,\n                         __pairs = function(bodies)\n                             return function(t, k)\n                                     local nk, nv = next(t, k)\n                                     if nv then\n                                         local GM = nv.gravity * nv.radius^2\n                                         local bp = BodyParameters(0,\n                                                                   nv.id,\n                                                                   nv.radius,\n                                                                   nv.pos,\n                                                                   GM)\n                                         bp.name = nk\n                                         return nk, bp\n                                    end\n                                    return nk, nv\n                                 end, bodies, nil\n                           end })\n    })\n\n  Converting Data Sources:\n  An instance of 'PlanetaryReference' that has been adapted to a data source\n  can be used to convert that source to simple table. For example,\n  using the adapted instance shown above:\n    load('convertedData=' .. tostring(ref))()\n    newRef=PlanetaryReference(convertedData)\n  Also See: kepler.lua\n  ]]--\n--[[                    START OF LOCAL IMPLEMENTATION DETAILS             ]]--\n-- Type checks\nlocal function isNumber(n)  return type(n)           == 'number' end\nlocal function isSNumber(n) return type(tonumber(n)) == 'number' end\nlocal function isTable(t)   return type(t)           == 'table'  end\nlocal function isString(s)  return type(s)           == 'string' end\nlocal function isVector(v)  return isTable(v)\n                                    and isNumber(v.x and v.y and v.z) end\nlocal function isMapPosition(m) return isTable(m) and isNumber(m.latitude  and\n                                                               m.longitude and\n                                                               m.altitude  and\n                                                               m.bodyId    and\n                                                               m.systemId) end\n-- Constants\nlocal deg2rad    = math.pi/180\nlocal rad2deg    = 180/math.pi\nlocal epsilon    = 1e-10\nlocal num        = ' *([+-]?%d+%.?%d*e?[+-]?%d*)'\nlocal posPattern = '::pos{' .. num .. ',' .. num .. ',' ..  num .. ',' ..\n                   num ..  ',' .. num .. '}'\n-- Utilities\nlocal utils  = require('cpml.utils')\nlocal vec3   = require('cpml.vec3')\nlocal clamp  = utils.clamp\nlocal function float_eq(a,b)\n    if a == 0 then return math.abs(b) < 1e-09 end\n    if b == 0 then return math.abs(a) < 1e-09 end\n    return math.abs(a - b) < math.max(math.abs(a),math.abs(b))*epsilon\nend\nlocal function formatNumber(n)\n    local result = string.gsub(\n                    string.reverse(string.format('%.4f',n)),\n                    '^0*%.?','')\n    return result == '' and '0' or string.reverse(result)\nend\nlocal function formatValue(obj)\n    if isVector(obj) then\n        return string.format('{x=%.3f,y=%.3f,z=%.3f}', obj.x, obj.y, obj.z)\n    end\n    if isTable(obj) and not getmetatable(obj) then\n        local list = {}\n        local nxt  = next(obj)\n        if type(nxt) == 'nil' or nxt == 1 then -- assume this is an array\n            list = obj\n        else\n            for k,v in pairs(obj) do\n                local value = formatValue(v)\n                if type(k) == 'number' then\n                    table.insert(list, string.format('[%s]=%s', k, value))\n                else\n                    table.insert(list, string.format('%s=%s',   k, value))\n                end\n            end\n        end\n        return string.format('{%s}', table.concat(list, ','))\n    end\n    if isString(obj) then\n        return string.format(\"'%s'\", obj:gsub(\"'\",[[\\']]))\n    end\n    return tostring(obj)\nend\n-- CLASSES\n-- BodyParameters: Attributes of planetary bodies (planets and moons)\nlocal BodyParameters = {}\nBodyParameters.__index = BodyParameters\nBodyParameters.__tostring =\n    function(obj, indent)\n        local sep = indent or ''\n        local keys = {}\n        for k in pairs(obj) do table.insert(keys, k) end\n        table.sort(keys)\n        local list = {}\n        for _, k in ipairs(keys) do\n            local value = formatValue(obj[k])\n            if type(k) == 'number' then\n                table.insert(list, string.format('[%s]=%s', k, value))\n            else\n                table.insert(list, string.format('%s=%s', k, value))\n            end\n        end\n        if indent then\n            return string.format('%s%s',\n                                 indent,\n                                 table.concat(list, ',\\n' .. indent))\n        end\n        return string.format('{%s}', table.concat(list, ','))\n    end\nBodyParameters.__eq = function(lhs, rhs)\n        return lhs.planetarySystemId == rhs.planetarySystemId and\n               lhs.bodyId            == rhs.bodyId            and\n               float_eq(lhs.radius, rhs.radius)               and\n               float_eq(lhs.center.x, rhs.center.x)           and\n               float_eq(lhs.center.y, rhs.center.y)           and\n               float_eq(lhs.center.z, rhs.center.z)           and\n               float_eq(lhs.GM, rhs.GM)\n    end\nlocal function mkBodyParameters(systemId, bodyId, radius, worldCoordinates, GM)\n    -- 'worldCoordinates' can be either table or vec3\n    assert(isSNumber(systemId),\n           'Argument 1 (planetarySystemId) must be a number:' .. type(systemId))\n    assert(isSNumber(bodyId),\n           'Argument 2 (bodyId) must be a number:' .. type(bodyId))\n    assert(isSNumber(radius),\n           'Argument 3 (radius) must be a number:' .. type(radius))\n    assert(isTable(worldCoordinates),\n           'Argument 4 (worldCoordinates) must be a array or vec3.' ..\n           type(worldCoordinates))\n    assert(isSNumber(GM),\n           'Argument 5 (GM) must be a number:' .. type(GM))\n    return setmetatable({planetarySystemId = tonumber(systemId),\n                         bodyId            = tonumber(bodyId),\n                         radius            = tonumber(radius),\n                         center            = vec3(worldCoordinates),\n                         GM                = tonumber(GM) }, BodyParameters)\nend\n-- MapPosition: Geographical coordinates of a point on a planetary body.\nlocal MapPosition = {}\nMapPosition.__index = MapPosition\nMapPosition.__tostring = function(p)\n        return string.format('::pos{%d,%d,%s,%s,%s}',\n                             p.systemId,\n                             p.bodyId,\n                             formatNumber(p.latitude*rad2deg),\n                             formatNumber(p.longitude*rad2deg),\n                             formatNumber(p.altitude))\n    end\nMapPosition.__eq       = function(lhs, rhs)\n        return lhs.bodyId   == rhs.bodyId              and\n               lhs.systemId == rhs.systemId            and\n               float_eq(lhs.latitude,   rhs.latitude)  and\n               float_eq(lhs.altitude,   rhs.altitude)  and\n               (float_eq(lhs.longitude, rhs.longitude) or\n                float_eq(lhs.latitude, math.pi/2)      or\n                float_eq(lhs.latitude, -math.pi/2))\n    end\n-- latitude and longitude are in degrees while altitude is in meters\nlocal function mkMapPosition(overload, bodyId, latitude, longitude, altitude)\n    local systemId = overload -- Id or '::pos{...}' string\n    if isString(overload) and not longitude and not altitude and\n                              not bodyId    and not latitude then\n        systemId, bodyId, latitude, longitude, altitude =\n                                            string.match(overload, posPattern)\n        assert(systemId, 'Argument 1 (position string) is malformed.')\n    else\n        assert(isSNumber(systemId),\n               'Argument 1 (systemId) must be a number:' .. type(systemId))\n        assert(isSNumber(bodyId),\n               'Argument 2 (bodyId) must be a number:' .. type(bodyId))\n        assert(isSNumber(latitude),\n               'Argument 3 (latitude) must be in degrees:' .. type(latitude))\n        assert(isSNumber(longitude),\n               'Argument 4 (longitude) must be in degrees:' .. type(longitude))\n        assert(isSNumber(altitude),\n               'Argument 5 (altitude) must be in meters:' .. type(altitude))\n    end\n    systemId  = tonumber(systemId)\n    bodyId    = tonumber(bodyId)\n    latitude  = tonumber(latitude)\n    longitude = tonumber(longitude)\n    altitude  = tonumber(altitude)\n    if bodyId == 0 then -- this is a hack to represent points in space\n        return setmetatable({latitude  = latitude,\n                             longitude = longitude,\n                             altitude  = altitude,\n                             bodyId    = bodyId,\n                             systemId  = systemId}, MapPosition)\n    end\n    return setmetatable({latitude  = deg2rad*clamp(latitude, -90, 90),\n                         longitude = deg2rad*(longitude % 360),\n                         altitude  = altitude,\n                         bodyId    = bodyId,\n                         systemId  = systemId}, MapPosition)\nend\n-- PlanetarySystem - map body IDs to BodyParameters\nlocal PlanetarySystem = {}\nPlanetarySystem.__index = PlanetarySystem\nPlanetarySystem.__tostring =\n    function (obj, indent)\n        local sep = indent and (indent .. '  ' )\n        local bdylist = {}\n        local keys = {}\n        for k in pairs(obj) do table.insert(keys, k) end\n        table.sort(keys)\n        for _, bi in ipairs(keys) do\n            bdy = obj[bi]\n            local bdys = BodyParameters.__tostring(bdy, sep)\n            if indent then\n                table.insert(bdylist,\n                             string.format('[%s]={\\n%s\\n%s}',\n                                           bi, bdys, indent))\n            else\n                table.insert(bdylist, string.format('  [%s]=%s', bi, bdys))\n            end\n        end\n        if indent then\n            return string.format('\\n%s%s%s',\n                                 indent,\n                                 table.concat(bdylist, ',\\n' .. indent),\n                                 indent)\n        end\n        return string.format('{\\n%s\\n}', table.concat(bdylist, ',\\n'))\n    end\nlocal function mkPlanetarySystem(referenceTable)\n    local atlas = {}\n    local pid\n    for _, v in pairs(referenceTable) do\n        local id = v.planetarySystemId\n        if type(id) ~= 'number' then\n            error('Invalid planetary system ID: ' .. tostring(id))\n        elseif pid and id ~= pid then\n            error('Mismatch planetary system IDs: ' .. id .. ' and '\n                  .. pid)\n        end\n        local bid = v.bodyId\n        if type(bid) ~= 'number' then\n            error('Invalid body ID: ' .. tostring(bid))\n        elseif atlas[bid] then\n            error('Duplicate body ID: ' .. tostring(bid))\n        end\n        setmetatable(v.center, getmetatable(vec3.unit_x))\n        atlas[bid] = setmetatable(v, BodyParameters)\n        pid = id\n    end\n    return setmetatable(atlas, PlanetarySystem)\nend\n-- PlanetaryReference - map planetary system ID to PlanetarySystem\nPlanetaryReference = {}\nlocal function mkPlanetaryReference(referenceTable)\n    return setmetatable({ galaxyAtlas = referenceTable or {} },\n                          PlanetaryReference)\nend\nPlanetaryReference.__index        =\n    function(t,i)\n        if type(i) == 'number' then\n            local system = t.galaxyAtlas[i]\n            return mkPlanetarySystem(system)\n        end\n        return rawget(PlanetaryReference, i)\n    end\nPlanetaryReference.__pairs        =\n    function(obj)\n        return  function(t, k)\n                    local nk, nv = next(t, k)\n                    return nk, nv and mkPlanetarySystem(nv)\n                end, obj.galaxyAtlas, nil\n    end\nPlanetaryReference.__tostring     =\n    function (obj)\n        local pslist = {}\n        for _,ps in pairs(obj or {}) do\n            local psi = ps:getPlanetarySystemId()\n            local pss = PlanetarySystem.__tostring(ps, '    ')\n            table.insert(pslist,\n                         string.format('  [%s]={%s\\n  }', psi, pss))\n        end\n        return string.format('{\\n%s\\n}\\n', table.concat(pslist,',\\n'))\n    end\n--[[                       START OF PUBLIC INTERFACE                       ]]--\n-- PlanetaryReference CLASS METHODS:\n--\n-- BodyParameters - create an instance of BodyParameters class\n-- planetarySystemId  [in]: the body's planetary system ID.\n-- bodyId             [in]: the body's ID.\n-- radius             [in]: the radius in meters of the planetary body.\n-- bodyCenter         [in]: the world coordinates of the center (vec3 or table).\n-- GM                 [in]: the body's standard gravitational parameter.\n-- return: an instance of BodyParameters class.\n--\nPlanetaryReference.BodyParameters = mkBodyParameters\n--\n-- MapPosition - create an instance of the MapPosition class\n-- overload [in]: either a planetary system ID or a position string ('::pos...')\n-- bodyId [in]:   (ignored if overload is a position string) the body's ID.\n-- latitude [in]: (ignored if overload is a position string) the latitude.\n-- longitude [in]:(ignored if overload is a position string) the longitude.\n-- altitude [in]: (ignored if overload is a position string) the altitude.\n-- return: the class instance\n--\nPlanetaryReference.MapPosition    = mkMapPosition\n--\n-- PlanetarySystem - create an instance of PlanetarySystem class\n-- referenceData [in]: a table (indexed by bodyId) of body reference info.\n-- return: the class instance\n--\nPlanetaryReference.PlanetarySystem = mkPlanetarySystem\n--\n-- createBodyParameters - create an instance of BodyParameters class\n-- planetarySystemId  [in]: the body's planetary system ID.\n-- bodyId             [in]: the body's ID.\n-- surfaceArea        [in]: the body's surface area in square meters.\n-- aPosition          [in]: world coordinates of a position near the body.\n-- verticalAtPosition [in]: a vector pointing towards the body center.\n-- altitudeAtPosition [in]: the altitude in meters at the position.\n-- gravityAtPosition  [in]: the magnitude of the gravitational acceleration.\n-- return: an instance of BodyParameters class.\n--\nfunction PlanetaryReference.createBodyParameters(planetarySystemId,\n                                                 bodyId,\n                                                 surfaceArea,\n                                                 aPosition,\n                                                 verticalAtPosition,\n                                                 altitudeAtPosition,\n                                                 gravityAtPosition)\n    assert(isSNumber(planetarySystemId),\n           'Argument 1 (planetarySystemId) must be a number:' ..\n           type(planetarySystemId))\n    assert(isSNumber(bodyId),\n           'Argument 2 (bodyId) must be a number:' .. type(bodyId))\n    assert(isSNumber(surfaceArea),\n           'Argument 3 (surfaceArea) must be a number:' .. type(surfaceArea))\n    assert(isTable(aPosition),\n           'Argument 4 (aPosition) must be an array or vec3:' ..\n           type(aPosition))\n    assert(isTable(verticalAtPosition),\n           'Argument 5 (verticalAtPosition) must be an array or vec3:' ..\n           type(verticalAtPosition))\n    assert(isSNumber(altitudeAtPosition),\n           'Argument 6 (altitude) must be in meters:' ..\n           type(altitudeAtPosition))\n    assert(isSNumber(gravityAtPosition),\n           'Argument 7 (gravityAtPosition) must be number:' ..\n           type(gravityAtPosition))\n    local radius   = math.sqrt(surfaceArea/4/math.pi)\n    local distance = radius + altitudeAtPosition\n    local center   = vec3(aPosition) + distance*vec3(verticalAtPosition)\n    local GM       = gravityAtPosition * distance * distance\n    return mkBodyParameters(planetarySystemId, bodyId, radius, center, GM)\nend\n--\n-- isMapPosition - check for the presence of the 'MapPosition' fields\n-- valueToTest [in]: the value to be checked\n-- return: 'true' if all required fields are present in the input value\n--\nPlanetaryReference.isMapPosition  = isMapPosition\n-- PlanetaryReference INSTANCE METHODS:\n--\n-- getPlanetarySystem - get the planetary system using ID or MapPosition as key\n-- overload [in]: either the planetary system ID or a MapPosition that has it.\n-- return: instance of 'PlanetarySystem' class or nil on error\n--\nfunction PlanetaryReference:getPlanetarySystem(overload)\n    --if galaxyAtlas then\n        local planetarySystemId = overload\n        if isMapPosition(overload) then\n            planetarySystemId = overload.systemId\n        end\n        if type(planetarySystemId) == 'number' then\n            local system = self.galaxyAtlas[i]\n            if system then\n                if getmetatable(nv) ~= PlanetarySystem then\n                    system = mkPlanetarySystem(system)\n                end\n                return system\n            end\n        end\n    --end\n    --return nil\nend\n-- PlanetarySystem INSTANCE METHODS:\n--\n-- castIntersections - Find the closest body that intersects a \"ray cast\".\n-- origin [in]: the origin of the \"ray cast\" in world coordinates\n-- direction [in]: the direction of the \"ray cast\" as a 'vec3' instance.\n-- sizeCalculator [in]: (default: returns 1.05*radius) Returns size given body.\n-- bodyIds[in]: (default: all IDs in system) check only the given IDs.\n-- return: The closest body that blocks the cast or 'nil' if none.\n--\nfunction PlanetarySystem:castIntersections(origin,\n                                           direction,\n                                           sizeCalculator,\n                                           bodyIds)\n    local sizeCalculator = sizeCalculator or\n                            function (body) return 1.05*body.radius end\n    local candidates = {}\n    if bodyIds then\n        for _,i in ipairs(bodyIds) do candidates[i] = self[i] end\n    else\n        bodyIds = {}\n        for k,body in pairs(self) do\n            table.insert(bodyIds, k)\n            candidates[k] = body\n        end\n    end\n    local function compare(b1,b2)\n        local v1 = candidates[b1].center - origin\n        local v2 = candidates[b2].center - origin\n        return v1:len() < v2:len()\n    end\n    table.sort(bodyIds, compare)\n    local dir = direction:normalize()\n    for i, id in ipairs(bodyIds) do\n        local body   = candidates[id]\n        local c_oV3  = body.center - origin\n        local radius = sizeCalculator(body)\n        local dot    = c_oV3:dot(dir)\n        local desc   = dot^2 - (c_oV3:len2() - radius^2)\n        if desc >= 0 then\n            local root     = math.sqrt(desc)\n            local farSide  = dot + root\n            local nearSide = dot - root\n            if nearSide > 0 then\n                return body, farSide, nearSide\n            elseif farSide > 0 then\n                return body, farSide, nil\n            end\n        end\n    end\n    return nil, nil, nil\nend\n--\n-- closestBody - find the closest body to a given set of world coordinates\n-- coordinates       [in]: the world coordinates of position in space\n-- return: an instance of the BodyParameters object closest to 'coordinates'\n--\nfunction PlanetarySystem:closestBody(coordinates)\n    assert(type(coordinates) == 'table', 'Invalid coordinates.')\n    local minDistance2, body\n    local coord = vec3(coordinates)\n    for _,params in pairs(self) do\n        local distance2 = (params.center - coord):len2()\n        if not body or distance2 < minDistance2 then\n            body         = params\n            minDistance2 = distance2\n        end\n    end\n    return body\nend\n--\n-- convertToBodyIdAndWorldCoordinates - map to body Id and world coordinates\n-- overload [in]: an instance of MapPosition or a position string ('::pos...)\n-- return: a vec3 instance containing the world coordinates or 'nil' on error.\n--\nfunction PlanetarySystem:convertToBodyIdAndWorldCoordinates(overload)\n    local mapPosition = overload\n    if isString(overload) then\n        mapPosition = mkMapPosition(overload)\n    end\n    if mapPosition.bodyId == 0 then\n        return 0, vec3(mapPosition.latitude,\n                       mapPosition.longitude,\n                       mapPosition.altitude)\n    end\n    local params = self:getBodyParameters(mapPosition)\n    if params then\n        return mapPosition.bodyId,\n               params:convertToWorldCoordinates(mapPosition)\n    end\nend\n--\n-- getBodyParameters - get or create an instance of BodyParameters class\n-- overload [in]: either an instance of MapPosition or a body's ID.\n-- return: a BodyParameters instance or 'nil' if body ID is not found.\n--\nfunction PlanetarySystem:getBodyParameters(overload)\n    local bodyId = overload\n    if isMapPosition(overload) then\n        bodyId = overload.bodyId\n    end\n    assert(isSNumber(bodyId),\n               'Argument 1 (bodyId) must be a number:' .. type(bodyId))\n    return self[bodyId]\nend\n--\n-- getPlanetarySystemId - get the planetary system ID for this instance\n-- return: the planetary system ID or nil if no planets are in the system.\n--\nfunction PlanetarySystem:getPlanetarySystemId()\n    local k, v = next(self)\n    return v and v.planetarySystemId\nend\n-- BodyParameters INSTANCE METHODS:\n--\n-- convertToMapPosition - create an instance of MapPosition from coordinates\n-- worldCoordinates [in]: the world coordinates of the map position.\n-- return: an instance of MapPosition class\n--\nfunction BodyParameters:convertToMapPosition(worldCoordinates)\n    assert(isTable(worldCoordinates),\n           'Argument 1 (worldCoordinates) must be an array or vec3:' ..\n           type(worldCoordinates))\n    local worldVec  = vec3(worldCoordinates)\n    if self.bodyId == 0 then\n        return setmetatable({latitude  = worldVec.x,\n                             longitude = worldVec.y,\n                             altitude  = worldVec.z,\n                             bodyId    = 0,\n                             systemId  = self.planetarySystemId}, MapPosition)\n    end\n    local coords    = worldVec - self.center\n    local distance  = coords:len()\n    local altitude  = distance - self.radius\n    local latitude  = 0\n    local longitude = 0\n    if not float_eq(distance, 0) then\n        local phi = math.atan(coords.y, coords.x)\n        longitude = phi >= 0 and phi or (2*math.pi + phi)\n        latitude  = math.pi/2 - math.acos(coords.z/distance)\n    end\n    return setmetatable({latitude  = latitude,\n                         longitude = longitude,\n                         altitude  = altitude,\n                         bodyId    = self.bodyId,\n                         systemId  = self.planetarySystemId}, MapPosition)\nend\n--\n-- convertToWorldCoordinates - convert a map position to world coordinates\n-- overload [in]: an instance of MapPosition or a position string ('::pos...')\n--\nfunction BodyParameters:convertToWorldCoordinates(overload)\n    local mapPosition = isString(overload) and\n                                           mkMapPosition(overload) or overload\n    if mapPosition.bodyId == 0 then -- support deep space map position\n        return vec3(mapPosition.latitude,\n                    mapPosition.longitude,\n                    mapPosition.altitude)\n    end\n    assert(isMapPosition(mapPosition),\n           'Argument 1 (mapPosition) is not an instance of \"MapPosition\".')\n    assert(mapPosition.systemId == self.planetarySystemId,\n           'Argument 1 (mapPosition) has a different planetary system ID.')\n    assert(mapPosition.bodyId == self.bodyId,\n           'Argument 1 (mapPosition) has a different planetary body ID.')\n    local xproj = math.cos(mapPosition.latitude)\n    return self.center + (self.radius + mapPosition.altitude) *\n           vec3(xproj*math.cos(mapPosition.longitude),\n                xproj*math.sin(mapPosition.longitude),\n                math.sin(mapPosition.latitude))\nend\n--\n-- getAltitude - calculate the altitude of a point given in world coordinates.\n-- worldCoordinates [in]: the world coordinates of the point.\n-- return: the altitude in meters\n--\nfunction BodyParameters:getAltitude(worldCoordinates)\n    return (vec3(worldCoordinates) - self.center):len() - self.radius\nend\n--\n-- getDistance - calculate the distance to a point given in world coordinates.\n-- worldCoordinates [in]: the world coordinates of the point.\n-- return: the distance in meters\n--\nfunction BodyParameters:getDistance(worldCoordinates)\n    return (vec3(worldCoordinates) - self.center):len()\nend\n--\n-- getGravity - calculate the gravity vector induced by the body.\n-- worldCoordinates [in]: the world coordinates of the point.\n-- return: the gravity vector in meter/seconds^2\n--\nfunction BodyParameters:getGravity(worldCoordinates)\n    local radial = self.center - vec3(worldCoordinates) -- directed towards body\n    local len2   = radial:len2()\n    return (self.GM/len2) * radial/math.sqrt(len2)\nend\n-- end of module\nreturn setmetatable(PlanetaryReference,\n                    { __call = function(_,...)\n                                    return mkPlanetaryReference(...)\n                               end })\nend\nfunction Keplers()\n    --[[\n  Provides methods for computing orbital information for an object\n  Usage:\n  Kepler = require('autoconf.custom.kepler')\n  alioth = Kepler({ GM=157470826617,\n                    bodyId=2,\n                    center={x=-8.000,y=-8.000,z=-126303.000},\n                    name='Alioth',\n                    planetarySystemId=0,\n                    radius=126068\n                  })\n  altitude = 6000\n  position = '::pos{0,2,0,0,6000}'\n  e, o     = alioth:escapeAndOrbitalSpeed(altitude)\n  orbit    = alioth:orbitalParameters(position, {0, o+1, 0})\n  print(\"Eccentricity \" .. orbit.eccentricity)\n  print(\"Perihelion \" .. orbit.periapsis.altitude)\n  print(\"Max. speed \" .. orbit.periapsis.speed)\n  print(\"Circular orbit speed \" .. orbit.periapsis.circularOrbitSpeed)\n  print(\"Aphelion \"  .. orbit.apoapsis.altitude)\n  print(\"Min. speed \" .. orbit.apoapsis.speed)\n  print(\"Orbital period \" .. orbit.period)\n  --- output:\n    Eccentricity 0.0018324307017878\n    Perihelion 6000.0\n    Max. speed 1092.9462297033\n    Circular orbit speed 1091.9462297033\n    Aphelion 6484.8994605062\n    Min. speed 1088.9480596194\n    Orbital period 762.02818214049\n  Methods:\n    Kepler:escapeAndOrbitalSpeed - for a given celestial body and altitude.\n    Kepler:orbitalParameters - for a given massless object and a celestial body.\n  Description\n  The motion of an object in the vicinity of substantially larger mass is\n  in the domain of the \"2-body problem\". By assuming the object whose motion\n  is of interest is of negligable mass simplifies the calculations of:\n  the speed to escape the body, the speed of a circular orbit, and the\n  parameters defining the orbit of the object (or the lack of orbit as the\n  case may be).\n  Orbital Parameters:\n     periapsis - the closest approach to the planet\n      apoapsis - the furthest point from the planet if in orbit (otherwise nil)\n  eccentricity - 0 for circular orbits\n                <1 for elliptical orbits\n                 1 for parabiolic trajectory\n                >1 for hyperbolic trajectory\n        period - time (in seconds) to complete an orbit\n  Also See: planetref.lua\n]]--\nlocal vec3       = require('cpml.vec3')\nlocal PlanetRef  = PlanetRef()\nlocal function isString(s) return type(s)   == 'string' end\nlocal function isTable(t)  return type(t)   == 'table'  end\nlocal function float_eq(a,b)\n    if a == 0 then return math.abs(b) < 1e-09 end\n    if b == 0 then return math.abs(a) < 1e-09 end\n    return math.abs(a - b) < math.max(math.abs(a),math.abs(b))*epsilon\nend\nKepler = {}\nKepler.__index = Kepler\n--\n-- escapeAndOrbitalSpeed - speed required to escape and for a circular orbit\n-- altitude [in]: the height of the orbit in meters above \"sea-level\"\n-- return: the speed in m/s needed to escape the celestial body and to orbit it.\n--\nfunction Kepler:escapeAndOrbitalSpeed(altitude)\n    assert(self.body)\n    -- P = -GMm/r and KE = mv^2/2 (no lorentz factor used)\n    -- mv^2/2 = GMm/r\n    -- v^2 = 2GM/r\n    -- v = sqrt(2GM/r1)\n    local distance = altitude + self.body.radius\n    if not float_eq(distance, 0) then\n        local orbit = math.sqrt(self.body.GM/distance)\n        return math.sqrt(2)*orbit, orbit\n    end\n    return nil, nil\nend\n--\n-- orbitalParameters: determine the orbital elements for a two-body system.\n-- overload [in]: the world coordinates or map coordinates of a massless object.\n-- velocity [in]: The velocity of the massless point object in m/s.\n-- return: the 6 orbital elements for the massless object.\n--\nfunction Kepler:orbitalParameters(overload, velocity)\n    assert(self.body)\n    assert(isTable(overload) or isString(overload))\n    assert(isTable(velocity))\n    local pos = (isString(overload) or PlanetRef.isMapPosition(overload)) and\n                            self.body:convertToWorldCoordinates(overload) or\n                vec3(overload)\n    local v   = vec3(velocity)\n    local r   = pos - self.body.center\n    local v2  = v:len2()\n    local d   = r:len()\n    local mu  = self.body.GM\n    local e   = ((v2 - mu/d)*r - r:dot(v)*v)/mu\n    local a   = mu/(2*mu/d - v2)\n    local ecc = e:len()\n    local dir = e:normalize()\n    local pd  = a*(1-ecc)\n    local ad  = a*(1+ecc)\n    local per = pd*dir + self.body.center\n    local apo = ecc <= 1 and -ad*dir + self.body.center or nil\n    local trm = math.sqrt(a*mu*(1-ecc*ecc))\n    local Period = apo and 2*math.pi*math.sqrt(a^3/mu)\n    -- These are great and all, but, I need more.\n    local trueAnomaly = math.acos((e:dot(r))/(ecc*d))\n    if r:dot(v) < 0 then\n        trueAnomaly = -(trueAnomaly - 2*math.pi)\n    end\n    -- Apparently... cos(EccentricAnomaly) = (cos(trueAnomaly) + eccentricity)/(1 + eccentricity * cos(trueAnomaly))\n    local EccentricAnomaly = math.acos((math.cos(trueAnomaly) + ecc)/(1 + ecc * math.cos(trueAnomaly)))\n    -- Then.... apparently if this is below 0, we should add 2pi to it\n    -- I think also if it's below 0, we're past the apoapsis?\n    local timeTau = EccentricAnomaly\n    if timeTau < 0 then\n        timeTau = timeTau + 2*math.pi\n    end\n    -- So... time since periapsis...\n    -- Is apparently easy if you get mean anomly.  t = M/n where n is mean motion, = 2*pi/Period\n\n\n    local MeanAnomaly = timeTau - ecc * math.sin(timeTau)\n    local TimeSincePeriapsis = MeanAnomaly/(2*math.pi/Period)\n    --system.print(MeanAnomaly .. \" - \" .. TimeSincePeriapsis .. \" - \" .. Period .. \" - \" .. EccentricAnomaly .. \" - \" .. timeTau .. \" - \" .. trueAnomaly)\n    -- Mean anom is 0 at periapsis, positive before it... and positive after it.\n    -- I guess this is why I needed to use timeTau and not EccentricAnomaly here\n\n    local TimeToPeriapsis = Period - TimeSincePeriapsis\n    local TimeToApoapsis = TimeToPeriapsis + Period/2\n    if trueAnomaly - math.pi > 0 then -- TBH I think something's wrong in my formulas because I needed this.\n        TimeToPeriapsis = TimeSincePeriapsis\n        TimeToApoapsis = TimeToPeriapsis + Period/2\n    end\n    if TimeToApoapsis > Period then\n        TimeToApoapsis = TimeToApoapsis - Period\n    end\n    return { periapsis       = { position           = per,\n                                 speed              = trm/pd,\n                                 circularOrbitSpeed = math.sqrt(mu/pd),\n                                 altitude           = pd - self.body.radius},\n             apoapsis        = apo and\n                               { position           = apo,\n                                 speed              = trm/ad,\n                                 circularOrbitSpeed = math.sqrt(mu/ad),\n                                 altitude           = ad - self.body.radius},\n             currentVelocity = v,\n             currentPosition = pos,\n             eccentricity    = ecc,\n             period          = Period,\n             eccentricAnomaly = EccentricAnomaly,\n             meanAnomaly = MeanAnomaly,\n             timeToPeriapsis = TimeToPeriapsis,\n             timeToApoapsis = TimeToApoapsis\n           }\nend\n\nlocal function new(bodyParameters)\n    local params = PlanetRef.BodyParameters(bodyParameters.planetarySystemId,\n                                            bodyParameters.bodyId,\n                                            bodyParameters.radius,\n                                            bodyParameters.center,\n                                            bodyParameters.GM)\n    return setmetatable({body = params}, Kepler)\nend\nreturn setmetatable(Kepler, { __call = function(_,...) return new(...) end })\nend\nfunction Kinematics()\n    --[[\n  DualUniverse kinematic equations\n  Author: JayleBreak\n  Usage (unit.start):\n  Kinematics = require('autoconf.custom.kinematics')\n  Methods:\n   computeAccelerationTime - \"relativistic\" version of t = (vf - vi)/a\n   computeDistanceAndTime - Return distance & time needed to reach final speed.\n   computeTravelTime - \"relativistic\" version of t=(sqrt(2ad+v^2)-v)/a\n  Description\n  DualUniverse increases the effective mass of constructs as their absolute\n  speed increases by using the \"lorentz\" factor (from relativity) as the scale\n  factor.  This results in an upper bound on the absolute speed of constructs\n  (excluding \"warp\" drive) that is set to 30 000 KPH (8 333 MPS). This module\n  provides utilities for computing some physical quantities taking this\n  scaling into account.\n]]--\nlocal Kinematic = {} -- just a namespace\nlocal C       = 30000000/3600\nlocal C2      = C*C\nlocal ITERATIONS = 100 -- iterations over engine \"warm-up\" period\nlocal function lorentz(v) return 1/math.sqrt(1 - v*v/C2) end\n--\n-- computeAccelerationTime - \"relativistic\" version of t = (vf - vi)/a\n-- initial      [in]: initial (positive) speed in meters per second.\n-- acceleration [in]: constant acceleration until 'finalSpeed' is reached.\n-- final        [in]: the speed at the end of the time interval.\n-- return: the time in seconds spent in traversing the distance\n--\nfunction Kinematic.computeAccelerationTime(initial, acceleration, final)\n    -- The low speed limit of following is: t=(vf-vi)/a (from: vf=vi+at)\n    local k1 = C*math.asin(initial/C)\n    return (C * math.asin(final/C) - k1)/acceleration\nend\n--\n-- computeDistanceAndTime - Return distance & time needed to reach final speed.\n-- initial[in]:     Initial speed in meters per second.\n-- final[in]:       Final speed in meters per second.\n-- restMass[in]:    Mass of the construct at rest in Kg.\n-- thrust[in]:      Engine's maximum thrust in Newtons.\n-- t50[in]:         (default: 0) Time interval to reach 50% thrust in seconds.\n-- brakeThrust[in]: (default: 0) Constant thrust term when braking.\n-- return: Distance (in meters), time (in seconds) required for change.\n--\nfunction Kinematic.computeDistanceAndTime(initial,\n                                          final,\n                                          restMass,\n                                          thrust,\n                                          t50,\n                                          brakeThrust)\n    -- This function assumes that the applied thrust is colinear with the\n    -- velocity. Furthermore, it does not take into account the influence\n    -- of gravity, not just in terms of its impact on velocity, but also\n    -- its impact on the orientation of thrust relative to velocity.\n    -- These factors will introduce (usually) small errors which grow as\n    -- the length of the trip increases.\n    t50            = t50 or 0\n    brakeThrust    = brakeThrust or 0 -- usually zero when accelerating\n    local tau0     = lorentz(initial)\n    local speedUp  = initial <= final\n    local a0       = thrust * (speedUp and 1 or -1)/restMass\n    local b0       = -brakeThrust/restMass\n    local totA     = a0+b0\n    if speedUp and totA <= 0 or not speedUp and totA >= 0 then\n        return -1, -1 -- no solution\n    end\n    local distanceToMax, timeToMax = 0, 0\n    -- If, the T50 time is set, then assume engine is at zero thrust and will\n    -- reach full thrust in 2*T50 seconds. Thrust curve is given by:\n    -- Thrust: F(z)=(a0*(1+sin(z))+2*b0)/2 where z=pi*(t/t50 - 1)/2\n    -- Acceleration is given by F(z)/m(z) where m(z) = m/sqrt(1-v^2/c^2)\n    -- or v(z)' = (a0*(1+sin(z))+2*b0)*sqrt(1-v(z)^2/c^2)/2\n    if a0 ~= 0 and t50 > 0 then\n        -- Closed form solution for velocity exists:\n        -- v(t) = -c*tan(w)/sqrt(tan(w)^2+1) => w = -asin(v/c)\n        -- w=(pi*t*(a0/2+b0)-a0*t50*sin(pi*t/2/t50)+*pi*c*k1)/pi/c\n        -- @ t=0, v(0) = vi\n        -- pi*c*k1/pi/c = -asin(vi/c)\n        -- k1 = asin(vi/c)\n        local k1  = math.asin(initial/C)\n        local c1  = math.pi*(a0/2+b0)\n        local c2  = a0*t50\n        local c3  = C*math.pi\n        local v = function(t)\n            local w  = (c1*t - c2*math.sin(math.pi*t/2/t50) + c3*k1)/c3\n            local tan = math.tan(w)\n            return C*tan/math.sqrt(tan*tan+1)\n        end\n        local speedchk = speedUp and function(s) return s >= final end or\n                                     function(s) return s <= final end\n        timeToMax  = 2*t50\n        if speedchk(v(timeToMax)) then\n            local lasttime = 0\n            while math.abs(timeToMax - lasttime) > 0.5 do\n                local t = (timeToMax + lasttime)/2\n                if speedchk(v(t)) then\n                    timeToMax = t\n                else\n                    lasttime = t\n                end\n            end\n        end\n        -- There is no closed form solution for distance in this case.\n        -- Numerically integrate for time t=0 to t=2*T50 (or less)\n        local lastv = initial\n        local tinc  = timeToMax/ITERATIONS\n        for step = 1, ITERATIONS do\n            local speed = v(step*tinc)\n            distanceToMax = distanceToMax + (speed+lastv)*tinc/2\n            lastv = speed\n        end\n        if timeToMax < 2*t50 then\n            return distanceToMax, timeToMax\n        end\n        initial     = lastv\n    end\n    -- At full thrust, acceleration only depends on the Lorentz factor:\n    -- v(t)' = (F/m(v)) = a*sqrt(1-v(t)^2/c^2) where a = a0+b0\n    -- -> v = c*sin((at+k1)/c)\n    -- @ t=0, v=vi: k1 = c*asin(vi/c)\n    -- -> t = (c*asin(v/c) - k1)/a\n    -- x(t)' = c*sin((at+k1)/c)\n    -- x = k2 - c^2 cos((at+k1)/c)/a\n    -- @ t=0, x=0: k2 = c^2 * cos(k1/c)/a\n    local k1       = C*math.asin(initial/C)\n    local time     = (C * math.asin(final/C) - k1)/totA\n    local k2       = C2 *math.cos(k1/C)/totA\n    local distance = k2 - C2 * math.cos((totA*time + k1)/C)/totA\n    return distance+distanceToMax, time+timeToMax\nend\n--\n-- computeTravelTime - \"relativistic\" version of t=(sqrt(2ad+v^2)-v)/a\n-- initialSpeed [in]: initial (positive) speed in meters per second\n-- acceleration [in]: constant acceleration until 'distance' is traversed\n-- distance [in]: the distance traveled in meters\n-- return: the time in seconds spent in traversing the distance\n--\nfunction Kinematic.computeTravelTime(initial, acceleration, distance)\n    -- The low speed limit of following is: t=(sqrt(2ad+v^2)-v)/a\n    -- (from: d=vt+at^2/2)\n    if distance == 0 then return 0 end\n    if acceleration > 0 then\n        local k1       = C*math.asin(initial/C)\n        local k2       = C2*math.cos(k1/C)/acceleration\n        return (C*math.acos(acceleration*(k2 - distance)/C2) - k1)/acceleration\n    end\n    assert(initial > 0, 'Acceleration and initial speed are both zero.')\n    return distance/initial\nend\nfunction Kinematic.lorentz(v) return lorentz(v) end\nreturn Kinematic\nend\nPlanetaryReference = PlanetRef()\ngalaxyReference = PlanetaryReference(Atlas())\nKinematic = Kinematics()\nKep = Keplers()\nfunction getDistanceDisplayString(distance)\n    local su = distance > 100000\n    local result = \"\"\n    if su then\n        -- Convert to SU\n        result = round(distance/1000/200,1) .. \" SU\"\n    else\n        -- Convert to KM\n        result = round(distance/1000,1) .. \" KM\"\n    end\n\n    return result\nend\n\nPlanetaryReference = PlanetRef()\ngalaxyReference = PlanetaryReference(Atlas())\n\nMapScreenButtons = {}\nMapScreenMouseX = 0\nMapScreenMouseY = 0\nMapScreenMouseDown = false\nMapScreenButtonSelected = 0\nlocal worldPos = vec3(core.getConstructWorldPos())\nlocal locX = (worldPos.x/400000)\nlocal locY = (worldPos.y/400000)*(-1)\nlocal destX = 0\nlocal destY = 0\nlocal sudistance = 0\nlocal loc = vec3(core.getConstructWorldPos())\nlocal ion = galaxyReference[0][120]  ---uses Atlas functions\nlocal thades = vec3(29165536.000, 10865536.000, 65536.000)\nlocal sinnen = vec3(58665536.000, 29665536.000, 58165536.000)\nlocal alioth = galaxyReference[0][2]    ---uses Atlas functions\nlocal madis = vec3(17465536.000, 22665536.000, -34464.000)\nlocal jago = vec3(-94134464.000, 12765536.000, -3634464.000)\nlocal symeon = vec3(14165536.000, -85634464.000, -934464.000)\nlocal lacobus = vec3(98865536.000, -13534464.000, -934464.000)\nlocal teoma = vec3(80865536.000, 54665536.000, -934464.000)\nlocal feli = vec3(-43534464.000, 22565536.000, -48934464.000)\nlocal talemai = vec3(-13234464.000, 55765536.000, 465536.000)\nlocal sicari = vec3(52765536.000, 27165536.000, 52065536.000)\nlocal distion = math.floor(ion:getDistance(loc)/200000)   ---uses getDistance functions----\nlocal distthades = string.format(\"%.2f\", math.sqrt((loc.x-thades.x)^2+(loc.y-thades.y)^2+(loc.z-thades.z)^2)/200000)\nlocal distalioth = math.floor(alioth:getDistance(loc)/200000)   ---uses getDistance functions----\nlocal distmadis = string.format(\"%.2f\", math.sqrt((loc.x-madis.x)^2+(loc.y-madis.y)^2+(loc.z-madis.z)^2)/200000)\nlocal distjago = string.format(\"%.2f\", math.sqrt((loc.x-jago.x)^2+(loc.y-jago.y)^2+(loc.z-jago.z)^2)/200000)\nlocal distlacobus = string.format(\"%.2f\", math.sqrt((loc.x-lacobus.x)^2+(loc.y-lacobus.y)^2+(loc.z-lacobus.z)^2)/200000)\nlocal distteoma = string.format(\"%.2f\", math.sqrt((loc.x-teoma.x)^2+(loc.y-teoma.y)^2+(loc.z-teoma.z)^2)/200000)\nlocal distsymeon = string.format(\"%.2f\", math.sqrt((loc.x-symeon.x)^2+(loc.y-symeon.y)^2+(loc.z-symeon.z)^2)/200000)\nlocal distfeli = string.format(\"%.2f\", math.sqrt((loc.x-feli.x)^2+(loc.y-feli.y)^2+(loc.z-feli.z)^2)/200000)\nlocal distsinnen = string.format(\"%.2f\", math.sqrt((loc.x-sinnen.x)^2+(loc.y-sinnen.y)^2+(loc.z-sinnen.z)^2)/200000)\nlocal disttalemai = string.format(\"%.2f\", math.sqrt((loc.x-talemai.x)^2+(loc.y-talemai.y)^2+(loc.z-talemai.z)^2)/200000)\nlocal distsicari = string.format(\"%.2f\", math.sqrt((loc.x-sicari.x)^2+(loc.y-sicari.y)^2+(loc.z-sicari.z)^2)/200000)\nselection = 0\n\n\n      for i = 1,1 do\n   local button = {id = (\"b\"..1), enabled=true, td=\"<td>\", top=2/100, bottom=13/100, left=1/100, right=28/100}\n    table.insert(MapScreenButtons, button)\nend\n  for i = 2,2 do\n   local button = {id = (\"b\"..2), enabled=true, td=\"<td>\", top=15/100, bottom=26/100, left=1/100, right=30/100}\n    table.insert(MapScreenButtons, button)\nend\n    for i = 3,3 do\n    local button = {id = (\"b\"..3), enabled=true, td=\"<td>\", top=27/100, bottom=38/100, left=1/100, right=28/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 4,4 do\n    local button = {id = (\"b\"..4), enabled=true, td=\"<td>\", top=39/100, bottom=50/100, left=1/100, right=28/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 5,5 do\n    local button = {id = (\"b\"..5), enabled=true, td=\"<td>\", top=51/100, bottom=62/100, left=1/100, right=28/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 6,6 do\n    local button = {id = (\"b\"..6), enabled=true, td=\"<td>\", top=64/100, bottom=75/100, left=1/100, right=28/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 7,7 do\n    local button = {id = (\"b\"..7), enabled=true, td=\"<td>\", top=2/100, bottom=13/100, left=75/100, right=100/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 8,8 do\n    local button = {id = (\"b\"..8), enabled=true, td=\"<td>\", top=15/100, bottom=26/100, left=75/100, right=100/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 9,9 do\n    local button = {id = (\"b\"..9), enabled=true, td=\"<td>\", top=27/100, bottom=38/100, left=75/100, right=100/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 10,10 do\n    local button = {id = (\"b\"..10), enabled=true, td=\"<td>\", top=39/100, bottom=50/100, left=75/100, right=100/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 11,11 do\n    local button = {id = (\"b\"..11), enabled=true, td=\"<td>\", top=51/100, bottom=62/100, left=75/100, right=100/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 12,12 do\n    local button = {id = (\"b\"..12), enabled=true, td=\"<td>\", top=64/100, bottom=75/100, left=75/100, right=100/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 13,13 do\n    local button = {id = (\"b\"..13), enabled=true, td=\"<td>\", top=90/100, bottom=100/100, left=1/100, right=18/100}\n    table.insert(MapScreenButtons, button)\nend\nfunction evaluateButtons()\n  local selected = 0\n\n  if #MapScreenButtons >= 1 then\n -- Set button styles\n       for i, button in ipairs(MapScreenButtons) do\n            if button.left < MapScreenMouseX and MapScreenMouseX < button.right and button.top < MapScreenMouseY and MapScreenMouseY < button.bottom then\n                if MapScreenMouseDown and MapScreenButtonSelected == i then\n                end\n                selected = i\n            end\n            if not button.enabled then\n            end\n\n        end\n  end\n  return selected\nend\n\nfunction onButtonDown(buttonNo)\n  local button = MapScreenButtons[buttonNo]\n  if not button or not button.enabled then\n\treturn\n  end\nend\nfunction onButtonUp(buttonNo)\n  local button = MapScreenButtons[buttonNo]\n  if not button or not button.enabled then\n    return\n  end\nfunction onClick(buttonNo)\n  local button = MapScreenButtons[buttonNo]\n  if not button or not button.enabled then\n    return\n  end\nend\n\n\n\n  if buttonNo == 1 then\ndestX = 0\ndestY = 0\nselection = 1\nsudistance = distalioth\n  elseif buttonNo == 2 then\ndestX = 43\ndestY = -56\nselection = 2\nsudistance = distmadis\n  elseif buttonNo == 3 then\ndestX = 73\ndestY = -27\nselection = 3\nsudistance = distthades\n  elseif buttonNo == 4 then\ndestX = -33\ndestY = -139\nselection = 4\nsudistance = disttalemai\n  elseif buttonNo == 5 then\ndestX = -109\ndestY = -56\nselection = 5\nsudistance = distfeli\n  elseif buttonNo == 6 then\ndestX = 131\ndestY = -68\nselection = 6\nsudistance = distsicari\n  elseif buttonNo == 7 then\ndestX = 35\ndestY = 214\nselection = 7\nsudistance = distsymeon\n  elseif buttonNo == 8 then\ndestX = 146\ndestY = -74\nselection = 8\nsudistance = distsinnen\n  elseif buttonNo == 9 then\ndestX = -235\ndestY = -32\nselection = 9\nsudistance = distjago\n  elseif buttonNo == 10 then\ndestX = 202\ndestY = -137\nselection = 10\nsudistance = distteoma\n  elseif buttonNo == 11 then\ndestX = 7\ndestY = 247\nselection = 11\nsudistance = distion\n  elseif buttonNo == 12 then\ndestX = 247\ndestY = 34\nselection = 12\nsudistance = distlacobus\n  elseif buttonNo == 13 then\n  unit.exit()\n  end\nend\n\n\nlocal floor = math.floor\nlocal concat = table.concat\n\nlocal secondsInMinute = 60\nlocal secondsInHour = secondsInMinute * 60\nlocal secondsInDay = secondsInHour * 24\nlocal secondsInYear = 365.2419 * secondsInDay\n\nlocal minTotalSecondsToShowOnlyYears = secondsInYear * 10\n\n---@param totalSeconds number\n---@param maxComponents nil|number\nlocal function formatTimeWithUnits (totalSeconds, maxComponents)\n  maxComponents = maxComponents or 2\n\n  local buffer = {}\n\n  if totalSeconds < 0 then\n    buffer[#buffer + 1] = \"-\"\n    totalSeconds = -totalSeconds\n    maxComponents = maxComponents + 1\n  end\n\n  local showOnlyYears = totalSeconds > minTotalSecondsToShowOnlyYears\n\n  local years = floor(totalSeconds / secondsInYear)\n  if years > 0 then buffer[#buffer + 1] = years .. \"y\" end\n\n  if #buffer < maxComponents and not showOnlyYears then\n    local days = floor(totalSeconds % secondsInYear / secondsInDay)\n    if days > 0 then buffer[#buffer + 1] = days .. \"d\" end\n  end\n\n  if #buffer < maxComponents and not showOnlyYears then\n    local hours = floor(totalSeconds % secondsInDay / secondsInHour)\n    if hours > 0 then buffer[#buffer + 1] = hours .. \"h\" end\n  end\n\n  if #buffer < maxComponents and not showOnlyYears then\n    local minutes = floor(totalSeconds % secondsInHour / secondsInMinute)\n    if minutes > 0 then buffer[#buffer + 1] = minutes .. \"m\" end\n  end\n\n  if #buffer < maxComponents and not showOnlyYears then\n    local seconds = floor(totalSeconds % secondsInMinute)\n    if seconds > 0 then buffer[#buffer + 1] = seconds .. \"s\" end\n  end\n\n  if #buffer == 0 then return \"0s\" end\n\n  return concat(buffer, \" \")\n\nend\n\n\n\n\nfunction updateScreen()\n\nloc = vec3(core.getConstructWorldPos())\n\nlocal shipVelocity = vec3(core.getVelocity()):len() * 3.6\nlocal shipAcceleration = vec3(core.getVelocity()):len() * 3.6\nlocal time_to_distance = 0\nlocal display_selection = \"\"\n\nif selection == 1 then\n    alioth = galaxyReference[0][2]    ---uses Atlas functions\n    distalioth = math.floor(alioth:getDistance(loc)/200000)   ---uses getDistance functions----\n    time_to_distance = distalioth * 200 / shipVelocity\n    display_selection = \"alioth\"\nelseif selection == 2 then\n    madis = vec3(17465536.000, 22665536.000, -34464.000)\n    distmadis = string.format(\"%.2f\", math.sqrt((loc.x-madis.x)^2+(loc.y-madis.y)^2+(loc.z-madis.z)^2)/200000)\n    time_to_distance = distmadis * 200 / shipVelocity\n    display_selection = \"madis\"\nelseif selection == 3 then\n    thades = vec3(29165536.000, 10865536.000, 65536.000)\n    distthades = string.format(\"%.2f\", math.sqrt((loc.x-thades.x)^2+(loc.y-thades.y)^2+(loc.z-thades.z)^2)/200000)\n    time_to_distance = distthades * 200 / shipVelocity\n    display_selection = \"thades\"\nelseif selection == 4 then\n    talemai = vec3(-13234464.000, 55765536.000, 465536.000)\n    disttalemai = string.format(\"%.2f\", math.sqrt((loc.x-talemai.x)^2+(loc.y-talemai.y)^2+(loc.z-talemai.z)^2)/200000)\n    time_to_distance = disttalemai * 200 / shipVelocity\n    display_selection = \"talemai\"\nelseif selection == 5 then\n    feli = vec3(-43534464.000, 22565536.000, -48934464.000)\n    distfeli = string.format(\"%.2f\", math.sqrt((loc.x-feli.x)^2+(loc.y-feli.y)^2+(loc.z-feli.z)^2)/200000)\n    time_to_distance = distfeli * 200 / shipVelocity\n    display_selection = \"feli\"\nelseif selection == 6 then\n    sicari = vec3(52765536.000, 27165536.000, 52065536.000)\n    distsicari = string.format(\"%.2f\", math.sqrt((loc.x-sicari.x)^2+(loc.y-sicari.y)^2+(loc.z-sicari.z)^2)/200000)\n    time_to_distance = distsicari * 200 / shipVelocity\n    display_selection = \"sicari\"\nelseif selection == 7 then\n    symeon = vec3(14165536.000, -85634464.000, -934464.000)\n    distsymeon = string.format(\"%.2f\", math.sqrt((loc.x-symeon.x)^2+(loc.y-symeon.y)^2+(loc.z-symeon.z)^2)/200000)\n    time_to_distance = distsymeon * 200 / shipVelocity\n    display_selection = \"symeon\"\nelseif selection == 8 then\n    sinnen = vec3(58665536.000, 29665536.000, 58165536.000)\n    distsinnen = string.format(\"%.2f\", math.sqrt((loc.x-sinnen.x)^2+(loc.y-sinnen.y)^2+(loc.z-sinnen.z)^2)/200000)\n    time_to_distance = distsinnen * 200 / shipVelocity\n    display_selection = \"sinnen\"\nelseif selection == 9 then\n    jago = vec3(-94134464.000, 12765536.000, -3634464.000)\n    distjago = string.format(\"%.2f\", math.sqrt((loc.x-jago.x)^2+(loc.y-jago.y)^2+(loc.z-jago.z)^2)/200000)\n    time_to_distance = distjago * 200 / shipVelocity\n    display_selection = \"jago\"\nelseif selection == 10 then\n    teoma = vec3(80865536.000, 54665536.000, -934464.000)\n    distteoma = string.format(\"%.2f\", math.sqrt((loc.x-teoma.x)^2+(loc.y-teoma.y)^2+(loc.z-teoma.z)^2)/200000)\n    time_to_distance = distteoma * 200 / shipVelocity\n    display_selection = \"teoma\"\nelseif selection == 11 then\n    ion = galaxyReference[0][120]  ---uses Atlas functions\n    distion = math.floor(ion:getDistance(loc)/200000)   ---uses getDistance functions----\n    time_to_distance = distion * 200 / shipVelocity\n    display_selection = \"ion\"\nelseif selection == 12 then\n    lacobus = vec3(98865536.000, -13534464.000, -934464.000)\n    distlacobus = string.format(\"%.2f\", math.sqrt((loc.x-lacobus.x)^2+(loc.y-lacobus.y)^2+(loc.z-lacobus.z)^2)/200000)\n    time_to_distance = distlacobus * 200 / shipVelocity\n    display_selection = \"lacobus\"\nelse\n    time_to_distance = sudistance * 200 / shipVelocity\n    display_selection = \"none\"\nend\nshipVelocity = string.format(\"%.2f\", shipVelocity)\nwarpmath = math.floor(math.floor(core.getConstructMass()/ 1000)  * sudistance * 0.00025)\n\ntime_to_distance_min = time_to_distance * 60\ntime_to_distance_min_sec = time_to_distance_min * 60\n\ntime_to_distance = formatTimeWithUnits (time_to_distance_min_sec, 3)\n\nhtml= ([[\n<svg class=\"bootstrap\" viewBox=\"0 0 1024 1024\" style=\"width:100%; height:100%\">\n\n<circle cx=\"500\" cy=\"500\" r=\"400\" stroke=\"#FFF\" stroke-width=\"3\" transform=\"\"></circle>\n<circle cx=\"500\" cy=\"500\" r=\"350\" stroke=\"#FFF\" stroke-width=\"3\" transform=\"\" stroke-opacity=\"0.2\"></circle>\n<circle cx=\"500\" cy=\"500\" r=\"300\" stroke=\"#FFF\" stroke-width=\"3\" transform=\"\"></circle><circle cx=\"500\" cy=\"500\" r=\"250\" stroke=\"#FFF\" stroke-width=\"3\" transform=\"\" stroke-opacity=\"0.2\"></circle>\n<circle cx=\"500\" cy=\"500\" r=\"200\" stroke=\"#FFF\" stroke-width=\"3\" transform=\"\"></circle><circle cx=\"500\" cy=\"500\" r=\"150\" stroke=\"#FFF\" stroke-width=\"3\" transform=\"\" stroke-opacity=\"0.2\"></circle>\n<circle cx=\"500\" cy=\"500\" r=\"100\" stroke=\"lightblue\" stroke-width=\"3\" transform=\"\"></circle><circle cx=\"500\" cy=\"500\" r=\"50\" stroke=\"lightblue\" stroke-width=\"3\" transform=\"\" stroke-opacity=\"0.2\"></circle>\n<circle cx=\"500\" cy=\"500\" r=\"20\" stroke=\"Orange\" stroke-width=\"2\" transform=\"\"></circle><text x=\"510\" y=\"510\" fill=\"Yellow\">Helios</text>\n<circle cx=\"-0.00\" cy=\"0\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle>\n<text x=\"-0.00\" y=\"0\" transform=\"translate(500,480)\" fill=\"white\" font-size=\"20\">Alioth</text><circle cx=\"7.16\" cy=\"247.59\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle>\n<text x=\"7.16\" y=\"247.59\" transform=\"translate(480,480)\" fill=\"white\" font-size=\"20\">Ion</text><circle cx=\"35.41\" cy=\"214.09\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle>\n<text x=\"35.41\" y=\"214.09\" transform=\"translate(500,480)\" fill=\"white\" font-size=\"20\">Symeon</text><circle cx=\"-33.09\" cy=\"-139.41\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle>\n<text x=\"-33.09\" y=\"-139.41\" transform=\"translate(500,480)\" fill=\"white\" font-size=\"20\">Talemai</text><circle cx=\"202.16\" cy=\"-136.66\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle>\n<text x=\"202.16\" y=\"-136.66\" transform=\"translate(500,480)\" fill=\"white\" font-size=\"20\">Teoma</text><circle cx=\"247.16\" cy=\"33.84\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle>\n<text x=\"247.16\" y=\"33.84\" transform=\"translate(500,480)\" fill=\"white\" font-size=\"20\">Lacobus</text><circle cx=\"-108.84\" cy=\"-56.41\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle>\n<text x=\"-108.84\" y=\"-56.41\" transform=\"translate(500,480)\" fill=\"white\" font-size=\"20\">Feli</text><circle cx=\"72.91\" cy=\"-27.16\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle>\n<text x=\"72.91\" y=\"-27.16\" transform=\"translate(500,485)\" fill=\"white\" font-size=\"20\">Thades</text><circle cx=\"43.66\" cy=\"-56.66\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle>\n<text x=\"43.66\" y=\"-56.66\" transform=\"translate(500,480)\" fill=\"white\" font-size=\"20\">Madis</text><circle cx=\"-235.34\" cy=\"-31.91\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle>\n<text x=\"-235.34\" y=\"-31.91\" transform=\"translate(500,480)\" fill=\"white\" font-size=\"20\">Jago</text><circle cx=\"131.91\" cy=\"-67.91\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle>\n<text x=\"131.91\" y=\"-67.91\" transform=\"translate(475,480)\" fill=\"white\" font-size=\"20\">Sicari</text><circle cx=\"146.66\" cy=\"-74.16\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle>\n<text x=\"146.66\" y=\"-74.16\" transform=\"translate(515,480)\" fill=\"white\" font-size=\"20\">Sinnen</text>\n<line stroke-linecap=\"undefined\" stroke-linejoin=\"undefined\" id=\"svg_1\" y2=\"]]..destY..[[\" x2=\"]]..destX..[[\" y1=\"]]..locY..[[\" x1=\"]]..locX..[[\" transform=\"translate(500,500)\" stroke-width=\"5\" stroke=\"#ff0000\" fill=\"none\"/>\n<circle cx=\"]]..locX..[[\" cy=\"]]..locY..[[\" r=\"3\" stroke=\"black\" stroke-width=\"1\" fill=\"limegreen\" transform=\"translate(500,500)\"></circle>\n<text x=\"]]..locX..[[\" y=\"]]..locY..[[\" transform=\"translate(500,500)\"\nfill=\"limegreen\" font-size= \"4.5vh\" font-weight= \"bold\">//SHIP POSITION</text>\n</svg>\n<svg class=\"bootstrap\" viewBox=\"0 0 1024 612\" style=\"width:100%; height:100%\">\n\n <g>\n  <title>Layer 1</title>\n  <g id=\"svg_24\">\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_8\" y=\"70\" x=\"55\" stroke-width=\"0\" fill=\"Yellow\">Alioth  :]]..distalioth..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_14\" y=\"170\" x=\"55\" stroke-width=\"0\" fill=\"Yellow\">Madis  :]]..distmadis..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_17\" y=\"270\" x=\"55\" stroke-width=\"0\" fill=\"Yellow\">Thades  :]]..distthades..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_20\" y=\"370\" x=\"55\" stroke-width=\"0\" fill=\"Yellow\">Talemai  :]]..disttalemai..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_23\" y=\"470\" x=\"55\" stroke-width=\"0\" fill=\"Yellow\">Feli  :]]..distfeli..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_26\" y=\"570\" x=\"55\" stroke-width=\"0\" fill=\"Yellow\">Sicari  :]]..distsicari..[[ SU</text>\n   <g id=\"svg_12\">\n    <rect rx=\"10\" id=\"svg_1\" height=\"50\" width=\"250\" y=\"30\" x=\"15\" stroke-width=\"10\" stroke=\"#FFF\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_3\" height=\"50\" width=\"250\" y=\"105\" x=\"15\" stroke-width=\"10\" stroke=\"#FFF\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_7\" height=\"50\" width=\"250\" y=\"180\" x=\"15\" stroke-width=\"10\" stroke=\"#FFF\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_9\" height=\"50\" width=\"250\" y=\"255\" x=\"15\" stroke-width=\"10\" stroke=\"#FFF\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_10\" height=\"50\" width=\"250\" y=\"330\" x=\"15\" stroke-width=\"10\" stroke=\"#FFF\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_11\" height=\"50\" width=\"250\" y=\"405\" x=\"15\" stroke-width=\"10\" stroke=\"#FFF\" fill=\"none\"/>\n   </g>\n  </g>\n  <g id=\"svg_40\">\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_25\" y=\"70\" x=\"997.163642\" stroke-width=\"0\" fill=\"Yellow\">Symeon  :]]..distsymeon..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_27\" y=\"170\" x=\"997.163642\" stroke-width=\"0\" fill=\"Yellow\">Sinnen  :]]..distsinnen..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_28\" y=\"270\" x=\"997.163642\" stroke-width=\"0\" fill=\"Yellow\">Jago  :]]..distjago..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_30\" y=\"370\" x=\"997.163642\" stroke-width=\"0\" fill=\"Yellow\">Teoma  :]]..distteoma..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_31\" y=\"470\" x=\"997.163642\" stroke-width=\"0\" fill=\"Yellow\">Ion  :]]..distion..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_32\" y=\"570\" x=\"997.163642\" stroke-width=\"0\" fill=\"Yellow\">Lacobus  :]]..distlacobus..[[ SU</text>\n   <g id=\"svg_39\">\n    <rect rx=\"10\" id=\"svg_33\" height=\"50\" width=\"250\" y=\"30\" x=\"760\" stroke-width=\"10\" stroke=\"#FFF\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_34\" height=\"50\" width=\"250\" y=\"105\" x=\"760\" stroke-width=\"10\" stroke=\"#FFF\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_35\" height=\"50\" width=\"250\" y=\"180\" x=\"760\" stroke-width=\"10\" stroke=\"#FFF\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_36\" height=\"50\" width=\"250\" y=\"255\" x=\"760\" stroke-width=\"10\" stroke=\"#FFF\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_37\" height=\"50\" width=\"250\" y=\"330\" x=\"760\" stroke-width=\"10\" stroke=\"#FFF\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_38\" height=\"50\" width=\"250\" y=\"405\" x=\"760\" stroke-width=\"10\" stroke=\"#FFF\" fill=\"none\"/>\n   </g>\n  </g>\n </g>\n  <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" id=\"svg_32\" y=\"700\" x=\"20\" stroke-width=\"0\" fill=\"LightBlue\">Est. Warp Cost: ]]..warpmath..[[</text>\n  <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" id=\"svg_32\" y=\"750\" x=\"20\" stroke-width=\"0\" fill=\"LightBlue\">Construct Weight: ]]..math.floor(core.getConstructMass()/ 1000)..[[ tons</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" id=\"svg_32\" y=\"700\" x=\"500\" stroke-width=\"0\" fill=\"LightBlue\">TTD: ]]..time_to_distance..[[ </text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" id=\"svg_32\" y=\"750\" x=\"500\" stroke-width=\"0\" fill=\"LightBlue\">VELOC: ]]..shipVelocity..[[ km/h</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" id=\"svg_32\" y=\"700\" x=\"900\" stroke-width=\"0\" fill=\"LightBlue\">DEST: ]]..display_selection..[[ </text>\n\n</svg>\n\n    ]])\n\nscreen.setHTML(html)\n--screen2.setHTML(html)\nend\nunit.setTimer(\"spacemap\",.08)\n\n","filter":{"args":[],"signature":"start()","slotKey":"-1"},"key":"2"},{"code":"updateScreen()","filter":{"args":[{"value":"spacemap"}],"signature":"tick(timerId)","slotKey":"-1"},"key":"3"}],"methods":[],"events":[]}





    ----Older Version In Multiple formats for Learning Purposes. DU IT :)
    Space Map with Warp Calculation

    Credits to All of DU Lua Community


    Requirements:
    1 Dynamic Construct
    1 Screen
    1 Program Board

    Link Screen then Core

    Two Versions are available and do the same thing.

    One uses variables and math with some built in functions from Lua to get the values.
    One uses Functions from JayleBreak's atlas and functions to get the values.

     


    *KNOWN BUGS*

    ----On fresh login, Core has to be ran one time to send Construct weight data over the server, otherwise math will be wrong.
    So sit down in pilot seat one time and then run programming board. After that its always set. ---Server Bug


    ----Currently has Bug with Screen Flickers on half of the svg during setHTML redraw update-- 9/23 Patch

     

     


    Planets are organized similar to DU ingame map and are stationary svg.
    ---------- Math and Variables Version---------

    ---Space Map
    ---Unit Start
    MapScreenButtons = {}
    MapScreenMouseX = 0
    MapScreenMouseY = 0
    MapScreenMouseDown = false
    MapScreenButtonSelected = 0
    
    
    
    local worldPos = vec3(core.getConstructWorldPos())
    local locX = (worldPos.x/400000)
    local locY = (worldPos.y/400000)*(-1)
    local destX = 0
    local destY = 0
    local sudistance = 0
    local loc = vec3(core.getConstructWorldPos())
    local ion = vec3(2865536.000, -99034464.000, -934464.000)
    local thades = vec3(29165536.000, 10865536.000, 65536.000)
    local sinnen = vec3(58665536.000, 29665536.000, 58165536.000)
    local alioth = vec3(-8.000, -8.000, -126303.000)
    local madis = vec3(17465536.000, 22665536.000, -34464.000)
    local jago = vec3(-94134464.000, 12765536.000, -3634464.000)
    local symeon = vec3(14165536.000, -85634464.000, -934464.000)
    local lacobus = vec3(98865536.000, -13534464.000, -934464.000)
    local teoma = vec3(80865536.000, 54665536.000, -934464.000)
    local feli = vec3(-43534464.000, 22565536.000, -48934464.000)
    local talemai = vec3(-13234464.000, 55765536.000, 465536.000)
    local sicari = vec3(52765536.000, 27165536.000, 52065536.000)
    local distion = string.format("%.2f", math.sqrt((loc.x-ion.x)^2+(loc.y-ion.y)^2+(loc.z-ion.z)^2)/200000)
    local distthades = string.format("%.2f", math.sqrt((loc.x-thades.x)^2+(loc.y-thades.y)^2+(loc.z-thades.z)^2)/200000)
    local distalioth = string.format("%.2f", math.sqrt((loc.x-alioth.x)^2+(loc.y-alioth.y)^2+(loc.z-alioth.z)^2)/200000)
    local distmadis = string.format("%.2f", math.sqrt((loc.x-madis.x)^2+(loc.y-madis.y)^2+(loc.z-madis.z)^2)/200000)
    local distjago = string.format("%.2f", math.sqrt((loc.x-jago.x)^2+(loc.y-jago.y)^2+(loc.z-jago.z)^2)/200000)
    local distlacobus = string.format("%.2f", math.sqrt((loc.x-lacobus.x)^2+(loc.y-lacobus.y)^2+(loc.z-lacobus.z)^2)/200000)
    local distteoma = string.format("%.2f", math.sqrt((loc.x-teoma.x)^2+(loc.y-teoma.y)^2+(loc.z-teoma.z)^2)/200000)
    local distsymeon = string.format("%.2f", math.sqrt((loc.x-symeon.x)^2+(loc.y-symeon.y)^2+(loc.z-symeon.z)^2)/200000)
    local distfeli = string.format("%.2f", math.sqrt((loc.x-feli.x)^2+(loc.y-feli.y)^2+(loc.z-feli.z)^2)/200000)
    local distsinnen = string.format("%.2f", math.sqrt((loc.x-sinnen.x)^2+(loc.y-sinnen.y)^2+(loc.z-sinnen.z)^2)/200000)
    local disttalemai = string.format("%.2f", math.sqrt((loc.x-talemai.x)^2+(loc.y-talemai.y)^2+(loc.z-talemai.z)^2)/200000)
    local distsicari = string.format("%.2f", math.sqrt((loc.x-sicari.x)^2+(loc.y-sicari.y)^2+(loc.z-sicari.z)^2)/200000)
    
    
    
          for i = 1,1 do
       local button = {id = ("b"..1), enabled=true, td="<td>", top=2/100, bottom=13/100, left=1/100, right=28/100}
        table.insert(MapScreenButtons, button)
    end
      for i = 2,2 do
       local button = {id = ("b"..2), enabled=true, td="<td>", top=15/100, bottom=26/100, left=1/100, right=30/100}
        table.insert(MapScreenButtons, button)
    end
        for i = 3,3 do
        local button = {id = ("b"..3), enabled=true, td="<td>", top=27/100, bottom=38/100, left=1/100, right=28/100}
          table.insert(MapScreenButtons, button)
    end
        for i = 4,4 do   
        local button = {id = ("b"..4), enabled=true, td="<td>", top=39/100, bottom=50/100, left=1/100, right=28/100}
          table.insert(MapScreenButtons, button)
    end
        for i = 5,5 do   
        local button = {id = ("b"..5), enabled=true, td="<td>", top=51/100, bottom=62/100, left=1/100, right=28/100}
          table.insert(MapScreenButtons, button)
    end
        for i = 6,6 do   
        local button = {id = ("b"..6), enabled=true, td="<td>", top=64/100, bottom=75/100, left=1/100, right=28/100}
          table.insert(MapScreenButtons, button)
    end
        for i = 7,7 do   
        local button = {id = ("b"..7), enabled=true, td="<td>", top=2/100, bottom=13/100, left=75/100, right=100/100}
          table.insert(MapScreenButtons, button)
    end
        for i = 8,8 do   
        local button = {id = ("b"..8), enabled=true, td="<td>", top=15/100, bottom=26/100, left=75/100, right=100/100}
          table.insert(MapScreenButtons, button)
    end
        for i = 9,9 do   
        local button = {id = ("b"..9), enabled=true, td="<td>", top=27/100, bottom=38/100, left=75/100, right=100/100}
          table.insert(MapScreenButtons, button)
    end
        for i = 10,10 do   
        local button = {id = ("b"..10), enabled=true, td="<td>", top=39/100, bottom=50/100, left=75/100, right=100/100}
          table.insert(MapScreenButtons, button)
    end
        for i = 11,11 do   
        local button = {id = ("b"..11), enabled=true, td="<td>", top=51/100, bottom=62/100, left=75/100, right=100/100}
          table.insert(MapScreenButtons, button)
    end
        for i = 12,12 do   
        local button = {id = ("b"..12), enabled=true, td="<td>", top=64/100, bottom=75/100, left=75/100, right=100/100}
          table.insert(MapScreenButtons, button)
    end
        for i = 13,13 do   
        local button = {id = ("b"..13), enabled=true, td="<td>", top=90/100, bottom=100/100, left=1/100, right=18/100}
        table.insert(MapScreenButtons, button)
    end
    function evaluateButtons()
      local selected = 0
      
      if #MapScreenButtons >= 1 then
     -- Set button styles
           for i, button in ipairs(MapScreenButtons) do
                if button.left < MapScreenMouseX and MapScreenMouseX < button.right and button.top < MapScreenMouseY and MapScreenMouseY < button.bottom then
                    if MapScreenMouseDown and MapScreenButtonSelected == i then
                    end
                    selected = i
                end
                if not button.enabled then
                end
    
            end
      end
      return selected
    end
    
    function onButtonDown(buttonNo)
      local button = MapScreenButtons[buttonNo]    
      if not button or not button.enabled then
    	return
      end
    end
    function onButtonUp(buttonNo)
      local button = MapScreenButtons[buttonNo]    
      if not button or not button.enabled then
        return
      end
    function onClick(buttonNo)
      local button = MapScreenButtons[buttonNo]    
      if not button or not button.enabled then
        return
      end
    end
      if buttonNo == 1 then
    destX = 0
    destY = 0
    sudistance = distalioth
      elseif buttonNo == 2 then
    destX = 43
    destY = -56
    sudistance = distmadis
      elseif buttonNo == 3 then
    destX = 73
    destY = -27
    sudistance = distthades        
      elseif buttonNo == 4 then
    destX = -33
    destY = -139
    sudistance = disttalemai
      elseif buttonNo == 5 then
    destX = -109
    destY = -56
    sudistance = distfeli        
      elseif buttonNo == 6 then
    destX = 131
    destY = -68
    sudistance = distsicari        
      elseif buttonNo == 7 then
    destX = 35
    destY = 214
    sudistance = distsymeon
      elseif buttonNo == 8 then
    destX = 146
    destY = -74
    sudistance = distsinnen        
      elseif buttonNo == 9 then
    destX = -235
    destY = -32
    sudistance = distjago       
      elseif buttonNo == 10 then
    destX = 202
    destY = -137
    sudistance = distteoma        
      elseif buttonNo == 11 then
    destX = 7
    destY = 247
    sudistance = distion        
      elseif buttonNo == 12 then
    destX = 247
    destY = 34
    sudistance = distlacobus
      elseif buttonNo == 13 then
      unit.exit()
      end
    end
    
    function updateScreen() 
    warpmath = math.floor(math.floor(core.getConstructMass()/ 1000)  * sudistance * 0.00025)
    html= ([[
    <svg class="bootstrap" viewBox="0 0 1024 1024" style="width:100%; height:100%">      
    <circle cx="500" cy="500" r="400" stroke="darkgreen" stroke-width="3" transform=""></circle><circle cx="500" cy="500" r="350" stroke="darkgreen" stroke-width="3" transform="" stroke-opacity="0.2"></circle><circle cx="500" cy="500" r="300" stroke="darkgreen" stroke-width="3" transform=""></circle><circle cx="500" cy="500" r="250" stroke="darkgreen" stroke-width="3" transform="" stroke-opacity="0.2"></circle><circle cx="500" cy="500" r="200" stroke="darkgreen" stroke-width="3" transform=""></circle><circle cx="500" cy="500" r="150" stroke="darkgreen" stroke-width="3" transform="" stroke-opacity="0.2"></circle><circle cx="500" cy="500" r="100" stroke="lightblue" stroke-width="3" transform=""></circle><circle cx="500" cy="500" r="50" stroke="lightblue" stroke-width="3" transform="" stroke-opacity="0.2"></circle><circle cx="500" cy="500" r="20" stroke="Orange" stroke-width="2" transform=""></circle><text x="510" y="510" fill="Yellow">Helios</text><circle cx="-0.00" cy="0" r="10" stroke="black" stroke-width="1" fill="blue" transform="translate(500,500)"></circle><text x="-0.00" y="0" transform="translate(500,480)" fill="white" font-size="20">Alioth</text><circle cx="7.16" cy="247.59" r="10" stroke="black" stroke-width="1" fill="blue" transform="translate(500,500)"></circle><text x="7.16" y="247.59" transform="translate(480,480)" fill="white" font-size="20">Ion</text><circle cx="35.41" cy="214.09" r="10" stroke="black" stroke-width="1" fill="blue" transform="translate(500,500)"></circle><text x="35.41" y="214.09" transform="translate(500,480)" fill="white" font-size="20">Symeon</text><circle cx="-33.09" cy="-139.41" r="10" stroke="black" stroke-width="1" fill="blue" transform="translate(500,500)"></circle><text x="-33.09" y="-139.41" transform="translate(500,480)" fill="white" font-size="20">Talemai</text><circle cx="202.16" cy="-136.66" r="10" stroke="black" stroke-width="1" fill="blue" transform="translate(500,500)"></circle><text x="202.16" y="-136.66" transform="translate(500,480)" fill="white" font-size="20">Teoma</text><circle cx="247.16" cy="33.84" r="10" stroke="black" stroke-width="1" fill="blue" transform="translate(500,500)"></circle><text x="247.16" y="33.84" transform="translate(500,480)" fill="white" font-size="20">Lacobus</text><circle cx="-108.84" cy="-56.41" r="10" stroke="black" stroke-width="1" fill="blue" transform="translate(500,500)"></circle><text x="-108.84" y="-56.41" transform="translate(500,480)" fill="white" font-size="20">Feli</text><circle cx="72.91" cy="-27.16" r="10" stroke="black" stroke-width="1" fill="blue" transform="translate(500,500)"></circle><text x="72.91" y="-27.16" transform="translate(500,485)" fill="white" font-size="20">Thades</text><circle cx="43.66" cy="-56.66" r="10" stroke="black" stroke-width="1" fill="blue" transform="translate(500,500)"></circle><text x="43.66" y="-56.66" transform="translate(500,480)" fill="white" font-size="20">Madis</text><circle cx="-235.34" cy="-31.91" r="10" stroke="black" stroke-width="1" fill="blue" transform="translate(500,500)"></circle><text x="-235.34" y="-31.91" transform="translate(500,480)" fill="white" font-size="20">Jago</text><circle cx="131.91" cy="-67.91" r="10" stroke="black" stroke-width="1" fill="blue" transform="translate(500,500)"></circle><text x="131.91" y="-67.91" transform="translate(475,480)" fill="white" font-size="20">Sicari</text><circle cx="146.66" cy="-74.16" r="10" stroke="black" stroke-width="1" fill="blue" transform="translate(500,500)"></circle><text x="146.66" y="-74.16" transform="translate(515,480)" fill="white" font-size="20">Sinnen</text>
    <line stroke-linecap="undefined" stroke-linejoin="undefined" id="svg_1" y2="]]..destY..[[" x2="]]..destX..[[" y1="]]..locY..[[" x1="]]..locX..[[" transform="translate(500,500)" stroke-width="5" stroke="#ff0000" fill="none"/>        
    <circle cx="]]..locX..[[" cy="]]..locY..[[" r="3" stroke="black" stroke-width="1" fill="limegreen" transform="translate(500,500)"></circle>
    <text x="]]..locX..[[" y="]]..locY..[[" transform="translate(500,500)" 
    fill="limegreen" font-size= "4.5vh" font-weight= "bold">//SHIP POSITION</text>
    </svg>
    <svg class="bootstrap" viewBox="0 0 1024 612" style="width:100%; height:100%">
     <g>
      <title>Layer 1</title>
      <g id="svg_24">
       <text stroke="null" transform="matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="20" id="svg_8" y="70" x="55" stroke-width="0" fill="Yellow">Alioth  :]]..distalioth..[[ SU</text>
       <text stroke="null" transform="matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="20" id="svg_14" y="170" x="55" stroke-width="0" fill="Yellow">Madis  :]]..distmadis..[[ SU</text>
       <text stroke="null" transform="matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="20" id="svg_17" y="270" x="55" stroke-width="0" fill="Yellow">Thades  :]]..distthades..[[ SU</text>
       <text stroke="null" transform="matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="20" id="svg_20" y="370" x="55" stroke-width="0" fill="Yellow">Talemai  :]]..disttalemai..[[ SU</text>
       <text stroke="null" transform="matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="20" id="svg_23" y="470" x="55" stroke-width="0" fill="Yellow">Feli  :]]..distfeli..[[ SU</text>
       <text stroke="null" transform="matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="20" id="svg_26" y="570" x="55" stroke-width="0" fill="Yellow">Sicari  :]]..distsicari..[[ SU</text>
       <g id="svg_12">
        <rect rx="10" id="svg_1" height="50" width="250" y="30" x="15" stroke-width="20" stroke="#00ff00" fill="none"/>
        <rect rx="10" id="svg_3" height="50" width="250" y="105" x="15" stroke-width="20" stroke="#00ff00" fill="none"/>
        <rect rx="10" id="svg_7" height="50" width="250" y="180" x="15" stroke-width="20" stroke="#00ff00" fill="none"/>
        <rect rx="10" id="svg_9" height="50" width="250" y="255" x="15" stroke-width="20" stroke="#00ff00" fill="none"/>
        <rect rx="10" id="svg_10" height="50" width="250" y="330" x="15" stroke-width="20" stroke="#00ff00" fill="none"/>
        <rect rx="10" id="svg_11" height="50" width="250" y="405" x="15" stroke-width="20" stroke="#00ff00" fill="none"/>
       </g>
      </g>
      <g id="svg_40">
       <text stroke="null" transform="matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="20" id="svg_25" y="70" x="997.163642" stroke-width="0" fill="Yellow">Symeon  :]]..distsymeon..[[ SU</text>
       <text stroke="null" transform="matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="20" id="svg_27" y="170" x="997.163642" stroke-width="0" fill="Yellow">Sinnen  :]]..distsinnen..[[ SU</text>
       <text stroke="null" transform="matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="20" id="svg_28" y="270" x="997.163642" stroke-width="0" fill="Yellow">Jago  :]]..distjago..[[ SU</text>
       <text stroke="null" transform="matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="20" id="svg_30" y="370" x="997.163642" stroke-width="0" fill="Yellow">Teoma  :]]..distteoma..[[ SU</text>
       <text stroke="null" transform="matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="20" id="svg_31" y="470" x="997.163642" stroke-width="0" fill="Yellow">Ion  :]]..distion..[[ SU</text>
       <text stroke="null" transform="matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="20" id="svg_32" y="570" x="997.163642" stroke-width="0" fill="Yellow">Lacobus  :]]..distlacobus..[[ SU</text>
       <g id="svg_39">
        <rect rx="10" id="svg_33" height="50" width="250" y="30" x="760" stroke-width="20" stroke="#00ff00" fill="none"/>
        <rect rx="10" id="svg_34" height="50" width="250" y="105" x="760" stroke-width="20" stroke="#00ff00" fill="none"/>
        <rect rx="10" id="svg_35" height="50" width="250" y="180" x="760" stroke-width="20" stroke="#00ff00" fill="none"/>
        <rect rx="10" id="svg_36" height="50" width="250" y="255" x="760" stroke-width="20" stroke="#00ff00" fill="none"/>
        <rect rx="10" id="svg_37" height="50" width="250" y="330" x="760" stroke-width="20" stroke="#00ff00" fill="none"/>
        <rect rx="10" id="svg_38" height="50" width="250" y="405" x="760" stroke-width="20" stroke="#00ff00" fill="none"/>
       </g>
      </g>
     </g>
    <text stroke="null" transform="matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="30" id="svg_32" y="700" x="20" stroke-width="0" fill="LightBlue">Est. Warp Cost: ]]..warpmath..[[</text>
      <text stroke="null" transform="matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="30" id="svg_32" y="750" x="20" stroke-width="0" fill="LightBlue">Construct Weight: ]]..math.floor(core.getConstructMass()/ 1000)..[[ tons</text>
        
    </svg> 
        ]])
    screen.setHTML(html)
    end
    unit.setTimer("spacemap",.08)
    
    
    
    
    
    
    
    ---Unit Tick spacemap
    updateScreen()
    
    ---MouseDown *,*
    MapScreenMouseX = x
    MapScreenMouseY = y
    MapScreenMouseDown = true
    MapScreenButtonSelected = evaluateButtons()
    onButtonDown(MapScreenButtonSelected)
    
    
    ---MouseUp *,*
    MapScreenMouseX = x
    MapScreenMouseY = y
    MapScreenMouseDown = false
    local buttonNo = evaluateButtons()
    if MapScreenButtonSelected > 0 and MapScreenButtonSelected == buttonNo then
        onButtonUp(buttonNo)
        onClick(buttonNo)
    end
    MapScreenButtonSelected = -buttonNo
    

    Json Paste
     

    {"slots":{"0":{"name":"screen","type":{"events":[],"methods":[]}},"1":{"name":"core","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":"MapScreenMouseX = x\nMapScreenMouseY = y\nMapScreenMouseDown = false\nlocal buttonNo = evaluateButtons()\nif MapScreenButtonSelected > 0 and MapScreenButtonSelected == buttonNo then\n    onButtonUp(buttonNo)\n    onClick(buttonNo)\nend\nMapScreenButtonSelected = -buttonNo","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"mouseUp(x,y)","slotKey":"0"},"key":"0"},{"code":"MapScreenMouseX = x\nMapScreenMouseY = y\nMapScreenMouseDown = true\nMapScreenButtonSelected = evaluateButtons()\nonButtonDown(MapScreenButtonSelected)\n","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"mouseDown(x,y)","slotKey":"0"},"key":"1"},{"code":"MapScreenButtons = {}\nMapScreenMouseX = 0\nMapScreenMouseY = 0\nMapScreenMouseDown = false\nMapScreenButtonSelected = 0\n\n\n\nlocal worldPos = vec3(core.getConstructWorldPos())\nlocal locX = (worldPos.x/400000)\nlocal locY = (worldPos.y/400000)*(-1)\nlocal destX = 0\nlocal destY = 0\nlocal sudistance = 0\nlocal loc = vec3(core.getConstructWorldPos())\nlocal ion = vec3(2865536.000, -99034464.000, -934464.000)\nlocal thades = vec3(29165536.000, 10865536.000, 65536.000)\nlocal sinnen = vec3(58665536.000, 29665536.000, 58165536.000)\nlocal alioth = vec3(-8.000, -8.000, -126303.000)\nlocal madis = vec3(17465536.000, 22665536.000, -34464.000)\nlocal jago = vec3(-94134464.000, 12765536.000, -3634464.000)\nlocal symeon = vec3(14165536.000, -85634464.000, -934464.000)\nlocal lacobus = vec3(98865536.000, -13534464.000, -934464.000)\nlocal teoma = vec3(80865536.000, 54665536.000, -934464.000)\nlocal feli = vec3(-43534464.000, 22565536.000, -48934464.000)\nlocal talemai = vec3(-13234464.000, 55765536.000, 465536.000)\nlocal sicari = vec3(52765536.000, 27165536.000, 52065536.000)\nlocal distion = string.format(\"%.2f\", math.sqrt((loc.x-ion.x)^2+(loc.y-ion.y)^2+(loc.z-ion.z)^2)/200000)\nlocal distthades = string.format(\"%.2f\", math.sqrt((loc.x-thades.x)^2+(loc.y-thades.y)^2+(loc.z-thades.z)^2)/200000)\nlocal distalioth = string.format(\"%.2f\", math.sqrt((loc.x-alioth.x)^2+(loc.y-alioth.y)^2+(loc.z-alioth.z)^2)/200000)\nlocal distmadis = string.format(\"%.2f\", math.sqrt((loc.x-madis.x)^2+(loc.y-madis.y)^2+(loc.z-madis.z)^2)/200000)\nlocal distjago = string.format(\"%.2f\", math.sqrt((loc.x-jago.x)^2+(loc.y-jago.y)^2+(loc.z-jago.z)^2)/200000)\nlocal distlacobus = string.format(\"%.2f\", math.sqrt((loc.x-lacobus.x)^2+(loc.y-lacobus.y)^2+(loc.z-lacobus.z)^2)/200000)\nlocal distteoma = string.format(\"%.2f\", math.sqrt((loc.x-teoma.x)^2+(loc.y-teoma.y)^2+(loc.z-teoma.z)^2)/200000)\nlocal distsymeon = string.format(\"%.2f\", math.sqrt((loc.x-symeon.x)^2+(loc.y-symeon.y)^2+(loc.z-symeon.z)^2)/200000)\nlocal distfeli = string.format(\"%.2f\", math.sqrt((loc.x-feli.x)^2+(loc.y-feli.y)^2+(loc.z-feli.z)^2)/200000)\nlocal distsinnen = string.format(\"%.2f\", math.sqrt((loc.x-sinnen.x)^2+(loc.y-sinnen.y)^2+(loc.z-sinnen.z)^2)/200000)\nlocal disttalemai = string.format(\"%.2f\", math.sqrt((loc.x-talemai.x)^2+(loc.y-talemai.y)^2+(loc.z-talemai.z)^2)/200000)\nlocal distsicari = string.format(\"%.2f\", math.sqrt((loc.x-sicari.x)^2+(loc.y-sicari.y)^2+(loc.z-sicari.z)^2)/200000)\n\n\n\n      for i = 1,1 do\n   local button = {id = (\"b\"..1), enabled=true, td=\"<td>\", top=2/100, bottom=13/100, left=1/100, right=28/100}\n    table.insert(MapScreenButtons, button)\nend\n  for i = 2,2 do\n   local button = {id = (\"b\"..2), enabled=true, td=\"<td>\", top=15/100, bottom=26/100, left=1/100, right=30/100}\n    table.insert(MapScreenButtons, button)\nend\n    for i = 3,3 do\n    local button = {id = (\"b\"..3), enabled=true, td=\"<td>\", top=27/100, bottom=38/100, left=1/100, right=28/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 4,4 do   \n    local button = {id = (\"b\"..4), enabled=true, td=\"<td>\", top=39/100, bottom=50/100, left=1/100, right=28/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 5,5 do   \n    local button = {id = (\"b\"..5), enabled=true, td=\"<td>\", top=51/100, bottom=62/100, left=1/100, right=28/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 6,6 do   \n    local button = {id = (\"b\"..6), enabled=true, td=\"<td>\", top=64/100, bottom=75/100, left=1/100, right=28/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 7,7 do   \n    local button = {id = (\"b\"..7), enabled=true, td=\"<td>\", top=2/100, bottom=13/100, left=75/100, right=100/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 8,8 do   \n    local button = {id = (\"b\"..8), enabled=true, td=\"<td>\", top=15/100, bottom=26/100, left=75/100, right=100/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 9,9 do   \n    local button = {id = (\"b\"..9), enabled=true, td=\"<td>\", top=27/100, bottom=38/100, left=75/100, right=100/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 10,10 do   \n    local button = {id = (\"b\"..10), enabled=true, td=\"<td>\", top=39/100, bottom=50/100, left=75/100, right=100/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 11,11 do   \n    local button = {id = (\"b\"..11), enabled=true, td=\"<td>\", top=51/100, bottom=62/100, left=75/100, right=100/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 12,12 do   \n    local button = {id = (\"b\"..12), enabled=true, td=\"<td>\", top=64/100, bottom=75/100, left=75/100, right=100/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 13,13 do   \n    local button = {id = (\"b\"..13), enabled=true, td=\"<td>\", top=90/100, bottom=100/100, left=1/100, right=18/100}\n    table.insert(MapScreenButtons, button)\nend\nfunction evaluateButtons()\n  local selected = 0\n  \n  if #MapScreenButtons >= 1 then\n -- Set button styles\n       for i, button in ipairs(MapScreenButtons) do\n            if button.left < MapScreenMouseX and MapScreenMouseX < button.right and button.top < MapScreenMouseY and MapScreenMouseY < button.bottom then\n                if MapScreenMouseDown and MapScreenButtonSelected == i then\n                end\n                selected = i\n            end\n            if not button.enabled then\n            end\n\n        end\n  end\n  return selected\nend\n\nfunction onButtonDown(buttonNo)\n  local button = MapScreenButtons[buttonNo]    \n  if not button or not button.enabled then\n\treturn\n  end\nend\nfunction onButtonUp(buttonNo)\n  local button = MapScreenButtons[buttonNo]    \n  if not button or not button.enabled then\n    return\n  end\nfunction onClick(buttonNo)\n  local button = MapScreenButtons[buttonNo]    \n  if not button or not button.enabled then\n    return\n  end\nend\n  if buttonNo == 1 then\ndestX = 0\ndestY = 0\nsudistance = distalioth\n  elseif buttonNo == 2 then\ndestX = 43\ndestY = -56\nsudistance = distmadis\n  elseif buttonNo == 3 then\ndestX = 73\ndestY = -27\nsudistance = distthades        \n  elseif buttonNo == 4 then\ndestX = -33\ndestY = -139\nsudistance = disttalemai\n  elseif buttonNo == 5 then\ndestX = -109\ndestY = -56\nsudistance = distfeli        \n  elseif buttonNo == 6 then\ndestX = 131\ndestY = -68\nsudistance = distsicari        \n  elseif buttonNo == 7 then\ndestX = 35\ndestY = 214\nsudistance = distsymeon\n  elseif buttonNo == 8 then\ndestX = 146\ndestY = -74\nsudistance = distsinnen        \n  elseif buttonNo == 9 then\ndestX = -235\ndestY = -32\nsudistance = distjago       \n  elseif buttonNo == 10 then\ndestX = 202\ndestY = -137\nsudistance = distteoma        \n  elseif buttonNo == 11 then\ndestX = 7\ndestY = 247\nsudistance = distion        \n  elseif buttonNo == 12 then\ndestX = 247\ndestY = 34\nsudistance = distlacobus\n  elseif buttonNo == 13 then\n  unit.exit()\n  end\nend\n\nfunction updateScreen() \nwarpmath = math.floor(math.floor(core.getConstructMass()/ 1000)  * sudistance * 0.00025)\nhtml= ([[\n<svg class=\"bootstrap\" viewBox=\"0 0 1024 1024\" style=\"width:100%; height:100%\">      \n<circle cx=\"500\" cy=\"500\" r=\"400\" stroke=\"darkgreen\" stroke-width=\"3\" transform=\"\"></circle><circle cx=\"500\" cy=\"500\" r=\"350\" stroke=\"darkgreen\" stroke-width=\"3\" transform=\"\" stroke-opacity=\"0.2\"></circle><circle cx=\"500\" cy=\"500\" r=\"300\" stroke=\"darkgreen\" stroke-width=\"3\" transform=\"\"></circle><circle cx=\"500\" cy=\"500\" r=\"250\" stroke=\"darkgreen\" stroke-width=\"3\" transform=\"\" stroke-opacity=\"0.2\"></circle><circle cx=\"500\" cy=\"500\" r=\"200\" stroke=\"darkgreen\" stroke-width=\"3\" transform=\"\"></circle><circle cx=\"500\" cy=\"500\" r=\"150\" stroke=\"darkgreen\" stroke-width=\"3\" transform=\"\" stroke-opacity=\"0.2\"></circle><circle cx=\"500\" cy=\"500\" r=\"100\" stroke=\"lightblue\" stroke-width=\"3\" transform=\"\"></circle><circle cx=\"500\" cy=\"500\" r=\"50\" stroke=\"lightblue\" stroke-width=\"3\" transform=\"\" stroke-opacity=\"0.2\"></circle><circle cx=\"500\" cy=\"500\" r=\"20\" stroke=\"Orange\" stroke-width=\"2\" transform=\"\"></circle><text x=\"510\" y=\"510\" fill=\"Yellow\">Helios</text><circle cx=\"-0.00\" cy=\"0\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle><text x=\"-0.00\" y=\"0\" transform=\"translate(500,480)\" fill=\"white\" font-size=\"20\">Alioth</text><circle cx=\"7.16\" cy=\"247.59\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle><text x=\"7.16\" y=\"247.59\" transform=\"translate(480,480)\" fill=\"white\" font-size=\"20\">Ion</text><circle cx=\"35.41\" cy=\"214.09\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle><text x=\"35.41\" y=\"214.09\" transform=\"translate(500,480)\" fill=\"white\" font-size=\"20\">Symeon</text><circle cx=\"-33.09\" cy=\"-139.41\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle><text x=\"-33.09\" y=\"-139.41\" transform=\"translate(500,480)\" fill=\"white\" font-size=\"20\">Talemai</text><circle cx=\"202.16\" cy=\"-136.66\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle><text x=\"202.16\" y=\"-136.66\" transform=\"translate(500,480)\" fill=\"white\" font-size=\"20\">Teoma</text><circle cx=\"247.16\" cy=\"33.84\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle><text x=\"247.16\" y=\"33.84\" transform=\"translate(500,480)\" fill=\"white\" font-size=\"20\">Lacobus</text><circle cx=\"-108.84\" cy=\"-56.41\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle><text x=\"-108.84\" y=\"-56.41\" transform=\"translate(500,480)\" fill=\"white\" font-size=\"20\">Feli</text><circle cx=\"72.91\" cy=\"-27.16\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle><text x=\"72.91\" y=\"-27.16\" transform=\"translate(500,485)\" fill=\"white\" font-size=\"20\">Thades</text><circle cx=\"43.66\" cy=\"-56.66\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle><text x=\"43.66\" y=\"-56.66\" transform=\"translate(500,480)\" fill=\"white\" font-size=\"20\">Madis</text><circle cx=\"-235.34\" cy=\"-31.91\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle><text x=\"-235.34\" y=\"-31.91\" transform=\"translate(500,480)\" fill=\"white\" font-size=\"20\">Jago</text><circle cx=\"131.91\" cy=\"-67.91\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle><text x=\"131.91\" y=\"-67.91\" transform=\"translate(475,480)\" fill=\"white\" font-size=\"20\">Sicari</text><circle cx=\"146.66\" cy=\"-74.16\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle><text x=\"146.66\" y=\"-74.16\" transform=\"translate(515,480)\" fill=\"white\" font-size=\"20\">Sinnen</text>\n<line stroke-linecap=\"undefined\" stroke-linejoin=\"undefined\" id=\"svg_1\" y2=\"]]..destY..[[\" x2=\"]]..destX..[[\" y1=\"]]..locY..[[\" x1=\"]]..locX..[[\" transform=\"translate(500,500)\" stroke-width=\"5\" stroke=\"#ff0000\" fill=\"none\"/>        \n<circle cx=\"]]..locX..[[\" cy=\"]]..locY..[[\" r=\"3\" stroke=\"black\" stroke-width=\"1\" fill=\"limegreen\" transform=\"translate(500,500)\"></circle>\n<text x=\"]]..locX..[[\" y=\"]]..locY..[[\" transform=\"translate(500,500)\" \nfill=\"limegreen\" font-size= \"4.5vh\" font-weight= \"bold\">//SHIP POSITION</text>\n</svg>\n<svg class=\"bootstrap\" viewBox=\"0 0 1024 612\" style=\"width:100%; height:100%\">\n <g>\n  <title>Layer 1</title>\n  <g id=\"svg_24\">\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_8\" y=\"70\" x=\"55\" stroke-width=\"0\" fill=\"Yellow\">Alioth  :]]..distalioth..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_14\" y=\"170\" x=\"55\" stroke-width=\"0\" fill=\"Yellow\">Madis  :]]..distmadis..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_17\" y=\"270\" x=\"55\" stroke-width=\"0\" fill=\"Yellow\">Thades  :]]..distthades..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_20\" y=\"370\" x=\"55\" stroke-width=\"0\" fill=\"Yellow\">Talemai  :]]..disttalemai..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_23\" y=\"470\" x=\"55\" stroke-width=\"0\" fill=\"Yellow\">Feli  :]]..distfeli..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_26\" y=\"570\" x=\"55\" stroke-width=\"0\" fill=\"Yellow\">Sicari  :]]..distsicari..[[ SU</text>\n   <g id=\"svg_12\">\n    <rect rx=\"10\" id=\"svg_1\" height=\"50\" width=\"250\" y=\"30\" x=\"15\" stroke-width=\"20\" stroke=\"#00ff00\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_3\" height=\"50\" width=\"250\" y=\"105\" x=\"15\" stroke-width=\"20\" stroke=\"#00ff00\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_7\" height=\"50\" width=\"250\" y=\"180\" x=\"15\" stroke-width=\"20\" stroke=\"#00ff00\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_9\" height=\"50\" width=\"250\" y=\"255\" x=\"15\" stroke-width=\"20\" stroke=\"#00ff00\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_10\" height=\"50\" width=\"250\" y=\"330\" x=\"15\" stroke-width=\"20\" stroke=\"#00ff00\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_11\" height=\"50\" width=\"250\" y=\"405\" x=\"15\" stroke-width=\"20\" stroke=\"#00ff00\" fill=\"none\"/>\n   </g>\n  </g>\n  <g id=\"svg_40\">\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_25\" y=\"70\" x=\"997.163642\" stroke-width=\"0\" fill=\"Yellow\">Symeon  :]]..distsymeon..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_27\" y=\"170\" x=\"997.163642\" stroke-width=\"0\" fill=\"Yellow\">Sinnen  :]]..distsinnen..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_28\" y=\"270\" x=\"997.163642\" stroke-width=\"0\" fill=\"Yellow\">Jago  :]]..distjago..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_30\" y=\"370\" x=\"997.163642\" stroke-width=\"0\" fill=\"Yellow\">Teoma  :]]..distteoma..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_31\" y=\"470\" x=\"997.163642\" stroke-width=\"0\" fill=\"Yellow\">Ion  :]]..distion..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_32\" y=\"570\" x=\"997.163642\" stroke-width=\"0\" fill=\"Yellow\">Lacobus  :]]..distlacobus..[[ SU</text>\n   <g id=\"svg_39\">\n    <rect rx=\"10\" id=\"svg_33\" height=\"50\" width=\"250\" y=\"30\" x=\"760\" stroke-width=\"20\" stroke=\"#00ff00\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_34\" height=\"50\" width=\"250\" y=\"105\" x=\"760\" stroke-width=\"20\" stroke=\"#00ff00\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_35\" height=\"50\" width=\"250\" y=\"180\" x=\"760\" stroke-width=\"20\" stroke=\"#00ff00\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_36\" height=\"50\" width=\"250\" y=\"255\" x=\"760\" stroke-width=\"20\" stroke=\"#00ff00\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_37\" height=\"50\" width=\"250\" y=\"330\" x=\"760\" stroke-width=\"20\" stroke=\"#00ff00\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_38\" height=\"50\" width=\"250\" y=\"405\" x=\"760\" stroke-width=\"20\" stroke=\"#00ff00\" fill=\"none\"/>\n   </g>\n  </g>\n </g>\n<text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" id=\"svg_32\" y=\"700\" x=\"20\" stroke-width=\"0\" fill=\"LightBlue\">Est. Warp Cost: ]]..warpmath..[[</text>\n  <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" id=\"svg_32\" y=\"750\" x=\"20\" stroke-width=\"0\" fill=\"LightBlue\">Construct Weight: ]]..math.floor(core.getConstructMass()/ 1000)..[[ tons</text>\n    \n</svg> \n    ]])\nscreen.setHTML(html)\nend\nunit.setTimer(\"spacemap\",.08)\n\n","filter":{"args":[],"signature":"start()","slotKey":"-1"},"key":"2"},{"code":"updateScreen()","filter":{"args":[{"value":"spacemap"}],"signature":"tick(timerId)","slotKey":"-1"},"key":"3"}],"methods":[],"events":[]}


    ---------- JayleBreak Atlas and Functions Version---------

    function Atlas()
            return {
        [0] = {
          [1]={
            GM=6930729684,
            bodyId=1,
            center={x=17465536.000,y=22665536.000,z=-34464.000},
            name='Madis',
            planetarySystemId=0,
            radius=44300
          },
          [2]={
            GM=157470826617,
            bodyId=2,
            center={x=-8.000,y=-8.000,z=-126303.000},
            name='Alioth',
            planetarySystemId=0,
            radius=126068
          },
          [3]={
            GM=11776905000,
            bodyId=3,
            center={x=29165536.000,y=10865536.000,z=65536.000},
            name='Thades',
            planetarySystemId=0,
            radius=49000
          },
          [4]={
            GM=14893847582,
            bodyId=4,
            center={x=-13234464.000,y=55765536.000,z=465536.000},
            name='Talemai',
            planetarySystemId=0,
            radius=57450
          },
          [5]={
            GM=16951680000,
            bodyId=5,
            center={x=-43534464.000,y=22565536.000,z=-48934464.000},
            name='Feli',
            planetarySystemId=0,
            radius=60000
          },
          [6]={
            GM=10502547741,
            bodyId=6,
            center={x=52765536.000,y=27165538.000,z=52065535.000},
            name='Sicari',
            planetarySystemId=0,
            radius=51100
          },
          [7]={
            GM=13033380591,
            bodyId=7,
            center={x=58665538.000,y=29665535.000,z=58165535.000},
            name='Sinnen',
            planetarySystemId=0,
            radius=54950
          },
          [8]={
            GM=18477723600,
            bodyId=8,
            center={x=80865538.000,y=54665536.000,z=-934463.940},
            name='Teoma',
            planetarySystemId=0,
            radius=62000
          },
          [9]={
            GM=18606274330,
            bodyId=9,
            center={x=-94134462.000,y=12765534.000,z=-3634464.000},
            name='Jago',
            planetarySystemId=0,
            radius=61590
          },
          [10]={
            GM=78480000,
            bodyId=10,
            center={x=17448118.224,y=22966846.286,z=143078.820},
            name='Madis Moon 1',
            planetarySystemId=0,
            radius=10000
          },
          [11]={
            GM=237402000,
            bodyId=11,
            center={x=17194626.000,y=22243633.880,z=-214962.810},
            name='Madis Moon 2',
            planetarySystemId=0,
            radius=11000
          },
          [12]={
            GM=265046609,
            bodyId=12,
            center={x=17520614.000,y=22184730.000,z=-309989.990},
            name='Madis Moon 3',
            planetarySystemId=0,
            radius=15005
          },
          [21]={
            GM=2118960000,
            bodyId=21,
            center={x=457933.000,y=-1509011.000,z=115524.000},
            name='Alioth Moon 1',
            planetarySystemId=0,
            radius=30000
          },
          [22]={
            GM=2165833514,
            bodyId=22,
            center={x=-1692694.000,y=729681.000,z=-411464.000},
            name='Alioth Moon 4',
            planetarySystemId=0,
            radius=30330
          },
          [26]={
            GM=68234043600,
            bodyId=26,
            center={x=-1404835.000,y=562655.000,z=-285074.000},
            name='Sanctuary',
            planetarySystemId=0,
            radius=83400
          },
          [30]={
            GM=211564034,
            bodyId=30,
            center={x=29214402.000,y=10907080.695,z=433858.200},
            name='Thades Moon 1',
            planetarySystemId=0,
            radius=14002
          },
          [31]={
            GM=264870000,
            bodyId=31,
            center={x=29404193.000,y=10432768.000,z=19554.131},
            name='Thades Moon 2',
            planetarySystemId=0,
            radius=15000
          },
          [40]={
            GM=141264000,
            bodyId=40,
            center={x=-13503090.000,y=55594325.000,z=769838.640},
            name='Talemai Moon 2',
            planetarySystemId=0,
            radius=12000
          },
          [41]={
            GM=106830900,
            bodyId=41,
            center={x=-12800515.000,y=55700259.000,z=325207.840},
            name='Talemai Moon 3',
            planetarySystemId=0,
            radius=11000
          },
          [42]={
            GM=264870000,
            bodyId=42,
            center={x=-13058408.000,y=55781856.000,z=740177.760},
            name='Talemai Moon 1',
            planetarySystemId=0,
            radius=15000
          },
          [50]={
            GM=499917600,
            bodyId=50,
            center={x=-43902841.780,y=22261034.700,z=-48862386.000},
            name='Feli Moon 1',
            planetarySystemId=0,
            radius=14000
          },
          [70]={
            GM=396912600,
            bodyId=70,
            center={x=58969616.000,y=29797945.000,z=57969449.000},
            name='Sinnen Moon 1',
            planetarySystemId=0,
            radius=17000
          },
          [100]={
            GM=13975172474,
            bodyId=100,
            center={x=98865536.000,y=-13534464.000,z=-934461.990},
            name='Lacobus',
            planetarySystemId=0,
            radius=55650
          },
          [101]={
            GM=264870000,
            bodyId=101,
            center={x=98905288.170,y=-13950921.100,z=-647589.530},
            name='Lacobus Moon 3',
            planetarySystemId=0,
            radius=15000
          },
          [102]={
            GM=444981600,
            bodyId=102,
            center={x=99180968.000,y=-13783862.000,z=-926156.400},
            name='Lacobus Moon 1',
            planetarySystemId=0,
            radius=18000
          },
          [103]={
            GM=211503600,
            bodyId=103,
            center={x=99250052.000,y=-13629215.000,z=-1059341.400},
            name='Lacobus Moon 2',
            planetarySystemId=0,
            radius=14000
          },
          [110]={
            GM=9204742375,
            bodyId=110,
            center={x=14165536.000,y=-85634465.000,z=-934464.300},
            name='Symeon',
            planetarySystemId=0,
            radius=49050
          },
          [120]={
            GM=7135606629,
            bodyId=120,
            center={x=2865536.700,y=-99034464.000,z=-934462.020},
            name='Ion',
            planetarySystemId=0,
            radius=44950
          },
          [121]={
            GM=106830900,
            bodyId=121,
            center={x=2472916.800,y=-99133747.000,z=-1133582.800},
            name='Ion Moon 1',
            planetarySystemId=0,
            radius=11000
          },
          [122]={
            GM=176580000,
            bodyId=122,
            center={x=2995424.500,y=-99275010.000,z=-1378480.700},
            name='Ion Moon 2',
            planetarySystemId=0,
            radius=15000
          }  
         }
        }
        end
    function PlanetRef() 
    --[[ 
      Provide coordinate transforms and access to kinematic related parameters
      Author: JayleBreak
      Usage (unit.start):
      PlanetaryReference = require('planetref')
      galaxyReference = PlanetaryReference(referenceTableSource)
      helios = galaxyReference[0] -- PlanetaryReference.PlanetarySystem instance
      alioth = helios[2]          -- PlanetaryReference.BodyParameters instance
      Methods:
        PlanetaryReference:getPlanetarySystem - based on planetary system ID.
        PlanetaryReference.isMapPosition - 'true' if an instance of 'MapPosition'
        PlanetaryReference.createBodyParameters - for entry into reference table
        PlanetaryReference.BodyParameters - a class containing a body's information.
        PlanetaryReference.MapPosition - a class for map coordinates
        PlanetaryReference.PlanetarySystem - a container for planetary system info.
        PlanetarySystem:castIntersections - from a position in a given direction.
        PlanetarySystem:closestBody - to the specified coordinates.
        PlanetarySystem:convertToBodyIdAndWorldCoordinates - from map coordinates.
        PlanetarySystem:getBodyParameters - from reference table.
        PlanetarySystem:getPlanetarySystemId - for the instance.
        BodyParameters:convertToWorldCoordinates - from map coordinates
        BodyParameters:convertToMapPosition - from world coordinates
        BodyParameters:getAltitude - of world coordinates
        BodyParameters:getDistance - from center to world coordinates
        BodyParameters:getGravity - at a given position in world coordinates.
      Description
      An instance of the 'PlanetaryReference' "class" can contain transform and
      kinematic reference information for all planetary systems in DualUniverse.
      Each planetary system is identified by a numeric identifier. Currently,
      the only planetary system, Helios, has the identifier: zero. This "class"
      supports the indexing ('[]') operation which is equivalent to the
      use of the 'getPlanetarySystem' method. It also supports the 'pairs()'
      method for iterating over planetary systems.
    
      An instance of the 'PlanetarySystem' "class" contains all reference
      information for a specific system. It supports the indexing ('[]') and
      'pairs()' functions which allows iteration over each "body" in the
      system where the key is the numeric body ID. It also supports the
      'tostring()' method.
      An instance of the 'BodyParameters' "class" contains all reference
      information for a single celestial "body" (a moon or planet). It supports
      the 'tostring()' method, and contains the data members:
              planetarySystemId - numeric planetary system ID
              bodyId            - numeric body ID
              radius            - radius of the body in meters (zero altitude)
              center            - world coordinates of the body's center position
              GM                - the gravitation parameter (g = GM/radius^2)
      Note that the user is allowed to add custom fields (e.g. body name), but
      should insure that complex table values have the '__tostring' metamethod
      implemented.
      Transform and Kinematics:
      "World" coordinates is a cartesian coordinate system with an origin at an
      arbitrary fixed point in a planetary system and with distances measured in
      meters. The coordinates are expressible either as a simple table of 3 values
      or an instance of the 'vec3' class.  In either case, the planetary system
      identity is implicit.
      "Map" coordinates is a geographic coordinate system with an origin at the
      center of an identified (by a numeric value) celestial body which is a
      member of an identified (also a numeric value) planetary system. Note that
      the convention that latitude, longitude, and altitude values will be the
      position's x, y, and z world coordinates in the special case of body ID 0.
      The kinematic parameters in the reference data permit calculations of the
      gravitational attraction of the celestial body on other objects.
      Reference Data:
      This is an example of reference data with a single entry assigned to
      planetary system ID 0, and body ID 2 ('Alioth'):
        referenceTable = {
              [0] = { [2] = { planetarySystemId = 0,
                              bodyId = 2,
                              radius = 126068,
                              center = vec3({x=-8, y=-8, z=-126303}),
                              GM = 1.572199+11 } -- as in F=-GMm/r^2
              }
          }
        ref=PlanetaryReference(referenceTable)
      Collecting Reference Data:
      A combination of information from the "Map" screen in the DU user interface,
      and values reported by the DU Lua API can be the source of the reference
      table's data (planetarySystemId, bodyId, and surfaceArea is from the user
      interface):
        referenceTable = {}
        referenceTable[planetarySystemId][bodyId] =
             PlanetaryReference.createBodyParameters(planetarySystemId,
                                                     bodyId,
                                                     surfaceArea,
                                                     core.getConstructWorldPos(),
                                                     core.getWorldVertical(),
                                                     core.getAltitude(),
                                                     core.g())
      Adapting Data Sources:
      Other sources of data can be adapted or converted. An example of adapting a
      table, defined in the file: 'planets.lua', containing information on a single
      planetary system and using celestial body name as the key follows (note that
      a 'name' field is added to the BodyParameters instance transparently after
      construction, and the '__pairs' meta function is required to support the
      'closestBody' and '__tostring' methods):
        ref=PlanetaryReference(
            {[0] = setmetatable(require('planets'),
                            { __index = function(bodies, bodyId)
                                 for _,v in pairs(bodies) do
                                     if v and v.bodyId == bodyId then return v end
                                 end
                                 return nil
                               end,
                             __pairs = function(bodies)
                                 return function(t, k)
                                         local nk, nv = next(t, k)
                                         if nv then
                                             local GM = nv.gravity * nv.radius^2
                                             local bp = BodyParameters(0,
                                                                       nv.id,
                                                                       nv.radius,
                                                                       nv.pos,
                                                                       GM)
                                             bp.name = nk
                                             return nk, bp
                                        end
                                        return nk, nv
                                     end, bodies, nil
                               end })
        })
    
      Converting Data Sources:
      An instance of 'PlanetaryReference' that has been adapted to a data source
      can be used to convert that source to simple table. For example,
      using the adapted instance shown above:
        load('convertedData=' .. tostring(ref))()
        newRef=PlanetaryReference(convertedData)
      Also See: kepler.lua
      ]]--
    --[[                    START OF LOCAL IMPLEMENTATION DETAILS             ]]--
    -- Type checks
    local function isNumber(n)  return type(n)           == 'number' end
    local function isSNumber(n) return type(tonumber(n)) == 'number' end
    local function isTable(t)   return type(t)           == 'table'  end
    local function isString(s)  return type(s)           == 'string' end
    local function isVector(v)  return isTable(v)
                                        and isNumber(v.x and v.y and v.z) end
    local function isMapPosition(m) return isTable(m) and isNumber(m.latitude  and
                                                                   m.longitude and
                                                                   m.altitude  and
                                                                   m.bodyId    and
                                                                   m.systemId) end
    -- Constants
    local deg2rad    = math.pi/180
    local rad2deg    = 180/math.pi
    local epsilon    = 1e-10
    local num        = ' *([+-]?%d+%.?%d*e?[+-]?%d*)'
    local posPattern = '::pos{' .. num .. ',' .. num .. ',' ..  num .. ',' ..
                       num ..  ',' .. num .. '}'
    -- Utilities
    local utils  = require('cpml.utils')
    local vec3   = require('cpml.vec3')
    local clamp  = utils.clamp
    local function float_eq(a,b)
        if a == 0 then return math.abs(b) < 1e-09 end
        if b == 0 then return math.abs(a) < 1e-09 end
        return math.abs(a - b) < math.max(math.abs(a),math.abs(b))*epsilon
    end
    local function formatNumber(n)
        local result = string.gsub(
                        string.reverse(string.format('%.4f',n)),
                        '^0*%.?','')
        return result == '' and '0' or string.reverse(result)
    end
    local function formatValue(obj)
        if isVector(obj) then
            return string.format('{x=%.3f,y=%.3f,z=%.3f}', obj.x, obj.y, obj.z)
        end
        if isTable(obj) and not getmetatable(obj) then
            local list = {}
            local nxt  = next(obj)
            if type(nxt) == 'nil' or nxt == 1 then -- assume this is an array
                list = obj
            else
                for k,v in pairs(obj) do
                    local value = formatValue(v)
                    if type(k) == 'number' then
                        table.insert(list, string.format('[%s]=%s', k, value))
                    else
                        table.insert(list, string.format('%s=%s',   k, value))
                    end
                end
            end
            return string.format('{%s}', table.concat(list, ','))
        end
        if isString(obj) then
            return string.format("'%s'", obj:gsub("'",[[\']]))
        end
        return tostring(obj)
    end
    -- CLASSES
    -- BodyParameters: Attributes of planetary bodies (planets and moons)
    local BodyParameters = {}
    BodyParameters.__index = BodyParameters
    BodyParameters.__tostring =
        function(obj, indent)
            local sep = indent or ''
            local keys = {}
            for k in pairs(obj) do table.insert(keys, k) end
            table.sort(keys)
            local list = {}
            for _, k in ipairs(keys) do
                local value = formatValue(obj[k])
                if type(k) == 'number' then
                    table.insert(list, string.format('[%s]=%s', k, value))
                else
                    table.insert(list, string.format('%s=%s', k, value))
                end
            end
            if indent then
                return string.format('%s%s',
                                     indent,
                                     table.concat(list, ',\n' .. indent))
            end
            return string.format('{%s}', table.concat(list, ','))
        end
    BodyParameters.__eq = function(lhs, rhs)
            return lhs.planetarySystemId == rhs.planetarySystemId and
                   lhs.bodyId            == rhs.bodyId            and
                   float_eq(lhs.radius, rhs.radius)               and
                   float_eq(lhs.center.x, rhs.center.x)           and
                   float_eq(lhs.center.y, rhs.center.y)           and
                   float_eq(lhs.center.z, rhs.center.z)           and
                   float_eq(lhs.GM, rhs.GM)
        end
    local function mkBodyParameters(systemId, bodyId, radius, worldCoordinates, GM)
        -- 'worldCoordinates' can be either table or vec3
        assert(isSNumber(systemId),
               'Argument 1 (planetarySystemId) must be a number:' .. type(systemId))
        assert(isSNumber(bodyId),
               'Argument 2 (bodyId) must be a number:' .. type(bodyId))
        assert(isSNumber(radius),
               'Argument 3 (radius) must be a number:' .. type(radius))
        assert(isTable(worldCoordinates),
               'Argument 4 (worldCoordinates) must be a array or vec3.' ..
               type(worldCoordinates))
        assert(isSNumber(GM),
               'Argument 5 (GM) must be a number:' .. type(GM))
        return setmetatable({planetarySystemId = tonumber(systemId),
                             bodyId            = tonumber(bodyId),
                             radius            = tonumber(radius),
                             center            = vec3(worldCoordinates),
                             GM                = tonumber(GM) }, BodyParameters)
    end
    -- MapPosition: Geographical coordinates of a point on a planetary body.
    local MapPosition = {}
    MapPosition.__index = MapPosition
    MapPosition.__tostring = function(p)
            return string.format('::pos{%d,%d,%s,%s,%s}',
                                 p.systemId,
                                 p.bodyId,
                                 formatNumber(p.latitude*rad2deg),
                                 formatNumber(p.longitude*rad2deg),
                                 formatNumber(p.altitude))
        end
    MapPosition.__eq       = function(lhs, rhs)
            return lhs.bodyId   == rhs.bodyId              and
                   lhs.systemId == rhs.systemId            and
                   float_eq(lhs.latitude,   rhs.latitude)  and
                   float_eq(lhs.altitude,   rhs.altitude)  and
                   (float_eq(lhs.longitude, rhs.longitude) or
                    float_eq(lhs.latitude, math.pi/2)      or
                    float_eq(lhs.latitude, -math.pi/2))
        end
    -- latitude and longitude are in degrees while altitude is in meters
    local function mkMapPosition(overload, bodyId, latitude, longitude, altitude)
        local systemId = overload -- Id or '::pos{...}' string
        if isString(overload) and not longitude and not altitude and
                                  not bodyId    and not latitude then
            systemId, bodyId, latitude, longitude, altitude =
                                                string.match(overload, posPattern)
            assert(systemId, 'Argument 1 (position string) is malformed.')
        else
            assert(isSNumber(systemId),
                   'Argument 1 (systemId) must be a number:' .. type(systemId))
            assert(isSNumber(bodyId),
                   'Argument 2 (bodyId) must be a number:' .. type(bodyId))
            assert(isSNumber(latitude),
                   'Argument 3 (latitude) must be in degrees:' .. type(latitude))
            assert(isSNumber(longitude),
                   'Argument 4 (longitude) must be in degrees:' .. type(longitude))
            assert(isSNumber(altitude),
                   'Argument 5 (altitude) must be in meters:' .. type(altitude))
        end
        systemId  = tonumber(systemId)
        bodyId    = tonumber(bodyId)
        latitude  = tonumber(latitude)
        longitude = tonumber(longitude)
        altitude  = tonumber(altitude)
        if bodyId == 0 then -- this is a hack to represent points in space
            return setmetatable({latitude  = latitude,
                                 longitude = longitude,
                                 altitude  = altitude,
                                 bodyId    = bodyId,
                                 systemId  = systemId}, MapPosition)
        end
        return setmetatable({latitude  = deg2rad*clamp(latitude, -90, 90),
                             longitude = deg2rad*(longitude % 360),
                             altitude  = altitude,
                             bodyId    = bodyId,
                             systemId  = systemId}, MapPosition)
    end
    -- PlanetarySystem - map body IDs to BodyParameters
    local PlanetarySystem = {}
    PlanetarySystem.__index = PlanetarySystem
    PlanetarySystem.__tostring =
        function (obj, indent)
            local sep = indent and (indent .. '  ' )
            local bdylist = {}
            local keys = {}
            for k in pairs(obj) do table.insert(keys, k) end
            table.sort(keys)
            for _, bi in ipairs(keys) do
                bdy = obj[bi]
                local bdys = BodyParameters.__tostring(bdy, sep)
                if indent then
                    table.insert(bdylist,
                                 string.format('[%s]={\n%s\n%s}',
                                               bi, bdys, indent))
                else
                    table.insert(bdylist, string.format('  [%s]=%s', bi, bdys))
                end
            end
            if indent then
                return string.format('\n%s%s%s',
                                     indent,
                                     table.concat(bdylist, ',\n' .. indent),
                                     indent)
            end
            return string.format('{\n%s\n}', table.concat(bdylist, ',\n'))
        end
    local function mkPlanetarySystem(referenceTable)
        local atlas = {}
        local pid
        for _, v in pairs(referenceTable) do
            local id = v.planetarySystemId
            if type(id) ~= 'number' then
                error('Invalid planetary system ID: ' .. tostring(id))
            elseif pid and id ~= pid then
                error('Mismatch planetary system IDs: ' .. id .. ' and '
                      .. pid)
            end
            local bid = v.bodyId
            if type(bid) ~= 'number' then
                error('Invalid body ID: ' .. tostring(bid))
            elseif atlas[bid] then
                error('Duplicate body ID: ' .. tostring(bid))
            end
            setmetatable(v.center, getmetatable(vec3.unit_x))
            atlas[bid] = setmetatable(v, BodyParameters)
            pid = id
        end
        return setmetatable(atlas, PlanetarySystem)
    end
    -- PlanetaryReference - map planetary system ID to PlanetarySystem
    PlanetaryReference = {}
    local function mkPlanetaryReference(referenceTable)
        return setmetatable({ galaxyAtlas = referenceTable or {} },
                              PlanetaryReference)
    end
    PlanetaryReference.__index        = 
        function(t,i)
            if type(i) == 'number' then
                local system = t.galaxyAtlas[i]
                return mkPlanetarySystem(system)
            end
            return rawget(PlanetaryReference, i)
        end
    PlanetaryReference.__pairs        =
        function(obj)
            return  function(t, k)
                        local nk, nv = next(t, k)
                        return nk, nv and mkPlanetarySystem(nv)
                    end, obj.galaxyAtlas, nil
        end
    PlanetaryReference.__tostring     =
        function (obj)
            local pslist = {}
            for _,ps in pairs(obj or {}) do
                local psi = ps:getPlanetarySystemId()
                local pss = PlanetarySystem.__tostring(ps, '    ')
                table.insert(pslist,
                             string.format('  [%s]={%s\n  }', psi, pss))
            end
            return string.format('{\n%s\n}\n', table.concat(pslist,',\n'))
        end
    --[[                       START OF PUBLIC INTERFACE                       ]]--
    -- PlanetaryReference CLASS METHODS:
    --
    -- BodyParameters - create an instance of BodyParameters class
    -- planetarySystemId  [in]: the body's planetary system ID.
    -- bodyId             [in]: the body's ID.
    -- radius             [in]: the radius in meters of the planetary body.
    -- bodyCenter         [in]: the world coordinates of the center (vec3 or table).
    -- GM                 [in]: the body's standard gravitational parameter.
    -- return: an instance of BodyParameters class.
    --
    PlanetaryReference.BodyParameters = mkBodyParameters
    --
    -- MapPosition - create an instance of the MapPosition class
    -- overload [in]: either a planetary system ID or a position string ('::pos...')
    -- bodyId [in]:   (ignored if overload is a position string) the body's ID.
    -- latitude [in]: (ignored if overload is a position string) the latitude.
    -- longitude [in]:(ignored if overload is a position string) the longitude.
    -- altitude [in]: (ignored if overload is a position string) the altitude.
    -- return: the class instance
    --
    PlanetaryReference.MapPosition    = mkMapPosition
    --
    -- PlanetarySystem - create an instance of PlanetarySystem class
    -- referenceData [in]: a table (indexed by bodyId) of body reference info.
    -- return: the class instance
    --
    PlanetaryReference.PlanetarySystem = mkPlanetarySystem
    --
    -- createBodyParameters - create an instance of BodyParameters class
    -- planetarySystemId  [in]: the body's planetary system ID.
    -- bodyId             [in]: the body's ID.
    -- surfaceArea        [in]: the body's surface area in square meters.
    -- aPosition          [in]: world coordinates of a position near the body.
    -- verticalAtPosition [in]: a vector pointing towards the body center.
    -- altitudeAtPosition [in]: the altitude in meters at the position.
    -- gravityAtPosition  [in]: the magnitude of the gravitational acceleration.
    -- return: an instance of BodyParameters class.
    --
    function PlanetaryReference.createBodyParameters(planetarySystemId,
                                                     bodyId,
                                                     surfaceArea,
                                                     aPosition,
                                                     verticalAtPosition,
                                                     altitudeAtPosition,
                                                     gravityAtPosition)
        assert(isSNumber(planetarySystemId),
               'Argument 1 (planetarySystemId) must be a number:' ..
               type(planetarySystemId))
        assert(isSNumber(bodyId),
               'Argument 2 (bodyId) must be a number:' .. type(bodyId))
        assert(isSNumber(surfaceArea),
               'Argument 3 (surfaceArea) must be a number:' .. type(surfaceArea))
        assert(isTable(aPosition),
               'Argument 4 (aPosition) must be an array or vec3:' ..
               type(aPosition))
        assert(isTable(verticalAtPosition),
               'Argument 5 (verticalAtPosition) must be an array or vec3:' ..
               type(verticalAtPosition))
        assert(isSNumber(altitudeAtPosition),
               'Argument 6 (altitude) must be in meters:' ..
               type(altitudeAtPosition))
        assert(isSNumber(gravityAtPosition),
               'Argument 7 (gravityAtPosition) must be number:' ..
               type(gravityAtPosition))
        local radius   = math.sqrt(surfaceArea/4/math.pi)
        local distance = radius + altitudeAtPosition
        local center   = vec3(aPosition) + distance*vec3(verticalAtPosition)
        local GM       = gravityAtPosition * distance * distance
        return mkBodyParameters(planetarySystemId, bodyId, radius, center, GM)
    end
    --
    -- isMapPosition - check for the presence of the 'MapPosition' fields
    -- valueToTest [in]: the value to be checked
    -- return: 'true' if all required fields are present in the input value
    --
    PlanetaryReference.isMapPosition  = isMapPosition
    -- PlanetaryReference INSTANCE METHODS:
    --
    -- getPlanetarySystem - get the planetary system using ID or MapPosition as key
    -- overload [in]: either the planetary system ID or a MapPosition that has it.
    -- return: instance of 'PlanetarySystem' class or nil on error
    --
    function PlanetaryReference:getPlanetarySystem(overload)
        --if galaxyAtlas then
            local planetarySystemId = overload
            if isMapPosition(overload) then
                planetarySystemId = overload.systemId
            end
            if type(planetarySystemId) == 'number' then
                local system = self.galaxyAtlas[i]
                if system then
                    if getmetatable(nv) ~= PlanetarySystem then
                        system = mkPlanetarySystem(system)
                    end
                    return system
                end
            end
        --end
        --return nil
    end
    -- PlanetarySystem INSTANCE METHODS:
    --
    -- castIntersections - Find the closest body that intersects a "ray cast".
    -- origin [in]: the origin of the "ray cast" in world coordinates
    -- direction [in]: the direction of the "ray cast" as a 'vec3' instance.
    -- sizeCalculator [in]: (default: returns 1.05*radius) Returns size given body.
    -- bodyIds[in]: (default: all IDs in system) check only the given IDs.
    -- return: The closest body that blocks the cast or 'nil' if none.
    --
    function PlanetarySystem:castIntersections(origin,
                                               direction,
                                               sizeCalculator,
                                               bodyIds)
        local sizeCalculator = sizeCalculator or 
                                function (body) return 1.05*body.radius end
        local candidates = {}
        if bodyIds then
            for _,i in ipairs(bodyIds) do candidates[i] = self[i] end
        else
            bodyIds = {}
            for k,body in pairs(self) do
                table.insert(bodyIds, k)
                candidates[k] = body
            end
        end
        local function compare(b1,b2)
            local v1 = candidates[b1].center - origin
            local v2 = candidates[b2].center - origin
            return v1:len() < v2:len()
        end
        table.sort(bodyIds, compare)
        local dir = direction:normalize()
        for i, id in ipairs(bodyIds) do
            local body   = candidates[id]
            local c_oV3  = body.center - origin
            local radius = sizeCalculator(body)
            local dot    = c_oV3:dot(dir)
            local desc   = dot^2 - (c_oV3:len2() - radius^2)
            if desc >= 0 then
                local root     = math.sqrt(desc)
                local farSide  = dot + root
                local nearSide = dot - root
                if nearSide > 0 then
                    return body, farSide, nearSide
                elseif farSide > 0 then
                    return body, farSide, nil
                end
            end
        end
        return nil, nil, nil
    end
    --
    -- closestBody - find the closest body to a given set of world coordinates
    -- coordinates       [in]: the world coordinates of position in space
    -- return: an instance of the BodyParameters object closest to 'coordinates'
    --
    function PlanetarySystem:closestBody(coordinates)
        assert(type(coordinates) == 'table', 'Invalid coordinates.')
        local minDistance2, body
        local coord = vec3(coordinates)
        for _,params in pairs(self) do
            local distance2 = (params.center - coord):len2()
            if not body or distance2 < minDistance2 then
                body         = params
                minDistance2 = distance2
            end
        end
        return body
    end
    --
    -- convertToBodyIdAndWorldCoordinates - map to body Id and world coordinates
    -- overload [in]: an instance of MapPosition or a position string ('::pos...)
    -- return: a vec3 instance containing the world coordinates or 'nil' on error.
    --
    function PlanetarySystem:convertToBodyIdAndWorldCoordinates(overload)
        local mapPosition = overload
        if isString(overload) then
            mapPosition = mkMapPosition(overload)
        end
        if mapPosition.bodyId == 0 then
            return 0, vec3(mapPosition.latitude,
                           mapPosition.longitude,
                           mapPosition.altitude)
        end
        local params = self:getBodyParameters(mapPosition)
        if params then
            return mapPosition.bodyId,
                   params:convertToWorldCoordinates(mapPosition)
        end
    end
    --
    -- getBodyParameters - get or create an instance of BodyParameters class
    -- overload [in]: either an instance of MapPosition or a body's ID.
    -- return: a BodyParameters instance or 'nil' if body ID is not found.
    --
    function PlanetarySystem:getBodyParameters(overload)
        local bodyId = overload
        if isMapPosition(overload) then
            bodyId = overload.bodyId
        end
        assert(isSNumber(bodyId),
                   'Argument 1 (bodyId) must be a number:' .. type(bodyId))
        return self[bodyId]
    end
    --
    -- getPlanetarySystemId - get the planetary system ID for this instance
    -- return: the planetary system ID or nil if no planets are in the system.
    --
    function PlanetarySystem:getPlanetarySystemId()
        local k, v = next(self)
        return v and v.planetarySystemId
    end
    -- BodyParameters INSTANCE METHODS:
    --
    -- convertToMapPosition - create an instance of MapPosition from coordinates
    -- worldCoordinates [in]: the world coordinates of the map position.
    -- return: an instance of MapPosition class
    --
    function BodyParameters:convertToMapPosition(worldCoordinates)
        assert(isTable(worldCoordinates),
               'Argument 1 (worldCoordinates) must be an array or vec3:' ..
               type(worldCoordinates))
        local worldVec  = vec3(worldCoordinates) 
        if self.bodyId == 0 then
            return setmetatable({latitude  = worldVec.x,
                                 longitude = worldVec.y,
                                 altitude  = worldVec.z,
                                 bodyId    = 0,
                                 systemId  = self.planetarySystemId}, MapPosition)
        end
        local coords    = worldVec - self.center
        local distance  = coords:len()
        local altitude  = distance - self.radius
        local latitude  = 0
        local longitude = 0
        if not float_eq(distance, 0) then
            local phi = math.atan(coords.y, coords.x)
            longitude = phi >= 0 and phi or (2*math.pi + phi)
            latitude  = math.pi/2 - math.acos(coords.z/distance)
        end
        return setmetatable({latitude  = latitude,
                             longitude = longitude,
                             altitude  = altitude,
                             bodyId    = self.bodyId,
                             systemId  = self.planetarySystemId}, MapPosition)
    end
    --
    -- convertToWorldCoordinates - convert a map position to world coordinates
    -- overload [in]: an instance of MapPosition or a position string ('::pos...')
    --
    function BodyParameters:convertToWorldCoordinates(overload)
        local mapPosition = isString(overload) and
                                               mkMapPosition(overload) or overload
        if mapPosition.bodyId == 0 then -- support deep space map position
            return vec3(mapPosition.latitude,
                        mapPosition.longitude,
                        mapPosition.altitude)
        end
        assert(isMapPosition(mapPosition),
               'Argument 1 (mapPosition) is not an instance of "MapPosition".')
        assert(mapPosition.systemId == self.planetarySystemId,
               'Argument 1 (mapPosition) has a different planetary system ID.')
        assert(mapPosition.bodyId == self.bodyId,
               'Argument 1 (mapPosition) has a different planetary body ID.')
        local xproj = math.cos(mapPosition.latitude)
        return self.center + (self.radius + mapPosition.altitude) *
               vec3(xproj*math.cos(mapPosition.longitude),
                    xproj*math.sin(mapPosition.longitude),
                    math.sin(mapPosition.latitude))
    end
    --
    -- getAltitude - calculate the altitude of a point given in world coordinates.
    -- worldCoordinates [in]: the world coordinates of the point.
    -- return: the altitude in meters
    --
    function BodyParameters:getAltitude(worldCoordinates)
        return (vec3(worldCoordinates) - self.center):len() - self.radius
    end
    --
    -- getDistance - calculate the distance to a point given in world coordinates.
    -- worldCoordinates [in]: the world coordinates of the point.
    -- return: the distance in meters
    --
    function BodyParameters:getDistance(worldCoordinates)
        return (vec3(worldCoordinates) - self.center):len()
    end
    --
    -- getGravity - calculate the gravity vector induced by the body.
    -- worldCoordinates [in]: the world coordinates of the point.
    -- return: the gravity vector in meter/seconds^2
    --
    function BodyParameters:getGravity(worldCoordinates)
        local radial = self.center - vec3(worldCoordinates) -- directed towards body
        local len2   = radial:len2()
        return (self.GM/len2) * radial/math.sqrt(len2)
    end
    -- end of module
    return setmetatable(PlanetaryReference,
                        { __call = function(_,...)
                                        return mkPlanetaryReference(...)
                                   end })
    end
    function Keplers()
        --[[ 
      Provides methods for computing orbital information for an object
      Usage:
      Kepler = require('autoconf.custom.kepler')
      alioth = Kepler({ GM=157470826617,
                        bodyId=2,
                        center={x=-8.000,y=-8.000,z=-126303.000},
                        name='Alioth',
                        planetarySystemId=0,
                        radius=126068
                      })
      altitude = 6000
      position = '::pos{0,2,0,0,6000}'
      e, o     = alioth:escapeAndOrbitalSpeed(altitude)
      orbit    = alioth:orbitalParameters(position, {0, o+1, 0})
      print("Eccentricity " .. orbit.eccentricity)
      print("Perihelion " .. orbit.periapsis.altitude)
      print("Max. speed " .. orbit.periapsis.speed)
      print("Circular orbit speed " .. orbit.periapsis.circularOrbitSpeed)
      print("Aphelion "  .. orbit.apoapsis.altitude)
      print("Min. speed " .. orbit.apoapsis.speed)
      print("Orbital period " .. orbit.period)
      --- output:
        Eccentricity 0.0018324307017878
        Perihelion 6000.0
        Max. speed 1092.9462297033
        Circular orbit speed 1091.9462297033
        Aphelion 6484.8994605062
        Min. speed 1088.9480596194
        Orbital period 762.02818214049
      Methods:
        Kepler:escapeAndOrbitalSpeed - for a given celestial body and altitude.
        Kepler:orbitalParameters - for a given massless object and a celestial body.
      Description
      The motion of an object in the vicinity of substantially larger mass is
      in the domain of the "2-body problem". By assuming the object whose motion
      is of interest is of negligable mass simplifies the calculations of:
      the speed to escape the body, the speed of a circular orbit, and the
      parameters defining the orbit of the object (or the lack of orbit as the
      case may be).
      Orbital Parameters:
         periapsis - the closest approach to the planet
          apoapsis - the furthest point from the planet if in orbit (otherwise nil)
      eccentricity - 0 for circular orbits
                    <1 for elliptical orbits
                     1 for parabiolic trajectory
                    >1 for hyperbolic trajectory
            period - time (in seconds) to complete an orbit
      Also See: planetref.lua
    ]]--
    local vec3       = require('cpml.vec3')
    local PlanetRef  = PlanetRef()
    local function isString(s) return type(s)   == 'string' end
    local function isTable(t)  return type(t)   == 'table'  end
    local function float_eq(a,b)
        if a == 0 then return math.abs(b) < 1e-09 end
        if b == 0 then return math.abs(a) < 1e-09 end
        return math.abs(a - b) < math.max(math.abs(a),math.abs(b))*epsilon
    end
    Kepler = {}
    Kepler.__index = Kepler
    --
    -- escapeAndOrbitalSpeed - speed required to escape and for a circular orbit
    -- altitude [in]: the height of the orbit in meters above "sea-level"
    -- return: the speed in m/s needed to escape the celestial body and to orbit it.
    --
    function Kepler:escapeAndOrbitalSpeed(altitude)
        assert(self.body)
        -- P = -GMm/r and KE = mv^2/2 (no lorentz factor used)
        -- mv^2/2 = GMm/r
        -- v^2 = 2GM/r
        -- v = sqrt(2GM/r1)
        local distance = altitude + self.body.radius
        if not float_eq(distance, 0) then
            local orbit = math.sqrt(self.body.GM/distance)
            return math.sqrt(2)*orbit, orbit
        end
        return nil, nil
    end
    --
    -- orbitalParameters: determine the orbital elements for a two-body system.
    -- overload [in]: the world coordinates or map coordinates of a massless object.
    -- velocity [in]: The velocity of the massless point object in m/s.
    -- return: the 6 orbital elements for the massless object.
    --
    function Kepler:orbitalParameters(overload, velocity)
        assert(self.body)
        assert(isTable(overload) or isString(overload))
        assert(isTable(velocity))
        local pos = (isString(overload) or PlanetRef.isMapPosition(overload)) and
                                self.body:convertToWorldCoordinates(overload) or
                    vec3(overload)
        local v   = vec3(velocity)
        local r   = pos - self.body.center
        local v2  = v:len2()
        local d   = r:len()
        local mu  = self.body.GM
        local e   = ((v2 - mu/d)*r - r:dot(v)*v)/mu
        local a   = mu/(2*mu/d - v2)
        local ecc = e:len()
        local dir = e:normalize()
        local pd  = a*(1-ecc)
        local ad  = a*(1+ecc)
        local per = pd*dir + self.body.center
        local apo = ecc <= 1 and -ad*dir + self.body.center or nil
        local trm = math.sqrt(a*mu*(1-ecc*ecc))        
        local Period = apo and 2*math.pi*math.sqrt(a^3/mu)
        -- These are great and all, but, I need more.
        local trueAnomaly = math.acos((e:dot(r))/(ecc*d))
        if r:dot(v) < 0 then
            trueAnomaly = -(trueAnomaly - 2*math.pi)
        end        
        -- Apparently... cos(EccentricAnomaly) = (cos(trueAnomaly) + eccentricity)/(1 + eccentricity * cos(trueAnomaly))
        local EccentricAnomaly = math.acos((math.cos(trueAnomaly) + ecc)/(1 + ecc * math.cos(trueAnomaly)))
        -- Then.... apparently if this is below 0, we should add 2pi to it
        -- I think also if it's below 0, we're past the apoapsis?
        local timeTau = EccentricAnomaly
        if timeTau < 0 then
            timeTau = timeTau + 2*math.pi
        end
        -- So... time since periapsis...
        -- Is apparently easy if you get mean anomly.  t = M/n where n is mean motion, = 2*pi/Period
        
        
        local MeanAnomaly = timeTau - ecc * math.sin(timeTau)
        local TimeSincePeriapsis = MeanAnomaly/(2*math.pi/Period)
        --system.print(MeanAnomaly .. " - " .. TimeSincePeriapsis .. " - " .. Period .. " - " .. EccentricAnomaly .. " - " .. timeTau .. " - " .. trueAnomaly)
        -- Mean anom is 0 at periapsis, positive before it... and positive after it.
        -- I guess this is why I needed to use timeTau and not EccentricAnomaly here
        
        local TimeToPeriapsis = Period - TimeSincePeriapsis
        local TimeToApoapsis = TimeToPeriapsis + Period/2
        if trueAnomaly - math.pi > 0 then -- TBH I think something's wrong in my formulas because I needed this.
            TimeToPeriapsis = TimeSincePeriapsis
            TimeToApoapsis = TimeToPeriapsis + Period/2
        end
        if TimeToApoapsis > Period then
            TimeToApoapsis = TimeToApoapsis - Period
        end
        return { periapsis       = { position           = per,
                                     speed              = trm/pd,
                                     circularOrbitSpeed = math.sqrt(mu/pd),
                                     altitude           = pd - self.body.radius},
                 apoapsis        = apo and
                                   { position           = apo,
                                     speed              = trm/ad,
                                     circularOrbitSpeed = math.sqrt(mu/ad),
                                     altitude           = ad - self.body.radius},
                 currentVelocity = v,
                 currentPosition = pos,
                 eccentricity    = ecc,
                 period          = Period,
                 eccentricAnomaly = EccentricAnomaly,
                 meanAnomaly = MeanAnomaly,
                 timeToPeriapsis = TimeToPeriapsis,
                 timeToApoapsis = TimeToApoapsis
               }
    end
    
    local function new(bodyParameters)
        local params = PlanetRef.BodyParameters(bodyParameters.planetarySystemId,
                                                bodyParameters.bodyId,
                                                bodyParameters.radius,
                                                bodyParameters.center,
                                                bodyParameters.GM)
        return setmetatable({body = params}, Kepler)
    end
    return setmetatable(Kepler, { __call = function(_,...) return new(...) end })
    end
    function Kinematics()
        --[[ 
      DualUniverse kinematic equations
      Author: JayleBreak
      Usage (unit.start):
      Kinematics = require('autoconf.custom.kinematics')
      Methods:
       computeAccelerationTime - "relativistic" version of t = (vf - vi)/a
       computeDistanceAndTime - Return distance & time needed to reach final speed.
       computeTravelTime - "relativistic" version of t=(sqrt(2ad+v^2)-v)/a
      Description
      DualUniverse increases the effective mass of constructs as their absolute
      speed increases by using the "lorentz" factor (from relativity) as the scale
      factor.  This results in an upper bound on the absolute speed of constructs
      (excluding "warp" drive) that is set to 30 000 KPH (8 333 MPS). This module
      provides utilities for computing some physical quantities taking this
      scaling into account.
    ]]--
    local Kinematic = {} -- just a namespace
    local C       = 30000000/3600
    local C2      = C*C
    local ITERATIONS = 100 -- iterations over engine "warm-up" period
    local function lorentz(v) return 1/math.sqrt(1 - v*v/C2) end
    --
    -- computeAccelerationTime - "relativistic" version of t = (vf - vi)/a
    -- initial      [in]: initial (positive) speed in meters per second.
    -- acceleration [in]: constant acceleration until 'finalSpeed' is reached.
    -- final        [in]: the speed at the end of the time interval.
    -- return: the time in seconds spent in traversing the distance
    --
    function Kinematic.computeAccelerationTime(initial, acceleration, final)
        -- The low speed limit of following is: t=(vf-vi)/a (from: vf=vi+at)
        local k1 = C*math.asin(initial/C)
        return (C * math.asin(final/C) - k1)/acceleration
    end
    --
    -- computeDistanceAndTime - Return distance & time needed to reach final speed.
    -- initial[in]:     Initial speed in meters per second.
    -- final[in]:       Final speed in meters per second.
    -- restMass[in]:    Mass of the construct at rest in Kg.
    -- thrust[in]:      Engine's maximum thrust in Newtons.
    -- t50[in]:         (default: 0) Time interval to reach 50% thrust in seconds.
    -- brakeThrust[in]: (default: 0) Constant thrust term when braking.
    -- return: Distance (in meters), time (in seconds) required for change.
    --
    function Kinematic.computeDistanceAndTime(initial,
                                              final,
                                              restMass,
                                              thrust,
                                              t50,
                                              brakeThrust)
        -- This function assumes that the applied thrust is colinear with the
        -- velocity. Furthermore, it does not take into account the influence
        -- of gravity, not just in terms of its impact on velocity, but also
        -- its impact on the orientation of thrust relative to velocity.
        -- These factors will introduce (usually) small errors which grow as
        -- the length of the trip increases.
        t50            = t50 or 0
        brakeThrust    = brakeThrust or 0 -- usually zero when accelerating
        local tau0     = lorentz(initial)
        local speedUp  = initial <= final
        local a0       = thrust * (speedUp and 1 or -1)/restMass
        local b0       = -brakeThrust/restMass
        local totA     = a0+b0
        if speedUp and totA <= 0 or not speedUp and totA >= 0 then
            return -1, -1 -- no solution
        end
        local distanceToMax, timeToMax = 0, 0
        -- If, the T50 time is set, then assume engine is at zero thrust and will
        -- reach full thrust in 2*T50 seconds. Thrust curve is given by:
        -- Thrust: F(z)=(a0*(1+sin(z))+2*b0)/2 where z=pi*(t/t50 - 1)/2
        -- Acceleration is given by F(z)/m(z) where m(z) = m/sqrt(1-v^2/c^2)
        -- or v(z)' = (a0*(1+sin(z))+2*b0)*sqrt(1-v(z)^2/c^2)/2
        if a0 ~= 0 and t50 > 0 then
            -- Closed form solution for velocity exists:
            -- v(t) = -c*tan(w)/sqrt(tan(w)^2+1) => w = -asin(v/c)
            -- w=(pi*t*(a0/2+b0)-a0*t50*sin(pi*t/2/t50)+*pi*c*k1)/pi/c
            -- @ t=0, v(0) = vi
            -- pi*c*k1/pi/c = -asin(vi/c)
            -- k1 = asin(vi/c)
            local k1  = math.asin(initial/C)
            local c1  = math.pi*(a0/2+b0)
            local c2  = a0*t50
            local c3  = C*math.pi
            local v = function(t)
                local w  = (c1*t - c2*math.sin(math.pi*t/2/t50) + c3*k1)/c3
                local tan = math.tan(w)
                return C*tan/math.sqrt(tan*tan+1)
            end
            local speedchk = speedUp and function(s) return s >= final end or
                                         function(s) return s <= final end
            timeToMax  = 2*t50
            if speedchk(v(timeToMax)) then
                local lasttime = 0
                while math.abs(timeToMax - lasttime) > 0.5 do
                    local t = (timeToMax + lasttime)/2
                    if speedchk(v(t)) then
                        timeToMax = t 
                    else
                        lasttime = t
                    end
                end
            end
            -- There is no closed form solution for distance in this case.
            -- Numerically integrate for time t=0 to t=2*T50 (or less)
            local lastv = initial
            local tinc  = timeToMax/ITERATIONS
            for step = 1, ITERATIONS do
                local speed = v(step*tinc)
                distanceToMax = distanceToMax + (speed+lastv)*tinc/2
                lastv = speed
            end
            if timeToMax < 2*t50 then
                return distanceToMax, timeToMax
            end
            initial     = lastv
        end
        -- At full thrust, acceleration only depends on the Lorentz factor:
        -- v(t)' = (F/m(v)) = a*sqrt(1-v(t)^2/c^2) where a = a0+b0
        -- -> v = c*sin((at+k1)/c)
        -- @ t=0, v=vi: k1 = c*asin(vi/c)
        -- -> t = (c*asin(v/c) - k1)/a
        -- x(t)' = c*sin((at+k1)/c)
        -- x = k2 - c^2 cos((at+k1)/c)/a
        -- @ t=0, x=0: k2 = c^2 * cos(k1/c)/a
        local k1       = C*math.asin(initial/C)
        local time     = (C * math.asin(final/C) - k1)/totA
        local k2       = C2 *math.cos(k1/C)/totA
        local distance = k2 - C2 * math.cos((totA*time + k1)/C)/totA
        return distance+distanceToMax, time+timeToMax
    end
    --
    -- computeTravelTime - "relativistic" version of t=(sqrt(2ad+v^2)-v)/a
    -- initialSpeed [in]: initial (positive) speed in meters per second
    -- acceleration [in]: constant acceleration until 'distance' is traversed
    -- distance [in]: the distance traveled in meters
    -- return: the time in seconds spent in traversing the distance
    --
    function Kinematic.computeTravelTime(initial, acceleration, distance)
        -- The low speed limit of following is: t=(sqrt(2ad+v^2)-v)/a
        -- (from: d=vt+at^2/2)
        if distance == 0 then return 0 end
        if acceleration > 0 then
            local k1       = C*math.asin(initial/C)
            local k2       = C2*math.cos(k1/C)/acceleration
            return (C*math.acos(acceleration*(k2 - distance)/C2) - k1)/acceleration
        end
        assert(initial > 0, 'Acceleration and initial speed are both zero.')
        return distance/initial
    end
    function Kinematic.lorentz(v) return lorentz(v) end
    return Kinematic
    end
    PlanetaryReference = PlanetRef()
    galaxyReference = PlanetaryReference(Atlas())
    Kinematic = Kinematics()
    Kep = Keplers()
    function getDistanceDisplayString(distance)
        local su = distance > 100000
        local result = ""
        if su then
            -- Convert to SU
            result = round(distance/1000/200,1) .. " SU"
        else
            -- Convert to KM
            result = round(distance/1000,1) .. " KM"
        end
    
        return result
    end
    
    PlanetaryReference = PlanetRef()
    galaxyReference = PlanetaryReference(Atlas())
    
    MapScreenButtons = {}
    MapScreenMouseX = 0
    MapScreenMouseY = 0
    MapScreenMouseDown = false
    MapScreenButtonSelected = 0
    local worldPos = vec3(core.getConstructWorldPos())
    local locX = (worldPos.x/400000)
    local locY = (worldPos.y/400000)*(-1)
    local destX = 0
    local destY = 0
    local sudistance = 0
    local loc = vec3(core.getConstructWorldPos())
    local ion = galaxyReference[0][120]  ---uses Atlas functions
    local thades = vec3(29165536.000, 10865536.000, 65536.000)
    local sinnen = vec3(58665536.000, 29665536.000, 58165536.000)
    local alioth = galaxyReference[0][2]    ---uses Atlas functions
    local madis = vec3(17465536.000, 22665536.000, -34464.000)
    local jago = vec3(-94134464.000, 12765536.000, -3634464.000)
    local symeon = vec3(14165536.000, -85634464.000, -934464.000)
    local lacobus = vec3(98865536.000, -13534464.000, -934464.000)
    local teoma = vec3(80865536.000, 54665536.000, -934464.000)
    local feli = vec3(-43534464.000, 22565536.000, -48934464.000)
    local talemai = vec3(-13234464.000, 55765536.000, 465536.000)
    local sicari = vec3(52765536.000, 27165536.000, 52065536.000)
    local distion = math.floor(ion:getDistance(loc)/200000)   ---uses getDistance functions----
    local distthades = string.format("%.2f", math.sqrt((loc.x-thades.x)^2+(loc.y-thades.y)^2+(loc.z-thades.z)^2)/200000)
    local distalioth = math.floor(alioth:getDistance(loc)/200000)   ---uses getDistance functions----
    local distmadis = string.format("%.2f", math.sqrt((loc.x-madis.x)^2+(loc.y-madis.y)^2+(loc.z-madis.z)^2)/200000)
    local distjago = string.format("%.2f", math.sqrt((loc.x-jago.x)^2+(loc.y-jago.y)^2+(loc.z-jago.z)^2)/200000)
    local distlacobus = string.format("%.2f", math.sqrt((loc.x-lacobus.x)^2+(loc.y-lacobus.y)^2+(loc.z-lacobus.z)^2)/200000)
    local distteoma = string.format("%.2f", math.sqrt((loc.x-teoma.x)^2+(loc.y-teoma.y)^2+(loc.z-teoma.z)^2)/200000)
    local distsymeon = string.format("%.2f", math.sqrt((loc.x-symeon.x)^2+(loc.y-symeon.y)^2+(loc.z-symeon.z)^2)/200000)
    local distfeli = string.format("%.2f", math.sqrt((loc.x-feli.x)^2+(loc.y-feli.y)^2+(loc.z-feli.z)^2)/200000)
    local distsinnen = string.format("%.2f", math.sqrt((loc.x-sinnen.x)^2+(loc.y-sinnen.y)^2+(loc.z-sinnen.z)^2)/200000)
    local disttalemai = string.format("%.2f", math.sqrt((loc.x-talemai.x)^2+(loc.y-talemai.y)^2+(loc.z-talemai.z)^2)/200000)
    local distsicari = string.format("%.2f", math.sqrt((loc.x-sicari.x)^2+(loc.y-sicari.y)^2+(loc.z-sicari.z)^2)/200000)
    
    
    
          for i = 1,1 do
       local button = {id = ("b"..1), enabled=true, td="<td>", top=2/100, bottom=13/100, left=1/100, right=28/100}
        table.insert(MapScreenButtons, button)
    end
      for i = 2,2 do
       local button = {id = ("b"..2), enabled=true, td="<td>", top=15/100, bottom=26/100, left=1/100, right=30/100}
        table.insert(MapScreenButtons, button)
    end
        for i = 3,3 do
        local button = {id = ("b"..3), enabled=true, td="<td>", top=27/100, bottom=38/100, left=1/100, right=28/100}
          table.insert(MapScreenButtons, button)
    end
        for i = 4,4 do   
        local button = {id = ("b"..4), enabled=true, td="<td>", top=39/100, bottom=50/100, left=1/100, right=28/100}
          table.insert(MapScreenButtons, button)
    end
        for i = 5,5 do   
        local button = {id = ("b"..5), enabled=true, td="<td>", top=51/100, bottom=62/100, left=1/100, right=28/100}
          table.insert(MapScreenButtons, button)
    end
        for i = 6,6 do   
        local button = {id = ("b"..6), enabled=true, td="<td>", top=64/100, bottom=75/100, left=1/100, right=28/100}
          table.insert(MapScreenButtons, button)
    end
        for i = 7,7 do   
        local button = {id = ("b"..7), enabled=true, td="<td>", top=2/100, bottom=13/100, left=75/100, right=100/100}
          table.insert(MapScreenButtons, button)
    end
        for i = 8,8 do   
        local button = {id = ("b"..8), enabled=true, td="<td>", top=15/100, bottom=26/100, left=75/100, right=100/100}
          table.insert(MapScreenButtons, button)
    end
        for i = 9,9 do   
        local button = {id = ("b"..9), enabled=true, td="<td>", top=27/100, bottom=38/100, left=75/100, right=100/100}
          table.insert(MapScreenButtons, button)
    end
        for i = 10,10 do   
        local button = {id = ("b"..10), enabled=true, td="<td>", top=39/100, bottom=50/100, left=75/100, right=100/100}
          table.insert(MapScreenButtons, button)
    end
        for i = 11,11 do   
        local button = {id = ("b"..11), enabled=true, td="<td>", top=51/100, bottom=62/100, left=75/100, right=100/100}
          table.insert(MapScreenButtons, button)
    end
        for i = 12,12 do   
        local button = {id = ("b"..12), enabled=true, td="<td>", top=64/100, bottom=75/100, left=75/100, right=100/100}
          table.insert(MapScreenButtons, button)
    end
        for i = 13,13 do   
        local button = {id = ("b"..13), enabled=true, td="<td>", top=90/100, bottom=100/100, left=1/100, right=18/100}
        table.insert(MapScreenButtons, button)
    end
    function evaluateButtons()
      local selected = 0
      
      if #MapScreenButtons >= 1 then
     -- Set button styles
           for i, button in ipairs(MapScreenButtons) do
                if button.left < MapScreenMouseX and MapScreenMouseX < button.right and button.top < MapScreenMouseY and MapScreenMouseY < button.bottom then
                    if MapScreenMouseDown and MapScreenButtonSelected == i then
                    end
                    selected = i
                end
                if not button.enabled then
                end
    
            end
      end
      return selected
    end
    
    function onButtonDown(buttonNo)
      local button = MapScreenButtons[buttonNo]    
      if not button or not button.enabled then
    	return
      end
    end
    function onButtonUp(buttonNo)
      local button = MapScreenButtons[buttonNo]    
      if not button or not button.enabled then
        return
      end
    function onClick(buttonNo)
      local button = MapScreenButtons[buttonNo]    
      if not button or not button.enabled then
        return
      end
    end
      if buttonNo == 1 then
    destX = 0
    destY = 0
    sudistance = distalioth
      elseif buttonNo == 2 then
    destX = 43
    destY = -56
    sudistance = distmadis
      elseif buttonNo == 3 then
    destX = 73
    destY = -27
    sudistance = distthades        
      elseif buttonNo == 4 then
    destX = -33
    destY = -139
    sudistance = disttalemai
      elseif buttonNo == 5 then
    destX = -109
    destY = -56
    sudistance = distfeli        
      elseif buttonNo == 6 then
    destX = 131
    destY = -68
    sudistance = distsicari        
      elseif buttonNo == 7 then
    destX = 35
    destY = 214
    sudistance = distsymeon
      elseif buttonNo == 8 then
    destX = 146
    destY = -74
    sudistance = distsinnen        
      elseif buttonNo == 9 then
    destX = -235
    destY = -32
    sudistance = distjago       
      elseif buttonNo == 10 then
    destX = 202
    destY = -137
    sudistance = distteoma        
      elseif buttonNo == 11 then
    destX = 7
    destY = 247
    sudistance = distion        
      elseif buttonNo == 12 then
    destX = 247
    destY = 34
    sudistance = distlacobus
      elseif buttonNo == 13 then
      unit.exit()
      end
    end
    
    function updateScreen() 
    warpmath = math.floor(math.floor(core.getConstructMass()/ 1000)  * sudistance * 0.00025)
    html= ([[
    <svg class="bootstrap" viewBox="0 0 1024 1024" style="width:100%; height:100%"><circle cx="500" cy="500" r="400" stroke="darkgreen" stroke-width="3" transform=""></circle><circle cx="500" cy="500" r="350" stroke="darkgreen" stroke-width="3" transform="" stroke-opacity="0.2"></circle><circle cx="500" cy="500" r="300" stroke="darkgreen" stroke-width="3" transform=""></circle><circle cx="500" cy="500" r="250" stroke="darkgreen" stroke-width="3" transform="" stroke-opacity="0.2"></circle><circle cx="500" cy="500" r="200" stroke="darkgreen" stroke-width="3" transform=""></circle><circle cx="500" cy="500" r="150" stroke="darkgreen" stroke-width="3" transform="" stroke-opacity="0.2"></circle><circle cx="500" cy="500" r="100" stroke="lightblue" stroke-width="3" transform=""></circle><circle cx="500" cy="500" r="50" stroke="lightblue" stroke-width="3" transform="" stroke-opacity="0.2"></circle><circle cx="500" cy="500" r="20" stroke="Orange" stroke-width="2" transform=""></circle><text x="510" y="510" fill="Yellow">Helios</text><circle cx="-0.00" cy="0" r="10" stroke="black" stroke-width="1" fill="blue" transform="translate(500,500)"></circle><text x="-0.00" y="0" transform="translate(500,480)" fill="white" font-size="20">Alioth</text><circle cx="7.16" cy="247.59" r="10" stroke="black" stroke-width="1" fill="blue" transform="translate(500,500)"></circle><text x="7.16" y="247.59" transform="translate(480,480)" fill="white" font-size="20">Ion</text><circle cx="35.41" cy="214.09" r="10" stroke="black" stroke-width="1" fill="blue" transform="translate(500,500)"></circle><text x="35.41" y="214.09" transform="translate(500,480)" fill="white" font-size="20">Symeon</text><circle cx="-33.09" cy="-139.41" r="10" stroke="black" stroke-width="1" fill="blue" transform="translate(500,500)"></circle><text x="-33.09" y="-139.41" transform="translate(500,480)" fill="white" font-size="20">Talemai</text><circle cx="202.16" cy="-136.66" r="10" stroke="black" stroke-width="1" fill="blue" transform="translate(500,500)"></circle><text x="202.16" y="-136.66" transform="translate(500,480)" fill="white" font-size="20">Teoma</text><circle cx="247.16" cy="33.84" r="10" stroke="black" stroke-width="1" fill="blue" transform="translate(500,500)"></circle><text x="247.16" y="33.84" transform="translate(500,480)" fill="white" font-size="20">Lacobus</text><circle cx="-108.84" cy="-56.41" r="10" stroke="black" stroke-width="1" fill="blue" transform="translate(500,500)"></circle><text x="-108.84" y="-56.41" transform="translate(500,480)" fill="white" font-size="20">Feli</text><circle cx="72.91" cy="-27.16" r="10" stroke="black" stroke-width="1" fill="blue" transform="translate(500,500)"></circle><text x="72.91" y="-27.16" transform="translate(500,485)" fill="white" font-size="20">Thades</text><circle cx="43.66" cy="-56.66" r="10" stroke="black" stroke-width="1" fill="blue" transform="translate(500,500)"></circle><text x="43.66" y="-56.66" transform="translate(500,480)" fill="white" font-size="20">Madis</text><circle cx="-235.34" cy="-31.91" r="10" stroke="black" stroke-width="1" fill="blue" transform="translate(500,500)"></circle><text x="-235.34" y="-31.91" transform="translate(500,480)" fill="white" font-size="20">Jago</text><circle cx="131.91" cy="-67.91" r="10" stroke="black" stroke-width="1" fill="blue" transform="translate(500,500)"></circle><text x="131.91" y="-67.91" transform="translate(475,480)" fill="white" font-size="20">Sicari</text><circle cx="146.66" cy="-74.16" r="10" stroke="black" stroke-width="1" fill="blue" transform="translate(500,500)"></circle><text x="146.66" y="-74.16" transform="translate(515,480)" fill="white" font-size="20">Sinnen</text>
    <line stroke-linecap="undefined" stroke-linejoin="undefined" id="svg_1" y2="]]..destY..[[" x2="]]..destX..[[" y1="]]..locY..[[" x1="]]..locX..[[" transform="translate(500,500)" stroke-width="5" stroke="#ff0000" fill="none"/>        
    <circle cx="]]..locX..[[" cy="]]..locY..[[" r="3" stroke="black" stroke-width="1" fill="limegreen" transform="translate(500,500)"></circle>
    <text x="]]..locX..[[" y="]]..locY..[[" transform="translate(500,500)" 
    fill="limegreen" font-size= "4.5vh" font-weight= "bold">//SHIP POSITION</text>
    </svg>
    <svg class="bootstrap" viewBox="0 0 1024 612" style="width:100%; height:100%">
     <g>
      <title>Layer 1</title>
      <g id="svg_24">
       <text stroke="null" transform="matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="20" id="svg_8" y="70" x="55" stroke-width="0" fill="Yellow">Alioth  :]]..distalioth..[[ SU</text>
       <text stroke="null" transform="matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="20" id="svg_14" y="170" x="55" stroke-width="0" fill="Yellow">Madis  :]]..distmadis..[[ SU</text>
       <text stroke="null" transform="matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="20" id="svg_17" y="270" x="55" stroke-width="0" fill="Yellow">Thades  :]]..distthades..[[ SU</text>
       <text stroke="null" transform="matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="20" id="svg_20" y="370" x="55" stroke-width="0" fill="Yellow">Talemai  :]]..disttalemai..[[ SU</text>
       <text stroke="null" transform="matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="20" id="svg_23" y="470" x="55" stroke-width="0" fill="Yellow">Feli  :]]..distfeli..[[ SU</text>
       <text stroke="null" transform="matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="20" id="svg_26" y="570" x="55" stroke-width="0" fill="Yellow">Sicari  :]]..distsicari..[[ SU</text>
       <g id="svg_12">
        <rect rx="10" id="svg_1" height="50" width="250" y="30" x="15" stroke-width="20" stroke="#00ff00" fill="none"/>
        <rect rx="10" id="svg_3" height="50" width="250" y="105" x="15" stroke-width="20" stroke="#00ff00" fill="none"/>
        <rect rx="10" id="svg_7" height="50" width="250" y="180" x="15" stroke-width="20" stroke="#00ff00" fill="none"/>
        <rect rx="10" id="svg_9" height="50" width="250" y="255" x="15" stroke-width="20" stroke="#00ff00" fill="none"/>
        <rect rx="10" id="svg_10" height="50" width="250" y="330" x="15" stroke-width="20" stroke="#00ff00" fill="none"/>
        <rect rx="10" id="svg_11" height="50" width="250" y="405" x="15" stroke-width="20" stroke="#00ff00" fill="none"/>
       </g>
      </g>
      <g id="svg_40">
       <text stroke="null" transform="matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="20" id="svg_25" y="70" x="997.163642" stroke-width="0" fill="Yellow">Symeon  :]]..distsymeon..[[ SU</text>
       <text stroke="null" transform="matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="20" id="svg_27" y="170" x="997.163642" stroke-width="0" fill="Yellow">Sinnen  :]]..distsinnen..[[ SU</text>
       <text stroke="null" transform="matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="20" id="svg_28" y="270" x="997.163642" stroke-width="0" fill="Yellow">Jago  :]]..distjago..[[ SU</text>
       <text stroke="null" transform="matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="20" id="svg_30" y="370" x="997.163642" stroke-width="0" fill="Yellow">Teoma  :]]..distteoma..[[ SU</text>
       <text stroke="null" transform="matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="20" id="svg_31" y="470" x="997.163642" stroke-width="0" fill="Yellow">Ion  :]]..distion..[[ SU</text>
       <text stroke="null" transform="matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="20" id="svg_32" y="570" x="997.163642" stroke-width="0" fill="Yellow">Lacobus  :]]..distlacobus..[[ SU</text>
       <g id="svg_39">
        <rect rx="10" id="svg_33" height="50" width="250" y="30" x="760" stroke-width="20" stroke="#00ff00" fill="none"/>
        <rect rx="10" id="svg_34" height="50" width="250" y="105" x="760" stroke-width="20" stroke="#00ff00" fill="none"/>
        <rect rx="10" id="svg_35" height="50" width="250" y="180" x="760" stroke-width="20" stroke="#00ff00" fill="none"/>
        <rect rx="10" id="svg_36" height="50" width="250" y="255" x="760" stroke-width="20" stroke="#00ff00" fill="none"/>
        <rect rx="10" id="svg_37" height="50" width="250" y="330" x="760" stroke-width="20" stroke="#00ff00" fill="none"/>
        <rect rx="10" id="svg_38" height="50" width="250" y="405" x="760" stroke-width="20" stroke="#00ff00" fill="none"/>
       </g>
      </g>
     </g>
     <text stroke="null" transform="matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="30" id="svg_32" y="700" x="20" stroke-width="0" fill="LightBlue">Est. Warp Cost: ]]..warpmath..[[</text>
      <text stroke="null" transform="matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="30" id="svg_32" y="750" x="20" stroke-width="0" fill="LightBlue">Construct Weight: ]]..math.floor(core.getConstructMass()/ 1000)..[[ tons</text>
        
    </svg>    
        ]])
    screen.setHTML(html)
    end
    unit.setTimer("spacemap",.08)
    
    
    

     

    Json Paste

    {"slots":{"0":{"name":"screen","type":{"events":[],"methods":[]}},"1":{"name":"core","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":"MapScreenMouseX = x\nMapScreenMouseY = y\nMapScreenMouseDown = false\nlocal buttonNo = evaluateButtons()\nif MapScreenButtonSelected > 0 and MapScreenButtonSelected == buttonNo then\n    onButtonUp(buttonNo)\n    onClick(buttonNo)\nend\nMapScreenButtonSelected = -buttonNo","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"mouseUp(x,y)","slotKey":"0"},"key":"0"},{"code":"MapScreenMouseX = x\nMapScreenMouseY = y\nMapScreenMouseDown = true\nMapScreenButtonSelected = evaluateButtons()\nonButtonDown(MapScreenButtonSelected)\n","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"mouseDown(x,y)","slotKey":"0"},"key":"1"},{"code":"function Atlas()\n        return {\n    [0] = {\n      [1]={\n        GM=6930729684,\n        bodyId=1,\n        center={x=17465536.000,y=22665536.000,z=-34464.000},\n        name='Madis',\n        planetarySystemId=0,\n        radius=44300\n      },\n      [2]={\n        GM=157470826617,\n        bodyId=2,\n        center={x=-8.000,y=-8.000,z=-126303.000},\n        name='Alioth',\n        planetarySystemId=0,\n        radius=126068\n      },\n      [3]={\n        GM=11776905000,\n        bodyId=3,\n        center={x=29165536.000,y=10865536.000,z=65536.000},\n        name='Thades',\n        planetarySystemId=0,\n        radius=49000\n      },\n      [4]={\n        GM=14893847582,\n        bodyId=4,\n        center={x=-13234464.000,y=55765536.000,z=465536.000},\n        name='Talemai',\n        planetarySystemId=0,\n        radius=57450\n      },\n      [5]={\n        GM=16951680000,\n        bodyId=5,\n        center={x=-43534464.000,y=22565536.000,z=-48934464.000},\n        name='Feli',\n        planetarySystemId=0,\n        radius=60000\n      },\n      [6]={\n        GM=10502547741,\n        bodyId=6,\n        center={x=52765536.000,y=27165538.000,z=52065535.000},\n        name='Sicari',\n        planetarySystemId=0,\n        radius=51100\n      },\n      [7]={\n        GM=13033380591,\n        bodyId=7,\n        center={x=58665538.000,y=29665535.000,z=58165535.000},\n        name='Sinnen',\n        planetarySystemId=0,\n        radius=54950\n      },\n      [8]={\n        GM=18477723600,\n        bodyId=8,\n        center={x=80865538.000,y=54665536.000,z=-934463.940},\n        name='Teoma',\n        planetarySystemId=0,\n        radius=62000\n      },\n      [9]={\n        GM=18606274330,\n        bodyId=9,\n        center={x=-94134462.000,y=12765534.000,z=-3634464.000},\n        name='Jago',\n        planetarySystemId=0,\n        radius=61590\n      },\n      [10]={\n        GM=78480000,\n        bodyId=10,\n        center={x=17448118.224,y=22966846.286,z=143078.820},\n        name='Madis Moon 1',\n        planetarySystemId=0,\n        radius=10000\n      },\n      [11]={\n        GM=237402000,\n        bodyId=11,\n        center={x=17194626.000,y=22243633.880,z=-214962.810},\n        name='Madis Moon 2',\n        planetarySystemId=0,\n        radius=11000\n      },\n      [12]={\n        GM=265046609,\n        bodyId=12,\n        center={x=17520614.000,y=22184730.000,z=-309989.990},\n        name='Madis Moon 3',\n        planetarySystemId=0,\n        radius=15005\n      },\n      [21]={\n        GM=2118960000,\n        bodyId=21,\n        center={x=457933.000,y=-1509011.000,z=115524.000},\n        name='Alioth Moon 1',\n        planetarySystemId=0,\n        radius=30000\n      },\n      [22]={\n        GM=2165833514,\n        bodyId=22,\n        center={x=-1692694.000,y=729681.000,z=-411464.000},\n        name='Alioth Moon 4',\n        planetarySystemId=0,\n        radius=30330\n      },\n      [26]={\n        GM=68234043600,\n        bodyId=26,\n        center={x=-1404835.000,y=562655.000,z=-285074.000},\n        name='Sanctuary',\n        planetarySystemId=0,\n        radius=83400\n      },\n      [30]={\n        GM=211564034,\n        bodyId=30,\n        center={x=29214402.000,y=10907080.695,z=433858.200},\n        name='Thades Moon 1',\n        planetarySystemId=0,\n        radius=14002\n      },\n      [31]={\n        GM=264870000,\n        bodyId=31,\n        center={x=29404193.000,y=10432768.000,z=19554.131},\n        name='Thades Moon 2',\n        planetarySystemId=0,\n        radius=15000\n      },\n      [40]={\n        GM=141264000,\n        bodyId=40,\n        center={x=-13503090.000,y=55594325.000,z=769838.640},\n        name='Talemai Moon 2',\n        planetarySystemId=0,\n        radius=12000\n      },\n      [41]={\n        GM=106830900,\n        bodyId=41,\n        center={x=-12800515.000,y=55700259.000,z=325207.840},\n        name='Talemai Moon 3',\n        planetarySystemId=0,\n        radius=11000\n      },\n      [42]={\n        GM=264870000,\n        bodyId=42,\n        center={x=-13058408.000,y=55781856.000,z=740177.760},\n        name='Talemai Moon 1',\n        planetarySystemId=0,\n        radius=15000\n      },\n      [50]={\n        GM=499917600,\n        bodyId=50,\n        center={x=-43902841.780,y=22261034.700,z=-48862386.000},\n        name='Feli Moon 1',\n        planetarySystemId=0,\n        radius=14000\n      },\n      [70]={\n        GM=396912600,\n        bodyId=70,\n        center={x=58969616.000,y=29797945.000,z=57969449.000},\n        name='Sinnen Moon 1',\n        planetarySystemId=0,\n        radius=17000\n      },\n      [100]={\n        GM=13975172474,\n        bodyId=100,\n        center={x=98865536.000,y=-13534464.000,z=-934461.990},\n        name='Lacobus',\n        planetarySystemId=0,\n        radius=55650\n      },\n      [101]={\n        GM=264870000,\n        bodyId=101,\n        center={x=98905288.170,y=-13950921.100,z=-647589.530},\n        name='Lacobus Moon 3',\n        planetarySystemId=0,\n        radius=15000\n      },\n      [102]={\n        GM=444981600,\n        bodyId=102,\n        center={x=99180968.000,y=-13783862.000,z=-926156.400},\n        name='Lacobus Moon 1',\n        planetarySystemId=0,\n        radius=18000\n      },\n      [103]={\n        GM=211503600,\n        bodyId=103,\n        center={x=99250052.000,y=-13629215.000,z=-1059341.400},\n        name='Lacobus Moon 2',\n        planetarySystemId=0,\n        radius=14000\n      },\n      [110]={\n        GM=9204742375,\n        bodyId=110,\n        center={x=14165536.000,y=-85634465.000,z=-934464.300},\n        name='Symeon',\n        planetarySystemId=0,\n        radius=49050\n      },\n      [120]={\n        GM=7135606629,\n        bodyId=120,\n        center={x=2865536.700,y=-99034464.000,z=-934462.020},\n        name='Ion',\n        planetarySystemId=0,\n        radius=44950\n      },\n      [121]={\n        GM=106830900,\n        bodyId=121,\n        center={x=2472916.800,y=-99133747.000,z=-1133582.800},\n        name='Ion Moon 1',\n        planetarySystemId=0,\n        radius=11000\n      },\n      [122]={\n        GM=176580000,\n        bodyId=122,\n        center={x=2995424.500,y=-99275010.000,z=-1378480.700},\n        name='Ion Moon 2',\n        planetarySystemId=0,\n        radius=15000\n      }  \n     }\n    }\n    end\nfunction PlanetRef() \n--[[ \n  Provide coordinate transforms and access to kinematic related parameters\n  Author: JayleBreak\n  Usage (unit.start):\n  PlanetaryReference = require('planetref')\n  galaxyReference = PlanetaryReference(referenceTableSource)\n  helios = galaxyReference[0] -- PlanetaryReference.PlanetarySystem instance\n  alioth = helios[2]          -- PlanetaryReference.BodyParameters instance\n  Methods:\n    PlanetaryReference:getPlanetarySystem - based on planetary system ID.\n    PlanetaryReference.isMapPosition - 'true' if an instance of 'MapPosition'\n    PlanetaryReference.createBodyParameters - for entry into reference table\n    PlanetaryReference.BodyParameters - a class containing a body's information.\n    PlanetaryReference.MapPosition - a class for map coordinates\n    PlanetaryReference.PlanetarySystem - a container for planetary system info.\n    PlanetarySystem:castIntersections - from a position in a given direction.\n    PlanetarySystem:closestBody - to the specified coordinates.\n    PlanetarySystem:convertToBodyIdAndWorldCoordinates - from map coordinates.\n    PlanetarySystem:getBodyParameters - from reference table.\n    PlanetarySystem:getPlanetarySystemId - for the instance.\n    BodyParameters:convertToWorldCoordinates - from map coordinates\n    BodyParameters:convertToMapPosition - from world coordinates\n    BodyParameters:getAltitude - of world coordinates\n    BodyParameters:getDistance - from center to world coordinates\n    BodyParameters:getGravity - at a given position in world coordinates.\n  Description\n  An instance of the 'PlanetaryReference' \"class\" can contain transform and\n  kinematic reference information for all planetary systems in DualUniverse.\n  Each planetary system is identified by a numeric identifier. Currently,\n  the only planetary system, Helios, has the identifier: zero. This \"class\"\n  supports the indexing ('[]') operation which is equivalent to the\n  use of the 'getPlanetarySystem' method. It also supports the 'pairs()'\n  method for iterating over planetary systems.\n\n  An instance of the 'PlanetarySystem' \"class\" contains all reference\n  information for a specific system. It supports the indexing ('[]') and\n  'pairs()' functions which allows iteration over each \"body\" in the\n  system where the key is the numeric body ID. It also supports the\n  'tostring()' method.\n  An instance of the 'BodyParameters' \"class\" contains all reference\n  information for a single celestial \"body\" (a moon or planet). It supports\n  the 'tostring()' method, and contains the data members:\n          planetarySystemId - numeric planetary system ID\n          bodyId            - numeric body ID\n          radius            - radius of the body in meters (zero altitude)\n          center            - world coordinates of the body's center position\n          GM                - the gravitation parameter (g = GM/radius^2)\n  Note that the user is allowed to add custom fields (e.g. body name), but\n  should insure that complex table values have the '__tostring' metamethod\n  implemented.\n  Transform and Kinematics:\n  \"World\" coordinates is a cartesian coordinate system with an origin at an\n  arbitrary fixed point in a planetary system and with distances measured in\n  meters. The coordinates are expressible either as a simple table of 3 values\n  or an instance of the 'vec3' class.  In either case, the planetary system\n  identity is implicit.\n  \"Map\" coordinates is a geographic coordinate system with an origin at the\n  center of an identified (by a numeric value) celestial body which is a\n  member of an identified (also a numeric value) planetary system. Note that\n  the convention that latitude, longitude, and altitude values will be the\n  position's x, y, and z world coordinates in the special case of body ID 0.\n  The kinematic parameters in the reference data permit calculations of the\n  gravitational attraction of the celestial body on other objects.\n  Reference Data:\n  This is an example of reference data with a single entry assigned to\n  planetary system ID 0, and body ID 2 ('Alioth'):\n    referenceTable = {\n          [0] = { [2] = { planetarySystemId = 0,\n                          bodyId = 2,\n                          radius = 126068,\n                          center = vec3({x=-8, y=-8, z=-126303}),\n                          GM = 1.572199+11 } -- as in F=-GMm/r^2\n          }\n      }\n    ref=PlanetaryReference(referenceTable)\n  Collecting Reference Data:\n  A combination of information from the \"Map\" screen in the DU user interface,\n  and values reported by the DU Lua API can be the source of the reference\n  table's data (planetarySystemId, bodyId, and surfaceArea is from the user\n  interface):\n    referenceTable = {}\n    referenceTable[planetarySystemId][bodyId] =\n         PlanetaryReference.createBodyParameters(planetarySystemId,\n                                                 bodyId,\n                                                 surfaceArea,\n                                                 core.getConstructWorldPos(),\n                                                 core.getWorldVertical(),\n                                                 core.getAltitude(),\n                                                 core.g())\n  Adapting Data Sources:\n  Other sources of data can be adapted or converted. An example of adapting a\n  table, defined in the file: 'planets.lua', containing information on a single\n  planetary system and using celestial body name as the key follows (note that\n  a 'name' field is added to the BodyParameters instance transparently after\n  construction, and the '__pairs' meta function is required to support the\n  'closestBody' and '__tostring' methods):\n    ref=PlanetaryReference(\n        {[0] = setmetatable(require('planets'),\n                        { __index = function(bodies, bodyId)\n                             for _,v in pairs(bodies) do\n                                 if v and v.bodyId == bodyId then return v end\n                             end\n                             return nil\n                           end,\n                         __pairs = function(bodies)\n                             return function(t, k)\n                                     local nk, nv = next(t, k)\n                                     if nv then\n                                         local GM = nv.gravity * nv.radius^2\n                                         local bp = BodyParameters(0,\n                                                                   nv.id,\n                                                                   nv.radius,\n                                                                   nv.pos,\n                                                                   GM)\n                                         bp.name = nk\n                                         return nk, bp\n                                    end\n                                    return nk, nv\n                                 end, bodies, nil\n                           end })\n    })\n\n  Converting Data Sources:\n  An instance of 'PlanetaryReference' that has been adapted to a data source\n  can be used to convert that source to simple table. For example,\n  using the adapted instance shown above:\n    load('convertedData=' .. tostring(ref))()\n    newRef=PlanetaryReference(convertedData)\n  Also See: kepler.lua\n  ]]--\n--[[                    START OF LOCAL IMPLEMENTATION DETAILS             ]]--\n-- Type checks\nlocal function isNumber(n)  return type(n)           == 'number' end\nlocal function isSNumber(n) return type(tonumber(n)) == 'number' end\nlocal function isTable(t)   return type(t)           == 'table'  end\nlocal function isString(s)  return type(s)           == 'string' end\nlocal function isVector(v)  return isTable(v)\n                                    and isNumber(v.x and v.y and v.z) end\nlocal function isMapPosition(m) return isTable(m) and isNumber(m.latitude  and\n                                                               m.longitude and\n                                                               m.altitude  and\n                                                               m.bodyId    and\n                                                               m.systemId) end\n-- Constants\nlocal deg2rad    = math.pi/180\nlocal rad2deg    = 180/math.pi\nlocal epsilon    = 1e-10\nlocal num        = ' *([+-]?%d+%.?%d*e?[+-]?%d*)'\nlocal posPattern = '::pos{' .. num .. ',' .. num .. ',' ..  num .. ',' ..\n                   num ..  ',' .. num .. '}'\n-- Utilities\nlocal utils  = require('cpml.utils')\nlocal vec3   = require('cpml.vec3')\nlocal clamp  = utils.clamp\nlocal function float_eq(a,b)\n    if a == 0 then return math.abs(b) < 1e-09 end\n    if b == 0 then return math.abs(a) < 1e-09 end\n    return math.abs(a - b) < math.max(math.abs(a),math.abs(b))*epsilon\nend\nlocal function formatNumber(n)\n    local result = string.gsub(\n                    string.reverse(string.format('%.4f',n)),\n                    '^0*%.?','')\n    return result == '' and '0' or string.reverse(result)\nend\nlocal function formatValue(obj)\n    if isVector(obj) then\n        return string.format('{x=%.3f,y=%.3f,z=%.3f}', obj.x, obj.y, obj.z)\n    end\n    if isTable(obj) and not getmetatable(obj) then\n        local list = {}\n        local nxt  = next(obj)\n        if type(nxt) == 'nil' or nxt == 1 then -- assume this is an array\n            list = obj\n        else\n            for k,v in pairs(obj) do\n                local value = formatValue(v)\n                if type(k) == 'number' then\n                    table.insert(list, string.format('[%s]=%s', k, value))\n                else\n                    table.insert(list, string.format('%s=%s',   k, value))\n                end\n            end\n        end\n        return string.format('{%s}', table.concat(list, ','))\n    end\n    if isString(obj) then\n        return string.format(\"'%s'\", obj:gsub(\"'\",[[\\']]))\n    end\n    return tostring(obj)\nend\n-- CLASSES\n-- BodyParameters: Attributes of planetary bodies (planets and moons)\nlocal BodyParameters = {}\nBodyParameters.__index = BodyParameters\nBodyParameters.__tostring =\n    function(obj, indent)\n        local sep = indent or ''\n        local keys = {}\n        for k in pairs(obj) do table.insert(keys, k) end\n        table.sort(keys)\n        local list = {}\n        for _, k in ipairs(keys) do\n            local value = formatValue(obj[k])\n            if type(k) == 'number' then\n                table.insert(list, string.format('[%s]=%s', k, value))\n            else\n                table.insert(list, string.format('%s=%s', k, value))\n            end\n        end\n        if indent then\n            return string.format('%s%s',\n                                 indent,\n                                 table.concat(list, ',\\n' .. indent))\n        end\n        return string.format('{%s}', table.concat(list, ','))\n    end\nBodyParameters.__eq = function(lhs, rhs)\n        return lhs.planetarySystemId == rhs.planetarySystemId and\n               lhs.bodyId            == rhs.bodyId            and\n               float_eq(lhs.radius, rhs.radius)               and\n               float_eq(lhs.center.x, rhs.center.x)           and\n               float_eq(lhs.center.y, rhs.center.y)           and\n               float_eq(lhs.center.z, rhs.center.z)           and\n               float_eq(lhs.GM, rhs.GM)\n    end\nlocal function mkBodyParameters(systemId, bodyId, radius, worldCoordinates, GM)\n    -- 'worldCoordinates' can be either table or vec3\n    assert(isSNumber(systemId),\n           'Argument 1 (planetarySystemId) must be a number:' .. type(systemId))\n    assert(isSNumber(bodyId),\n           'Argument 2 (bodyId) must be a number:' .. type(bodyId))\n    assert(isSNumber(radius),\n           'Argument 3 (radius) must be a number:' .. type(radius))\n    assert(isTable(worldCoordinates),\n           'Argument 4 (worldCoordinates) must be a array or vec3.' ..\n           type(worldCoordinates))\n    assert(isSNumber(GM),\n           'Argument 5 (GM) must be a number:' .. type(GM))\n    return setmetatable({planetarySystemId = tonumber(systemId),\n                         bodyId            = tonumber(bodyId),\n                         radius            = tonumber(radius),\n                         center            = vec3(worldCoordinates),\n                         GM                = tonumber(GM) }, BodyParameters)\nend\n-- MapPosition: Geographical coordinates of a point on a planetary body.\nlocal MapPosition = {}\nMapPosition.__index = MapPosition\nMapPosition.__tostring = function(p)\n        return string.format('::pos{%d,%d,%s,%s,%s}',\n                             p.systemId,\n                             p.bodyId,\n                             formatNumber(p.latitude*rad2deg),\n                             formatNumber(p.longitude*rad2deg),\n                             formatNumber(p.altitude))\n    end\nMapPosition.__eq       = function(lhs, rhs)\n        return lhs.bodyId   == rhs.bodyId              and\n               lhs.systemId == rhs.systemId            and\n               float_eq(lhs.latitude,   rhs.latitude)  and\n               float_eq(lhs.altitude,   rhs.altitude)  and\n               (float_eq(lhs.longitude, rhs.longitude) or\n                float_eq(lhs.latitude, math.pi/2)      or\n                float_eq(lhs.latitude, -math.pi/2))\n    end\n-- latitude and longitude are in degrees while altitude is in meters\nlocal function mkMapPosition(overload, bodyId, latitude, longitude, altitude)\n    local systemId = overload -- Id or '::pos{...}' string\n    if isString(overload) and not longitude and not altitude and\n                              not bodyId    and not latitude then\n        systemId, bodyId, latitude, longitude, altitude =\n                                            string.match(overload, posPattern)\n        assert(systemId, 'Argument 1 (position string) is malformed.')\n    else\n        assert(isSNumber(systemId),\n               'Argument 1 (systemId) must be a number:' .. type(systemId))\n        assert(isSNumber(bodyId),\n               'Argument 2 (bodyId) must be a number:' .. type(bodyId))\n        assert(isSNumber(latitude),\n               'Argument 3 (latitude) must be in degrees:' .. type(latitude))\n        assert(isSNumber(longitude),\n               'Argument 4 (longitude) must be in degrees:' .. type(longitude))\n        assert(isSNumber(altitude),\n               'Argument 5 (altitude) must be in meters:' .. type(altitude))\n    end\n    systemId  = tonumber(systemId)\n    bodyId    = tonumber(bodyId)\n    latitude  = tonumber(latitude)\n    longitude = tonumber(longitude)\n    altitude  = tonumber(altitude)\n    if bodyId == 0 then -- this is a hack to represent points in space\n        return setmetatable({latitude  = latitude,\n                             longitude = longitude,\n                             altitude  = altitude,\n                             bodyId    = bodyId,\n                             systemId  = systemId}, MapPosition)\n    end\n    return setmetatable({latitude  = deg2rad*clamp(latitude, -90, 90),\n                         longitude = deg2rad*(longitude % 360),\n                         altitude  = altitude,\n                         bodyId    = bodyId,\n                         systemId  = systemId}, MapPosition)\nend\n-- PlanetarySystem - map body IDs to BodyParameters\nlocal PlanetarySystem = {}\nPlanetarySystem.__index = PlanetarySystem\nPlanetarySystem.__tostring =\n    function (obj, indent)\n        local sep = indent and (indent .. '  ' )\n        local bdylist = {}\n        local keys = {}\n        for k in pairs(obj) do table.insert(keys, k) end\n        table.sort(keys)\n        for _, bi in ipairs(keys) do\n            bdy = obj[bi]\n            local bdys = BodyParameters.__tostring(bdy, sep)\n            if indent then\n                table.insert(bdylist,\n                             string.format('[%s]={\\n%s\\n%s}',\n                                           bi, bdys, indent))\n            else\n                table.insert(bdylist, string.format('  [%s]=%s', bi, bdys))\n            end\n        end\n        if indent then\n            return string.format('\\n%s%s%s',\n                                 indent,\n                                 table.concat(bdylist, ',\\n' .. indent),\n                                 indent)\n        end\n        return string.format('{\\n%s\\n}', table.concat(bdylist, ',\\n'))\n    end\nlocal function mkPlanetarySystem(referenceTable)\n    local atlas = {}\n    local pid\n    for _, v in pairs(referenceTable) do\n        local id = v.planetarySystemId\n        if type(id) ~= 'number' then\n            error('Invalid planetary system ID: ' .. tostring(id))\n        elseif pid and id ~= pid then\n            error('Mismatch planetary system IDs: ' .. id .. ' and '\n                  .. pid)\n        end\n        local bid = v.bodyId\n        if type(bid) ~= 'number' then\n            error('Invalid body ID: ' .. tostring(bid))\n        elseif atlas[bid] then\n            error('Duplicate body ID: ' .. tostring(bid))\n        end\n        setmetatable(v.center, getmetatable(vec3.unit_x))\n        atlas[bid] = setmetatable(v, BodyParameters)\n        pid = id\n    end\n    return setmetatable(atlas, PlanetarySystem)\nend\n-- PlanetaryReference - map planetary system ID to PlanetarySystem\nPlanetaryReference = {}\nlocal function mkPlanetaryReference(referenceTable)\n    return setmetatable({ galaxyAtlas = referenceTable or {} },\n                          PlanetaryReference)\nend\nPlanetaryReference.__index        = \n    function(t,i)\n        if type(i) == 'number' then\n            local system = t.galaxyAtlas[i]\n            return mkPlanetarySystem(system)\n        end\n        return rawget(PlanetaryReference, i)\n    end\nPlanetaryReference.__pairs        =\n    function(obj)\n        return  function(t, k)\n                    local nk, nv = next(t, k)\n                    return nk, nv and mkPlanetarySystem(nv)\n                end, obj.galaxyAtlas, nil\n    end\nPlanetaryReference.__tostring     =\n    function (obj)\n        local pslist = {}\n        for _,ps in pairs(obj or {}) do\n            local psi = ps:getPlanetarySystemId()\n            local pss = PlanetarySystem.__tostring(ps, '    ')\n            table.insert(pslist,\n                         string.format('  [%s]={%s\\n  }', psi, pss))\n        end\n        return string.format('{\\n%s\\n}\\n', table.concat(pslist,',\\n'))\n    end\n--[[                       START OF PUBLIC INTERFACE                       ]]--\n-- PlanetaryReference CLASS METHODS:\n--\n-- BodyParameters - create an instance of BodyParameters class\n-- planetarySystemId  [in]: the body's planetary system ID.\n-- bodyId             [in]: the body's ID.\n-- radius             [in]: the radius in meters of the planetary body.\n-- bodyCenter         [in]: the world coordinates of the center (vec3 or table).\n-- GM                 [in]: the body's standard gravitational parameter.\n-- return: an instance of BodyParameters class.\n--\nPlanetaryReference.BodyParameters = mkBodyParameters\n--\n-- MapPosition - create an instance of the MapPosition class\n-- overload [in]: either a planetary system ID or a position string ('::pos...')\n-- bodyId [in]:   (ignored if overload is a position string) the body's ID.\n-- latitude [in]: (ignored if overload is a position string) the latitude.\n-- longitude [in]:(ignored if overload is a position string) the longitude.\n-- altitude [in]: (ignored if overload is a position string) the altitude.\n-- return: the class instance\n--\nPlanetaryReference.MapPosition    = mkMapPosition\n--\n-- PlanetarySystem - create an instance of PlanetarySystem class\n-- referenceData [in]: a table (indexed by bodyId) of body reference info.\n-- return: the class instance\n--\nPlanetaryReference.PlanetarySystem = mkPlanetarySystem\n--\n-- createBodyParameters - create an instance of BodyParameters class\n-- planetarySystemId  [in]: the body's planetary system ID.\n-- bodyId             [in]: the body's ID.\n-- surfaceArea        [in]: the body's surface area in square meters.\n-- aPosition          [in]: world coordinates of a position near the body.\n-- verticalAtPosition [in]: a vector pointing towards the body center.\n-- altitudeAtPosition [in]: the altitude in meters at the position.\n-- gravityAtPosition  [in]: the magnitude of the gravitational acceleration.\n-- return: an instance of BodyParameters class.\n--\nfunction PlanetaryReference.createBodyParameters(planetarySystemId,\n                                                 bodyId,\n                                                 surfaceArea,\n                                                 aPosition,\n                                                 verticalAtPosition,\n                                                 altitudeAtPosition,\n                                                 gravityAtPosition)\n    assert(isSNumber(planetarySystemId),\n           'Argument 1 (planetarySystemId) must be a number:' ..\n           type(planetarySystemId))\n    assert(isSNumber(bodyId),\n           'Argument 2 (bodyId) must be a number:' .. type(bodyId))\n    assert(isSNumber(surfaceArea),\n           'Argument 3 (surfaceArea) must be a number:' .. type(surfaceArea))\n    assert(isTable(aPosition),\n           'Argument 4 (aPosition) must be an array or vec3:' ..\n           type(aPosition))\n    assert(isTable(verticalAtPosition),\n           'Argument 5 (verticalAtPosition) must be an array or vec3:' ..\n           type(verticalAtPosition))\n    assert(isSNumber(altitudeAtPosition),\n           'Argument 6 (altitude) must be in meters:' ..\n           type(altitudeAtPosition))\n    assert(isSNumber(gravityAtPosition),\n           'Argument 7 (gravityAtPosition) must be number:' ..\n           type(gravityAtPosition))\n    local radius   = math.sqrt(surfaceArea/4/math.pi)\n    local distance = radius + altitudeAtPosition\n    local center   = vec3(aPosition) + distance*vec3(verticalAtPosition)\n    local GM       = gravityAtPosition * distance * distance\n    return mkBodyParameters(planetarySystemId, bodyId, radius, center, GM)\nend\n--\n-- isMapPosition - check for the presence of the 'MapPosition' fields\n-- valueToTest [in]: the value to be checked\n-- return: 'true' if all required fields are present in the input value\n--\nPlanetaryReference.isMapPosition  = isMapPosition\n-- PlanetaryReference INSTANCE METHODS:\n--\n-- getPlanetarySystem - get the planetary system using ID or MapPosition as key\n-- overload [in]: either the planetary system ID or a MapPosition that has it.\n-- return: instance of 'PlanetarySystem' class or nil on error\n--\nfunction PlanetaryReference:getPlanetarySystem(overload)\n    --if galaxyAtlas then\n        local planetarySystemId = overload\n        if isMapPosition(overload) then\n            planetarySystemId = overload.systemId\n        end\n        if type(planetarySystemId) == 'number' then\n            local system = self.galaxyAtlas[i]\n            if system then\n                if getmetatable(nv) ~= PlanetarySystem then\n                    system = mkPlanetarySystem(system)\n                end\n                return system\n            end\n        end\n    --end\n    --return nil\nend\n-- PlanetarySystem INSTANCE METHODS:\n--\n-- castIntersections - Find the closest body that intersects a \"ray cast\".\n-- origin [in]: the origin of the \"ray cast\" in world coordinates\n-- direction [in]: the direction of the \"ray cast\" as a 'vec3' instance.\n-- sizeCalculator [in]: (default: returns 1.05*radius) Returns size given body.\n-- bodyIds[in]: (default: all IDs in system) check only the given IDs.\n-- return: The closest body that blocks the cast or 'nil' if none.\n--\nfunction PlanetarySystem:castIntersections(origin,\n                                           direction,\n                                           sizeCalculator,\n                                           bodyIds)\n    local sizeCalculator = sizeCalculator or \n                            function (body) return 1.05*body.radius end\n    local candidates = {}\n    if bodyIds then\n        for _,i in ipairs(bodyIds) do candidates[i] = self[i] end\n    else\n        bodyIds = {}\n        for k,body in pairs(self) do\n            table.insert(bodyIds, k)\n            candidates[k] = body\n        end\n    end\n    local function compare(b1,b2)\n        local v1 = candidates[b1].center - origin\n        local v2 = candidates[b2].center - origin\n        return v1:len() < v2:len()\n    end\n    table.sort(bodyIds, compare)\n    local dir = direction:normalize()\n    for i, id in ipairs(bodyIds) do\n        local body   = candidates[id]\n        local c_oV3  = body.center - origin\n        local radius = sizeCalculator(body)\n        local dot    = c_oV3:dot(dir)\n        local desc   = dot^2 - (c_oV3:len2() - radius^2)\n        if desc >= 0 then\n            local root     = math.sqrt(desc)\n            local farSide  = dot + root\n            local nearSide = dot - root\n            if nearSide > 0 then\n                return body, farSide, nearSide\n            elseif farSide > 0 then\n                return body, farSide, nil\n            end\n        end\n    end\n    return nil, nil, nil\nend\n--\n-- closestBody - find the closest body to a given set of world coordinates\n-- coordinates       [in]: the world coordinates of position in space\n-- return: an instance of the BodyParameters object closest to 'coordinates'\n--\nfunction PlanetarySystem:closestBody(coordinates)\n    assert(type(coordinates) == 'table', 'Invalid coordinates.')\n    local minDistance2, body\n    local coord = vec3(coordinates)\n    for _,params in pairs(self) do\n        local distance2 = (params.center - coord):len2()\n        if not body or distance2 < minDistance2 then\n            body         = params\n            minDistance2 = distance2\n        end\n    end\n    return body\nend\n--\n-- convertToBodyIdAndWorldCoordinates - map to body Id and world coordinates\n-- overload [in]: an instance of MapPosition or a position string ('::pos...)\n-- return: a vec3 instance containing the world coordinates or 'nil' on error.\n--\nfunction PlanetarySystem:convertToBodyIdAndWorldCoordinates(overload)\n    local mapPosition = overload\n    if isString(overload) then\n        mapPosition = mkMapPosition(overload)\n    end\n    if mapPosition.bodyId == 0 then\n        return 0, vec3(mapPosition.latitude,\n                       mapPosition.longitude,\n                       mapPosition.altitude)\n    end\n    local params = self:getBodyParameters(mapPosition)\n    if params then\n        return mapPosition.bodyId,\n               params:convertToWorldCoordinates(mapPosition)\n    end\nend\n--\n-- getBodyParameters - get or create an instance of BodyParameters class\n-- overload [in]: either an instance of MapPosition or a body's ID.\n-- return: a BodyParameters instance or 'nil' if body ID is not found.\n--\nfunction PlanetarySystem:getBodyParameters(overload)\n    local bodyId = overload\n    if isMapPosition(overload) then\n        bodyId = overload.bodyId\n    end\n    assert(isSNumber(bodyId),\n               'Argument 1 (bodyId) must be a number:' .. type(bodyId))\n    return self[bodyId]\nend\n--\n-- getPlanetarySystemId - get the planetary system ID for this instance\n-- return: the planetary system ID or nil if no planets are in the system.\n--\nfunction PlanetarySystem:getPlanetarySystemId()\n    local k, v = next(self)\n    return v and v.planetarySystemId\nend\n-- BodyParameters INSTANCE METHODS:\n--\n-- convertToMapPosition - create an instance of MapPosition from coordinates\n-- worldCoordinates [in]: the world coordinates of the map position.\n-- return: an instance of MapPosition class\n--\nfunction BodyParameters:convertToMapPosition(worldCoordinates)\n    assert(isTable(worldCoordinates),\n           'Argument 1 (worldCoordinates) must be an array or vec3:' ..\n           type(worldCoordinates))\n    local worldVec  = vec3(worldCoordinates) \n    if self.bodyId == 0 then\n        return setmetatable({latitude  = worldVec.x,\n                             longitude = worldVec.y,\n                             altitude  = worldVec.z,\n                             bodyId    = 0,\n                             systemId  = self.planetarySystemId}, MapPosition)\n    end\n    local coords    = worldVec - self.center\n    local distance  = coords:len()\n    local altitude  = distance - self.radius\n    local latitude  = 0\n    local longitude = 0\n    if not float_eq(distance, 0) then\n        local phi = math.atan(coords.y, coords.x)\n        longitude = phi >= 0 and phi or (2*math.pi + phi)\n        latitude  = math.pi/2 - math.acos(coords.z/distance)\n    end\n    return setmetatable({latitude  = latitude,\n                         longitude = longitude,\n                         altitude  = altitude,\n                         bodyId    = self.bodyId,\n                         systemId  = self.planetarySystemId}, MapPosition)\nend\n--\n-- convertToWorldCoordinates - convert a map position to world coordinates\n-- overload [in]: an instance of MapPosition or a position string ('::pos...')\n--\nfunction BodyParameters:convertToWorldCoordinates(overload)\n    local mapPosition = isString(overload) and\n                                           mkMapPosition(overload) or overload\n    if mapPosition.bodyId == 0 then -- support deep space map position\n        return vec3(mapPosition.latitude,\n                    mapPosition.longitude,\n                    mapPosition.altitude)\n    end\n    assert(isMapPosition(mapPosition),\n           'Argument 1 (mapPosition) is not an instance of \"MapPosition\".')\n    assert(mapPosition.systemId == self.planetarySystemId,\n           'Argument 1 (mapPosition) has a different planetary system ID.')\n    assert(mapPosition.bodyId == self.bodyId,\n           'Argument 1 (mapPosition) has a different planetary body ID.')\n    local xproj = math.cos(mapPosition.latitude)\n    return self.center + (self.radius + mapPosition.altitude) *\n           vec3(xproj*math.cos(mapPosition.longitude),\n                xproj*math.sin(mapPosition.longitude),\n                math.sin(mapPosition.latitude))\nend\n--\n-- getAltitude - calculate the altitude of a point given in world coordinates.\n-- worldCoordinates [in]: the world coordinates of the point.\n-- return: the altitude in meters\n--\nfunction BodyParameters:getAltitude(worldCoordinates)\n    return (vec3(worldCoordinates) - self.center):len() - self.radius\nend\n--\n-- getDistance - calculate the distance to a point given in world coordinates.\n-- worldCoordinates [in]: the world coordinates of the point.\n-- return: the distance in meters\n--\nfunction BodyParameters:getDistance(worldCoordinates)\n    return (vec3(worldCoordinates) - self.center):len()\nend\n--\n-- getGravity - calculate the gravity vector induced by the body.\n-- worldCoordinates [in]: the world coordinates of the point.\n-- return: the gravity vector in meter/seconds^2\n--\nfunction BodyParameters:getGravity(worldCoordinates)\n    local radial = self.center - vec3(worldCoordinates) -- directed towards body\n    local len2   = radial:len2()\n    return (self.GM/len2) * radial/math.sqrt(len2)\nend\n-- end of module\nreturn setmetatable(PlanetaryReference,\n                    { __call = function(_,...)\n                                    return mkPlanetaryReference(...)\n                               end })\nend\nfunction Keplers()\n    --[[ \n  Provides methods for computing orbital information for an object\n  Usage:\n  Kepler = require('autoconf.custom.kepler')\n  alioth = Kepler({ GM=157470826617,\n                    bodyId=2,\n                    center={x=-8.000,y=-8.000,z=-126303.000},\n                    name='Alioth',\n                    planetarySystemId=0,\n                    radius=126068\n                  })\n  altitude = 6000\n  position = '::pos{0,2,0,0,6000}'\n  e, o     = alioth:escapeAndOrbitalSpeed(altitude)\n  orbit    = alioth:orbitalParameters(position, {0, o+1, 0})\n  print(\"Eccentricity \" .. orbit.eccentricity)\n  print(\"Perihelion \" .. orbit.periapsis.altitude)\n  print(\"Max. speed \" .. orbit.periapsis.speed)\n  print(\"Circular orbit speed \" .. orbit.periapsis.circularOrbitSpeed)\n  print(\"Aphelion \"  .. orbit.apoapsis.altitude)\n  print(\"Min. speed \" .. orbit.apoapsis.speed)\n  print(\"Orbital period \" .. orbit.period)\n  --- output:\n    Eccentricity 0.0018324307017878\n    Perihelion 6000.0\n    Max. speed 1092.9462297033\n    Circular orbit speed 1091.9462297033\n    Aphelion 6484.8994605062\n    Min. speed 1088.9480596194\n    Orbital period 762.02818214049\n  Methods:\n    Kepler:escapeAndOrbitalSpeed - for a given celestial body and altitude.\n    Kepler:orbitalParameters - for a given massless object and a celestial body.\n  Description\n  The motion of an object in the vicinity of substantially larger mass is\n  in the domain of the \"2-body problem\". By assuming the object whose motion\n  is of interest is of negligable mass simplifies the calculations of:\n  the speed to escape the body, the speed of a circular orbit, and the\n  parameters defining the orbit of the object (or the lack of orbit as the\n  case may be).\n  Orbital Parameters:\n     periapsis - the closest approach to the planet\n      apoapsis - the furthest point from the planet if in orbit (otherwise nil)\n  eccentricity - 0 for circular orbits\n                <1 for elliptical orbits\n                 1 for parabiolic trajectory\n                >1 for hyperbolic trajectory\n        period - time (in seconds) to complete an orbit\n  Also See: planetref.lua\n]]--\nlocal vec3       = require('cpml.vec3')\nlocal PlanetRef  = PlanetRef()\nlocal function isString(s) return type(s)   == 'string' end\nlocal function isTable(t)  return type(t)   == 'table'  end\nlocal function float_eq(a,b)\n    if a == 0 then return math.abs(b) < 1e-09 end\n    if b == 0 then return math.abs(a) < 1e-09 end\n    return math.abs(a - b) < math.max(math.abs(a),math.abs(b))*epsilon\nend\nKepler = {}\nKepler.__index = Kepler\n--\n-- escapeAndOrbitalSpeed - speed required to escape and for a circular orbit\n-- altitude [in]: the height of the orbit in meters above \"sea-level\"\n-- return: the speed in m/s needed to escape the celestial body and to orbit it.\n--\nfunction Kepler:escapeAndOrbitalSpeed(altitude)\n    assert(self.body)\n    -- P = -GMm/r and KE = mv^2/2 (no lorentz factor used)\n    -- mv^2/2 = GMm/r\n    -- v^2 = 2GM/r\n    -- v = sqrt(2GM/r1)\n    local distance = altitude + self.body.radius\n    if not float_eq(distance, 0) then\n        local orbit = math.sqrt(self.body.GM/distance)\n        return math.sqrt(2)*orbit, orbit\n    end\n    return nil, nil\nend\n--\n-- orbitalParameters: determine the orbital elements for a two-body system.\n-- overload [in]: the world coordinates or map coordinates of a massless object.\n-- velocity [in]: The velocity of the massless point object in m/s.\n-- return: the 6 orbital elements for the massless object.\n--\nfunction Kepler:orbitalParameters(overload, velocity)\n    assert(self.body)\n    assert(isTable(overload) or isString(overload))\n    assert(isTable(velocity))\n    local pos = (isString(overload) or PlanetRef.isMapPosition(overload)) and\n                            self.body:convertToWorldCoordinates(overload) or\n                vec3(overload)\n    local v   = vec3(velocity)\n    local r   = pos - self.body.center\n    local v2  = v:len2()\n    local d   = r:len()\n    local mu  = self.body.GM\n    local e   = ((v2 - mu/d)*r - r:dot(v)*v)/mu\n    local a   = mu/(2*mu/d - v2)\n    local ecc = e:len()\n    local dir = e:normalize()\n    local pd  = a*(1-ecc)\n    local ad  = a*(1+ecc)\n    local per = pd*dir + self.body.center\n    local apo = ecc <= 1 and -ad*dir + self.body.center or nil\n    local trm = math.sqrt(a*mu*(1-ecc*ecc))        \n    local Period = apo and 2*math.pi*math.sqrt(a^3/mu)\n    -- These are great and all, but, I need more.\n    local trueAnomaly = math.acos((e:dot(r))/(ecc*d))\n    if r:dot(v) < 0 then\n        trueAnomaly = -(trueAnomaly - 2*math.pi)\n    end        \n    -- Apparently... cos(EccentricAnomaly) = (cos(trueAnomaly) + eccentricity)/(1 + eccentricity * cos(trueAnomaly))\n    local EccentricAnomaly = math.acos((math.cos(trueAnomaly) + ecc)/(1 + ecc * math.cos(trueAnomaly)))\n    -- Then.... apparently if this is below 0, we should add 2pi to it\n    -- I think also if it's below 0, we're past the apoapsis?\n    local timeTau = EccentricAnomaly\n    if timeTau < 0 then\n        timeTau = timeTau + 2*math.pi\n    end\n    -- So... time since periapsis...\n    -- Is apparently easy if you get mean anomly.  t = M/n where n is mean motion, = 2*pi/Period\n    \n    \n    local MeanAnomaly = timeTau - ecc * math.sin(timeTau)\n    local TimeSincePeriapsis = MeanAnomaly/(2*math.pi/Period)\n    --system.print(MeanAnomaly .. \" - \" .. TimeSincePeriapsis .. \" - \" .. Period .. \" - \" .. EccentricAnomaly .. \" - \" .. timeTau .. \" - \" .. trueAnomaly)\n    -- Mean anom is 0 at periapsis, positive before it... and positive after it.\n    -- I guess this is why I needed to use timeTau and not EccentricAnomaly here\n    \n    local TimeToPeriapsis = Period - TimeSincePeriapsis\n    local TimeToApoapsis = TimeToPeriapsis + Period/2\n    if trueAnomaly - math.pi > 0 then -- TBH I think something's wrong in my formulas because I needed this.\n        TimeToPeriapsis = TimeSincePeriapsis\n        TimeToApoapsis = TimeToPeriapsis + Period/2\n    end\n    if TimeToApoapsis > Period then\n        TimeToApoapsis = TimeToApoapsis - Period\n    end\n    return { periapsis       = { position           = per,\n                                 speed              = trm/pd,\n                                 circularOrbitSpeed = math.sqrt(mu/pd),\n                                 altitude           = pd - self.body.radius},\n             apoapsis        = apo and\n                               { position           = apo,\n                                 speed              = trm/ad,\n                                 circularOrbitSpeed = math.sqrt(mu/ad),\n                                 altitude           = ad - self.body.radius},\n             currentVelocity = v,\n             currentPosition = pos,\n             eccentricity    = ecc,\n             period          = Period,\n             eccentricAnomaly = EccentricAnomaly,\n             meanAnomaly = MeanAnomaly,\n             timeToPeriapsis = TimeToPeriapsis,\n             timeToApoapsis = TimeToApoapsis\n           }\nend\n\nlocal function new(bodyParameters)\n    local params = PlanetRef.BodyParameters(bodyParameters.planetarySystemId,\n                                            bodyParameters.bodyId,\n                                            bodyParameters.radius,\n                                            bodyParameters.center,\n                                            bodyParameters.GM)\n    return setmetatable({body = params}, Kepler)\nend\nreturn setmetatable(Kepler, { __call = function(_,...) return new(...) end })\nend\nfunction Kinematics()\n    --[[ \n  DualUniverse kinematic equations\n  Author: JayleBreak\n  Usage (unit.start):\n  Kinematics = require('autoconf.custom.kinematics')\n  Methods:\n   computeAccelerationTime - \"relativistic\" version of t = (vf - vi)/a\n   computeDistanceAndTime - Return distance & time needed to reach final speed.\n   computeTravelTime - \"relativistic\" version of t=(sqrt(2ad+v^2)-v)/a\n  Description\n  DualUniverse increases the effective mass of constructs as their absolute\n  speed increases by using the \"lorentz\" factor (from relativity) as the scale\n  factor.  This results in an upper bound on the absolute speed of constructs\n  (excluding \"warp\" drive) that is set to 30 000 KPH (8 333 MPS). This module\n  provides utilities for computing some physical quantities taking this\n  scaling into account.\n]]--\nlocal Kinematic = {} -- just a namespace\nlocal C       = 30000000/3600\nlocal C2      = C*C\nlocal ITERATIONS = 100 -- iterations over engine \"warm-up\" period\nlocal function lorentz(v) return 1/math.sqrt(1 - v*v/C2) end\n--\n-- computeAccelerationTime - \"relativistic\" version of t = (vf - vi)/a\n-- initial      [in]: initial (positive) speed in meters per second.\n-- acceleration [in]: constant acceleration until 'finalSpeed' is reached.\n-- final        [in]: the speed at the end of the time interval.\n-- return: the time in seconds spent in traversing the distance\n--\nfunction Kinematic.computeAccelerationTime(initial, acceleration, final)\n    -- The low speed limit of following is: t=(vf-vi)/a (from: vf=vi+at)\n    local k1 = C*math.asin(initial/C)\n    return (C * math.asin(final/C) - k1)/acceleration\nend\n--\n-- computeDistanceAndTime - Return distance & time needed to reach final speed.\n-- initial[in]:     Initial speed in meters per second.\n-- final[in]:       Final speed in meters per second.\n-- restMass[in]:    Mass of the construct at rest in Kg.\n-- thrust[in]:      Engine's maximum thrust in Newtons.\n-- t50[in]:         (default: 0) Time interval to reach 50% thrust in seconds.\n-- brakeThrust[in]: (default: 0) Constant thrust term when braking.\n-- return: Distance (in meters), time (in seconds) required for change.\n--\nfunction Kinematic.computeDistanceAndTime(initial,\n                                          final,\n                                          restMass,\n                                          thrust,\n                                          t50,\n                                          brakeThrust)\n    -- This function assumes that the applied thrust is colinear with the\n    -- velocity. Furthermore, it does not take into account the influence\n    -- of gravity, not just in terms of its impact on velocity, but also\n    -- its impact on the orientation of thrust relative to velocity.\n    -- These factors will introduce (usually) small errors which grow as\n    -- the length of the trip increases.\n    t50            = t50 or 0\n    brakeThrust    = brakeThrust or 0 -- usually zero when accelerating\n    local tau0     = lorentz(initial)\n    local speedUp  = initial <= final\n    local a0       = thrust * (speedUp and 1 or -1)/restMass\n    local b0       = -brakeThrust/restMass\n    local totA     = a0+b0\n    if speedUp and totA <= 0 or not speedUp and totA >= 0 then\n        return -1, -1 -- no solution\n    end\n    local distanceToMax, timeToMax = 0, 0\n    -- If, the T50 time is set, then assume engine is at zero thrust and will\n    -- reach full thrust in 2*T50 seconds. Thrust curve is given by:\n    -- Thrust: F(z)=(a0*(1+sin(z))+2*b0)/2 where z=pi*(t/t50 - 1)/2\n    -- Acceleration is given by F(z)/m(z) where m(z) = m/sqrt(1-v^2/c^2)\n    -- or v(z)' = (a0*(1+sin(z))+2*b0)*sqrt(1-v(z)^2/c^2)/2\n    if a0 ~= 0 and t50 > 0 then\n        -- Closed form solution for velocity exists:\n        -- v(t) = -c*tan(w)/sqrt(tan(w)^2+1) => w = -asin(v/c)\n        -- w=(pi*t*(a0/2+b0)-a0*t50*sin(pi*t/2/t50)+*pi*c*k1)/pi/c\n        -- @ t=0, v(0) = vi\n        -- pi*c*k1/pi/c = -asin(vi/c)\n        -- k1 = asin(vi/c)\n        local k1  = math.asin(initial/C)\n        local c1  = math.pi*(a0/2+b0)\n        local c2  = a0*t50\n        local c3  = C*math.pi\n        local v = function(t)\n            local w  = (c1*t - c2*math.sin(math.pi*t/2/t50) + c3*k1)/c3\n            local tan = math.tan(w)\n            return C*tan/math.sqrt(tan*tan+1)\n        end\n        local speedchk = speedUp and function(s) return s >= final end or\n                                     function(s) return s <= final end\n        timeToMax  = 2*t50\n        if speedchk(v(timeToMax)) then\n            local lasttime = 0\n            while math.abs(timeToMax - lasttime) > 0.5 do\n                local t = (timeToMax + lasttime)/2\n                if speedchk(v(t)) then\n                    timeToMax = t \n                else\n                    lasttime = t\n                end\n            end\n        end\n        -- There is no closed form solution for distance in this case.\n        -- Numerically integrate for time t=0 to t=2*T50 (or less)\n        local lastv = initial\n        local tinc  = timeToMax/ITERATIONS\n        for step = 1, ITERATIONS do\n            local speed = v(step*tinc)\n            distanceToMax = distanceToMax + (speed+lastv)*tinc/2\n            lastv = speed\n        end\n        if timeToMax < 2*t50 then\n            return distanceToMax, timeToMax\n        end\n        initial     = lastv\n    end\n    -- At full thrust, acceleration only depends on the Lorentz factor:\n    -- v(t)' = (F/m(v)) = a*sqrt(1-v(t)^2/c^2) where a = a0+b0\n    -- -> v = c*sin((at+k1)/c)\n    -- @ t=0, v=vi: k1 = c*asin(vi/c)\n    -- -> t = (c*asin(v/c) - k1)/a\n    -- x(t)' = c*sin((at+k1)/c)\n    -- x = k2 - c^2 cos((at+k1)/c)/a\n    -- @ t=0, x=0: k2 = c^2 * cos(k1/c)/a\n    local k1       = C*math.asin(initial/C)\n    local time     = (C * math.asin(final/C) - k1)/totA\n    local k2       = C2 *math.cos(k1/C)/totA\n    local distance = k2 - C2 * math.cos((totA*time + k1)/C)/totA\n    return distance+distanceToMax, time+timeToMax\nend\n--\n-- computeTravelTime - \"relativistic\" version of t=(sqrt(2ad+v^2)-v)/a\n-- initialSpeed [in]: initial (positive) speed in meters per second\n-- acceleration [in]: constant acceleration until 'distance' is traversed\n-- distance [in]: the distance traveled in meters\n-- return: the time in seconds spent in traversing the distance\n--\nfunction Kinematic.computeTravelTime(initial, acceleration, distance)\n    -- The low speed limit of following is: t=(sqrt(2ad+v^2)-v)/a\n    -- (from: d=vt+at^2/2)\n    if distance == 0 then return 0 end\n    if acceleration > 0 then\n        local k1       = C*math.asin(initial/C)\n        local k2       = C2*math.cos(k1/C)/acceleration\n        return (C*math.acos(acceleration*(k2 - distance)/C2) - k1)/acceleration\n    end\n    assert(initial > 0, 'Acceleration and initial speed are both zero.')\n    return distance/initial\nend\nfunction Kinematic.lorentz(v) return lorentz(v) end\nreturn Kinematic\nend\nPlanetaryReference = PlanetRef()\ngalaxyReference = PlanetaryReference(Atlas())\nKinematic = Kinematics()\nKep = Keplers()\nfunction getDistanceDisplayString(distance)\n    local su = distance > 100000\n    local result = \"\"\n    if su then\n        -- Convert to SU\n        result = round(distance/1000/200,1) .. \" SU\"\n    else\n        -- Convert to KM\n        result = round(distance/1000,1) .. \" KM\"\n    end\n\n    return result\nend\n\nPlanetaryReference = PlanetRef()\ngalaxyReference = PlanetaryReference(Atlas())\n\nMapScreenButtons = {}\nMapScreenMouseX = 0\nMapScreenMouseY = 0\nMapScreenMouseDown = false\nMapScreenButtonSelected = 0\nlocal worldPos = vec3(core.getConstructWorldPos())\nlocal locX = (worldPos.x/400000)\nlocal locY = (worldPos.y/400000)*(-1)\nlocal destX = 0\nlocal destY = 0\nlocal sudistance = 0\nlocal loc = vec3(core.getConstructWorldPos())\nlocal ion = galaxyReference[0][120]  ---uses Atlas functions\nlocal thades = vec3(29165536.000, 10865536.000, 65536.000)\nlocal sinnen = vec3(58665536.000, 29665536.000, 58165536.000)\nlocal alioth = galaxyReference[0][2]    ---uses Atlas functions\nlocal madis = vec3(17465536.000, 22665536.000, -34464.000)\nlocal jago = vec3(-94134464.000, 12765536.000, -3634464.000)\nlocal symeon = vec3(14165536.000, -85634464.000, -934464.000)\nlocal lacobus = vec3(98865536.000, -13534464.000, -934464.000)\nlocal teoma = vec3(80865536.000, 54665536.000, -934464.000)\nlocal feli = vec3(-43534464.000, 22565536.000, -48934464.000)\nlocal talemai = vec3(-13234464.000, 55765536.000, 465536.000)\nlocal sicari = vec3(52765536.000, 27165536.000, 52065536.000)\nlocal distion = math.floor(ion:getDistance(loc)/200000)   ---uses getDistance functions----\nlocal distthades = string.format(\"%.2f\", math.sqrt((loc.x-thades.x)^2+(loc.y-thades.y)^2+(loc.z-thades.z)^2)/200000)\nlocal distalioth = math.floor(alioth:getDistance(loc)/200000)   ---uses getDistance functions----\nlocal distmadis = string.format(\"%.2f\", math.sqrt((loc.x-madis.x)^2+(loc.y-madis.y)^2+(loc.z-madis.z)^2)/200000)\nlocal distjago = string.format(\"%.2f\", math.sqrt((loc.x-jago.x)^2+(loc.y-jago.y)^2+(loc.z-jago.z)^2)/200000)\nlocal distlacobus = string.format(\"%.2f\", math.sqrt((loc.x-lacobus.x)^2+(loc.y-lacobus.y)^2+(loc.z-lacobus.z)^2)/200000)\nlocal distteoma = string.format(\"%.2f\", math.sqrt((loc.x-teoma.x)^2+(loc.y-teoma.y)^2+(loc.z-teoma.z)^2)/200000)\nlocal distsymeon = string.format(\"%.2f\", math.sqrt((loc.x-symeon.x)^2+(loc.y-symeon.y)^2+(loc.z-symeon.z)^2)/200000)\nlocal distfeli = string.format(\"%.2f\", math.sqrt((loc.x-feli.x)^2+(loc.y-feli.y)^2+(loc.z-feli.z)^2)/200000)\nlocal distsinnen = string.format(\"%.2f\", math.sqrt((loc.x-sinnen.x)^2+(loc.y-sinnen.y)^2+(loc.z-sinnen.z)^2)/200000)\nlocal disttalemai = string.format(\"%.2f\", math.sqrt((loc.x-talemai.x)^2+(loc.y-talemai.y)^2+(loc.z-talemai.z)^2)/200000)\nlocal distsicari = string.format(\"%.2f\", math.sqrt((loc.x-sicari.x)^2+(loc.y-sicari.y)^2+(loc.z-sicari.z)^2)/200000)\n\n\n\n      for i = 1,1 do\n   local button = {id = (\"b\"..1), enabled=true, td=\"<td>\", top=2/100, bottom=13/100, left=1/100, right=28/100}\n    table.insert(MapScreenButtons, button)\nend\n  for i = 2,2 do\n   local button = {id = (\"b\"..2), enabled=true, td=\"<td>\", top=15/100, bottom=26/100, left=1/100, right=30/100}\n    table.insert(MapScreenButtons, button)\nend\n    for i = 3,3 do\n    local button = {id = (\"b\"..3), enabled=true, td=\"<td>\", top=27/100, bottom=38/100, left=1/100, right=28/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 4,4 do   \n    local button = {id = (\"b\"..4), enabled=true, td=\"<td>\", top=39/100, bottom=50/100, left=1/100, right=28/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 5,5 do   \n    local button = {id = (\"b\"..5), enabled=true, td=\"<td>\", top=51/100, bottom=62/100, left=1/100, right=28/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 6,6 do   \n    local button = {id = (\"b\"..6), enabled=true, td=\"<td>\", top=64/100, bottom=75/100, left=1/100, right=28/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 7,7 do   \n    local button = {id = (\"b\"..7), enabled=true, td=\"<td>\", top=2/100, bottom=13/100, left=75/100, right=100/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 8,8 do   \n    local button = {id = (\"b\"..8), enabled=true, td=\"<td>\", top=15/100, bottom=26/100, left=75/100, right=100/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 9,9 do   \n    local button = {id = (\"b\"..9), enabled=true, td=\"<td>\", top=27/100, bottom=38/100, left=75/100, right=100/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 10,10 do   \n    local button = {id = (\"b\"..10), enabled=true, td=\"<td>\", top=39/100, bottom=50/100, left=75/100, right=100/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 11,11 do   \n    local button = {id = (\"b\"..11), enabled=true, td=\"<td>\", top=51/100, bottom=62/100, left=75/100, right=100/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 12,12 do   \n    local button = {id = (\"b\"..12), enabled=true, td=\"<td>\", top=64/100, bottom=75/100, left=75/100, right=100/100}\n      table.insert(MapScreenButtons, button)\nend\n    for i = 13,13 do   \n    local button = {id = (\"b\"..13), enabled=true, td=\"<td>\", top=90/100, bottom=100/100, left=1/100, right=18/100}\n    table.insert(MapScreenButtons, button)\nend\nfunction evaluateButtons()\n  local selected = 0\n  \n  if #MapScreenButtons >= 1 then\n -- Set button styles\n       for i, button in ipairs(MapScreenButtons) do\n            if button.left < MapScreenMouseX and MapScreenMouseX < button.right and button.top < MapScreenMouseY and MapScreenMouseY < button.bottom then\n                if MapScreenMouseDown and MapScreenButtonSelected == i then\n                end\n                selected = i\n            end\n            if not button.enabled then\n            end\n\n        end\n  end\n  return selected\nend\n\nfunction onButtonDown(buttonNo)\n  local button = MapScreenButtons[buttonNo]    \n  if not button or not button.enabled then\n\treturn\n  end\nend\nfunction onButtonUp(buttonNo)\n  local button = MapScreenButtons[buttonNo]    \n  if not button or not button.enabled then\n    return\n  end\nfunction onClick(buttonNo)\n  local button = MapScreenButtons[buttonNo]    \n  if not button or not button.enabled then\n    return\n  end\nend\n  if buttonNo == 1 then\ndestX = 0\ndestY = 0\nsudistance = distalioth\n  elseif buttonNo == 2 then\ndestX = 43\ndestY = -56\nsudistance = distmadis\n  elseif buttonNo == 3 then\ndestX = 73\ndestY = -27\nsudistance = distthades        \n  elseif buttonNo == 4 then\ndestX = -33\ndestY = -139\nsudistance = disttalemai\n  elseif buttonNo == 5 then\ndestX = -109\ndestY = -56\nsudistance = distfeli        \n  elseif buttonNo == 6 then\ndestX = 131\ndestY = -68\nsudistance = distsicari        \n  elseif buttonNo == 7 then\ndestX = 35\ndestY = 214\nsudistance = distsymeon\n  elseif buttonNo == 8 then\ndestX = 146\ndestY = -74\nsudistance = distsinnen        \n  elseif buttonNo == 9 then\ndestX = -235\ndestY = -32\nsudistance = distjago       \n  elseif buttonNo == 10 then\ndestX = 202\ndestY = -137\nsudistance = distteoma        \n  elseif buttonNo == 11 then\ndestX = 7\ndestY = 247\nsudistance = distion        \n  elseif buttonNo == 12 then\ndestX = 247\ndestY = 34\nsudistance = distlacobus\n  elseif buttonNo == 13 then\n  unit.exit()\n  end\nend\n\nfunction updateScreen() \nwarpmath = math.floor(math.floor(core.getConstructMass()/ 1000)  * sudistance * 0.00025)\nhtml= ([[\n<svg class=\"bootstrap\" viewBox=\"0 0 1024 1024\" style=\"width:100%; height:100%\"><circle cx=\"500\" cy=\"500\" r=\"400\" stroke=\"darkgreen\" stroke-width=\"3\" transform=\"\"></circle><circle cx=\"500\" cy=\"500\" r=\"350\" stroke=\"darkgreen\" stroke-width=\"3\" transform=\"\" stroke-opacity=\"0.2\"></circle><circle cx=\"500\" cy=\"500\" r=\"300\" stroke=\"darkgreen\" stroke-width=\"3\" transform=\"\"></circle><circle cx=\"500\" cy=\"500\" r=\"250\" stroke=\"darkgreen\" stroke-width=\"3\" transform=\"\" stroke-opacity=\"0.2\"></circle><circle cx=\"500\" cy=\"500\" r=\"200\" stroke=\"darkgreen\" stroke-width=\"3\" transform=\"\"></circle><circle cx=\"500\" cy=\"500\" r=\"150\" stroke=\"darkgreen\" stroke-width=\"3\" transform=\"\" stroke-opacity=\"0.2\"></circle><circle cx=\"500\" cy=\"500\" r=\"100\" stroke=\"lightblue\" stroke-width=\"3\" transform=\"\"></circle><circle cx=\"500\" cy=\"500\" r=\"50\" stroke=\"lightblue\" stroke-width=\"3\" transform=\"\" stroke-opacity=\"0.2\"></circle><circle cx=\"500\" cy=\"500\" r=\"20\" stroke=\"Orange\" stroke-width=\"2\" transform=\"\"></circle><text x=\"510\" y=\"510\" fill=\"Yellow\">Helios</text><circle cx=\"-0.00\" cy=\"0\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle><text x=\"-0.00\" y=\"0\" transform=\"translate(500,480)\" fill=\"white\" font-size=\"20\">Alioth</text><circle cx=\"7.16\" cy=\"247.59\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle><text x=\"7.16\" y=\"247.59\" transform=\"translate(480,480)\" fill=\"white\" font-size=\"20\">Ion</text><circle cx=\"35.41\" cy=\"214.09\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle><text x=\"35.41\" y=\"214.09\" transform=\"translate(500,480)\" fill=\"white\" font-size=\"20\">Symeon</text><circle cx=\"-33.09\" cy=\"-139.41\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle><text x=\"-33.09\" y=\"-139.41\" transform=\"translate(500,480)\" fill=\"white\" font-size=\"20\">Talemai</text><circle cx=\"202.16\" cy=\"-136.66\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle><text x=\"202.16\" y=\"-136.66\" transform=\"translate(500,480)\" fill=\"white\" font-size=\"20\">Teoma</text><circle cx=\"247.16\" cy=\"33.84\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle><text x=\"247.16\" y=\"33.84\" transform=\"translate(500,480)\" fill=\"white\" font-size=\"20\">Lacobus</text><circle cx=\"-108.84\" cy=\"-56.41\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle><text x=\"-108.84\" y=\"-56.41\" transform=\"translate(500,480)\" fill=\"white\" font-size=\"20\">Feli</text><circle cx=\"72.91\" cy=\"-27.16\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle><text x=\"72.91\" y=\"-27.16\" transform=\"translate(500,485)\" fill=\"white\" font-size=\"20\">Thades</text><circle cx=\"43.66\" cy=\"-56.66\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle><text x=\"43.66\" y=\"-56.66\" transform=\"translate(500,480)\" fill=\"white\" font-size=\"20\">Madis</text><circle cx=\"-235.34\" cy=\"-31.91\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle><text x=\"-235.34\" y=\"-31.91\" transform=\"translate(500,480)\" fill=\"white\" font-size=\"20\">Jago</text><circle cx=\"131.91\" cy=\"-67.91\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle><text x=\"131.91\" y=\"-67.91\" transform=\"translate(475,480)\" fill=\"white\" font-size=\"20\">Sicari</text><circle cx=\"146.66\" cy=\"-74.16\" r=\"10\" stroke=\"black\" stroke-width=\"1\" fill=\"blue\" transform=\"translate(500,500)\"></circle><text x=\"146.66\" y=\"-74.16\" transform=\"translate(515,480)\" fill=\"white\" font-size=\"20\">Sinnen</text>\n<line stroke-linecap=\"undefined\" stroke-linejoin=\"undefined\" id=\"svg_1\" y2=\"]]..destY..[[\" x2=\"]]..destX..[[\" y1=\"]]..locY..[[\" x1=\"]]..locX..[[\" transform=\"translate(500,500)\" stroke-width=\"5\" stroke=\"#ff0000\" fill=\"none\"/>        \n<circle cx=\"]]..locX..[[\" cy=\"]]..locY..[[\" r=\"3\" stroke=\"black\" stroke-width=\"1\" fill=\"limegreen\" transform=\"translate(500,500)\"></circle>\n<text x=\"]]..locX..[[\" y=\"]]..locY..[[\" transform=\"translate(500,500)\" \nfill=\"limegreen\" font-size= \"4.5vh\" font-weight= \"bold\">//SHIP POSITION</text>\n</svg>\n<svg class=\"bootstrap\" viewBox=\"0 0 1024 612\" style=\"width:100%; height:100%\">\n <g>\n  <title>Layer 1</title>\n  <g id=\"svg_24\">\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_8\" y=\"70\" x=\"55\" stroke-width=\"0\" fill=\"Yellow\">Alioth  :]]..distalioth..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_14\" y=\"170\" x=\"55\" stroke-width=\"0\" fill=\"Yellow\">Madis  :]]..distmadis..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_17\" y=\"270\" x=\"55\" stroke-width=\"0\" fill=\"Yellow\">Thades  :]]..distthades..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_20\" y=\"370\" x=\"55\" stroke-width=\"0\" fill=\"Yellow\">Talemai  :]]..disttalemai..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_23\" y=\"470\" x=\"55\" stroke-width=\"0\" fill=\"Yellow\">Feli  :]]..distfeli..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_26\" y=\"570\" x=\"55\" stroke-width=\"0\" fill=\"Yellow\">Sicari  :]]..distsicari..[[ SU</text>\n   <g id=\"svg_12\">\n    <rect rx=\"10\" id=\"svg_1\" height=\"50\" width=\"250\" y=\"30\" x=\"15\" stroke-width=\"20\" stroke=\"#00ff00\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_3\" height=\"50\" width=\"250\" y=\"105\" x=\"15\" stroke-width=\"20\" stroke=\"#00ff00\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_7\" height=\"50\" width=\"250\" y=\"180\" x=\"15\" stroke-width=\"20\" stroke=\"#00ff00\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_9\" height=\"50\" width=\"250\" y=\"255\" x=\"15\" stroke-width=\"20\" stroke=\"#00ff00\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_10\" height=\"50\" width=\"250\" y=\"330\" x=\"15\" stroke-width=\"20\" stroke=\"#00ff00\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_11\" height=\"50\" width=\"250\" y=\"405\" x=\"15\" stroke-width=\"20\" stroke=\"#00ff00\" fill=\"none\"/>\n   </g>\n  </g>\n  <g id=\"svg_40\">\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_25\" y=\"70\" x=\"997.163642\" stroke-width=\"0\" fill=\"Yellow\">Symeon  :]]..distsymeon..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_27\" y=\"170\" x=\"997.163642\" stroke-width=\"0\" fill=\"Yellow\">Sinnen  :]]..distsinnen..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_28\" y=\"270\" x=\"997.163642\" stroke-width=\"0\" fill=\"Yellow\">Jago  :]]..distjago..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_30\" y=\"370\" x=\"997.163642\" stroke-width=\"0\" fill=\"Yellow\">Teoma  :]]..distteoma..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_31\" y=\"470\" x=\"997.163642\" stroke-width=\"0\" fill=\"Yellow\">Ion  :]]..distion..[[ SU</text>\n   <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"20\" id=\"svg_32\" y=\"570\" x=\"997.163642\" stroke-width=\"0\" fill=\"Yellow\">Lacobus  :]]..distlacobus..[[ SU</text>\n   <g id=\"svg_39\">\n    <rect rx=\"10\" id=\"svg_33\" height=\"50\" width=\"250\" y=\"30\" x=\"760\" stroke-width=\"20\" stroke=\"#00ff00\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_34\" height=\"50\" width=\"250\" y=\"105\" x=\"760\" stroke-width=\"20\" stroke=\"#00ff00\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_35\" height=\"50\" width=\"250\" y=\"180\" x=\"760\" stroke-width=\"20\" stroke=\"#00ff00\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_36\" height=\"50\" width=\"250\" y=\"255\" x=\"760\" stroke-width=\"20\" stroke=\"#00ff00\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_37\" height=\"50\" width=\"250\" y=\"330\" x=\"760\" stroke-width=\"20\" stroke=\"#00ff00\" fill=\"none\"/>\n    <rect rx=\"10\" id=\"svg_38\" height=\"50\" width=\"250\" y=\"405\" x=\"760\" stroke-width=\"20\" stroke=\"#00ff00\" fill=\"none\"/>\n   </g>\n  </g>\n </g>\n <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" id=\"svg_32\" y=\"700\" x=\"20\" stroke-width=\"0\" fill=\"LightBlue\">Est. Warp Cost: ]]..warpmath..[[</text>\n  <text stroke=\"null\" transform=\"matrix(0.7907331239400577,0,0,0.7600725676692406,3.135703637258853,5.731969683147472) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" id=\"svg_32\" y=\"750\" x=\"20\" stroke-width=\"0\" fill=\"LightBlue\">Construct Weight: ]]..math.floor(core.getConstructMass()/ 1000)..[[ tons</text>\n    \n</svg>    \n    ]])\nscreen.setHTML(html)\nend\nunit.setTimer(\"spacemap\",.08)\n\n\n","filter":{"args":[],"signature":"start()","slotKey":"-1"},"key":"2"},{"code":"updateScreen()","filter":{"args":[{"value":"spacemap"}],"signature":"tick(timerId)","slotKey":"-1"},"key":"3"}],"methods":[],"events":[]}




     

     

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

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

     

  9. I welcome you to The League of Solo Players.

    Its an Organization Dedicated to All the Gods that chose to be solo.

    This Organization is a tool to connect all solo players regardless of current Organizations to share free information, wether it be gaming issues or to Lua coding issues.

    Every Player is Equal.

    All voices will be heard.

    This Organization Identifies as Solo Player :)

     

    Website

     

    https://community.dualthegame.com/organization/the-league-of-solo-players/#tab-description

     

    Discord

    https://discord.gg/3nCCcJj

×
×
  • Create New...