forked from juvenius/du_ez_scanner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdu_ez_scanner.json
113 lines (113 loc) · 15.6 KB
/
du_ez_scanner.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
{
"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": [] } },
"-2": { "name": "system", "type": { "events": [], "methods": [] } },
"-3": { "name": "library", "type": { "events": [], "methods": [] } }
},
"handlers": [
{
"code": "-- general\nlocal title = \"◄ EZ SCANNER ►\" \nlocal line1 = \"\"\n--local add_style = \"\"\nlocal line2 =\"\"\n\n-- left, main, line1\nif size == 0 then \n\tline1 = \"<text style='color:white'>➀➁➂➃</text>\"\n\tline2 = \"<text style='color:#eca943'>Alt+3 <b>[+]</b> ■ <b>[-]</b> Alt+5</text>\"\n elseif size == 1 then \t\n \tline1 = \"<text style='color:#eca943'>➊</text>➁➂➃\"\n\tline2 = \"<text style='color:#eca943'>Alt+3 <b>[+]</b> ■ <b>[-]</b> Alt+5</text>\"\n elseif size == 2 then \n \tline1 = \"<text style='color:#eca943'>➊➋</text>➂➃\" \n\tline2 = \"<text style='color:#eca943'>Alt+3 <b>[+]</b> ■ <b>[-]</b> Alt+5</text>\"\n elseif size == 3 then \t\n\tline1 = \"<text style='color:#eca943'>➊➋➌</text>➃\"\n\tline2 = \"<text style='color:#eca943'>Alt+3 <b>[+]</b> ■ <b>[-]</b> Alt+5</text>\"\n elseif size == 4 then \n\tline1 = \"<text style='color:#498aff'>➊➋➌➍</text>\"\n line2 = \"<text style='color:#498aff'>FIND IT! ALT+4</text>\" \nend\n\n-- left, main, line2\nlocal line3 = \"\"\nif size < 4 then \n\tline3 =\"DISTANCE: \"..distance\n else\n\tline3=\"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\t<p id=\"main_block\" class=\"block\">]]..\n\ttitle..\"<br>\"..\n\tline2..\"<br>\"..\n\tline1..\"<br>\"..\n\tline3..\"<br>\"..\n\tline4..[[\n </p>]]\n \n-- help\nlocal help = [[\n\t<p id=\"help_block\" class=\"block\">]]..\n\thelp_block..[[\n\t</p>]]\n\nif help_tougle == false then help = \"\" end\n\n-- left\nlocal left_panel = [[\n\t<div id=\"panel_left\">]]..\n\tmain..\n\thelp..[[\n\t</div>]]\n\n-- slider \nlocal slider = \"\"\nif slider_tougle == true then -- slider tougle\n\n local line = distance_line_transform(distance) \n slider = [[ \n\t<div id=\"panel_slider\">\t \t\n <div id=\"slider_main\" style='top: ]] .. 100-line-3 .. [[%;'>]]..\n [[◯━━━━━━[ ]].. distance ..[[ ]<br> \n <p style=\"text-align: right\">]]..\"\".. line1..[[\n\t\t </p>\n </div> \n\t <p id=\"slider_header\">]]..\n title..[[<br>]]..\n\t\t line2..[[\n </p>\n\t</div>]]\nend\n\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 \n else\n \n body = \"<body>\"..left_panel..slider..\"</body>\" \n \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-- 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 = 300 --export\nauto_stop_after_pause = 300 --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--conversion of parameters\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\niddle = 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 local c = system.getPlayerWorldPos(player_id) \n d.p = vec3(c[1],c[2],c[3]) \n d.r = distance\n list[size] = d\n size = size + 1\n \n elseif size == 3 then \n \n\tif 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": "-2"
},
"key": "2"
},
{
"code": "-- Delete point from table\nif size > 0 then\n table.remove(list) \nelse\n list = {}\nend\n\n",
"filter": {
"args": [{ "value": "option5" }],
"signature": "actionStart(action)",
"slotKey": "-2"
},
"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": "-2"
},
"key": "4"
},
{
"code": "-- Solve location \nsolve_location(list) \n\nif size == 4 then\n\tlist = {}\n\tsize = 0\nend \n\nif pause_solve_tougle then \n pause_tougle = pause_solve_tougle \nend",
"filter": {
"args": [{ "value": "option4" }],
"signature": "actionStart(action)",
"slotKey": "-2"
},
"key": "5"
},
{
"code": "-- EXIT\n\nscript_exit() \n \n",
"filter": {
"args": [{ "value": "option9" }],
"signature": "actionStart(action)",
"slotKey": "-2"
},
"key": "6"
},
{
"code": "--activate help window\nhelp_tougle = not help_tougle",
"filter": {
"args": [{ "value": "option1" }],
"signature": "actionStart(action)",
"slotKey": "-2"
},
"key": "7"
},
{
"code": "-- distance imput\n-- scrollwheel aceleration\n-- distance contraints\n-- auto pause timer\ntime = system.getTime()\n\nif pause_tougle == false then\n local mouse = system.getThrottleInputFromMouseWheel()\n \n if distance ~= (distance + mouse)then\n local delta = round(system.getTime()-iddle,2) --scrollwheel aceleration\n local factor = 1 \n\n if delta < 0.08 then factor = 2 end \n \n if delta < 0.04 then factor = 20 end \n \n local d = distance + factor * mouse\n\n if d > 400 then --distance constraints\n distance = 400\n elseif d < 0 then \n distance = 0\n else \n distance = round(d,0)\n end\n \n iddle = system.getTime() --time last to move \n \n else \n local t = time - iddle --iddle timer pause \n \n if t > pause_timer then \n pause_tougle = true \n iddle = system.getTime()\n end --system.print(t..\" - \"..pause_timer) \n end\n\n else \n local t = time - iddle --iddle timer pause \n if t > stop_timer then script_exit() end \nend \n \n ",
"filter": { "args": [], "signature": "update()", "slotKey": "-2" },
"key": "8"
},
{
"code": "-- Slider Tougle\nslider_tougle = not slider_tougle ",
"filter": {
"args": [{ "value": "option7" }],
"signature": "actionStart(action)",
"slotKey": "-2"
},
"key": "9"
},
{
"code": "-- HTML, CSS\n\nstyle = [[\n\n p {\n /*color:#eca943;*/\n font-size:100%;\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 \t padding: 10px 10px 10px 10px;\n width: 320px;\n }\t\n\n #pause_block{ \n\t text-align: center;\n font-size:90%;\n }\n\n #panel_left { \n position: absolute;\n top: 0%;\n\t left: 0%;\n /*width: 310px;*/\n\n }\n #slider_header {\n position: absolute;\n top: 0vh;\n font-size:110%;\n\t width: 100%;\n\t text-align: center;\t \n }\n\n\n #slider_main {\n position: relative;\n font-size:105%;\n\t color:#eca943;\n /*left: -51%;/*0%*/*/\n }\n\n #slider_footer{\n position: relative;\n font-size:120%;\n top:80%;\n left:10%; \n }\n\n #panel_slider {\n position: absolute;\n top: 54.5vh; ;\n left: 66.8vw;/*66.8vw;*/\n width: 9vw;/*9vw;*/\n height: 28.5vh;\n transform: skew(15.85deg); /*15.85deg*/\n border-bottom: 28.5vh solid rgba(0,0,0,.25);\n border-right: 1vw solid transparent;\n /*background-color:rgba(0,0,0,.75)*/ \t\n }\n\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.0 | 2020.11.24 <br> \n github.com/juvenius/du_ez_scanner <br>\n Issues? discord: Juvenius#2318 <br>\n ▴ ▾ ◂ ▸ ▵ ▿ ◃ ▹ ▲ ▼ ◄ ► △ ▽ ◁ ▷<br>\n]]\n",
"filter": { "args": [], "signature": "start()", "slotKey": "-3" },
"key": "10"
},
{
"code": "-- FUNCTION LIBRARY\n\n-- place holder for start slash\nfunction start_splash() \nend \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(\"<text style='color:#eca943'>┍━━━━━NODE LOCATION━━━━━┑</text>\")\n system.print(position)\n system.print(\"<text style='color:#eca943'>┕━━━━━━━━━━━━━━━━━━┙</text>\")\n system.print(\"<text style='color:white'>SCRIPT PAUSED | START ALT+8 | EXIT ALT+9</text>\")\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 = round(system.getTime(),0)\n if c % r == 0 then \n return true\n else\n\t 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-- UPGRADE TO MORE PLANETS\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\nfunction 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)\nend\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",
"filter": { "args": [], "signature": "start()", "slotKey": "-3" },
"key": "11"
}
],
"methods": [],
"events": []
}