-
Notifications
You must be signed in to change notification settings - Fork 8
/
du_ez_scanner.json
1 lines (1 loc) · 15.5 KB
/
du_ez_scanner.json
1
{"slots":{"0":{"name":"core","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":[]}},"-3":{"name":"player","type":{"events":[],"methods":[]}},"-2":{"name":"construct","type":{"events":[],"methods":[]}},"-4":{"name":"system","type":{"events":[],"methods":[]}},"-5":{"name":"library","type":{"events":[],"methods":[]}}},"handlers":[{"code":"-- general\nlocal title = \"◄ EZ SCANNER ►\" \nlocal line1 = \"\"\nlocal line2 =\"<text style='color:#eca943'>Alt+3 <b>[+]</b> ■ <b>[-]</b> Alt+5</text>\"\nlocal line3 = \"\"\n--local add_style = \"\"\n\n-- left, main, line1\nif size == 0 then \n line1 = \"<text style='color:white'>➀➁➂➃</text>\"\n elseif size == 1 then \n line1 = \"<text style='color:#eca943'>➊</text>➁➂➃\"\n elseif size == 2 then \n line1 = \"<text style='color:#eca943'>➊➋</text>➂➃\" \n elseif size == 3 then \n line1 = \"<text style='color:#eca943'>➊➋➌</text>➃\"\n elseif size == 4 then \n line1 = \"<text style='color:#498aff'>➊➋➌➍</text>\"\n line2 = \"<text style='color:#498aff'>FIND IT! ALT+4</text>\" \nend\n\n-- left, main, line2\n\nif size < 4 then \n line3 =\"DISTANCE: \"..distance\n else\n line3=\"All Points In!\" \nend\n\n-- left, main, line3\nline4 = \"<text style='font-size:80%'> HELP ALT+1 | SLIDER ALT+7</text>\"\n\n-- left, main\nlocal main = [[\n <p id=\"main_block\" class=\"block\">]]..\n title..\"<br>\"..\n line2..\"<br>\"..\n line1..\"<br>\"..\n line3..\"<br>\"..\n line4..[[\n </p>]]\n \n-- help\nlocal help = [[\n <p id=\"help_block\" class=\"block\">]]..\n help_block..[[\n </p>]]\n\nif help_tougle == false then help = \"\" end\n\n-- left\nlocal left_panel = [[\n <div id=\"panel_left\">]]..\n main..\n help..[[\n </div>]]\n\n-- slider \nlocal slider = \"\"\nif slider_tougle == true then -- slider tougle\n local line = distance_line_transform(distance) \n slider = [[ \n <div id=\"panel_slider\"> \n <div id=\"slider_main\" style='top: ]] .. 100-line-3 .. [[%;'>]]..\n [[◯━━━━[ ]].. distance ..[[ ]<br> \n <p style=\"text-align: right\">]]..\"\".. line1..[[\n </p>\n </div> \n <p id=\"slider_header\">]]..\n title..[[<br>]]..\n line2..[[\n </p>\n </div>]]\nend\n------------------------------------------------ \n-- test panel\n\nlocal test_panel = \"\"\n\nif dev_mode == 1 then\n test_panel = [[\n <div id=\"panel_test\">]]..\n test_html..\n [[</div> \n ]] \nend \n------------------------------------------------ \n-- html\n\nheader = \"<header><style>\"..style..\"</style></header>\" \n\nif pause_tougle == true then \n \n local tic = ticker(2) \n local color = \"eca943\"\n if tic then color = \"498aff\" end \n \n unit.setTimer(\"clock\",1) \n \n body = [[<body>\n <div id=\"panel_left\">\n <p id=\"pause_block\">\n <text style='color:#]]..color..[['>■</text> EZ Scanner <br>\n START: ALT+8 | EXIT: ALT+9\n <p>\n </div></body>]] \n else \n body = \"<body>\"..left_panel..slider..test_panel..\"</body>\" \nend \n\nfooter = \"\"\nhtml = \"<html>\"..header..body..footer..\"</html>\"\nsystem.setScreen(html)\n\n\n","filter":{"args":[{"value":"clock"}],"signature":"tick(timerId)","slotKey":"-1"},"key":"0"},{"code":"------------------------------------------------------\n-- DU EZ Script by \n-- Version: 1.0\n-- Author: Juvenius Drakonius (discord: Juvenius#231)\n------------------------------------------------------\n\n\n-- Parameters \npause_script_on_start = false --export\nhelp_panel_on_start = true --export\nslider_panel_on_start = true --export\nclock_rate = 0.01 --export\nauto_solve_on_4_points = false --export\npause_script_after_solve = true --export\nauto_pause_script_timer = 1200 --export\nauto_stop_after_pause = 1200 --export\n\n-- Default Values\ndistance = 250 --defaul distance time\nlist = {} --table of points\nsize = 0 --table size\ntime = system.getTime()\n\nunit.setTimer(\"clock\",clock_rate)\nplayer_id = unit.getMasterPlayerId()\nplayer_name = database.getPlayer(player_id)\nplayer_pos_start = system.getPlayerWorldPos(player_id)\n--player_pos_start = unit.getMasterPlayerRelativePosition()\nsystem.showScreen(1)\nstart_splash()\n\n-- parameters maping\ndev_mode = 0\nhelp_tougle = help_panel_on_start\nslider_tougle = slider_panel_on_start\npause_tougle = pause_script_on_start \npause_timer = auto_pause_script_timer\nauto_solve_tougle = auto_solve_on_4_points\nidle = time -- iddle time to test auto pause\nstop_timer = auto_stop_after_pause\npause_solve_tougle = pause_script_after_solve","filter":{"args":[],"signature":"start()","slotKey":"-1"},"key":"1"},{"code":"-- Add point to table\nif size < 4 then\n local d = {}\n d.p = vec3(system.getPlayerWorldPos(player_id)) \n d.r = distance\n list[size] = d\n size = size + 1\n \n elseif size == 3 then \n \n if auto_solve_tougle == true then \n solve_location(list)\n if size == 4 then list = {} end \n else \n \n system.print(\"Ready to Find Node, Press Alt+4\")\n --system.print(json.encode(point_list))\n end \nend \n","filter":{"args":[{"value":"option3"}],"signature":"actionStart(action)","slotKey":"-4"},"key":"2"},{"code":"-- Delete point from table\nif size > 0 then\n table.remove(list)\n size = size - 1 \nelse\n list = {}\nend\n\n","filter":{"args":[{"value":"option5"}],"signature":"actionStart(action)","slotKey":"-4"},"key":"3"},{"code":"--pause script\npause_tougle = not pause_tougle\nif pause_tougle == false then\n unit.setTimer(\"clock\",clock_rate)\n system.print(\"EZ Scanner -Resumed-\")\nend","filter":{"args":[{"value":"option8"}],"signature":"actionStart(action)","slotKey":"-4"},"key":"4"},{"code":"-- Solve location \nsolve_location(list) \n\nif size == 4 then\n list = {}\n size = 0\nend \n\nif pause_solve_tougle then \n pause_tougle = pause_solve_tougle \nend","filter":{"args":[{"value":"option4"}],"signature":"actionStart(action)","slotKey":"-4"},"key":"5"},{"code":"-- EXIT\n\nscript_exit() \n \n","filter":{"args":[{"value":"option9"}],"signature":"actionStart(action)","slotKey":"-4"},"key":"6"},{"code":"--activate help window\nhelp_tougle = not help_tougle","filter":{"args":[{"value":"option1"}],"signature":"actionStart(action)","slotKey":"-4"},"key":"7"},{"code":"time = system.getTime()\n\nif pause_tougle == false then -- if script paused? \n local mouse = system.getThrottleInputFromMouseWheel()\n \n if distance ~= (distance + mouse)then \n distance = delta_scrollwheel(distance,mouse,time,idle) -- scrollwheel accel\n idle = system.getTime() -- time last to mouse_move \n else \n local t = time - idle -- idle timer to pause \n if t > pause_timer then \n pause_tougle = true \n idle = system.getTime() -- sets iddle time\n end --system.print(t..\" - \"..pause_timer) \n end\n\n else --if script paused? \n \n local t = time - idle -- iddle timer to stop \n if t > stop_timer then script_exit() end \n \nend \n \n\n\nbest_point(1,list)","filter":{"args":[],"signature":"update()","slotKey":"-4"},"key":"8"},{"code":"-- Slider Tougle\nslider_tougle = not slider_tougle ","filter":{"args":[{"value":"option7"}],"signature":"actionStart(action)","slotKey":"-4"},"key":"9"},{"code":"utils = require(\"cpml/utils\")\n\n\n","filter":{"args":[],"signature":"start()","slotKey":"-4"},"key":"10"},{"code":"-- HTML, CSS\n\ntest_html = \"\"\n\nstyle = [[\n\n p {\n font-size:90%;\n }\n\n .block {\n border: 1px solid DimGray;\n border-radius:10px;\n background-color: rgba(0,0,0,.5)\n }\n\n #main_block{\n text-align: center;\n padding: 10px 10px 10px 10px;\n }\n\n #help_block{\n text-align: left;\n padding: 10px 10px 10px 10px;\n width: 330px;\n } \n\n #pause_block{ \n text-align: center;\n font-size:80%;\n }\n\n #panel_left { \n position: absolute;\n top: 0%;\n left: 0%;\n /*width: 310px;*/\n\n }\n #slider_header {\n position: absolute;\n top: 0vh;\n font-size:90%;\n width: 100%;\n text-align: center; \n }\n\n\n #slider_main {\n position: relative;\n font-size:100%;\n color:#eca943;\n z-index: 1000;\n }\n\n #slider_footer{\n position: relative;\n font-size:100%;\n top:80%;\n left:10%; \n }\n\n #panel_slider {\n position: absolute;\n top: 51.9vh; ;\n left: 63.5vw;\n width: 9vw;\n height: 28.15vh;\n transform: skew(13.5deg); \n border-bottom: 28.5vh solid rgba(0,0,0,.85);\n border-right: 1vw solid transparent;\n z-index: 1000;\n }\n\n #panel_test { \n position: fixed;\n top: 100px; /* or whatever top you need */\n left: 50%;\n width: auto;\n -webkit-transform: translateX(-50%);\n -moz-transform: translateX(-50%);\n -ms-transform: translateX(-50%);\n -o-transform: translateX(-50%);\n transform: translateX(-50%);\n }\n\n]]\n\n\n\n----------------------------------------------\nhelp_block = [[\n <text style='color:#eca943'>HOW TO USE</text><br>\n 1) Use Scanner<br>\n 2) Scroll Mouse Wheel to Ping<br>\n 3) Add (Alt+3) | Remove (Alt+5) Points<br>\n 4) Find Node (Alt+4)<br>\n 5) Destination Link on Chat<br>\n 6) Resume Paussed Script (Alt+8)<br>\n 7) Exit Script (Alt+9)<br>\n ━━━━━━━━━━━━━━━━<br>\n <text style='color:#eca943'>GOOD TO KNOW</text><br>\n - Only Alioth Coords Tested ATM, yet on other planets<br>\n - After the node search, the scrip will pause. Resume if needed<br>\n - All points will be flused after search<br>\n - Keep the script paused to save GPU/CPU <br>\n - Change Script parameters for panels to be on/off at the start of the script<br>\n - The mouse scroll wheel has a aceleration multiplier, move it arround a bit to get the feeling of it \n ━━━━━━━━━━━━━━━━<br>\n <text style='color:#eca943'>KEY-SHORTCUTS</text><br>\n Mouse Wheel : Change Distance<br>\n Alt+1 : Help <br>\n Alt+2 : n/a<br>\n Alt+3 : Add Point <br>\n Alt+4 : Find Node <br>\n Alt+5 : Delete Point <br>\n Alt+6 : n/a<br>\n Alt+7 : Tougle Slider On/Off<br>\n Alt+8 : Pause | Resume Script <br>\n Alt+9 : Exit App <br>\n\n ━━━━━━━━━━━━━━━━<br>\n EZ Scanner | v1.05 | 2022.10.20 <br> \n github.com/juvenius/du_ez_scanner <br>\n Issues? discord: Juvenius#2318 <br>\n ▴ ▾ ◂ ▸ ▵ ▿ ◃ ▹ ▲ ▼ ◄ ► △ ▽ ◁ ▷<br>\n]]\n","filter":{"args":[],"signature":"start()","slotKey":"-5"},"key":"11"},{"code":"-- FUNCTION LIBRARY\n\n-- place holder for start slash\nfunction start_splash() \nend\n\n-- place holder for start slash\nfunction best_point(point,list)\n \n if next(list) ~= nil then\n local p_pos = system.getPlayerWorldPos(player_id) \n local a = vec3(p_pos)\n local b = vec3(player_pos_start)\n local d = utils.round((a-b):len(),30)\n\n test_html = \"<br>Distance: \"..d..\"<br>\"..json.encode(list)..\n \"points : \"..#list+1 \n end\nend \n\n\n-- Solve location table to coordinate link\nfunction solve_location(list)\n --does not return error on bad table or size \n \n if size == 4 then\n p1 = list[0].p\n r1 = list[0].r\n p2 = list[1].p\n r2 = list[1].r\n p3 = list[2].p\n r3 = list[2].r\n p4 = list[3].p\n r4 = list[3].r \n\n result = trilaterate(p1, r1, p2, r2, p3, r3, p4, r4)\n\n local x = math.floor(result.x)\n local y = math.floor(result.y)\n local z = math.floor(result.z)\n position = xyz_to_pos(x,y,z)\n system.setWaypoint(position)\n\n system.print(\"┍━━━━━NODE LOCATION━━━━━┑\")\n system.print(position)\n system.print(\"┕━━━━━━━━━━━━━━━━━━┙\")\n system.print(\"SCRIPT PAUSED | START ALT+8 | EXIT ALT+9\")\n\n else\n local msg\n if #list == 3 then\n msg = \"1 More point neededto find location \" \n else \n msg = 4-#table..\" More points needed to find location \" \n end \n system.print(msg) \n end\nend\n\n-- timer for tics\nfunction ticker(r) \n local c = utils.round(system.getTime(),1)\n if c % r == 0 then \n return true\n else\n return false\n end\nend \n\n-- script exit\nfunction script_exit() \n system.print(\"[ EZ Scaner is off ]\")\n unit.exit()\nend \n\n-- distance horizontal line transform \nfunction distance_line_transform(x)\n y = 0.02 + 0.253*x + -1.13E-04*x^2 \n return y\nend\n\n-- make link out of x,y,z coord\nfunction xyz_to_pos (x,y,z,planet,system)\n local system = tostring(0) \n local planet = tostring(0)\n local r = [[::pos{]]..system..[[,]]..planet..[[,]]..\n tostring(x) .. ',' .. \n tostring(y) .. ',' .. \n tostring(z) .. '}';\n return r\nend\n\n--round funcion\n--function round(num, numDecimalPlaces)\n-- if numDecimalPlaces and numDecimalPlaces>0 then\n-- local mult = 10^numDecimalPlaces\n-- return math.floor(num * mult + 0.5) / mult\n-- end\n-- return math.floor(num + 0.5)\n--end\n\n--trilaterate funcion\nfunction trilaterate(p1, r1, p2, r2, p3, r3, p4, r4)\n local r1s, r2s, r3s = r1*r1, r2*r2, r3*r3 \n local v2 = p2 - p1\n local ax = v2:normalize()\n local U = v2:len()\n local v3 = p3 - p1\n local ay = (v3 - v3:project_on(ax)):normalize()\n local v3x, v3y = v3:dot(ax), v3:dot(ay)\n local vs = v3x*v3x + v3y*v3y\n local az = ax:cross(ay) \n local x = (r1s - r2s + U*U) / (2*U) \n local y = (r1s - r3s + vs - 2*v3x*x)/(2*v3y)\n local m = r1s - (x^2) - (y^2) \n if m < 0.0000001 then m = 0 end\n local z = math.sqrt(m)\n local t1 = p1 + ax*x + ay*y + az*z\n local t2 = p1 + ax*x + ay*y - az*z\n \n if math.abs((p4 - t1):len() - r4) < math.abs((p4 - t2):len() - r4) then\n return t1\n else\n return t2\n end\n end\n\n-- Scrollwheell acceleration\nfunction delta_scrollwheel(distance,mouse,time,idle)\n \n local delta = utils.round(system.getTime()-idle,0.01) --scrollwheel aceleration \n --test_html = test_html..\"delta mouse: \"..delta\n --system.print(delta) \n local factor = 1 \n if delta < 0.06 then factor = 12.5 end \n local d = distance + factor * mouse\n if d > 400 then --distance constraints\n distance = 400\n elseif d < 0 then \n distance = 0\n else \n distance = utils.round(d,1)\n end \n return distance \nend \n \nfunction ditance_to_points (p,list)\n local x1\n local y1\n local z1 \n \n --for every point in\n --local d = ((x2 - x1)** 2 + (y2 - y1)**2 + (z2 - z1)**2)**(0.5) \n\nend \n ","filter":{"args":[],"signature":"start()","slotKey":"-5"},"key":"12"}],"methods":[],"events":[]}