diff --git a/Construct ID License Plate/Dynamic License Plate - PB.txt b/Construct ID License Plate/Dynamic License Plate - PB.txt new file mode 100644 index 0000000..87499cc --- /dev/null +++ b/Construct ID License Plate/Dynamic License Plate - PB.txt @@ -0,0 +1 @@ +{"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":"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":"slot1.setScriptInput(construct.getId())","filter":{"args":[],"signature":"onStart()","slotKey":"-1"},"key":1}],"methods":[],"events":[]} \ No newline at end of file diff --git a/Construct ID License Plate/Dynamic License Plate - renderscript.txt b/Construct ID License Plate/Dynamic License Plate - renderscript.txt new file mode 100644 index 0000000..e98bea6 --- /dev/null +++ b/Construct ID License Plate/Dynamic License Plate - renderscript.txt @@ -0,0 +1,156 @@ +local atlas = require("atlas") +--user configurable variables +local bgplanet = 2 +local planetsize = 400 +local outlinecolor1R, outlinecolor1G, outlinecolor1B = 0, 1.5, 1.75 +local outlinecolor2R, outlinecolor2G, outlinecolor2B = 0, 0.25, 0.5 +local outlinecolor3R, outlinecolor3G, outlinecolor3B = 0, 0.25, 0.5 +local textcolor1R, textcolor1G, textcolor1B = 1, 1, 1 +local textcolor2R, textcolor2G, textcolor2B = 3, 3, 3 +local spacebg = loadImage("assets.prod.novaquark.com/66839/ea555f35-0b6a-4c15-a4d4-d0d0b1e26927.png") +local drawspacebg = 1 +--# Local rendering preparation +-- Create layers +local rear = createLayer() +local back = createLayer() +local front = createLayer() +local fore = createLayer() + +local layer2 = createLayer() +local platetextsize = 200 +local font1 = loadFont("Play",platetextsize) +local font2 = loadFont("Play",platetextsize/2) + +local system = atlas[0] +local rx,ry = getResolution() + +if drawspacebg == 1 then + addImage(rear, spacebg, 0, 0, rx, ry) +end + +local images = {} +local function loadImages(src) + for k,img in pairs(images) do + if k == src then return img end + end + images[src] = loadImage(src) + return images[src] +end + +local function contains(t, u) + for i,v in pairs(t) do + if v == u then return true, i end + end + return false +end + +_planets = _planets or {} +local input, dist = getInput(), 0 + +if not _init then + if not system[_select] then + _select = 1 + end + for _,b in pairs(system) do + if b.systemId == 0 then + if b.satellites then + table.sort (b.satellites, function (b1, b2) return system[b1].positionInSystem < system[b1].positionInSystem end ) + end + _planets[#_planets+1] = b + end + end + table.sort (_planets, function (b1, b2) return b1.positionInSystem < b2.positionInSystem end ) + _init = true +end + +local planet = system[_select] +local vignette = loadImages(planet.iconPath) + + +--- Draw all planets +for i,body in pairs(_planets) do + -- For each planet load the icon from the atlas data + if i == bgplanet then + local img = loadImages(body.iconPath) + local hover = false + local r = planetsize + local bx, by = 450,350 + local mbx = 224+(i*350)/6 + + if body.hasAtmosphere then + local atm = body.atmosphereRadius/900 + + setNextStrokeWidth( rear, 0.1) + setNextStrokeColor( rear, 1, 1, 1, 0.03) + setNextShadow( rear, 80, 1, 1, 1, 0.035) + setNextFillColor( rear, 1, 1, 1, 0.025) + addCircle( rear, bx, by, r) + end + --Draw planet image + addImage( back, img, bx-r, by-r, 2*r, 2*r) + --draw border + setNextShadow(fore,25,outlinecolor1R, outlinecolor1G, outlinecolor1B,1) + setNextStrokeWidth(fore,5) + setNextFillColor(fore,0,0,0,0) + addBoxRounded(fore, 25, 25, rx - 50, ry - 50, 20) + + setNextShadow(fore,25,outlinecolor2R, outlinecolor2G, outlinecolor2B,1) + setNextFillColor(fore,textcolor1R, textcolor1G, textcolor1B,1) + local bndx,bndy = getTextBounds(font2,body.name[1]) + addText(fore,font2,body.name[1],rx/2-(bndx/2),ry/2-(bndy/2)-100) + end +end + +local baseCharacters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" +local baseLength = #baseCharacters + +local floor = math.floor +local abs = math.abs +local sub = string.sub +function baseEncode(x, base) + assert(base, "Argument 2 missing or nil") + assert(not (base > baseLength or base < 2), "Base not in range of 2 - " .. baseLength) + local returnString = "" + local negative = x < 0 + if negative then + x = abs(x) + end + local i = 0 + local remainder + while x ~= 0 do + i = i + 1 + x, remainder = floor(x / base), x % base + 1 + returnString = sub(baseCharacters, remainder, remainder) .. returnString + end + return (negative and "-" or "") .. returnString +end +local find = string.find +function baseDecode(s, encodedBase) + if encodedBase <= 36 then + s = s:upper() + end + + local positive = true + if sub(s, 1, 1) == "-" then + positive = false + s = sub(s, 2, -1) + end + + local returnNumber = 0 + local length = #s + + for i = 1, length do + local currentCharacter = sub(s, i, i) + local characterValue = (find(baseCharacters, currentCharacter) - 1) * encodedBase ^ (length - i) + returnNumber = returnNumber + characterValue + end + return positive and returnNumber or -returnNumber +end +function convertBase(s, encodedBase, newBase) + return baseEncode(baseDecode(s, encodedBase), newBase) +end +local platetext = convertBase(getInput(), 10, 36) +local bndw, bndh = getTextBounds(font1,platetext) +setNextShadow(layer2,50,outlinecolor3R, outlinecolor3G, outlinecolor3B,1) +setNextFillColor(layer2,textcolor2R, textcolor2G, textcolor2B,1) +addText(layer2,font1,platetext,rx/2-(bndw/2),(ry/2)+100) \ No newline at end of file diff --git a/Construct ID License Plate/readme.md b/Construct ID License Plate/readme.md new file mode 100644 index 0000000..5cee0e0 --- /dev/null +++ b/Construct ID License Plate/readme.md @@ -0,0 +1,24 @@ +# Dynamic Ship License Plate + +### Installation + +Copy the content of renderscript.txt into the screen you wish to use to display the license plate. +You may either use a standalone programming board, or a control seat to set the input to the script. + +To use a Programming Board: Paste PB.txt into a Programming Board as a config, and link it to the screen. +Any time the construct is compactified, the ID is regenerated, and the script input will need to be reset. +For this reason it may be preferable to use your control seat. + +To use your Control Seat: Link the seat to the screen, edit the seat's Lua with CTRL+L, click Unit on the left, and then click the onStart filter. +Paste this line into the very bottom of the onStart filter's code; + +[screenslot].setScriptInput(construct.getId()) + +where [screenslot] is replaced with the slot corresponding to the screen you linked earlier. + +### Configuration + +The colors and images are all customizable. Check the first couple lines of code. +To change the planet name and image displayed, simply change the "bgplanet" variable. +The values of this variable correspond to the entries in atlas.json. +For example, a value of 1 displays Madis, 2 displays Alioth, and 3 for Thades. \ No newline at end of file diff --git a/Conway's Game of Life/Conways Game Of Life - Renderscript.txt b/Conway's Game of Life/Conways Game Of Life - Renderscript.txt new file mode 100644 index 0000000..cd33a3b --- /dev/null +++ b/Conway's Game of Life/Conways Game Of Life - Renderscript.txt @@ -0,0 +1,122 @@ +if not init then + l1fontsize = 8 + l1xoffset = -20 + l1yoffset = 0 + rx, ry = getResolution() + cx1, cy1 = math.floor(rx/l1fontsize-1), math.floor(ry/l1fontsize) + mem1 = {} + mem2 = {} + refresh = 1 + for ix=1,cx1 do + mem1[ix] = {} + for iy=1,cy1 do + mem1[ix][iy] = math.random(math.floor(2))-1 + if mem1[ix][iy] == 1 then + mem1[ix][iy] = math.random(math.floor(2))-1 + if mem1[ix][iy] == 1 then + mem1[ix][iy] = math.random(math.floor(2))-1 + if mem1[ix][iy] == 1 then + mem1[ix][iy] = math.random(math.floor(2))-1 + end + end + end + end + end + for ix1=1,cx1 do + mem2[ix1] = {} + for iy1=1,cy1 do + mem2[ix1][iy1] = 0 + end + end + init = true +end + +fontL = loadFont("Play", 15) +layer1 = createLayer() +layer2 = createLayer() +cursorx, cursory = getCursor() +curx2 = math.floor(cursorx/8)+2 +cury2 = math.floor(cursory/8)+1 + +setNextFillColor(layer2, 0.4, 0.4, 0.4, 0.3) +addBox(layer2, 100, 100, 100, 25) +if refresh == 1 then + setNextFillColor(layer2, 0, 1, 0, 0.3) +else + setNextFillColor(layer2, 1, 0, 0, 1) +end +addText(layer2,fontL,"Pause",125,115) + +function updateStates() + for dx=1,cx1 do + for dy=1,cy1 do + --rules, in order + --mem2[dx][dy] = 0 + --neighbors = 0 + if dx > 1 and dx < cx1 then + if dy > 1 and dy < cy1 then + dx0 = dx - 1 + dx2 = dx + 1 + dy0 = dy - 1 + dy2 = dy + 1 + neighbors = mem1[dx0][dy0] + mem1[dx][dy0] + mem1[dx2][dy0] + mem1[dx0][dy] + mem1[dx2][dy] + mem1[dx0][dy2] + mem1[dx][dy2] + mem1[dx2][dy2] + if mem1[dx][dy] == 1 then + if neighbors == 2 or neighbors == 3 then + mem2[dx][dy] = 1 + else + mem2[dx][dy] = 0 + end + else + if neighbors == 3 then + mem2[dx][dy] = 1 + else + mem2[dx][dy] = 0 + end + end + end + end + end + end + mem1 = mem2 +end + +function DrawAllBoxes() + for bx=2,cx1 - 1 do + for by=2,cy1 - 1 do + if mem1[bx][by] == 1 then + setNextFillColor(layer1, 1, 1, 1, 1) + addBox(layer1, (bx*l1fontsize)+l1xoffset, (by*l1fontsize)+l1yoffset, l1fontsize, l1fontsize) + --addText(layer1,fontL,mem1[bx - 1][by - 1] + mem1[bx][by - 1] + mem1[bx + 1][by - 1] + mem1[bx - 1][by] + mem1[bx + 1][by] + mem1[bx - 1][by + 1] + mem1[bx][by + 1] + mem1[bx + 1][by + 1],(l1fontsize*bx)+l1xoffset, (l1fontsize*by)+l1yoffset) + + --addText(layer1,fontL,mem2[bx][by],(l1fontsize*bx)+l1xoffset, (l1fontsize*by)+l1yoffset) + end + end + end +end + +if refresh == 1 then + updateStates() +end + + +if getCursorReleased() then + if cursorx > 100 and cursorx < 200 then + if cursory > 100 and cursory < 125 then + if refresh == 1 then + refresh = 0 + else + refresh = 1 + end + end + end + if curx2 > 0 and cury2 > 0 then + if mem1[curx2][cury2] == 1 then + mem1[curx2][cury2] = 0 + else + mem1[curx2][cury2] = 1 + end + end +end + +DrawAllBoxes() +requestAnimationFrame(1) \ No newline at end of file diff --git a/Custom Font From Image/Custom Font.txt b/Custom Font From Image/Custom Font.txt new file mode 100644 index 0000000..bb4a9fa --- /dev/null +++ b/Custom Font From Image/Custom Font.txt @@ -0,0 +1,23 @@ +local customfontimage = loadImage("assets.prod.novaquark.com/66839/e294a1f0-11ae-4fa1-a5f8-aeb02288eb24.png") +local layer1 = createLayer() +local layer2 = createLayer() +local font1 = loadFont("Play",20) +local rx,ry = getResolution() + +setBackgroundColor(0.5,0.5,0.5) + +function addCustomText(drawlayer, imagehandle, textstring, xpos, ypos, size, colorr, colorg, colorb, colora) + destructstring = textstring + for ix=1,#textstring do + nextletter = string.sub(destructstring,1,1) + destructstring = string.sub(destructstring,2,string.len(destructstring)) + nextascii = string.byte(nextletter) - 33 + + local subxpos = math.fmod(nextascii,32) + local subypos = math.floor(nextascii / 32) + setNextFillColor(drawlayer, colorr, colorg, colorb, colora) + addImageSub(drawlayer, imagehandle, xpos+(ix * (size/2)), ypos, size, size, 0 + (68*subxpos), 0 + (68 * subypos), 68, 68) + end +end + +addCustomText(layer1, customfontimage, "This is a custom font, rendered from an image file.", 50, 150, 28, 0,0,0,1) \ No newline at end of file diff --git a/Custom Font From Image/customfont1.png b/Custom Font From Image/customfont1.png new file mode 100644 index 0000000..9203087 Binary files /dev/null and b/Custom Font From Image/customfont1.png differ diff --git a/DUOpenMarket Ad/DUOpenMarket Ad - Renderscript.txt b/DUOpenMarket Ad/DUOpenMarket Ad - Renderscript.txt new file mode 100644 index 0000000..8bad569 --- /dev/null +++ b/DUOpenMarket Ad/DUOpenMarket Ad - Renderscript.txt @@ -0,0 +1,186 @@ +if not init then + tick = 0 + tickmax = 100 + hexx = 515 + hexy = 175 + a = 2 * math.pi / 6 + r = 100 + display = 1 + displaymax = 4 + displaytick = 0 + displaytickmax = 175 + init = true +end +local layer = createLayer() +local layer2 = createLayer() +local layer3 = createLayer() +local layer4 = createLayer() +local rx, ry = getResolution() +local fontL = loadFont("Play", 80) +local fontB = loadFont("Play", 70) +local fontB2 = loadFont("Play", 71) +local fontB3 = loadFont("Play", 72) +local fontM = loadFont("Play", 50) +local fontS = loadFont("Play", 40) +local imagehandle = loadImage("assets.prod.novaquark.com/66839/b249f117-4120-472e-8c12-d84c04c28775.png") +local imagehandle2 = loadImage("assets.prod.novaquark.com/66839/8452f802-cb36-40ec-9d26-f5530a82ac1c.png") + +if display == 1 then + + addImage(layer, imagehandle, 0, 0, rx, ry) + + --setNextFillColor(layer, 1, 0, 0, 1) + --addText(layer, fontS, "In Development", rx*0.02, ry*0.08) + --setNextFillColor(layer, 1, 0, 0, 1) + --addText(layer, fontS, "@EpicPhail#3860", rx*0.02, ry*0.16) + + setNextShadow(layer3,15,0,0,0,1) + setNextFillColor(layer3, 1, 1, 1, 1) + addText(layer3, fontB, "DUOpenMarket", rx*0.265, ry*0.55) + + setNextShadow(layer3,15,0,0,0,1) + setNextFillColor(layer3, 0.65, 0.65, 0.65, 1) + addText(layer3, fontM, "Open Source Third-Party Market API", rx*0.11, ry*0.675) + + setNextFillColor(layer3, 0.65, 0.65, 0.65, 1) + setNextShadow(layer3,15,0,0,0,1) + addText(layer3, fontM, "with Discord-based login", rx*0.235, ry*0.74) + + setNextShadow(layer3,15,0,0,0,1) + setNextFillColor(layer3, 2, 2, 0, 1) + addText(layer3, fontL, "https://duopenmarket.com", rx*0.025, ry*0.9) + + + setNextShadow(layer4,15,0,0,0,1) + setNextFillColor(layer4, 1, 0.85, 0, 1) + addText(layer4, fontM, "Version 1.61.1", rx*0.04, ry*0.07) + + setNextShadow(layer4,15,0,0,0,1) + setNextFillColor(layer4, 1, 0.85, 0, 1) + addText(layer4, fontM, "Now Available!", rx*0.04, ry*0.17) + + setLayerOrigin(layer4,rx/2,ry/2) + setLayerRotation(layer4,(math.pi*2)*-0.1) + setLayerTranslation(layer4,50,-150) + + if tick > tickmax then + tick = 0 + end + if tick > (tickmax / 2) then + alpha = 1-(tick/tickmax) + else + alpha = (tick/tickmax) + end + for ia=0,5 do + setNextShadow(layer3,20,1,0.85,0,alpha) + setNextStrokeWidth(layer3,15) + setNextStrokeColor(layer3,1,0.85,0,alpha) + addLine(layer3,hexx + (r + tick) * math.cos(a * ia), hexy + (r + tick) * math.sin(a * ia),hexx + (r + tick) * math.cos(a * (ia+1)), hexy + (r + tick) * math.sin(a * (ia+1))) + end + tick = tick + 1 +end + +if display == 2 then + addImage(layer, imagehandle, 0, 0, rx, ry) + addImage(layer2, imagehandle2, -50, -75, rx, ry) + + setNextShadow(layer3,15,0,0,0,1) + setNextFillColor(layer3, 0.85, 0.85, 0.15, 1) + addText(layer3, fontS, "Tired of spreadsheets?", rx*0.05, ry*0.1) + + setNextShadow(layer3,15,0,0,0,1) + setNextFillColor(layer3, 0.85, 0.85, 0.15, 1) + addText(layer3, fontS, "Try graphs instead!", rx*0.05, ry*0.175) + + + setNextShadow(layer3,15,0,0,0,1) + setNextFillColor(layer3, 0.85, 0.85, 0.15, 1) + addText(layer3, fontS, "Automatically generated historical statistics", rx*0.05, ry*0.7) + + + setNextShadow(layer3,15,0,0,0,1) + setNextFillColor(layer3, 2, 2, 0, 1) + addText(layer3, fontL, "https://duopenmarket.com", rx*0.025, ry*0.9) +end + +if display == 3 then + + addImage(layer, imagehandle, 0, 0, rx, ry) + + setNextShadow(layer3,15,0,0,0,1) + setNextFillColor(layer3, 0.75, 0.75, 0.75, 1) + addText(layer3, fontB, "Current Features:", rx*0.025, ry*0.1) + + setNextShadow(layer3,15,0,0,0,1) + setNextFillColor(layer3, 0.45, 0.85, 0.25, 1) + addText(layer3, fontM, "Open-Source, with Secure Auth", rx*0.05, ry*0.2) + + setNextShadow(layer3,15,0,0,0,1) + setNextFillColor(layer3, 0.45, 0.85, 0.25, 1) + addText(layer3, fontM, "Advanced Searching, save search terms", rx*0.05, ry*0.3) + + setNextShadow(layer3,15,0,0,0,1) + setNextFillColor(layer3, 0.45, 0.85, 0.25, 1) + addText(layer3, fontM, "Small client, low resource use", rx*0.05, ry*0.4) + + setNextShadow(layer3,15,0,0,0,1) + setNextFillColor(layer3, 0.45, 0.85, 0.25, 1) + addText(layer3, fontM, "Sort by price, market, quantity, etc", rx*0.05, ry*0.5) + + setNextShadow(layer3,15,0,0,0,1) + setNextFillColor(layer3, 0.45, 0.85, 0.25, 1) + addText(layer3, fontM, "History trend Graphing and Economy stats", rx*0.05, ry*0.6) + + setNextShadow(layer3,15,0,0,0,1) + setNextFillColor(layer3, 2, 2, 0, 1) + addText(layer3, fontL, "https://duopenmarket.com", rx*0.025, ry*0.9) + +end + +if display == 4 then + + addImage(layer, imagehandle, 0, 0, rx, ry) + + setNextShadow(layer3,15,0,0,0,1) + setNextFillColor(layer3, 0.75, 0.75, 0.75, 1) + addText(layer3, fontB, "Features In Development:", rx*0.025, ry*0.1) + + setNextShadow(layer3,15,0,0,0,1) + setNextFillColor(layer3, 0.85, 0.45, 0.25, 1) + addText(layer3, fontM, "Profit and Margin calculators for industry", rx*0.05, ry*0.2) + + setNextShadow(layer3,15,0,0,0,1) + setNextFillColor(layer3, 0.85, 0.45, 0.25, 1) + addText(layer3, fontM, "Cost/value calculator for constructs", rx*0.05, ry*0.3) + + setNextShadow(layer3,15,0,0,0,1) + setNextFillColor(layer3, 0.85, 0.45, 0.25, 1) + addText(layer3, fontM, "Construct / Blueprint / Script Market", rx*0.05, ry*0.4) + + setNextShadow(layer3,15,0,0,0,1) + setNextFillColor(layer3, 0.85, 0.45, 0.25, 1) + addText(layer3, fontM, "Public anti-scam Reputation directory", rx*0.05, ry*0.5) + + setNextShadow(layer3,15,0,0,0,1) + setNextFillColor(layer3, 0.85, 0.45, 0.25, 1) + addText(layer3, fontM, "...And more!", rx*0.05, ry*0.7) + + setNextShadow(layer3,15,0,0,0,1) + setNextFillColor(layer3, 2, 2, 0, 1) + addText(layer3, fontL, "https://duopenmarket.com", rx*0.025, ry*0.9) + +end + + +if displaytick < displaytickmax then + displaytick = displaytick + 1 +else + if display == displaymax then + display = 1 + else + display = display + 1 + end + displaytick = 0 +end + +requestAnimationFrame(1) \ No newline at end of file diff --git a/Databank Key Viewer/DB Key Viewer - PB.txt b/Databank Key Viewer/DB Key Viewer - PB.txt new file mode 100644 index 0000000..9ed475f --- /dev/null +++ b/Databank Key Viewer/DB Key Viewer - PB.txt @@ -0,0 +1 @@ +{"slots":{"0":{"name":"screen","type":{"events":[],"methods":[]}},"1":{"name":"databank","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":"local screenoutput = screen.getScriptOutput()\nlocal screeninput = \"\"\nif screenoutput == \"\" then\n screeninput = \"?\"\nelse\n if screenoutput == \"<\" then\n --previous key\n if page > 0 then\n page = page - 1\n screeninput = \"KEY: \" .. DBKeys[page]\n else\n screeninput = \"\"\n end\n else\n if screenoutput == \">\" then\n --next key\n if page < NBKeys then\n page = page + 1\n screeninput = \"KEY: \" .. DBKeys[page]\n else\n screeninput = \"\"\n end\n else\n if screenoutput == \"KEYOK\" then\n --accepted key, send val\n screeninput = \"VAL: \" .. databank.getStringValue(DBKeys[page])\n else\n --command not understood\n end\n end\n end\nend\nscreen.setScriptInput(screeninput)\nscreen.clearScriptOutput()\nsystem.print(\"Screen OUT: \" .. screenoutput)\nsystem.print(\"Screen IN: \" .. screeninput)","filter":{"args":[{"variable":"*"}],"signature":"onOutputChanged(output)","slotKey":"0"},"key":"0"},{"code":"DBKeys = json.decode(databank.getKeys())\nNBKeys = databank.getNbKeys()\nscreen.activate()\nlocal screenoutput = screen.getScriptOutput()\nlocal screeninput = \"\"\nscreen.setScriptInput(\"?\")\nscreen.clearScriptOutput()\npage = 1\n\n\nsystem.print(\"Screen OUT: \" .. screenoutput)\nsystem.print(\"Screen IN: \" .. screeninput)","filter":{"args":[],"signature":"start()","slotKey":"-1"},"key":"1"}],"methods":[],"events":[]} \ No newline at end of file diff --git a/Databank Key Viewer/DB Key Viewer - renderscript.txt b/Databank Key Viewer/DB Key Viewer - renderscript.txt new file mode 100644 index 0000000..d799a20 --- /dev/null +++ b/Databank Key Viewer/DB Key Viewer - renderscript.txt @@ -0,0 +1,190 @@ +json = require("dkjson") +if not init then + init = true + imagebg = 1 + passwordstring = "" + displaystringdefault = "NO KEYS FOUND" + displaystringkey = "" + displaystringvalue = "" + lastinput = "" + valuetable = "" + drawposx = 50 + drawposy = 50 + scrollpos = 0 + color1R, color1G, color1B, color1A = 0, 0, 0, 0.85 --background + color2R, color2G, color2B, color2A = 0.1, 0.1, 0.1, 0.5 --button BG + color3R, color3G, color3B, color3A = 0.5, 0.3, 0.1, 0.5 --button border + color4R, color4G, color4B, color4A = 0.5, 0.3, 0.1, 0.5 --button BG hover + color5R, color5G, color5B, color5A = 0.9, 0.7, 0.1, 0.5 --button BG click + color6R, color6G, color6B, color6A = 1, 1, 1, 0.75 --button text + + color7R, color7G, color7B, color7A = 0.15, 0.15, 0.15, 1 --scrollbar BG + --color8R, color8G, color8B, color8A = 0.25, 0.75, 0.25, 0.15 --scrollbar grabber BG + --color9R, color9G, color9B, color9A = 1, 1, 1, 0.75 --scrollbar grabber border + + + color10R, color10G, color10B, color10A = 0.05, 0.05, 0.05, 1 --UI Panel BG + color11R, color11G, color11B, color11A = 1, 1, 0, 1 --Data Value Text +end +local layer = createLayer() -- Main Background +local layer4 = createLayer() -- key value text +local layer5 = createLayer() -- UI +local rx, ry = getResolution() +local fontL = loadFont("Play", 110) +local fontH = loadFont("Play", 100) +local fontB = loadFont("Play", 60) +local fontM = loadFont("Play", 40) +local fontS = loadFont("Play", 20) +local curx, cury = getCursor() +local scriptinput = "" +drawposx = 50 +drawposy = 50 + +setNextFillColor(layer, color1R, color1G, color1B, 1) +addBox(layer,0,0,rx,ry) + +if getInput() then + scriptinput = getInput() + --process PB input + if string.sub(scriptinput,0,4) == "KEY:" then + displaystringkey = string.sub(scriptinput,5,string.len(scriptinput)) + setOutput("KEYOK") + else + if string.sub(scriptinput,0,4) == "VAL:" then + scriptinput = string.sub(scriptinput,5,string.len(scriptinput)) + valuetable = scriptinput + setOutput("VALOK") + end + end + lastinput = scriptinput +end + +function DrawKeypadButton(btnx, btny, btnw, btnh, btntxt) + setNextFillColor(layer5, color2R, color2G, color2B, color2A) + if curx > btnx then + if curx < btnx+btnw then + if cury > btny then + if cury < (btny+btnh) then + if getCursorReleased() == true then + setNextFillColor(layer5, color5R, color5G, color5B, color5A) + setOutput(btntxt) + else + setNextFillColor(layer5, color4R, color4G, color4B, color4A) + end + end + end + end + end + setNextStrokeColor(layer5, color3R, color3G, color3B, color3A) + setNextStrokeWidth(layer5, 5) + addBoxRounded(layer5, btnx, btny, btnw, btnh, 5) + setNextFillColor(layer5, color6R, color6G, color6B, color6A) + addText(layer5, fontM, btntxt, btnx + (rx*0.015), btny + (ry*0.0625)) +end + +function DrawScrollBar(btnx, btny, btnw, btnh) + setNextFillColor(layer5, color7R, color7G, color7B, color7A) + addBox(layer5, btnx, btny, btnw, btnh) + setNextFillColor(layer5, color2R, color2G, color2B, color2A) + if curx > btnx then + if curx < (btnx + btnw) then + if cury > btny then + if cury < (btny + btnh) then + if getCursorDown() == true then + --drag scrollbar + setNextFillColor(layer5, color5R, color5G, color5B, color5A) + scrollpos = ((cury - btny) / btnh) * 2048 + else + setNextFillColor(layer5, color4R, color4G, color4B, color4A) + end + end + end + end + end + setNextStrokeColor(layer5, color3R, color3G, color3B, color3A) + setNextStrokeWidth(layer5, 5) + addBox(layer5, btnx, (((scrollpos/2048) * btnh) ), btnw, rx*0.025) +end + +function DrawInterface() + --Control bar, bottom + setNextFillColor(layer5, color10R, color10G, color10B, color10A) + addBox(layer5, 0, ry*0.8, rx, ry*0.2) + + DrawKeypadButton(rx*0.05,ry*0.8, rx*0.045, ry*0.08,"<") + DrawKeypadButton(rx*0.75,ry*0.8, rx*0.045, ry*0.08,">") + + addText(layer5, fontM, displaystringkey, rx*0.1 + 15, ry*0.815 + 35) +end + +function decodeJson(json) + local tempstring = string.sub(json, 2, string.len(json) - 1) + local tempchar = string.sub(json, 1, 1) + local charsleft = 0 + local namebuffer = "" + local isname = 0 + local valuebuffer = "" + local isvalue = 0 + repeat + tempchar = string.sub(tempstring, 1, 1) + tempstring = string.sub(tempstring, 2, string.len(tempstring)) + charsleft = string.len(tempstring) + if tempchar == "{" then + --increase indentation + drawposx = drawposx + 25 + drawposy = drawposy + 20 + namebuffer = "" + valuebuffer = "" + end + if tempchar == "}" then + --increase indentation + drawposx = drawposx - 25 + end + if tempchar == "]" then + --stop accumulating chars in buffer and print + isname = 0 + setNextFillColor(layer4, color11R, color11G, color11B, color11A) + addText(layer4, fontS, namebuffer, drawposx, drawposy - scrollpos) + --drawposy = drawposy + 20 + namebuffer = "" + end + if isname == 1 then + --accumulate chars in buffer + namebuffer = namebuffer .. tempchar + end + if tempchar == "[" then + --accumulate chars in buffer until the end of the name is reached + isname = 1 + end + if tempchar == "," and isvalue == 1 then + --stop accumulating chars in buffer and print + isvalue = 0 + setNextFillColor(layer4, color11R, color11G, color11B, color11A) + addText(layer4, fontS, valuebuffer, drawposx + 175, drawposy - scrollpos) + drawposy = drawposy + 20 + valuebuffer = "" + end + if tempchar == "{" and isvalue == 1 then + --stop accumulating chars in buffer and print + isvalue = 0 + valuebuffer = "" + end + if isvalue == 1 then + --accumulate chars in buffer + valuebuffer = valuebuffer .. tempchar + end + if tempchar == "=" then + --accumulate chars in buffer until the end of the value is reached + isvalue = 1 + end + until(charsleft == 0) +end + +--draw key value +decodeJson(valuetable) + +--draw UI +DrawScrollBar(rx*0.9,0,rx*0.1,ry*0.8) +DrawInterface() + +requestAnimationFrame(1) \ No newline at end of file diff --git a/Developer Utility Screen/DevScreen - Renderscript.txt b/Developer Utility Screen/DevScreen - Renderscript.txt new file mode 100644 index 0000000..4e2a31a --- /dev/null +++ b/Developer Utility Screen/DevScreen - Renderscript.txt @@ -0,0 +1,297 @@ +--simple persistence across frames, global varialbes must be created here +if not init then + tabindex = 1 + textbuffer = {} + keyboardshift = 0 + for ix=1,2 do + textbuffer[ix] = "" + end + bufferselect = 1 + a = 2 * math.pi / 6 + b = 2 * math.pi / 5 + r = 100 + slidervalue = 100 + fontselect = 1 + fontselectmax = 12 + init = true +end + +fontS = loadFont("Play", 15) +fontV = loadFont("Play", 30) +fonttab = {} +fontnames = {"FiraMono", "FiraMono-Bold", "Montserrat", "Montserrat-Light", "Montserrat-Bold", "Play", "Play-Bold", "RefrigeratorDeluxe", "RefrigeratorDeluxe-Light", "RobotoCondensed", "RobotoMono", "RobotoMono-Bold"} +for ia=fontselect,fontselect+4 do + fonttab[ia] = loadFont(fontnames[ia], 15) +end +layer1 = createLayer() +layer2 = createLayer() +layer3 = createLayer() +layer4 = createLayer() +rx, ry = getResolution() +cx, cy = getCursor() +cd = getCursorDown() +cp = getCursorPressed() +cr = getCursorReleased() +fontcount = getAvailableFontCount() +line = 1 +charset = "" + +function DrawCharacterSet() + for ix=0,255 do + line = math.floor(ix / 32) + if ix > 32 and ix < 127 then + setNextFillColor(layer1,0,1,0,1) + if ix == 34 or ix == 92 then + setNextFillColor(layer1,1,0,0,1) + end + end + if ix > 160 and ix < 194 then + setNextFillColor(layer1,1,1,0,1) + end + addText(layer1, fontS, string.char(ix), 30*(ix-(line*32))+30, (65*(line+1))+30) + addText(layer1, fontS, ix, 30*(ix-(line*32))+25, 65*(line+1)+50) + end +end + +function DrawButton(drawlayer, btnx, btny, btnw, btnh, btntxt, callfunc) + setNextFillColor(drawlayer, 0.35, 0.35, 0.35, 1) + if cx > btnx and cx < (btnx+btnw) then + if cy > btny and cy < (btny+btnh) then + if getCursorReleased() == true then + --clicked + setNextFillColor(drawlayer, 1, 0, 0, 1) + callfunc() + else + --hovered + setNextFillColor(drawlayer, 1, 1, 0, 1) + end + end + end + setNextStrokeWidth(drawlayer, 0) + addBoxRounded(drawlayer, btnx, btny, btnw, btnh, 5) + setNextFillColor(drawlayer, 1, 1, 1, 1) + local txtw, txty = getTextBounds(fontS,btntxt) + addText(drawlayer, fontS, btntxt, btnx + ((btnw - txtw)/2), btny + (btnh/2)+(txty/2)) +end + +function DrawScreenInfo() + setNextFillColor(layer1,1,0,0,1) + addText(layer1, fontS, "Resolution: " .. math.floor(rx) .. " x " .. math.floor(ry), 80, 80) + + setNextFillColor(layer1,1,0.5,0,1) + addText(layer1, fontS, "Cursor: " .. cx .. " , " .. cy, 80, 100) + setNextFillColor(layer1,1,1,0,1) + addText(layer1, fontS, "Down: " .. tostring(cd), 80, 120) + setNextFillColor(layer1,1,1,0,1) + addText(layer1, fontS, "Press: " .. tostring(cp), 80, 140) + setNextFillColor(layer1,1,1,0,1) + addText(layer1, fontS, "Release: " .. tostring(cr), 80, 160) + + ct = getTime() + dt = getDeltaTime() + setNextFillColor(layer1,0,1,0,1) + addText(layer1, fontS, "Time: " .. ct, 80, 200) + setNextFillColor(layer1,0,1,0,1) + addText(layer1, fontS, "Delta: " .. dt, 80, 220) + + rc = getRenderCost() + rcmax = getRenderCostMax() + setNextFillColor(layer1,0,0.5,1,1) + addText(layer1, fontS, "Render Cost: " .. rc .. " / " .. rcmax, 80, 300) +end + +function DrawOSKFull() + --generate on-screen keyboard + --Full keyboard, all buttons visible all the time, no shift. + local keyinc = 0 + for af=33,127 do + if af == 127 then + --backspace + liney = math.floor(keyinc / 16) + linex = keyinc - (liney*16) + output = function() textbuffer[bufferselect] = string.sub(textbuffer[bufferselect],1,string.len(textbuffer[bufferselect])-1) end + DrawButton(layer1, 320+(linex*35), 250+(liney*35), 60, 25, "BKSPC", output) + keyinc = keyinc + 1 + else + liney = math.floor(keyinc / 16) + linex = keyinc - (liney*16) + output = function() textbuffer[bufferselect] = textbuffer[bufferselect] .. string.char(af) end + DrawButton(layer1, 320+(linex*35), 250+(liney*35), 25, 25, string.char(af), output) + keyinc = keyinc + 1 + end + end +end + +function drawCircularProgressBar(layerin,xin,yin,rad,v,vmax) + local prcnt = v/vmax + local angle = prcnt*360 + local cntr = 0 + --progress circles + for xb = 1,20 do + cntr = cntr + 0.05 + setNextStrokeWidth(layerin,1) + setNextStrokeColor(layerin,0,0,0,0) + setNextFillColor(layerin,0,0.2,0.7,1) + addCircle(layerin,xin+(math.cos((prcnt*cntr)*(math.pi*2))*rad),yin+(math.sin((prcnt*cntr)*(math.pi*2))*rad),rad/3) + end + --center circle + setNextStrokeWidth(layerin,2) + setNextStrokeColor(layerin,0,0,0,0) + setNextFillColor(layerin,0.5,0.5,0.5,1) + addCircle(layerin,xin,yin,rad/2+(rad/4)) + --outer circle + setNextStrokeWidth(layerin,3) + setNextStrokeColor(layerin,0.5,0.5,0.5,1) + setNextFillColor(layerin,0,0,0,0) + addCircle(layerin,xin,yin,rad+(rad/3)) + --position circle + setNextStrokeWidth(layerin,1) + setNextStrokeColor(layerin,0.75,0.75,0.75,1) + setNextFillColor(layerin,0.75,0.75,0.75,1) + addCircle(layerin,xin+(math.cos(prcnt*(math.pi*2))*rad),yin+(math.sin(prcnt*(math.pi*2))*rad),rad/3) +end + +function DrawSlider(drawlayer, btnx, btny, btnw, btnh, value) + setNextFillColor(drawlayer, 0.35, 0.35, 0.35, 1) + if cx > btnx and cx < (btnx+btnw) then + if cy > (btny-(btnh*0.5)) and cy < (btny+(btnh*0.5)) then + if cd == true then + --clicked + setNextFillColor(drawlayer, 1, 0, 0, 1) + slidervalue = ((cx - btnx)/btnw)*100 + else + --hovered + setNextFillColor(drawlayer, 1, 1, 0, 1) + end + end + end + setNextStrokeWidth(drawlayer, 0) + addBoxRounded(drawlayer, btnx, btny-(btnh*0.25), btnw, btnh-(btnh*0.5), 5) + setNextFillColor(drawlayer, 1, 1, 1, 1) + addBoxRounded(drawlayer, btnx+((value*0.01)*btnw), btny-(btnh*0.5), 15, btnh, 5) +end + +function addHexagon1(inlayer,hexx,hexy,rad,strkwdth,sr,sg,sb,shwdth,shr,shg,shb,alpha) + for ia=0,5 do + setNextShadow(inlayer,shwdth,shr,shg,shb,alpha) + setNextStrokeWidth(inlayer,strkwdth) + setNextStrokeColor(inlayer,sr,sg,sb,alpha) + addLine(inlayer,hexx + (r + rad) * math.sin(a * ia), hexy + (r + rad) * math.cos(a * ia),hexx + (r + rad) * math.sin(a * (ia+1)), hexy + (r + rad) * math.cos(a * (ia+1))) + end +end + +function addHexagon2(inlayer,hexx,hexy,rad,strkwdth,sr,sg,sb,shwdth,shr,shg,shb,alpha) + for ia=0,5 do + setNextShadow(inlayer,shwdth,shr,shg,shb,alpha) + setNextStrokeWidth(inlayer,strkwdth) + setNextStrokeColor(inlayer,sr,sg,sb,alpha) + addLine(inlayer,hexx + (r + rad) * math.cos(a * ia), hexy + (r + rad) * math.sin(a * ia),hexx + (r + rad) * math.cos(a * (ia+1)), hexy + (r + rad) * math.sin(a * (ia+1))) + end +end + +function addPentagon(inlayer,hexx,hexy,rad,strkwdth,sr,sg,sb,shwdth,shr,shg,shb,alpha) + for ia=0,4 do + setNextShadow(inlayer,shwdth,shr,shg,shb,alpha) + setNextStrokeWidth(inlayer,strkwdth) + setNextStrokeColor(inlayer,sr,sg,sb,alpha) + addLine(inlayer,hexx + (r + rad) * math.sin(b * ia), hexy + (r + rad) * math.cos(b * ia),hexx + (r + rad) * math.sin(b * (ia+1)), hexy + (r + rad) * math.cos(b * (ia+1))) + end +end + +function addCustomText(drawlayer, imagehandle, textstring, xpos, ypos, size, colorr, colorg, colorb, colora) + destructstring = textstring + for ix=1,#textstring do + nextletter = string.sub(destructstring,1,1) + destructstring = string.sub(destructstring,2,string.len(destructstring)) + nextascii = string.byte(nextletter) - 33 + + local subxpos = math.fmod(nextascii,32) + local subypos = math.floor(nextascii / 32) + setNextFillColor(drawlayer, colorr, colorg, colorb, colora) + addImageSub(drawlayer, imagehandle, xpos+(ix * (size/2+2)), ypos, size, size, 0 + (68*subxpos), 0 + (68 * subypos), 68, 68) + end +end + +--Simple tab pane to keep things organized +setNextFillColor(layer1,0.1,0.1,0.1,1) +addBox(layer1,0,50,rx,ry - 50) +local output = function() tabindex = 1 end +DrawButton(layer1,10,10,100,30,"Charset",output) +local output = function() tabindex = 2 end +DrawButton(layer1,130,10,100,30,"Screen Data",output) +local output = function() tabindex = 3 end +DrawButton(layer1,250,10,100,30,"Inputs",output) +local output = function() tabindex = 4 end +DrawButton(layer1,370,10,100,30,"Bars / Meters",output) +local output = function() tabindex = 5 end +DrawButton(layer1,490,10,100,30,"Shapes",output) +local output = function() tabindex = 6 end +DrawButton(layer1,610,10,100,30,"Text",output) + +if tabindex == 1 then + DrawCharacterSet() +end +if tabindex == 2 then + DrawScreenInfo() +end +if tabindex == 3 then + --text buffer 1 + if bufferselect == 1 then + setNextFillColor(layer1,0.05,0.05,0.15,1) + else + setNextFillColor(layer1,0.05,0.05,0.05,1) + end + addBox(layer1,420,180,400,20) + setNextFillColor(layer1,1,1,1,1) + addText(layer1,fontS,textbuffer[1],420,195) + output = function() bufferselect = 1 end + DrawButton(layer1, 320, 180, 80, 15, "Buffer 1", output) + + --text buffer 2 + if bufferselect == 2 then + setNextFillColor(layer1,0.05,0.05,0.15,1) + else + setNextFillColor(layer1,0.05,0.05,0.05,1) + end + addBox(layer1,420,210,400,20) + setNextFillColor(layer1,1,1,1,1) + addText(layer1,fontS,textbuffer[2],420,225) + output = function() bufferselect = 2 end + DrawButton(layer1, 320, 210, 80, 15, "Buffer 2", output) + + DrawOSKFull() +end +if tabindex == 4 then + drawCircularProgressBar(layer1,200,200,50,slidervalue,100) + DrawSlider(layer1,400,200,150,50,slidervalue) +end +if tabindex == 5 then + addHexagon1(layer1,200,200,25,5,1,1,1,20,0,0,0,1) + addHexagon2(layer1,200,200,25,5,1,1,1,20,0,0,0,1) + addPentagon(layer1,200,450,25,5,1,1,1,20,0,0,0,1) +end +if tabindex == 6 then + local customfontimage = loadImage("assets.prod.novaquark.com/66839/e294a1f0-11ae-4fa1-a5f8-aeb02288eb24.png") + addCustomText(layer2, customfontimage, "This is a custom font, rendered from an image file.", 150, 100, 22, 0,0.25,0.75,1) + + setNextFillColor(layer1,0,1,1,1) + addText(layer1, fontS, "Available Fonts: " .. fontcount, 80, 495) + local prevfontselect = fontselect + local output = function() if fontselect > 1 then fontselect = fontselect - 1 end end + DrawButton(layer1, 40, 475, 35, 35, "<", output) + local output = function() if fontselect < fontselectmax - 4 then fontselect = fontselect + 1 end end + DrawButton(layer1, 300, 475, 35, 35, ">", output) + for aa=prevfontselect,prevfontselect+4 do + setNextFillColor(layer1,0,1,1,1) + addText(layer1, fonttab[aa], fontnames[aa], 100, ((aa - prevfontselect)*15)+515) + end + + addText(layer3,fontV,"Vertical Text Example 1",10,10) + setLayerRotation(layer3,(6.285*0.75)) + setLayerTranslation(layer3,25,400) + + addText(layer4,fontV,"Vertical Text Example 2",10,10) + setLayerRotation(layer4,(6.285*0.25)) + setLayerTranslation(layer4,75,100) +end +requestAnimationFrame(1) \ No newline at end of file diff --git a/Door Control/Door Control - PB.txt b/Door Control/Door Control - PB.txt new file mode 100644 index 0000000..7365a0c --- /dev/null +++ b/Door Control/Door Control - PB.txt @@ -0,0 +1 @@ +{"slots":{"0":{"name":"slot1","type":{"events":[],"methods":[]}},"1":{"name":"screen","type":{"events":[],"methods":[]}},"2":{"name":"slot3","type":{"events":[],"methods":[]}},"3":{"name":"slot4","type":{"events":[],"methods":[]}},"4":{"name":"slot5","type":{"events":[],"methods":[]}},"5":{"name":"slot6","type":{"events":[],"methods":[]}},"6":{"name":"slot7","type":{"events":[],"methods":[]}},"7":{"name":"slot8","type":{"events":[],"methods":[]}},"8":{"name":"slot9","type":{"events":[],"methods":[]}},"9":{"name":"slot10","type":{"events":[],"methods":[]}},"-1":{"name":"unit","type":{"events":[],"methods":[]}},"-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":"screen.activate()\nscreen.setScriptInput(\"?\")\nscreen.clearScriptOutput()","filter":{"args":[],"signature":"start()","slotKey":"-1"},"key":"0"},{"code":"slot1.deactivate()\nscreen.deactivate()","filter":{"args":[],"signature":"stop()","slotKey":"-1"},"key":"1"},{"code":"local screenoutput = screen.getScriptOutput()\nif unit.getMasterPlayerId() == 00000 then\n slot1.activate()\nelse\n if screenoutput == \"\" then\n screen.setScriptInput(\"?\")\n else\n if screenoutput == \"0000\" then\n screen.setScriptInput(\"1\")\n slot1.activate()\n else\n screen.setScriptInput(\"0\")\n slot1.deactivate()\n end\n end\nend\n\nscreen.clearScriptOutput()","filter":{"args":[],"signature":"update()","slotKey":"-4"},"key":"2"}],"methods":[],"events":[]} \ No newline at end of file diff --git a/Door Control/Door Control - renderscript.txt b/Door Control/Door Control - renderscript.txt new file mode 100644 index 0000000..3bc7a40 --- /dev/null +++ b/Door Control/Door Control - renderscript.txt @@ -0,0 +1,191 @@ +if not init then + init = true + passwordstring = "" + displaystringdefault = "[ENTER ACCESS CODE]" + displaystring = "" + displayswitchtimer = 0 + displayswitchtimerbase = 120 + displaycolorR, displaycolor8G, displaycolorB, displaycolorA = 1, 1, 1, 0.75 +end +local layer = createLayer() -- Main Background +local layer4 = createLayer() -- keypad boxes +local layer5 = createLayer() -- rotated text +local rx, ry = getResolution() +local fontL = loadFont("Play", 110) +local fontH = loadFont("Play", 100) +local fontB = loadFont("Play", 60) +local fontM = loadFont("Play", 40) +local fontS = loadFont("Play", 20) +local color1R, color1G, color1B, color1A = 1, 1, 1, 0.0 --button background +local color2R, color2G, color2B, color2A = 0, 0.75, 0, 0.5 --button border +local color3R, color3G, color3B, color3A = 1, 1, 1, 1 --text +local color4R, color4G, color4B, color4A = 1, 1, 1, 0.5 --button hover +local color5R, color5G, color5B, color5A = 1, 0.15, 0.15, 1 --input deny +local color6R, color6G, color6B, color6A = 0.15, 1, 0.15, 1 --input accept +local color7R, color7G, color7B, color7A = 0.25, 0.75, 0.25, 0.5 --button click +local color8R, color8G, color8B, color8A = 1, 1, 1, 0.75 --display text +local curx, cury = getCursor() +local scriptinput = "" + +setNextFillColor(layer, 0.0, 0, 0, 1) +addBox(layer,0,0,rx,ry) +logMessage(displayswitchtimer) +if getInput() then + scriptinput = getInput() + if scriptinput == "0" then + displaycolorR = 1 + displaycolorG = 0 + displaycolorB = 0 + displaycolorA = 0.75 + displaystring = "[ACCESS DENIED]" + displayswitchtimer = displayswitchtimerbase + end + if scriptinput == "1" then + displaycolorR = 0 + displaycolorG = 1 + displaycolorB = 0 + displaycolorA = 0.75 + displaystring = "[ACCESS GRANTED]" + displayswitchtimer = displayswitchtimerbase + end +end + +if displayswitchtimer > 0 then + displayswitchtimer = displayswitchtimer - 1 +end +if displayswitchtimer == 0 then + displaycolorR = 1 + displaycolorG = 1 + displaycolorB = 1 + displaycolorA = 0.75 + displaystring = displaystringdefault +end + +function DrawKeypadSendButton(btnx, btny, btnw, btnh, btntxt) + setNextFillColor(layer4, color1R, color1G, color1B, color1A) + if curx > btnx then + if curx < btnx+btnw then + if cury > btny then + if cury < (btny+btnh) then + if getCursorReleased() == true then + setNextFillColor(layer4, color7R, color7G, color7B, color7A) + setOutput(passwordstring) + passwordstring = "" + else + setNextFillColor(layer4, color4R, color4G, color4B, color4A) + end + end + end + end + end + setNextStrokeColor(layer4, color2R, color2G, color2B, color2A) + setNextStrokeWidth(layer4, 5) + addBoxRounded(layer4, btnx, btny, btnw, btnh, 5) + --setNextFillColor(layer5, 0.35, 0, 0, 1) + --addText(layer5, fontM, btntxt, btnx + (rx*0.015), btny + (ry*0.15)) +end + +function DrawKeypadButton(btnx, btny, btnw, btnh, btntxt) + setNextFillColor(layer4, color1R, color1G, color1B, color1A) + if curx > btnx then + if curx < btnx+btnw then + if cury > btny then + if cury < (btny+btnh) then + if getCursorReleased() == true then + if string.len(passwordstring) < 4 then + setNextFillColor(layer4, color7R, color7G, color7B, color7A) + passwordstring = passwordstring .. btntxt + else + setNextFillColor(layer4, color7R, color7G, color7B, color7A) + end + else + setNextFillColor(layer4, color4R, color4G, color4B, color4A) + end + end + end + end + end + setNextStrokeColor(layer4, color2R, color2G, color2B, color2A) + setNextStrokeWidth(layer4, 5) + addBoxRounded(layer4, btnx, btny, btnw, btnh, 5) + --setNextFillColor(layer5, 0.35, 0, 0, 1) + --addText(layer5, fontL, btntxt, btnx + (rx*0.015), btny + (ry*0.15)) +end + +function DrawKeypadText(btnx, btny, btnw, btnh, btntxt) + setNextFillColor(layer5, color3R, color3G, color3B, color3A) + addText(layer5, fontL, btntxt, btnx + (rx*0.015), btny + (ry*0.15)) +end + +function DrawKeypadSendText(btnx, btny, btnw, btnh, btntxt) + setNextFillColor(layer5, color3R, color3G, color3B, color3A) + addText(layer5, fontB, btntxt, btnx + (rx*0.015), btny + (ry*0.15)) +end + +function DrawInputText(rx, ry) + if string.len(passwordstring) < 4 then + setNextFillColor(layer5, color5R, color5G, color5B, color5A) + addText(layer5, fontL, passwordstring, rx*0.15, ry*0.35) + end + if string.len(passwordstring) == 4 then + setNextFillColor(layer5, color6R, color6G, color6B, color6A) + addText(layer5, fontL, passwordstring, rx*0.15, ry*0.35) + end +end + +function DrawDisplayText(rx, ry) + setNextFillColor(layer5, displaycolorR, displaycolorG, displaycolorB, displaycolorA) + addText(layer5, fontM, displaystring, rx*0.095, ry*0.15) +end + +function DrawDisplayLines(rx, ry) + setNextFillColor(layer5, color8R, color8G, color8B, color8A) + addLine(layer5, 0, ry*0.175, rx*1, ry*0.175) + setNextFillColor(layer5, color8R, color8G, color8B, color8A) + addLine(layer5, 0, ry*0.215, rx*0.42, ry*0.215) + setNextFillColor(layer5, color8R, color8G, color8B, color8A) + addLine(layer5, rx*0.13, ry*0.36, rx*1, ry*0.36) +end + +--draw keypad buttons +DrawKeypadButton(rx*0.3,ry*0.6, rx*0.1, ry*0.17,"1") +DrawKeypadButton(rx*0.3,ry*0.4, rx*0.1, ry*0.17,"2") +DrawKeypadButton(rx*0.3,ry*0.2, rx*0.1, ry*0.17,"3") + +DrawKeypadButton(rx*0.425,ry*0.6, rx*0.1, ry*0.17,"4") +DrawKeypadButton(rx*0.425,ry*0.4, rx*0.1, ry*0.17,"5") +DrawKeypadButton(rx*0.425,ry*0.2, rx*0.1, ry*0.17,"6") + +DrawKeypadButton(rx*0.55,ry*0.6, rx*0.1, ry*0.17,"7") +DrawKeypadButton(rx*0.55,ry*0.4, rx*0.1, ry*0.17,"8") +DrawKeypadButton(rx*0.55,ry*0.2, rx*0.1, ry*0.17,"9") + +DrawKeypadButton(rx*0.675,ry*0.6, rx*0.1, ry*0.17,"0") +DrawKeypadSendButton(rx*0.675,ry*0.2, rx*0.1, ry*0.37,"send") + + +--placeholder input text + +DrawDisplayText(rx, ry) +DrawDisplayLines(rx, ry) +DrawInputText(rx, ry) + +--draw keypad text +DrawKeypadText(rx*0.13,ry*0.52, rx*0.1, ry*0.17,"1") +DrawKeypadText(rx*0.245, ry*0.52, rx*0.1, ry*0.17,"2") +DrawKeypadText(rx*0.365, ry*0.52, rx*0.1, ry*0.17,"3") +DrawKeypadText(rx*0.13, ry*0.73, rx*0.1, ry*0.17,"4") +DrawKeypadText(rx*0.245, ry*0.73, rx*0.1, ry*0.17,"5") +DrawKeypadText(rx*0.365, ry*0.73, rx*0.1, ry*0.17,"6") +DrawKeypadText(rx*0.13, ry*0.93, rx*0.1, ry*0.17,"7") +DrawKeypadText(rx*0.245, ry*0.93, rx*0.1, ry*0.17,"8") +DrawKeypadText(rx*0.365, ry*0.93, rx*0.1, ry*0.17,"9") +DrawKeypadText(rx*0.13, ry*1.13, rx*0.1, ry*0.17,"0") +DrawKeypadSendText(rx*0.245, ry*1.13, rx*0.23, ry*0.17,"send") + + +--rotate text layer +setLayerRotation(layer5,(3.14*0.75)*2) +setLayerTranslation(layer5,-10,600) + +requestAnimationFrame(1) \ No newline at end of file diff --git a/Door Control/readme.md b/Door Control/readme.md new file mode 100644 index 0000000..6123be9 --- /dev/null +++ b/Door Control/readme.md @@ -0,0 +1,8 @@ +# Lua Door Access Code Control Script + +### MAKE SURE you change the default access code when installing the script + +Recommended to have the programming board be triggered by a Detection Zone linked to a switch, so it will start automatically when someone is in proximity of the door/screen. + +All colors on the screen are easy to change variables. Users can be assigned specific codes that only work for them, or general all-access codes can be created. +Supports automatic recognition of the system owner by player ID. \ No newline at end of file diff --git a/Drawing Board 1.1/Drawing Board 1 - Renderscript.txt b/Drawing Board 1.1/Drawing Board 1 - Renderscript.txt new file mode 100644 index 0000000..580287f --- /dev/null +++ b/Drawing Board 1.1/Drawing Board 1 - Renderscript.txt @@ -0,0 +1,216 @@ +if not Slider then + + + -- Returns a new slider class + Slider = {} + Slider.__index = Slider + function Slider:new(x, y, width, length, min, max, value, label) + self = { + x = x or 0, + y = y or 0, + l = length or 100, + w = width or 20, + min = min or 0, + max = max or 1, + ratio = 0, + label = label or "", + drag = false, + color = {1,1,1} + } + self.ratio = math.max(0, math.min(1, (value or self.min)/(self.max-self.min))) + + -- Set the value of the slider + function self:setValue(val) + if type(val) == 'number' then + self.value = math.max(self.min, math.min(self.max, val)) + end + end + + -- Get the value of the slider + function self:getValue(val) + return self.ratio*(self.max - self.min) + self.min + end + + -- Draws the slider on the screen using the given layer + function self:draw(layer) + -- Localize object data + local x, y, w, l = self.x, self.y, self.w, self.l + local min, max, ratio = self.min, self.max + + local font = loadFont('Play', 14) + + -- Get cursor data + local mx, my = getCursor() + local pressed = getCursorPressed() + local released = getCursorReleased() + + -- Determine if the cursor is on the bar and detect if the mouse is down + if (mx >= x and mx <= x+w) and (my >= y and my <= y+l) then + + if pressed then self.drag = true end + end + + -- Set the ratio based on the cursor position + if self.drag then + self.ratio = math.max(0, math.min(1, 1 - (my-y)/l)) + if released then + self.drag = false + end + end + + local ratio = self.ratio + local h = ratio*(max-min) + local color = self.color + + -- Draw the slider + setDefaultStrokeColor(layer, Shape_BoxRounded, 1, 1, 1, 1) + setDefaultStrokeWidth(layer, Shape_BoxRounded, 0.1) + + setNextFillColor(layer, 0.1, 0.1, 0.1, 1) + addBoxRounded(layer, x, y, w, l, 0) + + setNextFillColor(layer, color[1], color[2], color[3], 1) + addBoxRounded(layer, x, y+(1-ratio)*l, w, l*ratio, 0) + + setNextFillColor(layer, 0.5, 0.5, 0.5, 1) + addBoxRounded(layer, x-3, y+(1-ratio)*l -3, w+6, 6, 0) + + -- Draw label and value display + local label = self.label + setNextTextAlign( layer, AlignH_Center, AlignV_Middle) + addText( layer, font, label, x+0.5*w, y-14) + + local display = string.format('%.0f', math.floor(((ratio*(max - min) + min)*255)+0.5)) + setNextTextAlign( layer, AlignH_Center, AlignV_Middle) + addText( layer, font, display, x+0.5*w, y+l+14) + end + + + return setmetatable(self, Slider) + end + +end + +if not init then + l3fontsize = 20 + l2fontsize = 30 + l1fontsize = 40 + l3xoffset = -20 + l3yoffset = 0 + l2xoffset = -20 + l2yoffset = 0 + l1xoffset = -20 + l1yoffset = 0 + brushr = 0.5 + brushg = 0.2 + brushb = 0.7 + showmenu = 0 + fontL = loadFont("Play", l1fontsize) + rr = 8 + rx, ry = getResolution() + cx1, cy1 = rx/rr, ry/rr + mem1 = {} + mem2 = {} + mem3 = {} + charset = "0123456789ABCDEF" + for ix=1,cx1 do + mem1[ix] = {} + for iy=1,cy1 do + mem1[ix][iy] = 0 + end + end + for ix2=1,cx1 do + mem2[ix2] = {} + for iy2=1,cy1 do + mem2[ix2][iy2] = 0 + end + end + for ix3=1,cx1 do + mem3[ix3] = {} + for iy3=1,cy1 do + mem3[ix3][iy3] = 0 + end + end + maxcost = getRenderCostMax() + local r, g, b = 0.5, 0.5, 0.5 + + sliderRed = Slider:new(rx*0.8, ry*0.2, 16, ry*0.6, 0, 1, r, "Red") + sliderRed.color = { 1, 0, 0} + sliderGreen = Slider:new(rx*0.85, ry*0.2, 16, ry*0.6, 0, 1, g, "Green") + sliderGreen.color = { 0, 1, 0} + sliderBlue = Slider:new(rx*0.9, ry*0.2, 16, ry*0.6, 0, 1, b, "Blue") + sliderBlue.color = { 0, 0, 1} + + init = true +end + + +fontL = loadFont("Play", l1fontsize) +layer1 = createLayer() +layer2 = createLayer() +cursorx, cursory = getCursor() +curx2 = math.floor(cursorx/rr) +cury2 = math.floor(cursory/rr) + +function DrawAllPixelsL1() + local lm1, lm2, lm3, rr = mem1, mem2, mem3, rr + local sNFC, aB = setNextFillColor, addBox + for bx=1,cx1 do + currcost = getRenderCost() + if currcost < (maxcost*0.9) then + for by=1,cy1 do + sNFC(layer1, mem1[bx][by], mem2[bx][by], mem3[bx][by], 1) + aB(layer1, bx*rr, by*rr, rr,rr) + end + end + end +end + +function DrawUI() + if showmenu == 1 then + sliderRed:draw(layer2) + sliderGreen:draw(layer2) + sliderBlue:draw(layer2) + brushr = sliderRed.ratio + brushg = sliderGreen.ratio + brushb = sliderBlue.ratio + + setNextStrokeWidth(layer2, 5) + setNextStrokeColor(layer2, 1, 0, 0, 1) + setNextFillColor(layer2, 0.5,0.5,0.5, 1) + addBox(layer2, rx*0.875, ry*0.08, rx*0.04, ry*0.06) + + if cursorx > rx*0.875 and cursorx < (rx*0.875)+(rx*0.04) then + if cursory > ry*0.08 and cursory < (ry*0.08)+(ry*0.06) then + setNextStrokeWidth(layer2, 5) + setNextStrokeColor(layer2, 1, 0, 0, 1) + setNextFillColor(layer2, 1,0.5,0.5, 1) + addBox(layer2, rx*0.875, ry*0.08, rx*0.04, ry*0.06) + if getCursorDown() then + showmenu = 0 + end + end + end + else + setNextFillColor(layer2, brushr, brushg, brushb, 1) + addBox(layer2, 0, ry - 20, rx, 20) + if getCursorDown() then + if curx2 > 0 and cury2 > 0 then + if curx2 < rx and cury2 < ry then + if cursory < ry and cursory > (ry - 20) then + showmenu = 1 + else + mem1[curx2][cury2] = brushr + mem2[curx2][cury2] = brushg + mem3[curx2][cury2] = brushb + end + end + end + end + end +end + +DrawAllPixelsL1() +DrawUI() + +requestAnimationFrame(1) \ No newline at end of file diff --git a/Image Slideshow/Infinite Image Slideshow - Renderscript.txt b/Image Slideshow/Infinite Image Slideshow - Renderscript.txt new file mode 100644 index 0000000..7d28520 --- /dev/null +++ b/Image Slideshow/Infinite Image Slideshow - Renderscript.txt @@ -0,0 +1,77 @@ +if not init then + anim = 0 + animtick = 0 + animtickmax = 100 + display = 1 + nextdisplay = 1 + displaymax = 20 + displaytick = 0 + displaytickmax = 175 + images = {} + for xa=1,displaymax do + images[xa] = "" + end + + images[1] = "assets.prod.novaquark.com/66839/b249f117-4120-472e-8c12-d84c04c28775.png" + images[2] = "assets.prod.novaquark.com/66839/8452f802-cb36-40ec-9d26-f5530a82ac1c.png" + images[3] = "assets.prod.novaquark.com/10847/74614e8a-3e83-4054-ae34-5bd13e80b3fe.jpg" + images[4] = "assets.prod.novaquark.com/10847/2652fe31-3c4b-4daa-b1d2-4d25ec230cae.jpg" + images[5] = "assets.prod.novaquark.com/51710/a31ce61b-b290-49fd-b8cc-60ed50837e86.jpg" + images[6] = "assets.prod.novaquark.com/60816/b543e8eb-deb8-4319-926e-0bea0da6aa91.jpg" + images[7] = "assets.prod.novaquark.com/60816/d457cdb8-67bc-43b5-97e8-afcad2c42dde.jpg" + images[8] = "assets.prod.novaquark.com/15526/661fe770-9e52-4026-be44-7834c37da61c.jpg" + images[9] = "assets.prod.novaquark.com/15526/b7826b57-3ca0-4721-8bb3-13b47986dc9b.jpg" + images[10] = "assets.prod.novaquark.com/15526/e9d43aac-6706-486f-b91d-78024fac4679.jpg" + images[11] = "assets.prod.novaquark.com/15526/f79d0256-34c1-4945-b786-91027681b6df.png" + images[12] = "assets.prod.novaquark.com/3014/10bcb0e9-1ac9-44bf-9174-afb1854cce13.jpg" + images[12] = "assets.prod.novaquark.com/35519/b997a7b6-6217-4394-b34c-fa1ef6fee1d0.png" + images[13] = "assets.prod.novaquark.com/40256/19e9ef08-6674-4ab5-a9cf-708c2ed3c9be.jpg" + images[14] = "assets.prod.novaquark.com/40256/ae88a73f-acb0-45d1-a164-047084905db9.jpg" + images[15] = "assets.prod.novaquark.com/40256/fefa0f2d-31ee-4023-9ff7-abde8f43a00b.jpg" + images[16] = "assets.prod.novaquark.com/4745/566b4304-6cc5-4d3d-92ea-44b7f03f453d.jpg" + images[17] = "assets.prod.novaquark.com/60491/0ea71244-19fe-417f-bca2-6927bcafd9cd.jpg" + images[18] = "assets.prod.novaquark.com/60816/2c93cca6-f883-4be2-a279-396af1498efb.jpg" + images[19] = "assets.prod.novaquark.com/60816/6a2a2a2d-e9bd-403d-b87f-bec526314869.jpg" + images[20] = "assets.prod.novaquark.com/60816/814bd0e5-a651-410d-a2b7-0cc885c8ed7f.png" + + imagehandle = 0 + init = true +end +local layer = createLayer() +local rx, ry = getResolution() + +imagehandle = loadImage(images[display]) +imagehandle2 = loadImage(images[nextdisplay]) +if anim == 1 then + if animtick < animtickmax then + if display == displaymax then + nextdisplay = 1 + else + nextdisplay = display + 1 + end + local animprcnt = animtick/animtickmax + addImage(layer, imagehandle, 0 - rx*animprcnt, 0, rx, ry) + addImage(layer, imagehandle2, 0 - (rx*animprcnt) + rx, 0, rx, ry) + animtick = animtick + 1 + else + if display == displaymax then + display = 1 + else + display = display + 1 + end + displaytick = 0 + anim = 0 + addImage(layer, imagehandle2, 0, 0, rx, ry) + animtick = 0 + end +else + addImage(layer, imagehandle, 0, 0, rx, ry) +end + +if displaytick < displaytickmax then + displaytick = displaytick + 1 +else + anim = 1 +end + +requestAnimationFrame(1) \ No newline at end of file diff --git a/ImageToMovie/ImageMovieScript - Renderscript.txt b/ImageToMovie/ImageMovieScript - Renderscript.txt new file mode 100644 index 0000000..8f6f36a --- /dev/null +++ b/ImageToMovie/ImageMovieScript - Renderscript.txt @@ -0,0 +1,18 @@ +if not init then + frame = 1 + init = true +end +local movieimage = loadImage("assets.prod.novaquark.com/66839/9fb73abf-9898-439c-94fa-2cb6e63782ae.png") +local layer1 = createLayer() +local layer2 = createLayer() +local font1 = loadFont("Play",20) +local rx,ry = getResolution() +if frame == 255 then + frame = 1 +else + frame = frame + 1 +end +local subxpos = math.fmod(frame,5) +local subypos = math.floor(frame / 5) +addImageSub(layer1, movieimage, 0, 0, rx, ry, 0 + (200*subxpos), 0 + (112 * subypos), 200, 112) +requestAnimationFrame(1) \ No newline at end of file diff --git a/ImageToMovie/spacex-rocketlaunch-clip1.png b/ImageToMovie/spacex-rocketlaunch-clip1.png new file mode 100644 index 0000000..76bddf2 Binary files /dev/null and b/ImageToMovie/spacex-rocketlaunch-clip1.png differ diff --git a/Item ID Scraper/Item ID Scraper - PB.txt b/Item ID Scraper/Item ID Scraper - PB.txt new file mode 100644 index 0000000..6f68321 --- /dev/null +++ b/Item ID Scraper/Item ID Scraper - PB.txt @@ -0,0 +1 @@ +{"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":"slot10","type":{"events":[],"methods":[]}},"-1":{"name":"unit","type":{"events":[],"methods":[]}},"-2":{"name":"system","type":{"events":[],"methods":[]}},"-3":{"name":"library","type":{"events":[],"methods":[]}}},"handlers":[{"code":"list = \"\"\ntick = 175947631\nexecute = 1\n\nunit.setTimer(\"main\",1/60)","filter":{"args":[],"signature":"start()","slotKey":"-1"},"key":"0"},{"code":"if execute == 1 then\n if string.len(list) < 40000 then\n for ab=tick,tick + 5000 do\n if system.getItem(ab)[\"displayName\"] == \"\" then\n --invalid item, do nothing\n else\n list = list .. \"\\n\" .. ab .. \", \" .. system.getItem(ab)[\"displayName\"]\n end\n end\n tick = tick + 5000\n system.print(tick)\n else\n system.print(\"FLUSHED AT: \" .. tick)\n system.print(\"Type \\\"C\\\" in Lua Chat to continue execution.\")\n slot1.setRenderScript(list)\n list = \"\"\n execute = 0\n end\nelse\n --Do nothing\nend","filter":{"args":[{"value":"main"}],"signature":"tick(timerId)","slotKey":"-1"},"key":"1"},{"code":"system.print(\"STOPPED AT: \" .. tick)\nslot1.setRenderScript(list)","filter":{"args":[],"signature":"stop()","slotKey":"-1"},"key":"2"},{"code":"if text == \"c\" then\n execute = 1\nend","filter":{"args":[{"variable":"*"}],"signature":"inputText(text)","slotKey":"-2"},"key":"3"}],"methods":[],"events":[]} \ No newline at end of file diff --git a/Lighting RGB Control/Light RGB Control - PB.txt b/Lighting RGB Control/Light RGB Control - PB.txt new file mode 100644 index 0000000..dca7917 --- /dev/null +++ b/Lighting RGB Control/Light RGB Control - PB.txt @@ -0,0 +1 @@ +{"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":"slot10","type":{"events":[],"methods":[]}},"-1":{"name":"unit","type":{"events":[],"methods":[]}},"-2":{"name":"system","type":{"events":[],"methods":[]}},"-3":{"name":"library","type":{"events":[],"methods":[]}}},"handlers":[{"code":"ColorRed = 255 --export: Ship Accent Lighting color Red component\nColorGreen = 0 --export: Ship Accent Lighting color Green component\nColorBlue = 0 --export: Ship Accent Lighting color Blue component\n\nRainbow = 1 --export: Ship Accent Lighting RGB component will shift through all possible colors. Overrides other RGB settings. \n\nDimWhenOff = 0\n\nCtrR = 1\nCtrG = 0\nCtrB = 0\n\nslot1.deactivate()\nslot2.deactivate()\nslot3.deactivate()\nslot4.deactivate()\nslot5.deactivate()\nslot6.deactivate()\nslot7.deactivate()\nslot8.deactivate()\nslot9.deactivate()\nslot10.deactivate()\n\nslot1.setRGBColor(ColorRed,ColorGreen,ColorBlue)\nslot2.setRGBColor(ColorRed,ColorGreen,ColorBlue)\nslot3.setRGBColor(ColorRed,ColorGreen,ColorBlue)\nslot4.setRGBColor(ColorRed,ColorGreen,ColorBlue)\nslot5.setRGBColor(ColorRed,ColorGreen,ColorBlue)\nslot6.setRGBColor(ColorRed,ColorGreen,ColorBlue)\nslot7.setRGBColor(ColorRed,ColorGreen,ColorBlue)\nslot8.setRGBColor(ColorRed,ColorGreen,ColorBlue)\nslot9.setRGBColor(ColorRed,ColorGreen,ColorBlue)\nslot10.setRGBColor(ColorRed,ColorGreen,ColorBlue)\n\nslot1.activate()\nslot2.activate()\nslot3.activate()\nslot4.activate()\nslot5.activate()\nslot6.activate()\nslot7.activate()\nslot8.activate()\nslot9.activate()\nslot10.activate()","filter":{"args":[],"signature":"start()","slotKey":"-2"},"key":"0"},{"code":"if Rainbow == 1 then\n if CtrR == 1 then\n ColorGreen = ColorGreen + 1\n ColorRed = ColorRed - 1\n if ColorBlue > 0 then\n ColorBlue = ColorBlue - 1\n ColorRed = ColorRed + 1\n end\n if ColorRed == 0 then\n CtrR = 0\n CtrG = 1\n end\n end\n\n if CtrG == 1 then\n ColorBlue = ColorBlue + 1\n ColorGreen = ColorGreen - 1\n if ColorRed > 0 then\n ColorRed = ColorRed - 1\n ColorGreen = ColorGreen + 1\n end\n if ColorGreen == 0 then\n CtrG = 0\n CtrB = 1\n end\n end\n\n if CtrB == 1 then\n ColorRed = ColorRed + 1\n ColorBlue = ColorBlue - 1\n if ColorGreen > 0 then\n ColorGreen = ColorGreen - 1\n ColorBlue = ColorBlue + 1\n end\n if ColorBlue == 0 then\n CtrB = 0\n CtrR = 1\n end\n end\n slot1.deactivate()\n slot2.deactivate()\n slot3.deactivate()\n slot4.deactivate()\n slot5.deactivate()\n slot6.deactivate()\n slot7.deactivate()\n slot8.deactivate()\n slot9.deactivate()\n slot10.deactivate()\n\n slot1.setRGBColor(ColorRed,ColorGreen,ColorBlue)\n slot2.setRGBColor(ColorRed,ColorGreen,ColorBlue)\n slot3.setRGBColor(ColorRed,ColorGreen,ColorBlue)\n slot4.setRGBColor(ColorRed,ColorGreen,ColorBlue)\n slot5.setRGBColor(ColorRed,ColorGreen,ColorBlue)\n slot6.setRGBColor(ColorRed,ColorGreen,ColorBlue)\n slot7.setRGBColor(ColorRed,ColorGreen,ColorBlue)\n slot8.setRGBColor(ColorRed,ColorGreen,ColorBlue)\n slot9.setRGBColor(ColorRed,ColorGreen,ColorBlue)\n slot10.setRGBColor(ColorRed,ColorGreen,ColorBlue)\n\n slot1.activate()\n slot2.activate()\n slot3.activate()\n slot4.activate()\n slot5.activate()\n slot6.activate()\n slot7.activate()\n slot8.activate()\n slot9.activate()\n slot10.activate()\nend","filter":{"args":[],"signature":"update()","slotKey":"-2"},"key":"1"},{"code":"if DimWhenOff == 1 then\n slot1.deactivate()\n slot2.deactivate()\n slot3.deactivate()\n slot4.deactivate()\n slot5.deactivate()\n slot6.deactivate()\n slot7.deactivate()\n slot8.deactivate()\n slot9.deactivate()\n slot10.deactivate()\nend","filter":{"args":[],"signature":"stop()","slotKey":"-2"},"key":"2"}],"methods":[],"events":[]} \ No newline at end of file diff --git a/Lighting RGB Control/Light RGB Control - renderscript.txt b/Lighting RGB Control/Light RGB Control - renderscript.txt new file mode 100644 index 0000000..2f3521e --- /dev/null +++ b/Lighting RGB Control/Light RGB Control - renderscript.txt @@ -0,0 +1,129 @@ +-- Initialize +if not Slider then + + + -- Returns a new slider class + Slider = {} + Slider.__index = Slider + function Slider:new(x, y, width, length, min, max, value, label) + self = { + x = x or 0, + y = y or 0, + l = length or 100, + w = width or 20, + min = min or 0, + max = max or 1, + ratio = 0, + label = label or "", + drag = false, + color = {1,1,1} + } + self.ratio = math.max(0, math.min(1, (value or self.min)/(self.max-self.min))) + + -- Set the value of the slider + function self:setValue(val) + if type(val) == 'number' then + self.value = math.max(self.min, math.min(self.max, val)) + end + end + + -- Get the value of the slider + function self:getValue(val) + return self.ratio*(self.max - self.min) + self.min + end + + -- Draws the slider on the screen using the given layer + function self:draw(layer) + -- Localize object data + local x, y, w, l = self.x, self.y, self.w, self.l + local min, max, ratio = self.min, self.max + + local font = loadFont('Play', 14) + + -- Get cursor data + local mx, my = getCursor() + local pressed = getCursorPressed() + local released = getCursorReleased() + + -- Determine if the cursor is on the bar and detect if the mouse is down + if (mx >= x and mx <= x+w) and (my >= y and my <= y+l) then + + if pressed then self.drag = true end + end + + -- Set the ratio based on the cursor position + if self.drag then + self.ratio = math.max(0, math.min(1, 1 - (my-y)/l)) + if released then + self.drag = false + end + end + + local ratio = self.ratio + local h = ratio*(max-min) + local color = self.color + + -- Draw the slider + setDefaultStrokeColor(layer, Shape_BoxRounded, 1, 1, 1, 1) + setDefaultStrokeWidth(layer, Shape_BoxRounded, 0.1) + + setNextFillColor(layer, 0.1, 0.1, 0.1, 1) + addBoxRounded(layer, x, y, w, l, 0) + + setNextFillColor(layer, color[1], color[2], color[3], 1) + addBoxRounded(layer, x, y+(1-ratio)*l, w, l*ratio, 0) + + setNextFillColor(layer, 0.5, 0.5, 0.5, 1) + addBoxRounded(layer, x-3, y+(1-ratio)*l -3, w+6, 6, 0) + + -- Draw label and value display + local label = self.label + setNextTextAlign( layer, AlignH_Center, AlignV_Middle) + addText( layer, font, label, x+0.5*w, y-14) + + local display = string.format('%.0f', math.floor(((ratio*(max - min) + min)*255)+0.5)) + setNextTextAlign( layer, AlignH_Center, AlignV_Middle) + addText( layer, font, display, x+0.5*w, y+l+14) + end + + + return setmetatable(self, Slider) + end + +end + + +-- Get screen resolution +local rx, ry = getResolution() +local click = getCursorDown() + +-- Draw the 3 sliders +if not _init then + local r, g, b = 0.5, 0.5, 0.5 + + sliderRed = Slider:new(rx*0.8, ry*0.2, 16, ry*0.6, 0, 1, r, "Red") + sliderRed.color = { 1, 0, 0} + sliderGreen = Slider:new(rx*0.85, ry*0.2, 16, ry*0.6, 0, 1, g, "Green") + sliderGreen.color = { 0, 1, 0} + sliderBlue = Slider:new(rx*0.9, ry*0.2, 16, ry*0.6, 0, 1, b, "Blue") + sliderBlue.color = { 0, 0, 1} + + _init = true +end +-- Set the background color based on sliders value +setBackgroundColor( sliderRed.ratio, sliderGreen.ratio, sliderBlue.ratio, 1) +local layer = createLayer() + +setNextFillColor( layer, 0.05, 0.05, 0.05, 1) +addBoxRounded( layer, rx*0.75 +8, ry*0.1, rx*0.2, ry*0.8, 16) + +local font = loadFont('Play', 14) +setNextFillColor( layer, 0.05, 0.05, 0.05, 1) +addText(layer, font, math.floor((sliderRed.ratio*255)+0.5)..","..math.floor((sliderGreen.ratio*255)+0.5)..","..math.floor((sliderBlue.ratio*255)+0.5), 15, 15) +if click then setOutput(math.floor((sliderRed.ratio*255)+0.5)..","..math.floor((sliderGreen.ratio*255)+0.5)..","..math.floor((sliderBlue.ratio*255)+0.5)) end + +sliderRed:draw( layer) +sliderGreen:draw( layer) +sliderBlue:draw( layer) + +requestAnimationFrame(1) \ No newline at end of file diff --git a/Matrix Code Rain/MatrixCodeRain - Renderscript.txt b/Matrix Code Rain/MatrixCodeRain - Renderscript.txt new file mode 100644 index 0000000..6579778 --- /dev/null +++ b/Matrix Code Rain/MatrixCodeRain - Renderscript.txt @@ -0,0 +1,287 @@ +function randomString(length) + if not length or length <= 0 then return '' end + local rand1 = math.random(#charset) + return string.sub(charset, rand1, rand1) +end + +if not init then + l3fontsize = 40 + l2fontsize = 30 + l1fontsize = 20 + l3xoffset = -20 + l3yoffset = 0 + l2xoffset = -20 + l2yoffset = 0 + l1xoffset = -20 + l1yoffset = 0 + fontL = loadFont("Play", l1fontsize) + fontM = loadFont("Play", l2fontsize) + fontS = loadFont("Play", l3fontsize) + rx, ry = getResolution() + cx1, cy1 = rx/l1fontsize, ry/l1fontsize + cx2, cy2 = rx/l2fontsize, ry/l2fontsize + cx3, cy3 = rx/l3fontsize, ry/l3fontsize + mem1 = {} + mem2 = {} + mem3 = {} + charset = "0123456789ABCDEF" + for ix=1,cx1 do + mem1[ix] = {} + for iy=1,cy1 do + mem1[ix][iy] = {} + for iz=1,2 do + if iz == 1 then + mem1[ix][iy][iz] = randomString(1) + else + mem1[ix][iy][iz] = 1 + end + end + end + end + for jx=1,cx2 do + mem2[jx] = {} + for jy=1,cy2 do + mem2[jx][jy] = {} + for jz=1,2 do + if jz == 1 then + mem2[jx][jy][jz] = randomString(1) + else + mem2[jx][jy][jz] = 1 + end + end + end + end + for kx=1,cx3 do + mem3[kx] = {} + for ky=1,cy3 do + mem3[kx][ky] = {} + for kz=1,2 do + if kz == 1 then + mem3[kx][ky][kz] = randomString(1) + else + mem3[kx][ky][kz] = 1 + end + end + end + end + init = true +end + +fontL = loadFont("Play", l1fontsize) +fontM = loadFont("Play", l2fontsize) +fontS = loadFont("Play", l3fontsize) +layer1 = createLayer() +layer2 = createLayer() +layer3 = createLayer() + +function randomValueL1() + if posx ~= nil then + mem1[posx][posy][1] = randomString(1) + else + local randx1 = math.random(math.floor(cx1)) + local randy1 = math.random(math.floor(cy1)) + mem1[randx1][randy1][1] = randomString(1) + end +end + +function randomValueL2(posx,posy) + if posx ~= nil then + mem2[posx][posy][1] = randomString(1) + else + local randx2 = math.random(math.floor(cx2)) + local randy2 = math.random(math.floor(cy2)) + mem2[randx2][randy2][1] = randomString(1) + end +end + +function randomValueL3(posx,posy) + if posx ~= nil then + mem3[posx][posy][1] = randomString(1) + else + local randx3 = math.random(math.floor(cx3)) + local randy3 = math.random(math.floor(cy3)) + mem3[randx3][randy3][1] = randomString(1) + end +end + +function updateStatesL1() + for dx=1,cx1 do + local changecount = 0 + for dy=1,cy1 do + dy0 = (dy - 1) + dy2 = dy+1 + if dy0 > 0 then + if mem1[dx][dy][2] == 1 then + if mem1[dx][dy0][2] == 0 then + if changecount == 0 then + mem1[dx][dy][2] = 0 + changecount = 1 + end + end + end + end + if dy2 < cy1 then + if mem1[dx][dy][2] == 1 then + if mem1[dx][dy2][2] == 0 then + if changecount == 0 then + mem1[dx][dy2][2] = 1 + randomValueL1(dx,dy2) + changecount = 1 + end + end + end + end + end + rand4 = math.random(5) + if rand4 == 1 then + if changecount == 0 then + mem1[dx][1][2] = 0 + changecount = 1 + end + end + if rand4 == 4 then + if changecount == 0 then + mem1[dx][1][2] = 1 + randomValueL1(dx,1) + changecount = 1 + end + end + end +end + +function updateStatesL2() + for fx=1,cx2 do + local changecount = 0 + for fy=1,cy2 do + fy0 = (fy - 1) + fy2 = fy+1 + if fy0 > 0 then + if mem2[fx][fy][2] == 1 then + if mem2[fx][fy0][2] == 0 then + if changecount == 0 then + mem2[fx][fy][2] = 0 + changecount = 1 + end + end + end + end + if fy2 < cy2 then + if mem2[fx][fy][2] == 1 then + if mem2[fx][fy2][2] == 0 then + if changecount == 0 then + mem2[fx][fy2][2] = 1 + randomValueL2(fx,fy2) + changecount = 1 + end + end + end + end + end + rand5 = math.random(5) + if rand5 == 1 then + if changecount == 0 then + mem2[fx][1][2] = 0 + changecount = 1 + end + end + if rand5 == 4 then + if changecount == 0 then + mem2[fx][1][2] = 1 + randomValueL1(fx,1) + changecount = 1 + end + end + end +end + +function updateStatesL3() + for gx=1,cx3 do + local changecount = 0 + for gy=1,cy3 do + gy0 = (gy - 1) + gy2 = gy+1 + if gy0 > 0 then + if mem3[gx][gy][2] == 1 then + if mem3[gx][gy0][2] == 0 then + if changecount == 0 then + mem3[gx][gy][2] = 0 + changecount = 1 + end + end + end + end + if gy2 < cy3 then + if mem3[gx][gy][2] == 1 then + if mem3[gx][gy2][2] == 0 then + if changecount == 0 then + mem3[gx][gy2][2] = 1 + randomValueL3(gx,gy2) + changecount = 1 + end + end + end + end + end + rand6 = math.random(5) + if rand6 == 1 then + if changecount == 0 then + mem3[gx][1][2] = 0 + changecount = 1 + end + end + if rand6 == 4 then + if changecount == 0 then + mem3[gx][1][2] = 1 + randomValueL3(gx,1) + changecount = 1 + end + end + end +end + +function DrawAllTextL1() + for bx=1,cx1 do + for by=1,cy1 do + for bz=1,2 do + if mem1[bx][by][2] == 1 then + setNextFillColor(layer1, 0, 0.25, 0, 0.33) + addText(layer1, fontL, mem1[bx][by][1], (l1fontsize*bx)+l1xoffset, (l1fontsize*by)+l1yoffset) + end + end + end + end +end + +function DrawAllTextL2() + for ex=1,cx2 do + for ey=1,cy2 do + for ez=1,2 do + if mem2[ex][ey][2] == 1 then + setNextFillColor(layer2, 0, 0.5, 0, 0.5) + addText(layer2, fontM, mem2[ex][ey][1], (l2fontsize*ex)+l2xoffset, (l2fontsize*ey)+l2yoffset) + end + end + end + end +end + +function DrawAllTextL3() + for hx=1,cx3 do + for hy=1,cy3 do + for hz=1,2 do + if mem3[hx][hy][2] == 1 then + setNextFillColor(layer3, 0, 1, 0, 0.66) + addText(layer3, fontS, mem3[hx][hy][1], (l3fontsize*hx)+l3xoffset, (l3fontsize*hy)+l3yoffset) + end + end + end + end +end + +updateStatesL3() +updateStatesL2() +updateStatesL1() +DrawAllTextL3() +DrawAllTextL2() +DrawAllTextL1() +requestAnimationFrame(3) \ No newline at end of file diff --git a/Particle System/Particle System - Renderscript.txt b/Particle System/Particle System - Renderscript.txt new file mode 100644 index 0000000..07f3bde --- /dev/null +++ b/Particle System/Particle System - Renderscript.txt @@ -0,0 +1,116 @@ +if not init then + maxparticles = 120 + particlespeed = 0.25 + velocitylimit = 5 + particles = {} + for aa=1,maxparticles do + particles[aa] = {} + particles[aa][1] = math.random(1,1000) + particles[aa][2] = math.random(1,600) + local neg = math.random(1,2) - 1 + if neg == 0 then + neg = -1 + end + particles[aa][3] = math.random(1,100)/100 * neg + neg = math.random(1,2) - 1 + if neg == 0 then + neg = -1 + end + particles[aa][4] = math.random(1,100)/100 * neg + particles[aa][5] = 0 + particles[aa][6] = 0 + end + -- xpos, ypos, xvec, yvec, + + --particle behaviour + edgebehaviour = 1 + gravity = 0 + attraction = 1 + attractdistance = 100 + connect = 1 + velolimiting = 1 + + + function DrawParticles() + for ac=1,maxparticles do + setNextFillColor(layer1,0.3,0,0.3,0.6) + addCircle(layer1, particles[ac][1], particles[ac][2], 5) + end + end + + function UpdateParticles() + for ac=1,maxparticles do + if edgebehaviour == 1 then + if particles[ac][1] > (rx - 10) then --right + particles[ac][3] = particles[ac][3] * -1 + end + if particles[ac][1] < 10 then --left + particles[ac][3] = math.abs(particles[ac][3]) + end + + if particles[ac][2] < 10 then --top + particles[ac][4] = math.abs(particles[ac][4]) + end + if particles[ac][2] > (ry - 10) then --bottom + particles[ac][4] = particles[ac][4] * -1 + end + end + if edgebehaviour == 2 then + if particles[ac][1] > (rx - 10) then --right + particles[ac][1] = particles[ac][1] - rx + end + if particles[ac][1] < 10 then --left + particles[ac][1] = particles[ac][1] + rx + end + + if particles[ac][2] < 10 then --top + particles[ac][2] = particles[ac][2] + ry + end + if particles[ac][2] > (ry - 10) then --bottom + particles[ac][2] = particles[ac][2] - ry + end + end + if attraction == 1 or connect == 1 then + for af=1,maxparticles do + if af ~= ac then + local tempx1 = particles[ac][1] + local tempx2 = particles[af][1] + local tempy1 = particles[ac][2] + local tempy2 = particles[af][2] + if math.abs(tempx2 - tempx1) < attractdistance then + if math.abs(tempy2 - tempy1) < attractdistance then + if connect == 1 then + local dist1 = (tempx1 - tempx2)/attractdistance + local dist2 = (tempy1 - tempy2)/attractdistance + local distavg = (dist1 + dist2) / 2 + setNextStrokeColor(layer1,0.4+distavg,distavg,0.4-distavg,0.4+distavg) + addLine(layer1,tempx1,tempy1,tempx2,tempy2) + end + if attraction == 1 then + particles[ac][3] = particles[ac][3] - (((tempx2 - tempx1)/attractdistance)*0.05) + particles[ac][4] = particles[ac][4] - (((tempy2 - tempy1)/attractdistance)*0.05) + end + end + end + end + end + end + if velolimiting == 1 then + if particles[ac][3] > velocitylimit then particles[ac][3] = velocitylimit end + if particles[ac][3] < -velocitylimit then particles[ac][3] = -velocitylimit end + if particles[ac][4] > velocitylimit then particles[ac][4] = velocitylimit end + if particles[ac][4] < -velocitylimit then particles[ac][4] = -velocitylimit end + end + particles[ac][1] = particles[ac][1] + (particlespeed * particles[ac][3]) + particles[ac][2] = particles[ac][2] + (particlespeed * particles[ac][4]) + end + end + init = true +end +rx, ry = getResolution() +layer1 = createLayer() + +UpdateParticles() +DrawParticles() + +requestAnimationFrame(1) \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..f034657 --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +# DU-Lua-Scripts +A collection of potentially useful scripts and tools for Lua programming in Dual Universe.
+Nothing super complicated here, but perhaps you find some of these scripts useful to learn from.
+ +## List of available open-source scripts: + + \ No newline at end of file diff --git a/TYR MU Control Uplink/Readme.md b/TYR MU Control Uplink/Readme.md new file mode 100644 index 0000000..d9cd5aa --- /dev/null +++ b/TYR MU Control Uplink/Readme.md @@ -0,0 +1,41 @@ +# TYR Mining Unit Control Uplink + +This script will provide a simple but elegant report for Mining Units in Dual Universe, using a single Programming Board and Screen. It updates in real-time, provided nothing breaks. + +Originally written for TYR Expedition Group, I have been given permission to open source the code and provide it free to anyone who wishes to use it or improve upon it. + +## Usage + +You will need:
+
+
+Installation steps: +
    +
  1. Place your elements. They can be moved later.
  2. +
  3. Copy the contents of the screen file and paste it into your Screen element. Make sure the screen is on.
  4. +
  5. Copy the contents of the PB file, and in-game, right click your Programming Board, and select "Advanced > Paste Lua Configuration from Clipboard".
  6. +
  7. Link order is important here. Link the PB to the screen first. Second, link the PB to the databank. Then, link PB to all mining units you want the script to monitor.
  8. +
  9. Link your detection zone to the PB if you want the script to run when someone is nearby.
  10. +

+
+### If at any point the script stops updating, simply restart the programming board. +Sometimes, it gets stuck. This can happen when the system hits a lagspike, or something. Oof :( + +## TODO + +I had big ambitions for this project. Hopefully it will be revived at some point after NQ decides on a wipe. + +Features I would like to add: + \ No newline at end of file diff --git a/TYR MU Control Uplink/TYR MU Control - PB.txt b/TYR MU Control Uplink/TYR MU Control - PB.txt new file mode 100644 index 0000000..afc981a --- /dev/null +++ b/TYR MU Control Uplink/TYR MU Control - PB.txt @@ -0,0 +1 @@ +{"slots":{"0":{"name":"Screen","type":{"events":[],"methods":[]}},"1":{"name":"DB1","type":{"events":[],"methods":[]}},"2":{"name":"MU1","type":{"events":[],"methods":[]}},"3":{"name":"MU2","type":{"events":[],"methods":[]}},"4":{"name":"MU3","type":{"events":[],"methods":[]}},"5":{"name":"MU4","type":{"events":[],"methods":[]}},"6":{"name":"MU5","type":{"events":[],"methods":[]}},"7":{"name":"MU6","type":{"events":[],"methods":[]}},"8":{"name":"MU7","type":{"events":[],"methods":[]}},"9":{"name":"Core","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":"system.print(tostring(oreId) .. \",\" .. tostring(amount) .. \",\" .. tostring(rate))\nif tonumber(amount) > 0 then\n if tonumber(rate) > 0 then\n local orename = system.getItem(oreId)[\"displayName\"]\n local newkeyindex = DB1.getNbKeys()\n local calibtime = system.getUtcTime()\n DB1.setStringValue(newkeyindex + 1, tostring(orename) .. \",\" .. amount .. \",\" .. rate .. \",\" .. MU1.getLastExtractionPosition()[1] .. \",\" .. MU1.getLastExtractionPosition()[2] .. \",\" .. MU1.getLastExtractionPosition()[3] .. \",\" .. player.getId() .. \",\" .. player.getName() .. \",\" .. calibtime .. \",1\")\n system.print(orename .. \",\" .. amount .. \",\" .. rate .. \",\" .. MU1.getLastExtractionPosition()[1] .. \",\" .. MU1.getLastExtractionPosition()[2] .. \",\" .. MU1.getLastExtractionPosition()[3])\n end\nend","filter":{"args":[{"variable":"*"},{"variable":"*"},{"variable":"*"}],"signature":"onCalibrated(oreId,amount,rate)","slotKey":"2"},"key":"0"},{"code":"system.print(tostring(oreId) .. \",\" .. tostring(amount) .. \",\" .. tostring(rate))\nif tonumber(amount) > 0 then\n if tonumber(rate) > 0 then\n local orename = system.getItem(oreId)[\"displayName\"]\n local newkeyindex = DB1.getNbKeys()\n local calibtime = system.getUtcTime()\n DB1.setStringValue(newkeyindex + 1, orename .. \",\" .. amount .. \",\" .. rate .. \",\" .. MU2.getLastExtractionPosition()[1] .. \",\" .. MU2.getLastExtractionPosition()[2] .. \",\" .. MU2.getLastExtractionPosition()[3] .. \",\" .. player.getId() .. \",\" .. player.getName() .. \",\" .. calibtime .. \",2\")\n system.print(orename .. \",\" .. amount .. \",\" .. rate .. \",\" .. MU2.getLastExtractionPosition()[1] .. \",\" .. MU2.getLastExtractionPosition()[2] .. \",\" .. MU2.getLastExtractionPosition()[3])\n end\nend","filter":{"args":[{"variable":"*"},{"variable":"*"},{"variable":"*"}],"signature":"onCalibrated(oreId,amount,rate)","slotKey":"3"},"key":"1"},{"code":"system.print(tostring(oreId) .. \",\" .. tostring(amount) .. \",\" .. tostring(rate))\nif tonumber(amount) > 0 then\n if tonumber(rate) > 0 then\n local orename = system.getItem(oreId)[\"displayName\"]\n local newkeyindex = DB1.getNbKeys()\n local calibtime = system.getUtcTime()\n DB1.setStringValue(newkeyindex + 1, orename .. \",\" .. amount .. \",\" .. rate .. \",\" .. MU3.getLastExtractionPosition()[1] .. \",\" .. MU3.getLastExtractionPosition()[2] .. \",\" .. MU3.getLastExtractionPosition()[3] .. \",\" .. player.getId() .. \",\" .. player.getName() .. \",\" .. calibtime .. \",3\")\n system.print(orename .. \",\" .. amount .. \",\" .. rate .. \",\" .. MU3.getLastExtractionPosition()[1] .. \",\" .. MU3.getLastExtractionPosition()[2] .. \",\" .. MU3.getLastExtractionPosition()[3])\n end\nend","filter":{"args":[{"variable":"*"},{"variable":"*"},{"variable":"*"}],"signature":"onCalibrated(oreId,amount,rate)","slotKey":"4"},"key":"2"},{"code":"system.print(tostring(oreId) .. \",\" .. tostring(amount) .. \",\" .. tostring(rate))\nif tonumber(amount) > 0 then\n if tonumber(rate) > 0 then\n local orename = system.getItem(oreId)[\"displayName\"]\n local newkeyindex = DB1.getNbKeys()\n local calibtime = system.getUtcTime()\n DB1.setStringValue(newkeyindex + 1, orename .. \",\" .. amount .. \",\" .. rate .. \",\" .. MU4.getLastExtractionPosition()[1] .. \",\" .. MU4.getLastExtractionPosition()[2] .. \",\" .. MU4.getLastExtractionPosition()[3] .. \",\" .. player.getId() .. \",\" .. player.getName() .. \",\" .. calibtime .. \",4\")\n system.print(orename .. \",\" .. amount .. \",\" .. rate .. \",\" .. MU4.getLastExtractionPosition()[1] .. \",\" .. MU4.getLastExtractionPosition()[2] .. \",\" .. MU4.getLastExtractionPosition()[3])\n end\nend","filter":{"args":[{"variable":"*"},{"variable":"*"},{"variable":"*"}],"signature":"onCalibrated(oreId,amount,rate)","slotKey":"5"},"key":"3"},{"code":"system.print(tostring(oreId) .. \",\" .. tostring(amount) .. \",\" .. tostring(rate))\nif tonumber(amount) > 0 then\n if tonumber(rate) > 0 then\n local orename = system.getItem(oreId)[\"displayName\"]\n local newkeyindex = DB1.getNbKeys()\n local calibtime = system.getUtcTime()\n DB1.setStringValue(newkeyindex + 1, orename .. \",\" .. amount .. \",\" .. rate .. \",\" .. MU5.getLastExtractionPosition()[1] .. \",\" .. MU5.getLastExtractionPosition()[2] .. \",\" .. MU5.getLastExtractionPosition()[3] .. \",\" .. player.getId() .. \",\" .. player.getName() .. \",\" .. calibtime .. \",5\")\n system.print(orename .. \",\" .. amount .. \",\" .. rate .. \",\" .. MU5.getLastExtractionPosition()[1] .. \",\" .. MU5.getLastExtractionPosition()[2] .. \",\" .. MU5.getLastExtractionPosition()[3])\n end\nend","filter":{"args":[{"variable":"*"},{"variable":"*"},{"variable":"*"}],"signature":"onCalibrated(oreId,amount,rate)","slotKey":"6"},"key":"4"},{"code":"system.print(tostring(oreId) .. \",\" .. tostring(amount) .. \",\" .. tostring(rate))\nif tonumber(amount) > 0 then\n if tonumber(rate) > 0 then\n local orename = system.getItem(oreId)[\"displayName\"]\n local newkeyindex = DB1.getNbKeys()\n local calibtime = system.getUtcTime()\n DB1.setStringValue(newkeyindex + 1, orename .. \",\" .. amount .. \",\" .. rate .. \",\" .. MU6.getLastExtractionPosition()[1] .. \",\" .. MU6.getLastExtractionPosition()[2] .. \",\" .. MU6.getLastExtractionPosition()[3] .. \",\" .. player.getId() .. \",\" .. player.getName() .. \",\" .. calibtime .. \",6\")\n system.print(orename .. \",\" .. amount .. \",\" .. rate .. \",\" .. MU6.getLastExtractionPosition()[1] .. \",\" .. MU6.getLastExtractionPosition()[2] .. \",\" .. MU6.getLastExtractionPosition()[3])\n end\nend","filter":{"args":[{"variable":"*"},{"variable":"*"},{"variable":"*"}],"signature":"onCalibrated(oreId,amount,rate)","slotKey":"7"},"key":"5"},{"code":"if amount > 0 then\n if rate > 0 then\n local orename = system.getItem(oreId)[\"displayName\"]\n local newkeyindex = DB1.getNbKeys()\n DB1.setStringValue(newkeyindex + 1, orename .. \",\" .. amount .. \",\" .. rate .. \",\" .. MU7.getLastExtractionPosition()[1] .. \",\" .. MU7.getLastExtractionPosition()[2] .. \",\" .. MU7.getLastExtractionPosition()[3] .. \",\" .. system.getMasterPlayerId() .. \" - \" .. system.getPlayerName(system.getMasterPlayerId()))\n --system.print(orename .. \",\" .. amount .. \",\" .. rate .. \",\" .. MU2.getLastExtractionPosition()[1] .. \",\" .. MU2.getLastExtractionPosition()[2] .. \",\" .. MU2.getLastExtractionPosition()[3])\n end\nend","filter":{"args":[{"variable":"*"},{"variable":"*"},{"variable":"*"}],"signature":"calibrated(oreId,amount,rate)","slotKey":"8"},"key":"6"},{"code":"Screen.activate()\nscreenoutput = Screen.getScriptOutput()\nsendcalibrations = 0\ncalibindex = 0\nMUDBKeyList = DB1.getKeyList()\nMUDBKeyNB = DB1.getNbKeys()\nlastoutput = \"\"\ntickcount = 0\nnomoreunits = 0\nrefreshed = 0\nverbose = 0\nlastinput = \"\"\nScreen.setScriptInput(\"ACTIVATE\")\nunit.setTimer(\"main\",1/60)\nfunction newToString(x)\n if type(x) == 'table' then\n local elems = {}\n for k, v in pairs(x) do\n table.insert(elems, string.format('%s = %s', newToString(k), newToString(v)))\n end\n return string.format('{%s}', table.concat(elems, ', '))\n else\n return tostring(x)\n end\nend\nsystem.print(newToString(MUDBKeyList))\nsystem.print(MUDBKeyNB)","filter":{"args":[],"signature":"onStart()","slotKey":"-1"},"key":"7"},{"code":"Screen.setScriptInput(\"clear\")\nScreen.deactivate()","filter":{"args":[],"signature":"onStop()","slotKey":"-1"},"key":"8"},{"code":"screenoutput = Screen.getScriptOutput()\nif screenoutput == lastoutput then\n --do nothing\nelse\n if verbose == 1 then\n system.print(screenoutput)\n end\n if string.sub(screenoutput,1,3) == \"Ack\" then\n local bigger = 0\n local smaller = 0\n if refreshed == 1 then\n bigger = tickcount\n smaller = tonumber(string.sub(screenoutput,4,string.len(screenoutput)))\n else\n smaller = tickcount\n bigger = tonumber(string.sub(screenoutput,4,string.len(screenoutput)))\n end\n if bigger > smaller then\n --tickcount = tonumber(string.sub(screenoutput,4,string.len(screenoutput)))\n tickcount = tickcount + 1\n if tickcount == 2 then\n if MU1 ~= nil then\n local mustatus = MU1.getState()\n local mutimeleft = MU1.getRemainingTime()\n local muoreid = system.getItem(MU1.getActiveOre())[\"locDisplayName\"]\n local muoreicon = system.getItem(MU1.getActiveOre())[\"iconPath\"]\n local mubaserate = MU1.getBaseRate()\n local mueff = MU1.getEfficiency()\n local muadjbonus = MU1.getAdjacencyBonus()\n local mucalrate = MU1.getCalibrationRate()\n local muoptimum = MU1.getOptimalRate()\n local muprodrate = MU1.getProductionRate()\n local mutimesincecal = MU1.getLastExtractionTime()\n local muoretier = system.getItem(MU1.getActiveOre())[\"tier\"]\n local MU1string = \"MUSTATE1:\" .. mustatus .. \",\" .. mutimeleft .. \",\" .. muoreid .. \",\" .. muoreicon .. \",\" .. mubaserate .. \",\" .. mueff .. \",\" .. muadjbonus .. \",\" .. mucalrate .. \",\" .. muoptimum .. \",\" .. muprodrate .. \",\" .. mutimesincecal .. \",\" .. muoretier\n Screen.setScriptInput(MU1string)\n if verbose == 1 then\n system.print(MU1string)\n end\n else\n if lastinput == \"\" then\n lastinput = \"empty\"\n Screen.setScriptInput(lastinput)\n else\n lastinput = \"\"\n Screen.setScriptInput(lastinput)\n end\n if verbose == 1 then\n system.print(lastinput)\n end\n nomoreunits = 1\n end\n end\n\n if tickcount == 3 then\n if MU2 ~= nil then\n local mustatus = MU2.getState()\n local mutimeleft = MU2.getRemainingTime()\n local muoreid = system.getItem(MU2.getActiveOre())[\"locDisplayName\"]\n local muoreicon = system.getItem(MU2.getActiveOre())[\"iconPath\"]\n local mubaserate = MU2.getBaseRate()\n local mueff = MU2.getEfficiency()\n local muadjbonus = MU2.getAdjacencyBonus()\n local mucalrate = MU2.getCalibrationRate()\n local muoptimum = MU2.getOptimalRate()\n local muprodrate = MU2.getProductionRate()\n local mutimesincecal = MU2.getLastExtractionTime()\n local muoretier = system.getItem(MU1.getActiveOre())[\"tier\"]\n local MU2string = \"MUSTATE2:\" .. mustatus .. \",\" .. mutimeleft .. \",\" .. muoreid .. \",\" .. muoreicon .. \",\" .. mubaserate .. \",\" .. mueff .. \",\" .. muadjbonus .. \",\" .. mucalrate .. \",\" .. muoptimum .. \",\" .. muprodrate .. \",\" .. mutimesincecal .. \",\" .. muoretier\n Screen.setScriptInput(MU2string)\n if verbose == 1 then\n system.print(MU2string)\n end\n else\n if lastinput == \"\" then\n lastinput = \"empty\"\n Screen.setScriptInput(lastinput)\n else\n lastinput = \"\"\n Screen.setScriptInput(lastinput)\n end\n if verbose == 1 then\n system.print(lastinput)\n end\n nomoreunits = 1\n end\n end\n\n if tickcount == 4 then\n if MU3 ~= nil then\n local mustatus = MU3.getState()\n local mutimeleft = MU3.getRemainingTime()\n local muoreid = system.getItem(MU3.getActiveOre())[\"locDisplayName\"]\n local muoreicon = system.getItem(MU3.getActiveOre())[\"iconPath\"]\n local mubaserate = MU3.getBaseRate()\n local mueff = MU3.getEfficiency()\n local muadjbonus = MU3.getAdjacencyBonus()\n local mucalrate = MU3.getCalibrationRate()\n local muoptimum = MU3.getOptimalRate()\n local muprodrate = MU3.getProductionRate()\n local mutimesincecal = MU3.getLastExtractionTime()\n local muoretier = system.getItem(MU1.getActiveOre())[\"tier\"]\n local MU3string = \"MUSTATE3:\" .. mustatus .. \",\" .. mutimeleft .. \",\" .. muoreid .. \",\" .. muoreicon .. \",\" .. mubaserate .. \",\" .. mueff .. \",\" .. muadjbonus .. \",\" .. mucalrate .. \",\" .. muoptimum .. \",\" .. muprodrate .. \",\" .. mutimesincecal .. \",\" .. muoretier\n Screen.setScriptInput(MU3string)\n if verbose == 1 then\n system.print(MU3string)\n end\n else\n if lastinput == \"\" then\n lastinput = \"empty\"\n Screen.setScriptInput(lastinput)\n else\n lastinput = \"\"\n Screen.setScriptInput(lastinput)\n end\n if verbose == 1 then\n system.print(lastinput)\n end\n nomoreunits = 1\n end\n end\n\n if tickcount == 5 then\n if MU4 ~= nil then\n local mustatus = MU4.getState()\n local mutimeleft = MU4.getRemainingTime()\n local muoreid = system.getItem(MU4.getActiveOre())[\"locDisplayName\"]\n local muoreicon = system.getItem(MU4.getActiveOre())[\"iconPath\"]\n local mubaserate = MU4.getBaseRate()\n local mueff = MU4.getEfficiency()\n local muadjbonus = MU4.getAdjacencyBonus()\n local mucalrate = MU4.getCalibrationRate()\n local muoptimum = MU4.getOptimalRate()\n local muprodrate = MU4.getProductionRate()\n local mutimesincecal = MU4.getLastExtractionTime()\n local muoretier = system.getItem(MU1.getActiveOre())[\"tier\"]\n local MU4string = \"MUSTATE4:\" .. mustatus .. \",\" .. mutimeleft .. \",\" .. muoreid .. \",\" .. muoreicon .. \",\" .. mubaserate .. \",\" .. mueff .. \",\" .. muadjbonus .. \",\" .. mucalrate .. \",\" .. muoptimum .. \",\" .. muprodrate .. \",\" .. mutimesincecal .. \",\" .. muoretier\n Screen.setScriptInput(MU4string)\n if verbose == 1 then\n system.print(MU4string)\n end\n else\n if lastinput == \"\" then\n lastinput = \"empty\"\n Screen.setScriptInput(lastinput)\n else\n lastinput = \"\"\n Screen.setScriptInput(lastinput)\n end\n if verbose == 1 then\n system.print(lastinput)\n end\n nomoreunits = 1\n end\n end\n\n if tickcount == 6 then\n if MU5 ~= nil then\n local mustatus = MU5.getState()\n local mutimeleft = MU5.getRemainingTime()\n local muoreid = system.getItem(MU5.getActiveOre())[\"locDisplayName\"]\n local muoreicon = system.getItem(MU5.getActiveOre())[\"iconPath\"]\n local mubaserate = MU5.getBaseRate()\n local mueff = MU5.getEfficiency()\n local muadjbonus = MU5.getAdjacencyBonus()\n local mucalrate = MU5.getCalibrationRate()\n local muoptimum = MU5.getOptimalRate()\n local muprodrate = MU5.getProductionRate()\n local mutimesincecal = MU5.getLastExtractionTime()\n local muoretier = system.getItem(MU1.getActiveOre())[\"tier\"]\n local MU5string = \"MUSTATE5:\" .. mustatus .. \",\" .. mutimeleft .. \",\" .. muoreid .. \",\" .. muoreicon .. \",\" .. mubaserate .. \",\" .. mueff .. \",\" .. muadjbonus .. \",\" .. mucalrate .. \",\" .. muoptimum .. \",\" .. muprodrate .. \",\" .. mutimesincecal .. \",\" .. muoretier\n Screen.setScriptInput(MU5string)\n if verbose == 1 then\n system.print(MU5string)\n end\n else\n if lastinput == \"\" then\n lastinput = \"empty\"\n Screen.setScriptInput(lastinput)\n else\n lastinput = \"\"\n Screen.setScriptInput(lastinput)\n end\n if verbose == 1 then\n system.print(lastinput)\n end\n nomoreunits = 1\n end\n end\n\n if tickcount == 7 then\n if MU6 ~= nil then\n local mustatus = MU6.getState()\n local mutimeleft = MU6.getRemainingTime()\n local muoreid = system.getItem(MU6.getActiveOre())[\"locDisplayName\"]\n local muoreicon = system.getItem(MU6.getActiveOre())[\"iconPath\"]\n local mubaserate = MU6.getBaseRate()\n local mueff = MU6.getEfficiency()\n local muadjbonus = MU6.getAdjacencyBonus()\n local mucalrate = MU6.getCalibrationRate()\n local muoptimum = MU6.getOptimalRate()\n local muprodrate = MU6.getProductionRate()\n local mutimesincecal = MU6.getLastExtractionTime()\n local muoretier = system.getItem(MU1.getActiveOre())[\"tier\"]\n local MU6string = \"MUSTATE6:\" .. mustatus .. \",\" .. mutimeleft .. \",\" .. muoreid .. \",\" .. muoreicon .. \",\" .. mubaserate .. \",\" .. mueff .. \",\" .. muadjbonus .. \",\" .. mucalrate .. \",\" .. muoptimum .. \",\" .. muprodrate .. \",\" .. mutimesincecal .. \",\" .. muoretier\n Screen.setScriptInput(MU6string)\n if verbose == 1 then\n system.print(MU6string)\n end\n else\n nomoreunits = 1\n end\n end\n\n if tickcount == 8 then\n if MU7 ~= nil then\n local mustatus = MU7.getState()\n local mutimeleft = MU7.getRemainingTime()\n local muoreid = system.getItem(MU7.getActiveOre())[\"locDisplayName\"]\n local muoreicon = system.getItem(MU7.getActiveOre())[\"iconPath\"]\n local mubaserate = MU7.getBaseRate()\n local mueff = MU7.getEfficiency()\n local muadjbonus = MU7.getAdjacencyBonus()\n local mucalrate = MU7.getCalibrationRate()\n local muoptimum = MU7.getOptimalRate()\n local muprodrate = MU7.getProductionRate()\n local mutimesincecal = MU7.getLastExtractionTime()\n local muoretier = system.getItem(MU1.getActiveOre())[\"tier\"]\n local MU7string = \"MUSTATE7:\" .. mustatus .. \",\" .. mutimeleft .. \",\" .. muoreid .. \",\" .. muoreicon .. \",\" .. mubaserate .. \",\" .. mueff .. \",\" .. muadjbonus .. \",\" .. mucalrate .. \",\" .. muoptimum .. \",\" .. muprodrate .. \",\" .. mutimesincecal .. \",\" .. muoretier\n Screen.setScriptInput(MU7string)\n if verbose == 1 then\n system.print(MU7string)\n end\n else\n nomoreunits = 1\n end\n end\n \n if tickcount == 9 then\n nomoreunits = 1\n end\n else\n Screen.setScriptInput(\"\")\n end\n else\n Screen.setScriptInput(\"\")\n end\n if nomoreunits == 1 then\n unit.stopTimer(\"main\")\n unit.setTimer(\"calib\",0.1)\n end\n if verbose == 1 then\n system.print(tickcount)\n end\nend\nrefreshed = 0","filter":{"args":[{"value":"main"}],"signature":"onTimer(tag)","slotKey":"-1"},"key":"9"},{"code":"tickcount = -1\nnomoreunits = 0\nScreen.setScriptInput(\"refresh\")\nif verbose == 1 then\n system.print(\"refresh\")\nend\nrefreshed = 0\nunit.stopTimer(\"refresh\")\nunit.setTimer(\"main\",1/60)","filter":{"args":[{"value":"refresh"}],"signature":"onTimer(tag)","slotKey":"-1"},"key":"10"},{"code":"MUDBKeyList = DB1.getKeyList()\nMUDBKeyNB = DB1.getNbKeys()\nif calibindex > MUDBKeyNB then\n calibindex = 0\n tickcount = 2\n unit.stopTimer(\"calib\")\n unit.setTimer(\"refresh\",3)\nelse\n for i,k in pairs(MUDBKeyList) do\n if i == calibindex then\n local returnkey = DB1.getStringValue(k)\n Screen.setScriptInput(\"CALIBRT\"..i..\":\"..returnkey)\n end\n end\n calibindex = calibindex + 1\nend","filter":{"args":[{"value":"calib"}],"signature":"onTimer(tag)","slotKey":"-1"},"key":"11"}],"methods":[],"events":[]} \ No newline at end of file diff --git a/TYR MU Control Uplink/TYR MU Control - Renderscript.txt b/TYR MU Control Uplink/TYR MU Control - Renderscript.txt new file mode 100644 index 0000000..514785b --- /dev/null +++ b/TYR MU Control Uplink/TYR MU Control - Renderscript.txt @@ -0,0 +1,680 @@ +if not init then + init = true + freshinit = true + showimgbg = 1 + showdevoverlay = 0 + showactivationscreen = 1 + tickcount = 0 + maxtickcount = 8 + animtick = 0 + animtick2 = 0 + animtick2switch = 0 + animtick3 = 0 + animtick3max = 100 + lastinput = "" + rx, ry = getResolution() + a = 2 * math.pi / 6 + r = 100 + maxMUs = 7 + maxMUdatarows = 12 + tieravgs = {} + tieravgs["1"] = 20 + tieravgs["2"] = 35 + tieravgs["3"] = 45 + tieravgs["4"] = 150 + tieravgs["5"] = 825 + calibrationcost = 150000 + calibrationsperweek = 1 + tiletax = 500000 + warpcellprice = 7000 + hauldistance = 500 + haulermass = 1500 + uplinkenabled = 1 + uplinkpress = 0 + multitablestate = 2 + contexttext = "" + mem1 = {} + for ix=1,maxMUs do + mem1[ix] = {} + for iy=1,maxMUdatarows do + mem1[ix][iy] = 0 + end + end + calibrations = {} + for ix=1,18 do + calibrations[ix] = {} + for iy=1,10 do + calibrations[ix][iy] = 0 + end + end +end +local fontXL = loadFont("Play", 60) +local fontXLb = loadFont("Play-Bold", 60) +local fontL = loadFont("Play", 40) --unused +local fontLb = loadFont("Play-Bold", 40) +local fontM = loadFont("Play", 20) +local fontMb = loadFont("Play-Bold", 20) --unused +local fontM2 = loadFont("Play", 16) +local fontS = loadFont("Play", 14) --unused +local layer = createLayer() +local layer2 = createLayer() +local layer3 = createLayer() +local layer4 = createLayer() +local devlayer = createLayer() +local rx, ry = getResolution() +local cx, cy = getCursor() +local cd = getCursorDown() +local cp = getCursorPressed() +local cr = getCursorReleased() +local colorPrimaryR = 1 +local colorPrimaryG = 1 +local colorPrimaryB = 1 +local colorSecondaryR = 0 +local colorSecondaryG = 0 +local colorSecondaryB = 0 +local colorTertiaryR = 0.1 +local colorTertiaryG = 0.1 +local colorTertiaryB = 0.4 +local colorQuaternaryR = 0.05 +local colorQuaternaryG = 0.05 +local colorQuaternaryB = 0.05 +local rcmax = getRenderCostMax() +local rccurr = getRenderCost() +local tilevalue = 0 +local tilecost = 0 +contexttext = "" +setBackgroundColor(colorQuaternaryR, colorQuaternaryG, colorQuaternaryB) + +function round(num, numDecimalPlaces) + local mult = 10^(numDecimalPlaces or 0) + return math.floor(num * mult + 0.5) / mult +end + +function addHexagon(inlayer,hexx,hexy,tick,strkwdth,sr,sg,sb,shwdth,shr,shg,shb,alpha) + -- tick = radius + for ia=0,5 do + setNextShadow(inlayer,shwdth,shr,shg,shb,alpha) + setNextStrokeWidth(inlayer,strkwdth) + setNextStrokeColor(inlayer,sr,sg,sb,alpha) + addLine(inlayer,hexx + (r + tick) * math.cos(a * ia), hexy + (r + tick) * math.sin(a * ia),hexx + (r + tick) * math.cos(a * (ia+1)), hexy + (r + tick) * math.sin(a * (ia+1))) + end +end + +function drawBoxAnimation(tickin,layerin,xin,yin,sxin,syin,estate) + local pcnt1 = tickin/animtick3max + local pcnt2 = (tickin/2)/animtick3max + if pcnt1 > 0.5 then + pcnt2 = ((animtick3max - tickin)/2)/animtick3max + end + + setNextStrokeWidth(layer3,0) + setNextStrokeColor(layer3,0,0,0,0) + setNextShadow(layer3,10,1,1,1,0.2) + setNextFillColor(layer3,1,1,1,0.2) + addBox(layer3,tempx+((rx*0.22)*pcnt1),tempy+(ry*0.035*2)-25,(rx*0.22)*pcnt2,15) +end + +function drawUplinkWidget(drawlayer,strkwdth,width,height,xin,yin) + --addHexagon(layer3,xin,yin,-20,2,0.5,0.5,0.5,15,0,0,0,0.7) + local wgtr = 0.2 + local wgtg = 0.2 + local wgtb = 0.2 + local wgtstatus = "" + if uplinkenabled == 1 then + wgtg = 0.7 + wgtstatus = "Enabled" + else + wgtr = 0.7 + wgtstatus = "Disabled" + end + setNextShadow(drawlayer,strkwdth*3,0,0,0,0.7) + setNextFillColor(drawlayer,wgtr,wgtg,wgtb,0.4) + addCircle(drawlayer,xin,yin,strkwdth*2) + setNextStrokeWidth(drawlayer,strkwdth) + setNextShadow(drawlayer,strkwdth*3,0,0,0,0.7) + setNextStrokeColor(drawlayer,wgtr,wgtg,wgtb,0.85) + addBezier(drawlayer,xin-(width/2),yin-(height/4),xin,yin-(height/4)-25,xin+(width/2),yin-(height/4)) + setNextStrokeWidth(drawlayer,strkwdth) + setNextShadow(drawlayer,strkwdth*3,0,0,0,0.7) + setNextStrokeColor(drawlayer,wgtr,wgtg,wgtb,0.85) + addBezier(drawlayer,xin-((width/3)*2),yin-((height/4)*2),xin,yin-((height/4)*2)-30,xin+((width/3)*2),yin-((height/4)*2)) + setNextStrokeWidth(drawlayer,strkwdth) + setNextShadow(drawlayer,strkwdth*3,0,0,0,0.7) + setNextStrokeColor(drawlayer,wgtr,wgtg,wgtb,0.85) + addBezier(drawlayer,xin-((width/4)*3.3),yin-((height/4)*3),xin,yin-((height/4)*3)-35,xin+((width/4)*3.3),yin-((height/4)*3)) + setNextFillColor(drawlayer,wgtr,wgtg,wgtb,0.6) + setNextTextAlign(drawlayer,AlignH_Center,AlignV_Middle) + addText(drawlayer,fontM,"Uplink:",xin,yin+25) + setNextFillColor(drawlayer,wgtr,wgtg,wgtb,0.6) + setNextTextAlign(drawlayer,AlignH_Center,AlignV_Middle) + addText(drawlayer,fontM,wgtstatus,xin,yin+45) + if cx > xin-width then + if cx < xin+width then + if cy > yin-height then + if cy < yin+height then + if uplinkenabled == 1 then + contexttext = "Click to Disable." + else + contexttext = "Click to Enable." + end + if cp == true then + uplinkpress = 1 + end + if cr == true and uplinkpress == 1 then + if uplinkenabled == 1 then + uplinkenabled = 0 + else + uplinkenabled = 1 + end + end + end + end + end + end + uplinkpress = 0 +end + +function DrawTYRFooter() + --If you modify our script, please leave this intact + setNextFillColor(layer4, 1, 1, 1, 0.1) + addText(layer4, fontS, "Developed by TYR Expeditionary Group", rx*0.65, ry - 15) + setNextFillColor(layer4, 1, 1, 1, 0.2) + addText(layer4, fontS, "Developed by TYR Expeditionary Group", rx*0.65 - 2, ry - 15 - 2) +end + +function drawHexWidget1(tick) + addHexagon(layer3,680,200,15,4,0.5,0.5,0.5,15,0,0,0,0.7) + addHexagon(layer3,680,200,-20,2,0.3,0.3,0.3,8,0,0,0,0.7) + addHexagon(layer3,680,200,-55,2,0.3,0.3,0.3,8,0,0,0,0.7) + addHexagon(layer3,680,200,-90,1,0.5,0.5,0.5,4,0,0,0,0.7) + setNextShadow(layer3,4,0,0,0,0.5) + setNextStrokeWidth(layer3,2) + setNextStrokeColor(layer3,0.2,0.2,0.2,0.7) + addLine(layer3,795,200,565,200) + setNextShadow(layer3,4,0,0,0,0.5) + setNextStrokeWidth(layer3,2) + setNextStrokeColor(layer3,0.2,0.2,0.2,0.7) + addLine(layer3,735,300,625,100) + setNextShadow(layer3,4,0,0,0,0.5) + setNextStrokeWidth(layer3,2) + setNextStrokeColor(layer3,0.2,0.2,0.2,0.7) + addLine(layer3,735,100,625,300) + addHexagon(layer3,680,200,15-tick,1,0.4,0.0,0.4,4,0.4,0.0,0.4,0.3) +end + +function drawMUWidget1(tickin) + local alph1 = tickin/50 + --draw MU Script Image Assets + setNextFillColor(layer3,0.85,0.75,0.1,alph1) + addImageSub(layer3,assetimagehandle,900,355,77.5,212.5,0,0,155,425) +end + +function drawCircularProgressBar(layerin,xin,yin,rad,v) + local prcnt = v/86400 + local angle = prcnt*360 + local cntr = 0 + if v > 86400 then + if v > 259200 then + --losing calibration + setNextFillColor(layer3,1,0,0,0.5) + addTriangle(layer3,tempx+255,tempy+(ry*0.035*2)-40,tempx+275,tempy+(ry*0.035*2)-40,tempx+265,tempy+(ry*0.035*2)-15) + else + --calibration timer reset, but not losing calibration + setNextFillColor(layer3,1,1,0,0.5) + addCircle(layer3,tempx+265,tempy+(ry*0.035*2)-30,8) + end + else + for xb = 1,20 do + cntr = cntr + 0.05 + setNextStrokeWidth(layerin,1) + setNextStrokeColor(layerin,0,0,0,0) + setNextFillColor(layerin,0.4,0.0,0.4,0.5) + addCircle(layerin,xin+(math.cos((prcnt*cntr)*(math.pi*2))*rad),yin+(math.sin((prcnt*cntr)*(math.pi*2))*rad),5) + end + --center circle + setNextStrokeWidth(layerin,2) + setNextStrokeColor(layerin,0,0,0,0) + setNextFillColor(layerin,0.5,0.5,0.5,0.7) + addCircle(layerin,xin,yin,rad/2+(rad/4)) + --outer circle + setNextStrokeWidth(layerin,3) + setNextStrokeColor(layerin,0.5,0.5,0.5,0.7) + setNextFillColor(layerin,0,0,0,0) + addCircle(layerin,xin,yin,rad+(rad/3)) + --position circle + setNextStrokeWidth(layerin,1) + setNextStrokeColor(layerin,0.5,0.5,0.5,0.7) + setNextFillColor(layerin,0.5,0.5,0.5,0.7) + addCircle(layerin,xin+(math.cos(prcnt*(math.pi*2))*rad),yin+(math.sin(prcnt*(math.pi*2))*rad),5) + end + --context menu + if cx > xin-(rad*1.5) then + if cx < xin+(rad*1.5) then + if cy > yin-(rad*1.5) then + if cy < yin+(rad*1.5) then + if v > 86400 then + if v > 259200 then + contexttext = "Unit is losing calibration. (72Hrs+)" + else + contexttext = "Calibration Ready." + end + else + contexttext = "Calibration Available in " .. 24 - round(24*prcnt,1) .. " hours." + end + end + end + end + end +end + +function DrawMultiTableFrame() + setNextStrokeWidth(layer3,3) + setNextStrokeColor(layer3,0.3,0.3,0.3,1) + setNextFillColor(layer3,0,0,0,0) + addLine(layer3,570,353,723,353) + + setNextStrokeWidth(layer3,3) + setNextStrokeColor(layer3,0.3,0.3,0.3,1) + setNextFillColor(layer3,0,0,0,0) + addLine(layer3,570,360,875,360) + + setNextStrokeWidth(layer3,3) + setNextStrokeColor(layer3,0.3,0.3,0.3,1) + setNextFillColor(layer3,0,0,0,0) + addLine(layer3,570,353,570,460) + + setNextStrokeWidth(layer3,3) + setNextStrokeColor(layer3,0.3,0.3,0.3,1) + setNextFillColor(layer3,0,0,0,0) + addLine(layer3,577,360,577,560) +end + +function DrawEstimationsTable(tempx, tempy, tilevalue, tilecost) + --setNextFillColor(layer3,0.8,0.8,0.2,0.7) + --addText(layer3, fontM, "Estimations:", tempx+550,340) + + setNextFillColor(layer3,0.5,0.5,0.5,0.7) + addText(layer3, fontM2, "Yield Value: " .. tilevalue .. " h per week", tempx+550,380) + + setNextFillColor(layer3,0.7,0.2,0.2,0.7) + addText(layer3, fontM2, "Tile Cost: " .. (tilecost * calibrationsperweek) + tiletax .. " h per week", tempx+550,400) + setNextFillColor(layer3,0.5,0.5,0.5,0.7) + addText(layer3, fontM2, tilecost .. " x " .. calibrationsperweek .. " + " .. tiletax , tempx+550,420) + + setNextFillColor(layer3,0.7,0.2,0.2,0.7) + addText(layer3, fontM2, "Transport Cost: " .. math.ceil(haulermass * hauldistance * 0.00025)*warpcellprice .. " h per haul", tempx+550,460) + setNextFillColor(layer3,0.5,0.5,0.5,0.7) + addText(layer3, fontM2, "(" .. haulermass .. " x " .. hauldistance .. " x 0.00025) x ".. warpcellprice, tempx+550,480) + + local wklyprfts = tilevalue - ((tilecost * calibrationsperweek) + tiletax) + local tileappraisal = (((wklyprfts * 2) - (math.ceil(haulermass * hauldistance * 0.00025)*warpcellprice))*2)*3 + if wklyprfts > 0 then + setNextFillColor(layer3,0.2,0.7,0.2,0.7) + else + setNextFillColor(layer3,0.7,0.2,0.2,0.7) + end + addText(layer3, fontM2, "Weekly Profit: " .. wklyprfts .. " h per week", tempx+550,520) + if tileappraisal > 0 then + setNextFillColor(layer3,0.2,0.2,0.7,0.7) + else + setNextFillColor(layer3,0.7,0.2,0.2,0.7) + end + addText(layer3, fontM2, "Tile Value: " .. tileappraisal .. " h after 3 months", tempx+550,560) +end + +function DrawCalibrationTable(tempx, tempy, tilevalue, tilecost) + --setNextFillColor(layer3,0.8,0.8,0.2,0.7) + --addText(layer3, fontM, "Calibrations:", tempx+550,340) + for xxb=1,10 do + if calibrations[xxb][1] ~= "" and calibrations[xxb][1] ~= nil and calibrations[xxb][1] ~= 0 then + local calibstring = "Unit #" .. calibrations[xxb][10] .. " - " .. calibrations[xxb][8] .. " - " .. calibrations[xxb][2] .. " - " .. calibrations[xxb][1] + setNextFillColor(layer3,0.5,0.5,0.5,0.7) + addText(layer3, fontM2, calibstring, tempx+550,380+((xxb - 1)*20)) + end + end +end + +function DrawButton(drawlayer, btnx, btny, btnw, btnh, btntxt, callfunc) + setNextFillColor(drawlayer, 0.4, 0, 0.4, 0.25) + if cx > btnx and cx < (btnx+btnw) then + if cy > btny and cy < (btny+btnh) then + if getCursorReleased() == true then + --clicked + setNextFillColor(drawlayer, 0.85, 0.75, 0, 0.5) + callfunc() + else + --hovered + setNextFillColor(drawlayer, 0.65, 0.55, 0, 0.25) + end + end + end + setNextStrokeWidth(drawlayer, 0) + addBoxRounded(drawlayer, btnx, btny, btnw, btnh, 5) + setNextFillColor(drawlayer, 1, 1, 1, 1) + local txtw, txty = getTextBounds(fontS,btntxt) + addText(drawlayer, fontS, btntxt, btnx + ((btnw - txtw)/2), btny + (btnh/2)+(txty/2)) +end + +assetimagehandle = loadImage("assets.prod.novaquark.com/66839/49273f08-d4ab-4e33-a5a1-c105b051b587.png") +local bgimg1 = loadImage("assets.prod.novaquark.com/66839/022069f8-6b81-42ac-8623-c3514f0b567b.png") +local bgimg2 = loadImage("assets.prod.novaquark.com/66839/e62c54b7-89ff-45ca-9bfe-30c320b66533.png") + +if showimgbg == 1 then + if showactivationscreen == 0 then + addImage(layer, bgimg2, 0, 0, rx, ry) + setNextFillColor(layer, 0, 0, 0, 0.75) + addBox(layer,0,0,rx,ry) + else + addImage(layer, bgimg1, 0, 0, rx, ry) + end +else + setNextFillColor(layer, 0, 0, 0, 1) + addBox(layer,0,0,rx,ry) +end + +if getInput() then + if getInput() == lastinput then + --do nothing + else + local inputstr = getInput() + local passed = 0 + local fullpass = 0 + if inputstr == "clear" or inputstr == nil then + --clear the mem array + for ix=1,maxMUs do + mem1[ix] = {} + for iy=1,maxMUdatarows do + mem1[ix][iy] = 0 + end + end + tickcount = 1 + showactivationscreen = 1 + fullpass = 1 + setOutput("Ack "..tickcount) + end + if inputstr == "refresh" then + tickcount = tickcount + 1 + setOutput("Ack "..tickcount) + end + if string.sub(inputstr,1,8) == "ACTIVATE" then + showactivationscreen = 0 + tickcount = tickcount + 1 + setOutput("Ack "..tickcount) + end + if string.sub(inputstr,1,7) == "MUSTATE" then + showactivationscreen = 0 + local munum = string.sub(inputstr,8,8) + inputstr = string.sub(inputstr,10,string.len(inputstr)) + local inputstr2 = "" + for iy2=1,maxMUdatarows do + if inputstr ~= nil and inputstr ~= "" then + if iy2 == maxMUdatarows then + inputstr2 = string.sub(inputstr,1,string.len(inputstr)) + inputstr = "" + else + inputstr2 = string.sub(inputstr,1,string.find(inputstr,",") - 1) + inputstr = string.sub(inputstr,string.find(inputstr,",")+1,string.len(inputstr)) + end + mem1[tonumber(munum)][iy2] = inputstr2 + end + end + if tonumber(munum) > maxMUs then + tickcount = 1 + end + tickcount = tickcount + 1 + setOutput("Ack "..tickcount) + end + if string.sub(inputstr,1,7) == "CALIBRT" then + local keynum = string.sub(inputstr,8,8) + inputstr = string.sub(inputstr,10,string.len(inputstr)) + local inputstr2 = "" + for iy2=1,10 do + if inputstr ~= nil and inputstr ~= "" then + if iy2 == 10 then + inputstr2 = string.sub(inputstr,1,string.len(inputstr)) + inputstr = "" + else + inputstr2 = string.sub(inputstr,1,string.find(inputstr,",") - 1) + inputstr = string.sub(inputstr,string.find(inputstr,",")+1,string.len(inputstr)) + end + calibrations[tonumber(keynum)][iy2] = inputstr2 + end + end + tickcount = tickcount + 1 + setOutput("CAL "..tickcount) + end + end +else + setOutput("") +end + +if showactivationscreen == 0 then + setNextFillColor(layer2, 0,0,0,0.6) + addBox(layer2,0,0,rx,ry) + + setNextFillColor(layer3, 0,0,0,0.6) + setNextShadow(layer3, 20,0,0,0,0.5) + addBoxRounded(layer3,20,20,rx - 40,ry - 40,30) + + setNextFillColor(layer3,0.3,0.3,0.3,0.5) + addText(layer3, fontLb, "[TYR] Mining Unit Control Uplink", rx*0.05,ry*0.1 ) + + for ix3=1,maxMUs do + tempx = (rx*0.18)-150 + tempy = (ry*0.12*ix3)+20 + if mem1[ix3][1] == 0 then + --dont draw if empty + else + --draw MU status text + local usrtext = mem1[ix3][1] + local errstate = 0 + if usrtext == "2" then + usrtext = "RUNNING" + setNextFillColor(layer3,0.85,0.75,0,0.5) + end + if usrtext == "4" then + setNextFillColor(layer3,1,1,0,0.5) + usrtext = "NO_OUTPUT" + errstate = 3 + end + if usrtext == "3" then + setNextFillColor(layer3,1,0.7,0,0.5) + usrtext = "FULL" + errstate = 2 + end + if usrtext == "1" then + setNextFillColor(layer3,1,0,0,0.5) + usrtext = "STOPPED" + errstate = 1 + end + addText(layer3, fontM, usrtext, tempx+(rx*0.13),tempy) + + --draw MU title + if errstate == 0 then + setNextFillColor(layer3,0.75,0.65,0,0.5) + else + setNextFillColor(layer3,0.9,0.9,0,0.5) + end + addText(layer3, fontM, "MU #" .. ix3, tempx,tempy) + + --cycle bounding box + setNextStrokeWidth(layer3,1) + if errstate == 0 then + setNextStrokeColor(layer3,0.3,0.3,0.3,1) + else + setNextStrokeColor(layer3,0.6,0.6,0.6,1) + end + setNextFillColor(layer3,0,0,0,0) + addBox(layer3,tempx,tempy+(ry*0.035*1)-15,(rx*0.22),5) + --cycle progress + local prcnt = round(1 - (mem1[ix3][2] / 3600), 2) + if errstate == 0 then + setNextFillColor(layer3,0.75,0.65,0.1,0.7) + else + setNextFillColor(layer3,0.8,0.1,0.1,0.7) + end + addBox(layer3,tempx,tempy+(ry*0.035*1)-15,(rx*0.22)*prcnt,5) + + + if mem1[ix3][3] == "ib_invaliditem_displayname" then + --do nothing + else + --display icon + local newimagehandle = loadImage(mem1[ix3][4]) + addImage(layer3, newimagehandle, tempx+295, tempy - 10, 50, 50) + setNextFillColor(layer3,0.8,0.8,0.2,0.7) + addText(layer3, fontM, mem1[ix3][3], tempx+355,tempy+15) + end + + --production highlight animation (must be drawn before the box itself) + animtick3 = animtick3 + 1 + if animtick3 > 100 then + animtick3 = 1 + end + drawBoxAnimation(animtick3,layer3,tempx,tempy+(ry*0.035*2)-25,(rx*0.22),15,errstate) + + --production bounding box + setNextStrokeWidth(layer3,3) + setNextStrokeColor(layer3,0.3,0.3,0.3,1) + if errstate == 0 then + setNextStrokeColor(layer3,0.3,0.3,0.3,1) + else + setNextStrokeColor(layer3,0.6,0.6,0.6,1) + end + setNextFillColor(layer3,0,0,0,0) + addBox(layer3,tempx,tempy+(ry*0.035*2)-25,(rx*0.22),15) + --production optimum rate + setNextFillColor(layer3,0.4,0.4,0.4,0.4) + addBox(layer3,tempx,tempy+(ry*0.035*2)-25,(rx*0.22)*mem1[ix3][9],15) + --production current rate + if errstate == 0 then + setNextFillColor(layer3,0.4,0,0.4,0.7) + else + setNextFillColor(layer3,0.8,0.1,0.1,0.7) + end + addBox(layer3,tempx,tempy+(ry*0.035*2)-25,(rx*0.22)*mem1[ix3][8],15) + setNextFillColor(layer3,0.6,0.6,0.6,0.5) + addText(layer3, fontM, round(mem1[ix3][10],2) .. " L/h", tempx,tempy+(ry*0.035*2)-10) + + setNextFillColor(layer3,0.6,0.6,0.6,0.5) + addText(layer3, fontM2, "+" .. mem1[ix3][7]*100 .. "% adj.", tempx+150,tempy+(ry*0.035*2)-10) + + --Draw icons to show calibration status + drawCircularProgressBar(layer3,tempx+265,tempy+(ry*0.035*2)-30,15,round(mem1[ix3][11])) + + if mem1[ix3][1] == "RUNNING" then + if mem1[ix3][12] == "" then + --Do Nothing + else + setNextFillColor(layer3,0.6,0.6,0.6,0.5) + local minervalue = ((tieravgs[mem1[ix3][12]] * round(mem1[ix3][10],2)) * 24) * 7 + tilevalue = tilevalue + minervalue + tilecost = tilecost + calibrationcost + addText(layer3, fontM2, minervalue .. " h per week", tempx+355,tempy+(ry*0.035*2)-10) + end + end + end + end + + animtick = animtick + 1 + if animtick > 230 then + animtick = 1 + end + drawHexWidget1(animtick) + + if animtick2switch == 0 then + animtick2 = animtick2 + 1 + else + animtick2 = animtick2 - 1 + end + if animtick2 > 50 or animtick2 < 1 then + if animtick2switch == 0 then + animtick2switch = 1 + else + animtick2switch = 0 + end + end + drawMUWidget1(animtick2) + + drawUplinkWidget(layer3,5,50,50,940,90) + + DrawMultiTableFrame() + + local output = function() multitablestate = 1 setOutput("EST") end + DrawButton(layer3, 680, 325, 100, 25, "Estimation", output) + local output = function() multitablestate = 2 setOutput("CAL") end + DrawButton(layer3, 570, 325, 100, 25, "Calibration", output) + + if multitablestate == 1 then + DrawEstimationsTable(35, 400, tilevalue, tilecost) + end + if multitablestate == 2 then + DrawCalibrationTable(35, 400) + end + DrawTYRFooter() +else + --PB is deactivated, show activation prompt + --setNextFillColor(layer2, 0,0,0,0.6) + --addBox(layer2,0,0,rx,ry) + + setNextFillColor(layer2, 0.9, 0.9, 0.9, 1) + setNextShadow(layer2, 20, 0, 0, 0, 0.85) + addText(layer2, fontL, "Mining Unit Control Uplink", rx*0.205,ry*0.675 ) + + setNextFillColor(layer2, 0.9, 0.7, 0, 0.75) + addText(layer2, fontM, "Activate Programming Board to view status.", rx*0.205,ry*0.72 ) +end + + + +--draw cursor +if cx > 0 and cx < rx then + if cy > 0 and cy < ry then + setNextStrokeWidth(layer3,1) + if cd == true then + setNextStrokeColor(layer3,0.2,0.4,0.6,1) + else + setNextStrokeColor(layer3,0.5,0.5,0.5,1) + end + setNextFillColor(layer3,0,0,0,0) + addCircle(layer3,cx,cy,8) + setNextStrokeWidth(layer3,1) + if cd == true then + setNextStrokeColor(layer3,0.1,0.3,0.6,1) + else + setNextStrokeColor(layer3,0.5,0.5,0.5,1) + end + setNextFillColor(layer3,0,0,0,0) + addCircle(layer3,cx,cy,2) + if contexttext ~= "" then + local bxwdth = (string.len(contexttext)*6)+10 + local xpos = cx+5 + if (cx + bxwdth) > rx then + xpos = xpos - bxwdth + end + setNextStrokeWidth(layer3,3) + setNextStrokeColor(layer3,0.0,0.2,0.5,0.8) + setNextFillColor(layer3,0.2,0.2,0.2,0.7) + addBox(layer3,xpos,cy+5,bxwdth,18) + setNextFillColor(layer3,1,1,0,0.7) + addText(layer3,fontS,contexttext,xpos+3,cy+18) + end + end +end + + +--Dev Overlay +if showdevoverlay == 1 then + local cursp = 0 + if getCursorPressed() == false then cursp = 0 else cursp = 1 end + local cursr = 0 + if getCursorReleased() == false then cursr = 0 else cursr = 1 end + setNextFillColor(devlayer, 1, 0, 0, 1) + addText(devlayer, fontM, "Mouse P/R: " .. cursp .. " / " .. cursr, rx*0.001, ry*0.12) + setNextFillColor(devlayer, 1, 0, 0, 1) + addText(devlayer, fontM, "Frame: " .. getDeltaTime(), rx*0.001, ry*0.08) + setNextFillColor(devlayer, 1, 0, 0, 1) + addText(devlayer, fontM, "Render Cost: " .. getRenderCost() .. " / " .. rcmax, rx*0.001, ry*0.03) +end + +requestAnimationFrame(1) \ No newline at end of file diff --git a/TYR Ship Kiosk/Readme.md b/TYR Ship Kiosk/Readme.md new file mode 100644 index 0000000..fd566c2 --- /dev/null +++ b/TYR Ship Kiosk/Readme.md @@ -0,0 +1,25 @@ +# TYR Ship Sales Kiosk + +This script displays all relevent flight-statistics and characteristics for a given construct in a tab-like widget, alongside an image roll of said construct. Use it to display ship models or building blueprints and tokens for sale. +Does NOT have the ability to record orders. This script is Screen-Unit ONLY. + +Originally written for TYR Expedition Group, I have been given permission to open source the code and provide it free to anyone who wishes to use it or improve upon it. + +You may remove the TYR branding at your discretion, however we ask that if you're going to use our script without significant modification, that you please at least keep the mostly-transparent footer at the bottom intact for our recognition. + +## Usage + +You will need:
+
+
+Installation steps: +
    +
  1. Copy the contents of the renderscript file and paste it into your Screen element, making sure you have LUA selected at the top. Ensure the screen is on.
  2. +
  3. Alter the variables at the top of the script to your needs. Every variable is commented with what info it should contain, or what it affects.
  4. +
  5. Provide an image-roll for the construct. Acceptable images are 900 pixels wide, and 600\*n pixels tall, where n = how many images you'd like to display.
    + Maximum height is limited by NQ's acceptable filesize, but generally you can have about 6 or 7 images per construct.
  6. +
  7. Restart the screen and press the BROWSE button to ensure everything is working smoothly.
  8. +

+
\ No newline at end of file diff --git a/TYR Ship Kiosk/TYR-Ship-Kiosk - renderscript.txt b/TYR Ship Kiosk/TYR-Ship-Kiosk - renderscript.txt new file mode 100644 index 0000000..fee4180 --- /dev/null +++ b/TYR Ship Kiosk/TYR-Ship-Kiosk - renderscript.txt @@ -0,0 +1,739 @@ +if not init then + screenactive = 0 + imagebg = 1 + imgindex = 0 + tabindex = 1 + shipindex = 0 + shipindexmax = 6 + contexttext = "" + mem1 = {} + for ix=0,6 do + mem1[ix] = {} + for iy=0,35 do + mem1[ix][iy] = 0 + end + end + mem1[0][0] = "TYR Gryphon C" --ship name + mem1[0][1] = "assets.prod.novaquark.com/66839/d1ea9707-88bf-41c5-88d4-0df7250db22b.png" --img src + mem1[0][2] = "XS" --core size + mem1[0][3] = "TYR Expeditionary Group" --maker / creator name + mem1[0][4] = "8.84 t" --dry mass + mem1[0][5] = "0 KL" --cargo volume + mem1[0][6] = "20 t" --cargo max mass + mem1[0][7] = "800 L" --ATMO Fuel capacity + mem1[0][8] = "0 L" --SPACE Fuel capacity + mem1[0][9] = "0 L" --ROCKET Fuel capacity + mem1[0][10] = "14.1 g" -- ATMO Thrust + mem1[0][11] = "25.8 g" -- ATMO Brake + mem1[0][12] = "1,431 KM/H" -- ATMO Max Speed + mem1[0][13] = "2.77 g" -- ATMO Low Alt Lift + mem1[0][14] = "2.64 g" -- ATMO High Alt Lift + mem1[0][15] = "364 KM/H" -- ATMO Sus Speed + mem1[0][16] = "0 g" -- SPACE Thrust + mem1[0][17] = "0 g" -- SPACE Brake + mem1[0][18] = "50,000 KM/H" -- SPACE Max Speed + mem1[0][19] = "0 g" -- SPACE Low Alt Lift + mem1[0][20] = "60.8 m2" -- Xsec Vert + mem1[0][21] = "12.9 m2" -- Xsec Front + mem1[0][22] = "18.9 m2" -- Xsec Lat + mem1[0][23] = "50 k" -- inert matrix 1,1 + mem1[0][24] = "-7.6" -- inert matrix 2,1 + mem1[0][25] = "-0.17" -- inert matrix 3,1 + mem1[0][26] = "-7.6" -- inert matrix 1,2 + mem1[0][27] = "40 k" -- inert matrix 2,2 + mem1[0][28] = "1.4 k" -- inert matrix 3,2 + mem1[0][29] = "-0.17" -- inert matrix 1,3 + mem1[0][30] = "1.4 k" -- inert matrix 2,3 + mem1[0][31] = "58 k" -- inert matrix 3,3 + mem1[0][32] = "10,000,000 quanta" -- TOKEN price + mem1[0][33] = "7,500,000 quanta" -- BLUEPRINT price + mem1[0][34] = 6 -- number of image sections used (MAX 6) + mem1[0][35] = 12 -- number of tokens available + mem1[0][36] = 999 -- number of blueprints available + + + mem1[1][0] = "TYR Rook E" + mem1[1][1] = "assets.prod.novaquark.com/66839/2283b727-8101-444c-ab3b-f71605633026.png" --img src + mem1[1][2] = "S" --core size + mem1[1][3] = "TYR Expeditionary Group" --maker / creator name + mem1[1][4] = "8.84 t" --dry mass + mem1[1][5] = "0 KL" --cargo volume + mem1[1][6] = "20 t" --cargo max mass + mem1[1][7] = "800 L" --ATMO Fuel capacity + mem1[1][8] = "0 L" --SPACE Fuel capacity + mem1[1][9] = "0 L" --ROCKET Fuel capacity + mem1[1][10] = "14.1 g" -- ATMO Thrust + mem1[1][11] = "25.8 g" -- ATMO Brake + mem1[1][12] = "1,431 KM/H" -- ATMO Max Speed + mem1[1][13] = "2.77 g" -- ATMO Low Alt Lift + mem1[1][14] = "2.64 g" -- ATMO High Alt Lift + mem1[1][15] = "364 KM/H" -- ATMO Sus Speed + mem1[1][16] = "0 g" -- SPACE Thrust + mem1[1][17] = "0 g" -- SPACE Brake + mem1[1][18] = "50,000 KM/H" -- SPACE Max Speed + mem1[1][19] = "0 g" -- SPACE Low Alt Lift + mem1[1][20] = "60.8 m2" -- Xsec Vert + mem1[1][21] = "12.9 m2" -- Xsec Front + mem1[1][22] = "18.9 m2" -- Xsec Lat + mem1[1][23] = "50 k" -- inert matrix 1,1 + mem1[1][24] = "-7.6" -- inert matrix 2,1 + mem1[1][25] = "-0.17" -- inert matrix 3,1 + mem1[1][26] = "-7.6" -- inert matrix 1,2 + mem1[1][27] = "40 k" -- inert matrix 2,2 + mem1[1][28] = "1.4 k" -- inert matrix 3,2 + mem1[1][29] = "-0.17" -- inert matrix 1,3 + mem1[1][30] = "1.4 k" -- inert matrix 2,3 + mem1[1][31] = "58 k" -- inert matrix 3,3 + mem1[1][32] = "15,000,000 quanta" -- TOKEN price + mem1[1][33] = "10,000,000 quanta" -- BLUEPRINT price + mem1[1][34] = 4 -- number of image sections used (MAX 6) + mem1[1][35] = 12 -- number of tokens available + mem1[1][36] = 999 -- number of blueprints available + + + mem1[2][0] = "TYR Gryphon C 2" --ship name + mem1[2][1] = "assets.prod.novaquark.com/66839/d1ea9707-88bf-41c5-88d4-0df7250db22b.png" --img src + mem1[2][2] = "XS" --core size + mem1[2][3] = "TYR Expeditionary Group" --maker / creator name + mem1[2][4] = "8.84 t" --dry mass + mem1[2][5] = "0 KL" --cargo volume + mem1[2][6] = "20 t" --cargo max mass + mem1[2][7] = "800 L" --ATMO Fuel capacity + mem1[2][8] = "0 L" --SPACE Fuel capacity + mem1[2][9] = "0 L" --ROCKET Fuel capacity + mem1[2][10] = "14.1 g" -- ATMO Thrust + mem1[2][11] = "25.8 g" -- ATMO Brake + mem1[2][12] = "1,431 KM/H" -- ATMO Max Speed + mem1[2][13] = "2.77 g" -- ATMO Low Alt Lift + mem1[2][14] = "2.64 g" -- ATMO High Alt Lift + mem1[2][15] = "364 KM/H" -- ATMO Sus Speed + mem1[2][16] = "0 g" -- SPACE Thrust + mem1[2][17] = "0 g" -- SPACE Brake + mem1[2][18] = "50,000 KM/H" -- SPACE Max Speed + mem1[2][19] = "0 g" -- SPACE Low Alt Lift + mem1[2][20] = "60.8 m2" -- Xsec Vert + mem1[2][21] = "12.9 m2" -- Xsec Front + mem1[2][22] = "18.9 m2" -- Xsec Lat + mem1[2][23] = "50 k" -- inert matrix 1,1 + mem1[2][24] = "-7.6" -- inert matrix 2,1 + mem1[2][25] = "-0.17" -- inert matrix 3,1 + mem1[2][26] = "-7.6" -- inert matrix 1,2 + mem1[2][27] = "40 k" -- inert matrix 2,2 + mem1[2][28] = "1.4 k" -- inert matrix 3,2 + mem1[2][29] = "-0.17" -- inert matrix 1,3 + mem1[2][30] = "1.4 k" -- inert matrix 2,3 + mem1[2][31] = "58 k" -- inert matrix 3,3 + mem1[2][32] = "10,000,000 quanta" -- TOKEN price + mem1[2][33] = "7,500,000 quanta" -- BLUEPRINT price + mem1[2][34] = 5 -- number of image sections used (MAX 6) + mem1[2][35] = 0 -- number of tokens available + mem1[2][36] = 999 -- number of blueprints available + + + mem1[3][0] = "TYR Rook E 2" + mem1[3][1] = "assets.prod.novaquark.com/66839/2283b727-8101-444c-ab3b-f71605633026.png" --img src + mem1[3][2] = "S" --core size + mem1[3][3] = "TYR Expeditionary Group" --maker / creator name + mem1[3][4] = "8.84 t" --dry mass + mem1[3][5] = "0 KL" --cargo volume + mem1[3][6] = "20 t" --cargo max mass + mem1[3][7] = "800 L" --ATMO Fuel capacity + mem1[3][8] = "0 L" --SPACE Fuel capacity + mem1[3][9] = "0 L" --ROCKET Fuel capacity + mem1[3][10] = "14.1 g" -- ATMO Thrust + mem1[3][11] = "25.8 g" -- ATMO Brake + mem1[3][12] = "1,431 KM/H" -- ATMO Max Speed + mem1[3][13] = "2.77 g" -- ATMO Low Alt Lift + mem1[3][14] = "2.64 g" -- ATMO High Alt Lift + mem1[3][15] = "364 KM/H" -- ATMO Sus Speed + mem1[3][16] = "0 g" -- SPACE Thrust + mem1[3][17] = "0 g" -- SPACE Brake + mem1[3][18] = "50,000 KM/H" -- SPACE Max Speed + mem1[3][19] = "0 g" -- SPACE Low Alt Lift + mem1[3][20] = "60.8 m2" -- Xsec Vert + mem1[3][21] = "12.9 m2" -- Xsec Front + mem1[3][22] = "18.9 m2" -- Xsec Lat + mem1[3][23] = "50 k" -- inert matrix 1,1 + mem1[3][24] = "-7.6" -- inert matrix 2,1 + mem1[3][25] = "-0.17" -- inert matrix 3,1 + mem1[3][26] = "-7.6" -- inert matrix 1,2 + mem1[3][27] = "40 k" -- inert matrix 2,2 + mem1[3][28] = "1.4 k" -- inert matrix 3,2 + mem1[3][29] = "-0.17" -- inert matrix 1,3 + mem1[3][30] = "1.4 k" -- inert matrix 2,3 + mem1[3][31] = "58 k" -- inert matrix 3,3 + mem1[3][32] = "15,000,000 quanta" -- TOKEN price + mem1[3][33] = "10,000,000 quanta" -- BLUEPRINT price + mem1[3][34] = 6 -- number of image sections used (MAX 6) + mem1[3][35] = 12 -- number of tokens available + mem1[3][36] = 0 -- number of blueprints available + + + mem1[4][0] = "TYR Gryphon C 3" --ship name + mem1[4][1] = "assets.prod.novaquark.com/66839/d1ea9707-88bf-41c5-88d4-0df7250db22b.png" --img src + mem1[4][2] = "XS" --core size + mem1[4][3] = "TYR Expeditionary Group" --maker / creator name + mem1[4][4] = "8.84 t" --dry mass + mem1[4][5] = "0 KL" --cargo volume + mem1[4][6] = "20 t" --cargo max mass + mem1[4][7] = "800 L" --ATMO Fuel capacity + mem1[4][8] = "0 L" --SPACE Fuel capacity + mem1[4][9] = "0 L" --ROCKET Fuel capacity + mem1[4][10] = "14.1 g" -- ATMO Thrust + mem1[4][11] = "25.8 g" -- ATMO Brake + mem1[4][12] = "1,431 KM/H" -- ATMO Max Speed + mem1[4][13] = "2.77 g" -- ATMO Low Alt Lift + mem1[4][14] = "2.64 g" -- ATMO High Alt Lift + mem1[4][15] = "364 KM/H" -- ATMO Sus Speed + mem1[4][16] = "0 g" -- SPACE Thrust + mem1[4][17] = "0 g" -- SPACE Brake + mem1[4][18] = "50,000 KM/H" -- SPACE Max Speed + mem1[4][19] = "0 g" -- SPACE Low Alt Lift + mem1[4][20] = "60.8 m2" -- Xsec Vert + mem1[4][21] = "12.9 m2" -- Xsec Front + mem1[4][22] = "18.9 m2" -- Xsec Lat + mem1[4][23] = "50 k" -- inert matrix 1,1 + mem1[4][24] = "-7.6" -- inert matrix 2,1 + mem1[4][25] = "-0.17" -- inert matrix 3,1 + mem1[4][26] = "-7.6" -- inert matrix 1,2 + mem1[4][27] = "40 k" -- inert matrix 2,2 + mem1[4][28] = "1.4 k" -- inert matrix 3,2 + mem1[4][29] = "-0.17" -- inert matrix 1,3 + mem1[4][30] = "1.4 k" -- inert matrix 2,3 + mem1[4][31] = "58 k" -- inert matrix 3,3 + mem1[4][32] = "10,000,000 quanta" -- TOKEN price + mem1[4][33] = "7,500,000 quanta" -- BLUEPRINT price + mem1[4][34] = 4 -- number of image sections used (MAX 6) + mem1[4][35] = 12 -- number of tokens available + mem1[4][36] = 999 -- number of blueprints available + + + mem1[5][0] = "TYR Rook E 3" + mem1[5][1] = "assets.prod.novaquark.com/66839/2283b727-8101-444c-ab3b-f71605633026.png" --img src + mem1[5][2] = "S" --core size + mem1[5][3] = "TYR Expeditionary Group" --maker / creator name + mem1[5][4] = "8.84 t" --dry mass + mem1[5][5] = "0 KL" --cargo volume + mem1[5][6] = "20 t" --cargo max mass + mem1[5][7] = "800 L" --ATMO Fuel capacity + mem1[5][8] = "0 L" --SPACE Fuel capacity + mem1[5][9] = "0 L" --ROCKET Fuel capacity + mem1[5][10] = "14.1 g" -- ATMO Thrust + mem1[5][11] = "25.8 g" -- ATMO Brake + mem1[5][12] = "1,431 KM/H" -- ATMO Max Speed + mem1[5][13] = "2.77 g" -- ATMO Low Alt Lift + mem1[5][14] = "2.64 g" -- ATMO High Alt Lift + mem1[5][15] = "364 KM/H" -- ATMO Sus Speed + mem1[5][16] = "0 g" -- SPACE Thrust + mem1[5][17] = "0 g" -- SPACE Brake + mem1[5][18] = "50,000 KM/H" -- SPACE Max Speed + mem1[5][19] = "0 g" -- SPACE Low Alt Lift + mem1[5][20] = "60.8 m2" -- Xsec Vert + mem1[5][21] = "12.9 m2" -- Xsec Front + mem1[5][22] = "18.9 m2" -- Xsec Lat + mem1[5][23] = "50 k" -- inert matrix 1,1 + mem1[5][24] = "-7.6" -- inert matrix 2,1 + mem1[5][25] = "-0.17" -- inert matrix 3,1 + mem1[5][26] = "-7.6" -- inert matrix 1,2 + mem1[5][27] = "40 k" -- inert matrix 2,2 + mem1[5][28] = "1.4 k" -- inert matrix 3,2 + mem1[5][29] = "-0.17" -- inert matrix 1,3 + mem1[5][30] = "1.4 k" -- inert matrix 2,3 + mem1[5][31] = "58 k" -- inert matrix 3,3 + mem1[5][32] = "15,000,000 quanta" -- TOKEN price + mem1[5][33] = "10,000,000 quanta" -- BLUEPRINT price + mem1[5][34] = 6 -- number of image sections used (MAX 6) + mem1[5][35] = 12 -- number of tokens available + mem1[5][36] = 999 -- number of blueprints available + + color1R, color1G, color1B, color1A = 0.35, 0.35, 0.35, 0.15 --export:UI Panel BG Color + color2R, color2G, color2B, color2A = 0.75, 0.75, 0.75, 0.25 --export:UI Element BG, Hover + color3R, color3G, color3B, color3A = 0.9, 0.75, 0.25, 0.25 --export:UI Element BG, Selected + color4R, color4G, color4B, color4A = 0.5, 0.5, 0.5, 0.15 --export:UI Element Outline + color5R, color5G, color5B, color5A = 0.75, 0.75, 0.75, 0.75 --export:UI Element Text + color6R, color6G, color6B, color6A = 1.1, 0.6, 0.2, 0.2 --export:Index Widget Idle + color7R, color7G, color7B, color7A = 1.1, 0.8, 0.2, 0.4 --export:Index Widget Selected + color8R, color8G, color8B, color8A = 0, 0, 0, 0.5 --export:Shadow color + color9R, color9G, color9B, color9A = 0.05, 0.05, 0.05, 0.75 --export:BG Tint Color + color11R, color11G, color11B, color11A = 0.6, 0.4, 0, 1 --export:Header Text Color-BG + color12R, color12G, color12B, color12A = 0.9, 0.7, 0, 1 --export:Header Text Color-FG + color13R, color13G, color13B, color13A = 1,1,1,1 --export:Start Screen Header1 Text Color + color14R, color14G, color14B, color14A = 0.9,0.9,0.9,1 --export:Start Screen Header2 Text Color + color15R, color15G, color15B, color15A = 0.8,0.6,0.2,1 --export:Start Screen Header3 Text Color + color16R, color16G, color16B, color16A = 0.6, 0.6, 0.6, 1 --export:Stat Name Text Color + color17R, color17G, color17B, color17A = 0.9, 0.9, 0.9, 1 --export:Stat Text Color + color18R, color18G, color18B, color18A = 0.5, 0, 0, 1 --export:Out-Of-Stock Text Color-BG + color19R, color19G, color19B, color19A = 0.9, 0, 0, 1 --export:Out-Of-Stock Text Color-FG + color21R, color21G, color21B, color21A = 0.5,0.5,0.5,1 --export:Cursor Normal Color + color22R, color22G, color22B, color22A = 0.8,0.6,0.2,1 --export:Cursor Click-Down Color + color23R, color23G, color23B, color23A = 0.2,0.2,0.2,1 --export:Ship Creator Text Color-BG + color24R, color24G, color24B, color24A = 0.5,0.5,0.5,1 --export:Ship Creator Text Color-FG + + devoverlay = false + init = true +end +local layer = createLayer() -- Main Background +local layer2 = createLayer() -- image +local layer3 = createLayer() -- UI / Text +local layer4 = createLayer() -- cursor +local rx, ry = getResolution() +local fontL = loadFont("Play", 100) +local fontM = loadFont("Play", 50) +local fontS = loadFont("Play", 20) +local fontT1 = loadFont("Play", 60) +local fontT2 = loadFont("Play-Bold", 60) +local fontT3 = loadFont("Play", 20) +local cx, cy = getCursor() +local cd = getCursorDown() +local cp = getCursorPressed() +local cr = getCursorReleased() + +local bgimg1 = loadImage("assets.prod.novaquark.com/66839/022069f8-6b81-42ac-8623-c3514f0b567b.png") +local bgimg2 = loadImage("assets.prod.novaquark.com/66839/e62c54b7-89ff-45ca-9bfe-30c320b66533.png") + +if imagebg == 1 then + if screenactive == 1 then + addImage(layer, bgimg2, 0, 0, rx, ry) + setNextFillColor(layer, color9R, color9G, color9B, color9A) + addBox(layer,0,0,rx,ry) + else + addImage(layer, bgimg1, 0, 0, rx, ry) + end +else + setNextFillColor(layer, color9R, color9G, color9B, 1) + addBox(layer,0,0,rx,ry) +end + +function DrawTYRFooter() + --If you modify our script, please leave this intact + setNextFillColor(layer4, 1, 1, 1, 0.1) + addText(layer4, fontS, "Developed by TYR Expeditionary Group", rx*0.65, ry - 15) + setNextFillColor(layer4, 1, 1, 1, 0.2) + addText(layer4, fontS, "Developed by TYR Expeditionary Group", rx*0.65 - 2, ry - 15 - 2) +end + +function DrawButton(drawlayer, btnx, btny, btnw, btnh, btntxt) + setNextFillColor(drawlayer, color1R, color1G, color1B, color1A) + if cx > btnx then + if cx < btnx+btnw then + if cy > btny then + if cy < (btny+btnh) then + if getCursorReleased() == true then + --clicked + if btntxt == " BROWSE " then + screenactive = 1 + end + if btntxt == "<<<" then + if imgindex > 0 then + imgindex = imgindex - 1 + end + end + if btntxt == ">>>" then + if imgindex < mem1[shipindex][34] - 1 then + imgindex = imgindex + 1 + end + end + if btntxt == "<<" then + if shipindex > 0 then + shipindex = shipindex - 1 + imgindex = 0 + end + end + if btntxt == ">>" then + if shipindex < shipindexmax - 1 then + shipindex = shipindex + 1 + imgindex = 0 + end + end + if btntxt == "Power" then + tabindex = 1 + end + if btntxt == "Flight" then + tabindex = 2 + end + if btntxt == "Capacity" then + tabindex = 3 + end + setNextFillColor(drawlayer, color3R, color3G, color3B, color3A) + else + --hovered + setNextFillColor(drawlayer, color2R, color2G, color2B, color2A) + end + end + end + end + end + if btntxt == "Power" and tabindex == 1 then + setNextFillColor(drawlayer, color3R, color3G, color3B, color3A) + end + if btntxt == "Flight" and tabindex == 2 then + setNextFillColor(drawlayer, color3R, color3G, color3B, color3A) + end + if btntxt == "Capacity" and tabindex == 3 then + setNextFillColor(drawlayer, color3R, color3G, color3B, color3A) + end + setNextStrokeColor(drawlayer, color4R, color4G, color4B, color4A) + setNextStrokeWidth(drawlayer, 5) + setNextShadow(drawlayer, 25, color8R, color8G, color8B, color8A) + addBoxRounded(drawlayer, btnx, btny, btnw, btnh, 5) + setNextFillColor(drawlayer, color5R, color5G, color5B, color5A) + addText(drawlayer, fontS, btntxt, btnx + (rx*0.005), btny + (ry*0.05)) +end + +function DrawImageSubWithShadow(drawlayer, imgx, imgy, imgw, imgh, subx, suby, subw, subh, shadrad) + setNextShadow(drawlayer, shadrad, color8R, color8G, color8B, color8A) + setNextFillColor(drawlayer, color8R, color8G, color8B, 0) + addBox(drawlayer,imgx,imgy,imgw,imgh) + local imghandle = loadImage(mem1[shipindex][1]) + addImageSub(drawlayer, imghandle, imgx, imgy, imgw, imgh, subx, suby + (imgindex * 600), subw, subh) +end + +function DrawIndexWidget(drawlayer, px, py, sx, sy, index, indmax) + for xb=0,indmax do + if xb == index then + setNextFillColor(drawlayer, color7R, color7G, color7B, color7A) + else + setNextFillColor(drawlayer, color6R, color6G, color6B, color6A) + end + addCircle(drawlayer, px + (sx * (xb/indmax)), py, 10) + end +end + +function DrawNameRibbon() + --ribbon + setNextFillColor(layer3, color1R, color1G, color1B, color1A) + setNextShadow(layer3, 25, color8R, color8G, color8B, color8A) + addBox(layer3, 0, 5, rx, 60) + + --Ship Name + setNextFillColor(layer3, color11R, color11G, color11B, color11A) + addText(layer3, fontM, mem1[shipindex][0], rx * 0.075, ry * 0.085) + setNextFillColor(layer3, color12R, color12G, color12B, color12A) + addText(layer3, fontM, mem1[shipindex][0], rx * 0.075 - 2, ry * 0.085 - 2) + + --Draw Ship Index Widget + DrawIndexWidget(layer3, 675, 35, 250, 0, shipindex, shipindexmax - 1) + + --Creator Name + setNextFillColor(layer3, color1R, color1G, color1B, color1A) + setNextShadow(layer3, 25, color8R, color8G, color8B, color8A) + addBox(layer3, rx * 0.075 - 20, ry * 0.13 - 15, string.len(mem1[shipindex][3]) * 15, 20) + + setNextFillColor(layer3, color23R, color23G, color23B, color23A) + addText(layer3, fontS, mem1[shipindex][3], rx * 0.075, ry * 0.13) + setNextFillColor(layer3, color24R, color24G, color24B, color24A) + addText(layer3, fontS, mem1[shipindex][3], rx * 0.075 - 1, ry * 0.13 - 1) + + --Ship Display Controls + DrawButton(layer3,10,10,35,50,"<<") + DrawButton(layer3,rx - 45,10,35,50,">>") +end + +function DrawTabControl(drawlayer, px, py) + setNextFillColor(drawlayer, color1R, color1G, color1B, color1A) + setNextStrokeColor(drawlayer, color4R, color4G, color4B, color4A) + setNextStrokeWidth(drawlayer, 3) + setNextShadow(drawlayer, 25, color8R, color8G, color8B, color8A) + addBoxRounded(drawlayer, px, py, rx * 0.325, ry * 0.55, 5) + + if tabindex == 1 then + setNextFillColor(drawlayer, color11R, color11G, color11B, color11A) + addText(drawlayer, fontS, "ATMO:", px + 25, py + (ry * 0.035)) + setNextFillColor(drawlayer, color12R, color12G, color12B, color12A) + addText(drawlayer, fontS, "ATMO:", px + 25 - 2, py + (ry * 0.035) - 2) + + setNextFillColor(drawlayer, color16R, color16G, color16B, color16A) + addText(drawlayer, fontS, "Max Thrust:", px + 5, py + (ry * 0.0675)) + setNextFillColor(drawlayer, color17R, color17G, color17B, color17A) + addText(drawlayer, fontS, mem1[shipindex][10], px + 165, py + (ry * 0.0675)) + + setNextFillColor(drawlayer, color16R, color16G, color16B, color16A) + addText(drawlayer, fontS, "Brake Force:", px + 5, py + (ry * 0.1)) + setNextFillColor(drawlayer, color17R, color17G, color17B, color17A) + addText(drawlayer, fontS, mem1[shipindex][11], px + 165, py + (ry * 0.1)) + + setNextFillColor(drawlayer, color16R, color16G, color16B, color16A) + addText(drawlayer, fontS, "Max Speed:", px + 5, py + (ry * 0.1325)) + setNextFillColor(drawlayer, color17R, color17G, color17B, color17A) + addText(drawlayer, fontS, mem1[shipindex][12], px + 165, py + (ry * 0.1325)) + + setNextFillColor(drawlayer, color16R, color16G, color16B, color16A) + addText(drawlayer, fontS, "Low Alt Lift:", px + 5, py + (ry * 0.165)) + setNextFillColor(drawlayer, color17R, color17G, color17B, color17A) + addText(drawlayer, fontS, mem1[shipindex][13], px + 165, py + (ry * 0.165)) + + setNextFillColor(drawlayer, color16R, color16G, color16B, color16A) + addText(drawlayer, fontS, "High Alt Lift:", px + 5, py + (ry * 0.1975)) + setNextFillColor(drawlayer, color17R, color17G, color17B, color17A) + addText(drawlayer, fontS, mem1[shipindex][14], px + 165, py + (ry * 0.1975)) + + setNextFillColor(drawlayer, color16R, color16G, color16B, color16A) + addText(drawlayer, fontS, "Sust. Speed:", px + 5, py + (ry * 0.23)) + setNextFillColor(drawlayer, color17R, color17G, color17B, color17A) + addText(drawlayer, fontS, mem1[shipindex][15], px + 165, py + (ry * 0.23)) + + setNextFillColor(drawlayer, color11R, color11G, color11B, color11A) + addText(drawlayer, fontS, "SPACE:", px + 25, py + (ry * 0.285)) + setNextFillColor(drawlayer, color12R, color12G, color12B, color12A) + addText(drawlayer, fontS, "SPACE:", px + 25 - 2, py + (ry * 0.285) - 2) + + setNextFillColor(drawlayer, color16R, color16G, color16B, color16A) + addText(drawlayer, fontS, "Max Thrust:", px + 5, py + (ry * 0.3175)) + setNextFillColor(drawlayer, color17R, color17G, color17B, color17A) + addText(drawlayer, fontS, mem1[shipindex][16], px + 165, py + (ry * 0.3175)) + + setNextFillColor(drawlayer, color16R, color16G, color16B, color16A) + addText(drawlayer, fontS, "Brake Force:", px + 5, py + (ry * 0.35)) + setNextFillColor(drawlayer, color17R, color17G, color17B, color17A) + addText(drawlayer, fontS, mem1[shipindex][17], px + 165, py + (ry * 0.35)) + + setNextFillColor(drawlayer, color16R, color16G, color16B, color16A) + addText(drawlayer, fontS, "Max Speed:", px + 5, py + (ry * 0.385)) + setNextFillColor(drawlayer, color17R, color17G, color17B, color17A) + addText(drawlayer, fontS, mem1[shipindex][18], px + 165, py + (ry * 0.385)) + + setNextFillColor(drawlayer, color16R, color16G, color16B, color16A) + addText(drawlayer, fontS, "Low Alt Lift:", px + 5, py + (ry * 0.42)) + setNextFillColor(drawlayer, color17R, color17G, color17B, color17A) + addText(drawlayer, fontS, mem1[shipindex][19], px + 165, py + (ry * 0.42)) + end + + if tabindex == 2 then + setNextFillColor(drawlayer, color11R, color11G, color11B, color11A) + addText(drawlayer, fontS, "X SECTION:", px + 25, py + (ry * 0.035)) + setNextFillColor(drawlayer, color12R, color12G, color12B, color12A) + addText(drawlayer, fontS, "X SECTION:", px + 25 - 2, py + (ry * 0.035) - 2) + + setNextFillColor(drawlayer, color16R, color16G, color16B, color16A) + addText(drawlayer, fontS, "Vertical:", px + 5, py + (ry * 0.0675)) + setNextFillColor(drawlayer, color17R, color17G, color17B, color17A) + addText(drawlayer, fontS, mem1[shipindex][20], px + 165, py + (ry * 0.0675)) + + setNextFillColor(drawlayer, color16R, color16G, color16B, color16A) + addText(drawlayer, fontS, "Frontal:", px + 5, py + (ry * 0.1)) + setNextFillColor(drawlayer, color17R, color17G, color17B, color17A) + addText(drawlayer, fontS, mem1[shipindex][21], px + 165, py + (ry * 0.1)) + + setNextFillColor(drawlayer, color16R, color16G, color16B, color16A) + addText(drawlayer, fontS, "Lateral:", px + 5, py + (ry * 0.1325)) + setNextFillColor(drawlayer, color17R, color17G, color17B, color17A) + addText(drawlayer, fontS, mem1[shipindex][22], px + 165, py + (ry * 0.1325)) + + + setNextFillColor(drawlayer, color11R, color11G, color11B, color11A) + addText(drawlayer, fontS, "INERTIA MATRIX:", px + 25, py + (ry * 0.2075)) + setNextFillColor(drawlayer, color12R, color12G, color12B, color12A) + addText(drawlayer, fontS, "INERTIA MATRIX:", px + 25 - 2, py + (ry * 0.2075) - 2) + + setNextFillColor(drawlayer, color17R, color17G, color17B, color17A) + addText(drawlayer, fontS, mem1[shipindex][23], px + 5, py + (ry * 0.25)) + + setNextFillColor(drawlayer, color17R, color17G, color17B, color17A) + addText(drawlayer, fontS, mem1[shipindex][24], px + 100, py + (ry * 0.25)) + + setNextFillColor(drawlayer, color17R, color17G, color17B, color17A) + addText(drawlayer, fontS, mem1[shipindex][25], px + 195, py + (ry * 0.25)) + + setNextFillColor(drawlayer, color17R, color17G, color17B, color17A) + addText(drawlayer, fontS, mem1[shipindex][26], px + 5, py + (ry * 0.29)) + + setNextFillColor(drawlayer, color17R, color17G, color17B, color17A) + addText(drawlayer, fontS, mem1[shipindex][27], px + 100, py + (ry * 0.29)) + + setNextFillColor(drawlayer, color17R, color17G, color17B, color17A) + addText(drawlayer, fontS, mem1[shipindex][28], px + 195, py + (ry * 0.29)) + + setNextFillColor(drawlayer, color17R, color17G, color17B, color17A) + addText(drawlayer, fontS, mem1[shipindex][29], px + 5, py + (ry * 0.33)) + + setNextFillColor(drawlayer, color17R, color17G, color17B, color17A) + addText(drawlayer, fontS, mem1[shipindex][30], px + 100, py + (ry * 0.33)) + + setNextFillColor(drawlayer, color17R, color17G, color17B, color17A) + addText(drawlayer, fontS, mem1[shipindex][31], px + 195, py + (ry * 0.33)) + end + + if tabindex == 3 then + setNextFillColor(drawlayer, color11R, color11G, color11B, color11A) + addText(drawlayer, fontS, "CAPACITY:", px + 25, py + (ry * 0.035)) + setNextFillColor(drawlayer, color12R, color12G, color12B, color12A) + addText(drawlayer, fontS, "CAPACITY:", px + 25 - 2, py + (ry * 0.035) - 2) + + setNextFillColor(drawlayer, color16R, color16G, color16B, color16A) + addText(drawlayer, fontS, "Mass:", px + 5, py + (ry * 0.0675)) + setNextFillColor(drawlayer, color17R, color17G, color17B, color17A) + addText(drawlayer, fontS, mem1[shipindex][4], px + 165, py + (ry * 0.0675)) + + setNextFillColor(drawlayer, color16R, color16G, color16B, color16A) + addText(drawlayer, fontS, "Volume:", px + 5, py + (ry * 0.1)) + setNextFillColor(drawlayer, color17R, color17G, color17B, color17A) + addText(drawlayer, fontS, mem1[shipindex][5], px + 165, py + (ry * 0.1)) + + setNextFillColor(drawlayer, color16R, color16G, color16B, color16A) + addText(drawlayer, fontS, "Max Mass:", px + 5, py + (ry * 0.1325)) + setNextFillColor(drawlayer, color17R, color17G, color17B, color17A) + addText(drawlayer, fontS, mem1[shipindex][6], px + 165, py + (ry * 0.1325)) + + + setNextFillColor(drawlayer, color11R, color11G, color11B, color11A) + addText(drawlayer, fontS, "FUEL:", px + 25, py + (ry * 0.285)) + setNextFillColor(drawlayer, color12R, color12G, color12B, color12A) + addText(drawlayer, fontS, "FUEL:", px + 25 - 2, py + (ry * 0.285) - 2) + + setNextFillColor(drawlayer, color16R, color16G, color16B, color16A) + addText(drawlayer, fontS, "Atmo:", px + 5, py + (ry * 0.3175)) + setNextFillColor(drawlayer, color17R, color17G, color17B, color17A) + addText(drawlayer, fontS, mem1[shipindex][7], px + 165, py + (ry * 0.3175)) + + setNextFillColor(drawlayer, color16R, color16G, color16B, color16A) + addText(drawlayer, fontS, "Space:", px + 5, py + (ry * 0.35)) + setNextFillColor(drawlayer, color17R, color17G, color17B, color17A) + addText(drawlayer, fontS, mem1[shipindex][8], px + 165, py + (ry * 0.35)) + + setNextFillColor(drawlayer, color16R, color16G, color16B, color16A) + addText(drawlayer, fontS, "Rocket:", px + 5, py + (ry * 0.385)) + setNextFillColor(drawlayer, color17R, color17G, color17B, color17A) + addText(drawlayer, fontS, mem1[shipindex][9], px + 165, py + (ry * 0.385)) + end +end + +if screenactive == 0 then + setNextFillColor(layer2,color14R, color14G, color14B, color14A) + setNextShadow(layer2, 20, color8R, color8G, color8B, 0.85) + addText(layer2, fontT2, "Ship Sales Kiosk", rx*0.205,ry*0.675 ) + + setNextFillColor(layer2,color15R, color15G, color15B, color15A) + addText(layer2, fontT3, "Click BROWSE to view our luxury ships.", rx*0.205,ry*0.72 ) + + setNextShadow(layer2, 20, color8R, color8G, color8B, color8A) + DrawButton(layer3,rx * 0.725,ry * 0.675,110,50," BROWSE ") +else + --display header ribbon + DrawNameRibbon() + + --Main Image Display + DrawImageSubWithShadow(layer2, 50,100,600,400, 0,0,900,600, 25) + + --Draw Image Index Widget + DrawIndexWidget(layer3, 250, 475, 200, 0, imgindex, mem1[shipindex][34] - 1) + + --Image Display Controls + DrawButton(layer3,57,ry * 0.725,50,50,"<<<") + DrawButton(layer3,rx * 0.58,ry * 0.725,50,50,">>>") + + --Ship statistics tab control + DrawButton(layer3,rx * 0.65,ry * 0.15,70,50,"Power") + DrawButton(layer3,rx * 0.735,ry * 0.15,65,50,"Flight") + DrawButton(layer3,rx * 0.815,ry * 0.15,85,50,"Capacity") + + --Draw Tab Control + DrawTabControl(layer3,rx * 0.65,ry * 0.27) + + --Draw Core Size + setNextFillColor(layer3, color16R, color16G, color16B, color16A) + addText(layer3, fontS, "Core: " .. mem1[shipindex][2], rx * 0.915, ry * 0.225) + + --price display + setNextFillColor(layer3, color11R, color11G, color11B, color11A) + addText(layer3, fontS, "BLUEPRINT:", rx * 0.075, ry * 0.9) + setNextFillColor(layer3, color12R, color12G, color12B, color12A) + addText(layer3, fontS, "BLUEPRINT:", rx * 0.075 - 1, ry * 0.9 - 1) + + setNextFillColor(layer3, color17R, color17G, color17B, color17A) + addText(layer3, fontS, mem1[shipindex][33], rx * 0.2, ry * 0.9) + + setNextFillColor(layer3, color11R, color11G, color11B, color11A) + addText(layer3, fontS, "TOKEN:", rx * 0.075, ry * 0.95) + setNextFillColor(layer3, color12R, color12G, color12B, color12A) + addText(layer3, fontS, "TOKEN:", rx * 0.075 - 1, ry * 0.95 - 1) + + setNextFillColor(layer3, color17R, color17G, color17B, color17A) + addText(layer3, fontS, mem1[shipindex][32], rx * 0.2, ry * 0.95) + + + --stock display + if mem1[shipindex][36] > 0 then + setNextFillColor(layer3, color11R, color11G, color11B, color11A) + addText(layer3, fontS, "IN STOCK:", rx * 0.475, ry * 0.9) + setNextFillColor(layer3, color12R, color12G, color12B, color12A) + addText(layer3, fontS, "IN STOCK:", rx * 0.475 - 1, ry * 0.9 - 1) + + setNextFillColor(layer3, color17R, color17G, color17B, color17A) + addText(layer3, fontS, mem1[shipindex][36], rx * 0.575, ry * 0.9) + else + setNextFillColor(layer3, color18R, color18G, color18B, color18A) + addText(layer3, fontS, "OUT OF STOCK :(", rx * 0.475, ry * 0.9) + setNextFillColor(layer3, color19R, color19G, color19B, color19A) + addText(layer3, fontS, "OUT OF STOCK :(", rx * 0.475 - 1, ry * 0.9 - 1) + end + + if mem1[shipindex][35] > 0 then + setNextFillColor(layer3, color11R, color11G, color11B, color11A) + addText(layer3, fontS, "IN STOCK:", rx * 0.475, ry * 0.95) + setNextFillColor(layer3, color12R, color12G, color12B, color12A) + addText(layer3, fontS, "IN STOCK:", rx * 0.475 - 1, ry * 0.95 - 1) + + setNextFillColor(layer3, color17R, color17G, color17B, color17A) + addText(layer3, fontS, mem1[shipindex][35], rx * 0.575, ry * 0.95) + else + setNextFillColor(layer3, color18R, color18G, color18B, color18A) + addText(layer3, fontS, "OUT OF STOCK :(", rx * 0.475, ry * 0.95) + setNextFillColor(layer3, color19R, color19G, color19B, color19A) + addText(layer3, fontS, "OUT OF STOCK :(", rx * 0.475 - 1, ry * 0.95 - 1) + end + DrawTYRFooter() +end + + + + +if cx > 0 and cx < rx then + if cy > 0 and cy < ry then + setNextStrokeWidth(layer4,1) + if cd == true then + setNextStrokeColor(layer4,color22R, color22G, color22B, color22A) + else + setNextStrokeColor(layer4,color21R, color21G, color21B, color21A) + end + setNextFillColor(layer4,0,0,0,0) + addCircle(layer4,cx,cy,8) + setNextStrokeWidth(layer4,1) + if cd == true then + setNextStrokeColor(layer4,color22R, color22G, color22B, color22A) + else + setNextStrokeColor(layer4,color21R, color21G, color21B, color21A) + end + setNextFillColor(layer4,0,0,0,0) + addCircle(layer4,cx,cy,2) + if contexttext ~= "" then + local bxwdth = (string.len(contexttext)*6)+10 + local xpos = cx+5 + if (cx + bxwdth) > rx then + xpos = xpos - bxwdth + end + setNextStrokeWidth(layer4,3) + setNextStrokeColor(layer4,color4R, color4G, color4B, color4A) + setNextFillColor(layer4,color1R, color1G, color1B, color1A) + addBox(layer4,xpos,cy+5,bxwdth,18) + setNextFillColor(layer4,color5R, color5G, color5B, color5A) + addText(layer4,fontS,contexttext,xpos+3,cy+18) + end + end +end + +if devoverlay == true then + local rcmax = getRenderCostMax() + local rccurr = getRenderCost() + setNextFillColor(layer4, 1, 0, 0, 1) + local cursp = 0 + if getCursorPressed() == false then cursp = 0 else cursp = 1 end + local cursr = 0 + if getCursorReleased() == false then cursr = 0 else cursr = 1 end + addText(layer4, fontS, "Mouse P/R: " .. cursp .. " / " .. cursr, rx*0.001, ry*0.12) + setNextFillColor(layer4, 1, 0, 0, 1) + addText(layer4, fontS, "Frame: " .. getDeltaTime(), rx*0.001, ry*0.08) + setNextFillColor(layer4, 1, 0, 0, 1) + addText(layer4, fontS, "Render Cost: " .. getRenderCost() .. " / " .. rcmax, rx*0.001, ry*0.03) +end + +requestAnimationFrame(1) \ No newline at end of file diff --git a/Terminal Emulator/Terminal Emulator - Renderscript.txt b/Terminal Emulator/Terminal Emulator - Renderscript.txt new file mode 100644 index 0000000..bf335cb --- /dev/null +++ b/Terminal Emulator/Terminal Emulator - Renderscript.txt @@ -0,0 +1,72 @@ +if not init then + local textr, textg, textb = 1, 0.5, 0 + strings1 = {} + strings1[0] = "[ OK ][HID] Starting USB 7.0 Interface" + strings1[1] = "[ OK ] USB 7-0: New Device Found, VendorID=Novark, ProductID=AeroSuitGeneralPnP" + strings1[2] = "[ OK ] USB 7-0: New USB Device Strings: MFR=Novark, Product=AS10994, Serial=8971205532" + strings1[3] = "[ OK ][SYS] Freeing initrd Memory: 187429GB freed" + strings1[4] = "[ OK ][RTC_CMOS] Setting System Clock, synchronizing with Novark Arkship" + strings1[5] = "[ OK ] BIOS EDD Facility V6.26 2782-Jan-14, 1 Device Found" + strings1[6] = "[ OK ] Write-Protecting Kernel Binaries: 31648GB" + strings1[7] = "[ OK ][ACPI] Video Device [GFX0] (Multi-head:yes, ROM:no, POST:no)" + strings1[8] = "[ OK ][INPUT] Video Bus as /devices/LNXSYSTM:00/LNXSYSBUS:00/PNP0C35:00/LNXVIDEO:00/input/" + strings1[9] = "[ OK ][USBCORE] Registered New Interface Driver USBHID on Port 2142" + strings1[10] = "[ OK ][HID] Generic Input, hidRaw0: USB HID v7.1 Neuralink [Novark]" + strings1[11] = "[ ERROR ][SYS] Sys_core time error of .002 picoseconds. Correcting system clock... " + strings1[12] = "[ OK ][SYS] Integrity Check: All system elements reporting nominal." + strings1[13] = "[ ERROR ][SYS] System Warning: PointerException.Null thrown at 0xFFAE0095" + strings1[14] = "[ OK ][HID] Parsing filesystem for updates; No new volumes found." + strings1[15] = "[ OK ][SYS] Remounting root filesystem in read-write mode: OK" + strings1[16] = "[ OK ][HID] Creating qdisk volume: (Dynamic Size: 4096GB) on shared memory... Done." + strings1[17] = "[ OK ][HID] Rechecking unionfs and symlinks on qdisk... Done." + strings1[18] = "[ OK ][HID] Total qdisk volume entropy exceeded calculated parity entropy." + strings1[19] = "[ ERROR ][HID] Qbit error in system qdisk volume AD36C2B92E was corrected automatically." + strings1[20] = "[ OK ][TEMP] Cryostate readings updated. Qprocessor temperatures nominal." + strings1[21] = "[ ERROR ][TEMP] Qprocessor temperatures exceeding 65% maximum. System venting..." +end + +function randomString(length) + if not length or length <= 0 then return '' end + local rand1 = math.random(21) + return strings1[rand1] +end + +function randomInt(max) + if not max or max <= 0 then return '' end + local rand1 = math.random(max) + return rand1 +end + +if not init then + l1fontsize = 20 + l1xoffset = -20 + l1yoffset = 0 + rx, ry = getResolution() + cx1, cy1 = rx, ry/l1fontsize + mem1 = {} + for iy=1,cy1 do + mem1[iy] = randomString(1) + end + init = true +end + +fontL = loadFont("Play", l1fontsize) +layer1 = createLayer() + +function DrawAllTextL1() + for by=1,cy1 do + setNextFillColor(layer1, textr, textg, textb, 1) + addText(layer1, fontL, mem1[by], l1fontsize+l1xoffset, (l1fontsize*by)+l1yoffset) + end +end + +function ShiftLines() + for sy=1,cy1 - 1 do + mem1[sy] = mem1[sy+1] + end + mem1[math.floor(cy1)] = strings1[math.random(21)] +end + +DrawAllTextL1() +ShiftLines() +requestAnimationFrame(randomInt(20)) \ No newline at end of file diff --git a/Voxelmancy Space Gyro Tool/Voxelmancy Space Gyro Tool - PB.txt b/Voxelmancy Space Gyro Tool/Voxelmancy Space Gyro Tool - PB.txt new file mode 100644 index 0000000..475f0e2 --- /dev/null +++ b/Voxelmancy Space Gyro Tool/Voxelmancy Space Gyro Tool - PB.txt @@ -0,0 +1 @@ +{"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":"slot10","type":{"events":[],"methods":[]}},"-1":{"name":"unit","type":{"events":[],"methods":[]}},"-2":{"name":"system","type":{"events":[],"methods":[]}},"-3":{"name":"library","type":{"events":[],"methods":[]}}},"handlers":[{"code":"pressed1 = 1\nsystem.print(\"Gyro 1 Active\")","filter":{"args":[{"value":"option1"}],"signature":"actionStart(action)","slotKey":"-2"},"key":"0"},{"code":"local pressed1 = 0\nlocal pressed2 = 0\nlocal pressed3 = 0","filter":{"args":[],"signature":"start()","slotKey":"-2"},"key":"1"},{"code":"pressed2 = 1\nsystem.print(\"Gyro 2 Active\")","filter":{"args":[{"value":"option2"}],"signature":"actionStart(action)","slotKey":"-2"},"key":"2"},{"code":"pressed3 = 1\nsystem.print(\"Gyro 3 Active\")","filter":{"args":[{"value":"option3"}],"signature":"actionStart(action)","slotKey":"-2"},"key":"3"},{"code":"if pressed1 then\n slot1.activate() \n pressed1 = 0\nend","filter":{"args":[{"value":"option1"}],"signature":"actionStop(action)","slotKey":"-2"},"key":"4"},{"code":"if pressed2 then\n slot2.activate()\n pressed2 = 0\nend","filter":{"args":[{"value":"option2"}],"signature":"actionStop(action)","slotKey":"-2"},"key":"5"},{"code":"if pressed3 then\n slot3.activate() \n pressed3 = 0\nend","filter":{"args":[{"value":"option3"}],"signature":"actionStop(action)","slotKey":"-2"},"key":"6"}],"methods":[],"events":[]} \ No newline at end of file