[MOD EXT] Empyrion Scripting - Scripts

Discussion in 'The Hangar Bay' started by Ephoie, Mar 22, 2020.

  1. shadowiviper

    shadowiviper Commander

    Joined:
    Apr 13, 2020
    Messages:
    89
    Likes Received:
    144
    Hey, sorry I got a bit side tracked with real life things so never actually managed to finish this little project. I'll log in now and publish what I had finished on the workshop so hopefully some of it will be some use but will need some finishing. I believe I had 2 versions where I'd started to rewrite the whole thing to fit inside a single source LCD using a compiler script to put everything together, but in the process of converting it I broke a lot of stuff :) I also havent worked on it in the last few versions, both of the main game and the scripting mod so some updates may have broken things.

    https://steamcommunity.com/sharedfiles/filedetails/?id=2229888455
    Version 1 - only half finished and the source scripts are all over the place. This version was going to be 5 scripts running 5 separate LCDs but took up a lot of room

    https://steamcommunity.com/sharedfiles/filedetails/?id=2229893991
    Version 2 - all of the scripts in red at the back can be removed when the ship is ready. All of the red scripts get merged together to write a final compiled script that then runs all 5 screens in the cockpit. The screen at the top of all the others is the 'compiler' which outputs the merged contents of the 'red' scripts to the LCD behind the cockpit, which in turn runs all the outputs. This is probably the best version before I broke everything.

    The output screen called "CargoConfig" has a variable name, so if the OUTPUT is called CargoConfig[set=true] it goes into reset mode where it logs whats in the current containers with the amount per item. Once you change to something else such as CargoConfig[set=false] it goes back to display mode, where it shows the current contents relative to the logged "intended amounts". Its done this way as it predated the cacheDate functionality you added, and so it doesn't get reset on playfield change or can be published with values preloaded (e.g. a fighter with its Ammo config already set up)

    https://steamcommunity.com/sharedfiles/filedetails/?id=2229895082
    Version 3 - this is where I started to break everything. This version only has 3 output screens (left, right, centre) to help with spacing issues on the angled side screens, and again is a 'compiled' script so all the red ones are only needed for inital setup / entering config and can then be removed. This is massively unfinished and has a lot of broken stuff in it.

    Most of the unfinished parts were around the 'input' of variables via the script itself, so changing the name of "Script:HUD-System" to "Script:HUD-System[reset]" would reset the ship icon for example (dont think this was fully working). When the script first initialised it was going to create an icon of the current ship based on the Damage Map / Floor plan scripts but store this to a cacheData so it didnt have to run constantly. The icon was then going to be part of the central HUD screen with a shield indicator around it.

    The cargoconfig was also going to change slightly, as it no longer had its own dedicated output screen it the 'reset' was going to be on the main script itself, e.g. setting "Script:HUD-System[cargo]" to trigger the reset. I think I broke that when I was last playing around with it as well :(

    The main parts are:
    Central screen - only a framework for now, was going to have an icon of the ship / shield / weapon status on it
    Fuel bars - gradient colours / vertical bar charts for o2, fuel, pentaxid
    Crew monitor - health/status for each crew member, auto detect number of passenger seats on the ship and show who is sat in them
    Cargo monitor - set intended amount of each item, show which ones are empty / too low / too high or surplus items. Readable config so a docked ship can automatically reload/refuel
    Toggle switches for control panel switches and physical switches
    Everything is intended to show on projector screens and create nice borders around each block to help with display


    Finally in case its any help, here's the code I was working off for the final version (which is completely broken). The gaps in the code should represent breaking points of around 2,000 characters, so when I put it in game I can copy each 'block' to one of the InputN screens which are then compiled into a single merged script. I hadn't finished converting the final few parts to the my new system so this is basically all my notes/scribbles dumped into one

    Code:
    {{set 'top-border' 45}}
    {{set 'right-border' 92}}
    {{set 'iconColour' '#FFFFFFAA'}}
    {{set 'iconWeaponColor' '#CE1818AA'}}
    {{set 'iconThrusterColor' '#1818CEAA'}}
    {{set 'iconSize' '0.3'}}
    {{set 'iconLineHeight' '1.2em'}}
    {{set 'iconCspace' '0em'}}
    {{set 'Active' '#62ff00'}}
    {{set 'Inactive' '#e30211'}}
    {{set 'Warning' '#ede205'}}
    {{set 'Unavailable' '#CCCCCC50'}}
    {{set 'Highlight' '#a3d7ff'}}
    ------------------------
    {{set 'NL' (concat '<size=5><pos=' @root.Data.right-border '>║</pos>
    <pos=0>║</pos><pos=' @root.Data.right-border '>║</pos>
    <pos=0>║</pos></size>')}}
    {{set 'NLx2' (concat @root.Data.NL @root.Data.NL)}}
    {{set 'NLx3' (concat @root.Data.NLx2 @root.Data.NL)}}
    {{set 'NLx4' (concat @root.Data.NLx3 @root.Data.NL)}}
    {{set 'Top' (concat '<line-height=0.53em><size=5><cspace=-0.1em>╔' (bar 1 0 1 @root.data.top-border '═') '<pos=' @root.Data.right-border '>╗</pos></cspace></size>
    <pos=0>║</pos></size>' @root.Data.NL)}}
    {{set 'Bottom' (concat @root.Data.NL '<pos=' @root.Data.right-border '>║</pos>
    <cspace=-0.1em><size=5>╚' (bar 1 0 1 @root.data.top-border '═') '<pos=' @root.Data.right-border '>╝</pos></size></cspace>')}}
    {{~#if @root.CacheData.Recaching}}{{else}}
    {{~setcache 'Recaching' 'N'}}
    {{~/if}}
    {{~devices @root.E.S 'Script:HUD-System*'}}
    {{~split .0.CustomName '['}}
    {{~#if .1}}
    {{~#test .1 eq 'reset]'}}
    {{~#test @root.CacheData.Recaching eq 'N'}}
        {{~setcache 'Recaching' 'Y'}}
        {{~setcache 'ShipIcon' ''}}
        {{~setcache 'Shield' ''}}
        {{~setcache 'Thruster' ''}}
        {{~setcache 'Light' ''}}
        {{~setcache 'RCS' ''}}
        {{~setcache 'Switch' ''}}
        {{~setcache 'Ventilator' ''}}
        {{~setcache 'Weapons' ''}}
        {{~setcache 'Seats' '0'}}
        {{~setcache 'WeaponTypes' ''}}
    {{setcacheblock 'ShipIcon'}}
    {{~set 's' '▒'}}
    {{~set 'b' @root.data.iconColour}}
    {{~set 'ts' '▓'}}
    {{~set 'ws' '▩'}}
    {{~set 'bg' '#00000000'}}
    {{~#split (bar 1 0 1 (calc @root.E.S.MaxPos.X '-' @root.E.S.MinPos.X) ",") ","}}{{set 'xdiff' .}}{{/split}}
    {{~#split (bar 1 0 1 (calc @root.E.S.MaxPos.Z '-' @root.E.S.MinPos.Z) ",") ","}}{{set 'zdiff' .}}{{/split}}
    {{~#split (bar 1 0 1 (calc @root.E.S.MaxPos.Y '-' @root.E.S.MinPos.Y) ",") ","}}{{set 'ydiff' .}}{{/split}}
    {{~set 'z' @root.E.S.MaxPos.Z}}
    {{~set 'x' @root.E.S.MinPos.X}}
    {{~set 'y' (calc @root.E.S.MinPos.Y '+' 128)}}
    <size={{@root.data.iconSize}}><line-height={{@root.data.iconLineHeight}}><cspace={{@root.data.iconCspace}}>
    {{~#each @root.data.zdiff}}
    {{~#each @root.data.xdiff}}
    {{~set 'color' @root.data.bg}}
    {{~set 'display' @root.data.s}}
    {{~#each @root.data.ydiff}}
    {{~block @root.E.S @root.data.x @root.data.y @root.data.z}}
    {{~#test @root.data.color eq @root.data.bg}}
    {{~#if ../ID}}{{set 'color' @root.data.b}}{{/if}}
    {{~/test}}
    {{~#test @root.data.color eq @root.data.b}}
    {{~setblock 'color'}}
    {{~#test (configattr ID 'Group') eq 'cpgWeapon'}}{{@root.data.iconWeaponColor}}{{set 'display' @root.data.ws}}{{/test}}
    {{~#test (configattr ID 'Group') eq 'cpgThruster'}}{{@root.data.iconThrusterColor}}{{set 'display' @root.data.ts}}{{/test}}
    {{~/setblock}}{{~/test}}
    {{~#test (configattr ID 'Group') eq 'cpgWeapon'}}{{~#test ../Rotation neq 0}}
    {{~setcache 'Weapons' (concat @root.CacheData.Weapons "[" @root.data.x "," @root.data.y "," @root.data.z "]")}}
    {{~/test}}{{/test}}
    {{~#test (configattr ID 'Group') eq 'cpgThruster'}}{{~#if ../Active}}
    {{~setcache 'Thruster' (concat @root.CacheData.Thruster "[" @root.data.x "," @root.data.y "," @root.data.z "]")}}
    {{~/if}}{{/test}}
    {{~#test ID eq 1810}}{{~#if ../Active}}
    {{~setcache 'Shield' (concat @root.CacheData.Shield "[" @root.data.x "," @root.data.y "," @root.data.z "]")}}
    {{~/if}}{{/test}}
    {{~#test (configattr ID 'Group') eq 'cpgSignal'}}
    {{~setcache 'Switch' (concat @root.CacheData.Switch "[" @root.data.x "," @root.data.y "," @root.data.z "]")}}
    {{~/test}}
    {{~#test (configattr ID 'Group') eq 'cpgO2Ventilator'}}
    {{~setcache 'Ventilator' (concat @root.CacheData.Ventilator "[" @root.data.x "," @root.data.y "," @root.data.z "]")}}
    {{~/test}}
    {{~#test ID eq 272}}
    {{~setcache 'RCS' (concat @root.CacheData.RCS "[" @root.data.x "," @root.data.y "," @root.data.z "]")}}
    {{~/test}}
    {{~#test ID eq 279}}
    {{~setcache 'Light' (concat @root.CacheData.Light "[" @root.data.x "," @root.data.y "," @root.data.z "]")}}
    {{~/test}}
    {{~#test ID eq 715}}{{~setcache 'Seats' (calc @root.CacheData.Seats '+' 1)}}{{/test}}
    {{~/block}}
    {{~set 'y' (calc @root.data.y '+' 1)}}
    {{~/each}}
    <color={{@root.data.color}}>{{@root.data.display}}</color>
    {{~set 'x' (calc @root.data.x '+' 1)}}
    {{~set 'y' (calc @root.E.S.MinPos.Y '+' 128)}}
    {{~/each}}
    {{~set 'x' @root.E.S.MinPos.X}}
    {{~set 'z' (calc @root.data.z '-' 1)}}
    {{/each}}
    </cspace></line-height></size>
    {{/setcacheblock}}
    {{~/test}}
    {{~else}}
    {{~setcache 'Recaching' 'N'}}
    {{~/test}}
    {{~else}}
    {{~setcache 'Recaching' 'N'}}
    {{~/if}}{{/split}}{{/devices}}
    {{set 'types' 'Shield,Thruster,Light,RCS,Switch,Ventilator,Weapons'}}
    {{split @root.data.types ","}}
    {{#each .}}
    {{set 'type' .}}
    {{setblock 'x'}}
    {{~#test . eq 'Shield'}}{{@root.CacheData.Shield}}{{/test}}
    {{~#test . eq 'Light'}}{{@root.CacheData.Light}}{{/test}}
    {{~#test . eq 'RCS'}}{{@root.CacheData.RCS}}{{/test}}
    {{~#test . eq 'Switch'}}{{@root.CacheData.Switch}}{{/test}}
    {{~#test . eq 'Thruster'}}{{@root.CacheData.Thruster}}{{/test}}
    {{~#test . eq 'Ventilator'}}{{@root.CacheData.Ventilator}}{{/test}}
    {{~#test . eq 'Weapons'}}{{@root.CacheData.Weapons}}{{/test}}
    {{~/setblock}}
    {{~#test @root.Data.x.Length ge 2}}
    {{~split @root.data.x "]"}}
    {{~split .0 "["}}
    {{~split .1 ","}}
    {{~block @root.E.S .0 .1 .2}}
    {{~#if ID}}
    {{#if Active}}
    {{set (concat 'S<' @root.data.type '>') '1'}}
    {{set (concat 'C<' @root.data.type '>') @root.data.Active}}
    {{else}}
    {{set (concat 'S<' @root.data.type '>') '0'}}
    {{set (concat 'C<' @root.data.type '>') @root.data.Inactive}}
    {{/if}}
    {{else}}
    {{set (concat 'S<' @root.data.type '>') '2'}}
    {{set (concat 'C<' @root.data.type '>') @root.data.Unavailable}}
    {{/if}}
    {{~/block}}{{/split}}{{/split}}{{/split}}
    {{~else}}
    {{set (concat 'S<' @root.data.type '>') '2'}}
    {{set (concat 'C<' @root.data.type '>') @root.data.Unavailable}}
    {{/test}}
    {{/each}}
    {{/split}}
    {{~devices @root.E.S 'HUD-L'}}
    {{~settextblock .0}}
    {{~setfontsize .0 4}}
    {{~set 'R' 0}}{{~set 'G' 15}}{{~split "A,B,C,D,E,F" ","}}{{set "Hex" .}}{{/split}}{{~split "10,40,70" ","}}{{set "T" .}}{{/split}}
    {{~#use @root.E.S.FuelTank}}{{set 'zF' Capacity}}{{set 'xF' Content}}{{~/use}}
    {{~#use @root.E.S.PentaxidTank}}{{set 'zP' Capacity}}{{set 'xP' Content}}{{~/use}}
    {{~#use @root.E.S.OxygenTank}}{{set 'zO' Capacity}}{{set 'xO' Content}}{{~/use}}
    {{[email protected]}}<voffset=1><pos=10>Tanks</pos></voffset><pos={{@root.Data.right-border}}>║</pos>
    ╟{{bar 1 0 1 25 '─'}}<pos={{@root.Data.right-border}}>║</pos></line-height><line-height=1.25><cspace=-0.1em>
    {{#each @root.OreIds~}}
    {{#test @index leq 30}}
    {{~set 'Hr' @root.Data.R}}{{#test @root.Data.R geq 10}}{{set 'Hr' (lookup @root.Data.Hex (calc @root.Data.R '-' 10))}}{{/test}}
    {{~set 'Hg' @root.Data.G}}{{#test @root.Data.G geq 10}}{{set 'Hg' (lookup @root.Data.Hex (calc @root.Data.G '-' 10))}}{{/test}}
    {{~#test @root.Data.R le 15}}
    {{#math @root.Data.R '+' 1}}{{set 'R' .}}{{/math}}
    {{~else}}
    {{#math @root.Data.G '-' 1}}{{set 'G' .}}{{/math}}
    {{~/test}}
    {{~set 'i' @index}}{{~#each @root.Data.T}}
    {{~#test . 'eq' '10'}}{{set 'Ca' @root.Data.zF}}{{set 'Co' @root.Data.xF}}
    {{~else}}{{#test . 'eq' '40'}}{{set 'Ca' @root.Data.zO}}{{set 'Co' @root.Data.xO}}
    {{~else}}{{set 'Ca' @root.Data.zP}}{{set 'Co' @root.Data.xP}}{{/test}}{{/test}}
    {{~#math (calc 30 '/' @root.Data.Ca) '*' @root.Data.Co}}{{split . '.'}}{{set 'V' (calc .0 '+' 1)}}{{/split}}{{/math}}
    {{~#test @root.Data.V neq 'NaN'}}
    <size=3><pos={{../.}}><color=#{{concat @root.Data.Hr @root.Data.Hr @root.Data.Hg @root.Data.Hg "10"}}{{~#test @root.Data.i ge (calc 30 - @root.Data.V)}}FF{{else}}10{{~/test}}>▬▬▬▬</color></pos></size>
    {{~/test}}
    {{/each}}
    {{[email protected]~}}
    {{/test}}
    {{/each}}
    {{@root.data.NLx4~}}
    <size=11><color=#FFF>{{~#each @root.Data.T}}<pos={{.}}>{{~#test . 'eq' '10'}}☢{{else}}{{~#test . 'eq' '40'}}✇{{else}}⚛{{/test}}{{/test}}</pos>{{/each}}</color></size>
    <line-height=2>{{@root.Data.Bottom}}
    {{bar 1 0 1 8 '
    '}}
    {{@root.Data.Top}}<voffset=1>Ship</voffset><pos={{@root.Data.right-border}}>║</pos>
    {{~concat '<size=11><color=#2b84ad20>'
    '<pos=33%>☐</pos><size=8><color=' @root.data.C<Ventilator> '><pos=34.5%><voffset=1>✇</voffset></pos></color></size>'
    '<pos=42%>☐</pos><size=8><color=' @root.data.C<Shield> '><pos=43.5%><voffset=1>⚛</voffset></pos></color></size>'
    '<pos=51%>☐</pos><size=8><color=' @root.data.C<Light> '><pos=52.5%><voffset=1>☼</voffset></pos></color></size>'
    '<pos=60%>☐</pos><size=8><color=' @root.data.C<Switch> '><pos=61.5%><voffset=1>♮</voffset></pos></color></size>'
    '<pos=69%>☐</pos><size=8><color=' @root.data.C<Weapons> '><pos=70.5%><voffset=1>☄</voffset></pos></color></size>'
    '<pos=78%>☐</pos><size=8><color=' @root.data.C<Thruster> '><pos=78.5%><voffset=1>❖</voffset></pos></color></size>'
    '<pos=87%>☐</pos><size=8><color=' @root.data.C<RCS> '><pos=88.5%><voffset=1>Ⓡ</voffset></pos></color></size>'
    '</size></color>'}}
    ╟{{bar 1 0 1 25 '─'}}<pos={{@root.Data.right-border}}>║</pos>
    {{@root.data.NL~}}<size=3>
    <pos=4>Sector:</pos><pos=30>{{@root.P.PlayfieldType}}/{{@root.P.Name}}</pos>{{@root.data.NL~}}
    <pos=4>Sector Type:</pos><pos=30>{{@root.P.PlanetClass}}</pos>{{@root.data.NL~}}
    <pos=4>Position:</pos><pos=30>[{{@root.E.S.Position.X}}/{{@root.E.S.Position.Y}}/{{@root.E.S.Position.Z}}]</pos>{{@root.data.NL~}}
    </size>{{@root.Data.Bottom}}
    {{[email protected]}}<voffset=1>Crew</voffset><pos={{@root.Data.right-border}}>║</pos>
    ╟{{bar 1 0 1 25 '─'}}<pos={{@root.Data.right-border}}>║</pos>
    {{~set 'crossbar' (concat @root.Data.NLx3 '<pos=50>┼</pos><pos=65>┼</pos><pos=80>┼</pos><pos=8>' (bar 1 0 1 55 '─') '</pos>' @root.data.NLx3)}}
    {{@root.data.NL~}}<size=3><line-height=1><pos=50>│ <size=4> Hlth</size></pos><pos=65>│ <size=4>Temp</size></pos><pos=80>│ <size=4>Rad</size></pos>{{@root.data.NL~}}
    {{@root.Data.crossbar}}
    {{set 'bg' (concat '<color=' @root.data.Unavailable '>░</color>')}}
    {{~#if @root.E.S.Pilot.Name}}
    {{~setblock 'h'}}{{#math @root.E.S.Pilot.Health '/' @root.E.S.Pilot.HealthMax}}{{#test . geq 0.70}}{{@root.data.Active}}{{else}}{{#test ../. leq 0.30}}{{@root.data.Inactive}}{{else}}{{@root.data.Warning}}{{/test}}{{/test}}{{/math}}{{/setblock}}
    {{~setblock 't'}}{{#test @root.E.S.Pilot.BodyTemp geq 30{{@root.data.Warning}}{{else}}{{~#test @root.E.S.Pilot.BodyTemp leq 10}}#2222FF{{else}}{{@root.data.Active}}{{/test}}{{/test}}{{/setblock}}
    {{~setblock 'r'}}{{#math @root.E.S.Pilot.Radiation '/' @root.E.S.Pilot.RadiationMax}}{{#test . geq 0.50}}{{@root.data.Warning}}{{else}}{{#test ../. leq 0.25}}{{@root.data.Active}}{{else}}{{@root.data.Inactive}}{{/test}}{{/test}}{{/math}}{{/setblock}}
    {{~concat '<color=#AAAAEE><size=4><pos=4>Pilot: ' @root.E.S.Pilot.Name '</color></pos></size>'
    '<pos=50.5><color=' @root.data.h '>' (bar @root.E.S.Pilot.Health 0 @root.E.S.Pilot.HealthMax 5 '█' @root.data.bg) '</color></pos>'
    '<pos=65.5><color=' @root.data.h '>' (bar @root.E.S.Pilot.BodyTemp -10 90 5 '█' @root.data.bg) '</color></pos>'
    '<pos=80.5><color=' @root.data.r '>' (bar @root.E.S.Pilot.Radiation 0 @root.E.S.Pilot.RadiationMax 5 '█' @root.data.bg) '</color></pos>'
    @root.Data.crossbar}}
    {{~else}}<color=#CE181850><size=4><pos=4>Pilot: {{~/if}}</color></pos></size>
    {{~#split (bar 1 0 1 @root.CacheData.Seats ",") ","}}{{set 'seatsCount' .}}{{/split}}
    {{~#each @root.data.seatsCount}}{{~#test .length ge 2}}
    {{~lookupblock @root.E.S.Passengers @index}}<size=4><pos=4><color=#
    {{~setblock 'd'}}{{#test @index eq 0}}Copilot{{else}}{{~concat "Seat " @index}}{{/test}}{{/setblock}}
    {{~#if Name}}AAAAEE>
    {{~setblock 'h'}}{{#math Health '/' HealthMax}}{{#test . geq 0.70}}{{@root.data.Active}}{{else}}{{#test ../. leq 0.30}}{{@root.data.Inactive}}{{else}}{{@root.data.Warning}}{{/test}}{{/test}}{{/math}}{{/setblock}}
    {{~setblock 't'}}{{#test BodyTemp geq 30}}{{@root.data.Warning}}{{else}}{{~#test BodyTemp leq 10}}#2222FF{{else}}{{@root.data.Active}}{{/test}}{{/test}}{{/setblock}}
    {{~setblock 'r'}}{{#math Radiation '/' RadiationMax}}{{#test . geq 0.50}}{{@root.data.Warning}}{{else}}{{#test ../. leq 0.25}g}{{@root.data.Active}}{{else}}{{@root.data.Inactive}}{{/test}}{{/test}}{{/math}}{{/setblock}}
    {{~concat @root.data.d ': ' Name '</color></pos></size>'
    '<pos=50.5><color=' @root.data.h '>' (bar Health 0 HealthMax 5 '█' @root.data.bg) '</color></pos>'
    '<pos=65.5><color=' @root.data.h '>' (bar BodyTemp -10 90 5 '█' @root.data.bg) '</color></pos>'
    '<pos=80.5><color=' @root.data.r '>' (bar Radiation 0 RadiationMax 5 '█' @root.data.bg) '</color></pos>'
    @root.Data.crossbar}}
    {{~else}}CE181850>{{@root.data.d}}: {{Name}}</color></pos></size> {{@root.Data.crossbar}}{{~/if}}
    {{~/lookupblock}}{{~/test}}{{/each}}
    </line-height><line-height=2>
    </size>{{@root.Data.Bottom}}
    {{/settextblock}}
    {{/devices}}
    {{~devices @root.E.S 'HUD-R'}}
    {{~setfontsize .0 4}}
    {{~setblock 'Conf'}}{{split .0.CustomName '['}}{{#test .1 eq 'set=true]'}}{{set 'ConfMde' 1}}
    {{~#each @root.E.S.AllCustomDeviceNames~}}
    {{devices @root.E.S .}}{{#if .0.Device.VolumeCapacity~}}
    {{.0.CustomName}}[{{~items @root.E.S .0.CustomName}}{{~Id}}:{{Count~}},{{~/items}}]*
    {{~/if}}{{/devices}}{{/each}}
    {{~else}}
    {{gettext ../../.0}}{{split . '$'}}{{#test .0.length ge 9}}{{substring .0 8}}{{/test}}{{~/split}}{{/gettext}}
    {{~/test}}{{/split}}{{~/setblock}}
    {{settextblock .0}}<size=0>{{[email protected]~}}$</size>
    {{#if @root.Data.ConfMde}}
    <align=center><size=180%><color=#CE1818>⚠ Config Mode Enabled ⚠</color></size></align>
    Remove [set=true] from script name to store cargo configuration
    {{else}}
    {{@root.data.Top}}
    {{split @root.Data.Conf '*' true}}
    {{~#each .}}
    {{split . '['}}<size=120%><pos=5><color=#FFF><b>{{.0}}</b></color></pos></size>{{@root.Data.NL~}}
    {{~#test .1 neq ']'}}
    {{split (substring .1 0 (calc .1.Length - 2)) ',' true}}
    {{~#each .}}{{split . ':'}}
    {{~items @root.E.S ../../../.0}}{{#test Id eq ../.0}}{{set 'i' (concat @root.Data.i "," Id)}}
    <color={{#test Count le ../../.1}}{{@root.data.Warning}}{{else}}{{#test Count ge ../../../.1}}{{@root.data.Active}}{{else}}28b828{{/test}}{{/test}}><pos=5>◦ {{substring Name 0 11}}</pos><pos=55%> [<size=75%>{{Count}} / {{../../.1}}</size>]</pos></color>{{@root.Data.NL~}}
    {{~/test}}{{/items}}
    {{~/split}}{{/each}}
    {{~#each .}}{{split . ':'}}
    {{~#test .0 in @root.Data.i}}{{else}}
    <color={{@root.data.Inactive}}><pos=5>◦ {{substring (i18n ../.0 'English') 0 11}}</pos><pos=55%> [<size=75%>0 / {{../.1}}</size>]</pos></color>{{@root.Data.NL~}}
    {{~/test}}{{/split}}{{/each}}
    {{~items @root.E.S ../../.0}}{{#test Id in @root.Data.i}}{{else}}
    <color={{@root.data.Highlight}}><pos=5>◦ {{substring Name 0 11}}</pos><pos=55%> [<size=75%>{{Count}}</size>]</pos></color>{{@root.Data.NL~}}
    {{~/test}}{{/items}}
    {{set 'i' ''}}
    {{~/split}}
    {{/test}}
    {{/split}}
    {{@root.Data.NL~}}{{/each}}{{/split}}{{/if}}
    {{@root.Data.Bottom}}
    {{~devices @root.E.S 'Signals'}}
    {{~settextblock .0}}
    {{~setfontsize .0 4}}
    {{~set 'con' '<color=#44444440><cspace=-.59em><size=7>◖<voffset=1.5>▆</voffset>◗</cspace></color></size><size=4><voffset=1.2><pos='}}
    {{~set 'n' '<color=#CE1818>◌'}}
    {{~set 'y' '<color=#18CE18>◉'}}
    {{~set 'm' '</color></pos></voffset></size></pos><voffset=1.5><pos='}}
    {{~set 'yl' (concat '<pos=5>' @root.Data.con '13>' @root.Data.y @root.data.m '20>')}}
    {{~set 'yr' (concat '<pos=51>' @root.Data.con '59>' @root.Data.y @root.data.m '66>')}}
    {{~set 'nl' (concat '<pos=5>' @root.Data.con '6>' @root.Data.n @root.data.m '20>')}}
    {{~set 'nr' (concat '<pos=51>' @root.Data.con '52>' @root.Data.n @root.data.m '66>')}}
    {{~set 'x' '</voffset></pos>'}}
    {{~set 'i' 1}}
    {{[email protected]}}
    {{~signals @root.E.S '*'}}
    {{~#each .}}
    {{~#test (calc @root.Data.i '%' 2) eq 1}}
    {{~#if State}}{{@root.data.yl}}{{else}}{{@root.data.nl}}{{/if}}<size=3>{{substring Name 0 12}}</size>{{@root.data.x}}
    {{~else}}{{#if State}}{{@root.data.yr}}{{else}}{{@root.data.nr}}{{/if}}<size=3>{{substring Name 0 12}}</size>{{@root.data.x}}{{@root.data.NLx2~}}{{/test}}
    {{~set 'i' (calc @root.Data.i '+' 1)}}
    {{~/each}}
    {{~/signals}}{{~getswitches @root.E.S '*'}}
    {{~#each .}}{{~#test id in '1227-1230,1256-1262'}}
    {{~#test (calc @root.Data.i '%' 2) eq 1}}
    {{~#if SwitchState}}{{@root.data.yl}}{{else}}{{@root.data.nl}}{{/if}}<size=3>{{substring CustomName 0 12}}</size>{{@root.data.x}}
    {{~else}}{{#if SwitchState}}{{@root.data.yr}}{{else}}{{@root.data.nr}}{{/if}}<size=3>{{substring CustomName 0 12}}</size>{{@root.data.x}}{{@root.data.NLx2~}}{{/test}}
    {{~set 'i' (calc @root.Data.i '+' 1)}}
    {{~/test}}{{~/each}}
    {{~/getswitches}}
    {{@root.data.NL~}}
    {{@root.Data.Bottom}}
    {{/settextblock}}
    {{/devices}}
    

    Its all a bit of a jumble so if anything isn't making sense let me know and I will try to remember what it was for :)
     
    #181
    Ephoie likes this.
  2. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    991
    Likes Received:
    707
    @shadowiviper thanks :) the cockpit HUD is slowly taking shape ...

    20200918110246_1.jpg

    PS: ... ich bin noch dabei und wenn es fertig ist werde ich es vorstellen und in den Workshop stellen
     
    #182
    Last edited: Sep 19, 2020
    tachyon and Ephoie like this.
  3. tschancellor

    tschancellor Ensign

    Joined:
    Aug 21, 2020
    Messages:
    5
    Likes Received:
    8
    hiho! =)

    @ASTIC @Shadowviper:
    boar....wie geil is das denn.... :D
    Das HUD sieht schon echt geil aus.... :D

    btw...ich hab noch ne Frage:

    Kann man auf die Wassergeneratoren und auf die Automatischen Bergbaugeräte zugreifen? (Hintergrund: Ich würde den Inhalt gern automatisch einsammeln mittels "move" und gleichzeitig wieder betanken)

    Grüße und Vielen Dank schon mal im Voraus für Eure Bemühungen....
     
    #183
    Ephoie likes this.
  4. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    991
    Likes Received:
    707
    Leider sind die "externen" Geräte nicht über die API erreichbar :-(( sobald sie das einbauen werde ich es nutzen!!

    PS: Das CV hat 2 "Computerräume" mit je 9 Scripts ... 3 von den 18 sind (noch) frei ;-)

    upload_2020-9-19_14-36-28.png
     
    #184
    Ephoie likes this.
  5. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    991
    Likes Received:
    707
    Hier ist nun die Version 1.0 der "Vega AI"
    Here is version 1.0 of the "Vega AI"
    upload_2020-9-22_17-44-9.png
    upload_2020-9-22_17-47-48.png
    https://steamcommunity.com/sharedfiles/filedetails/?id=2227639387



    Eigenschaften:
    - 2 interaktive live LCD Cockpits (Schiff, Cargo, Playfield, PvP Warnung, Enemyscan, Signalstatus)
    - Automatischer Türschließmechanismus
    - Automatische Schildaktivierung
    - Planzenerkennung
    - Inventarkisten mit Übersichtsanzeige
    - Automatische Rohstoffzufuhr für Konstruktor
    - Warenverteilsystem und Inventarübersicht
    - Automatische Triebwerke
    - Komplette Signalkontrolle im Cockpit
    - Warnanzeige bei ausgeschaltetem Schildgenerator
    - 2 Teleporter (1x Netzwerk, 1x Script-Langstreckenteleporter)
    - Vollständige Medizinstation und Sanitäranlagen
    - Recycle/Deconstruct Scripte
    - Automatisches Auffüllen von O2, Energie und Pentaxid
    - Automatische Betankung (O2, Energie und Pentaxid) und Aufmunitionierung angedocker Schiffe
    - Automatische Umgebungsbeleuchtung
    - Dekoscripte für Landepad und Schildenergie
    - Deckpläne
    - Geschützes Landedeck
    - Großer Hangar
    - Innengarage mit Rampe für Kleinfahrzeuge
    - CPU T4

    20 Scripte (6 Reserve LCDs) und erweiterte Signallogik
    https://github.com/GitHub-TC/EmpyrionScripting

    Für die volle Funktionalität wird das EmpyrionScripting >=5.10.1 benötigt

    Dank an:
    - Wahnfriedenator
    - shadowiviper

    =================================================================
    Features:
    - 2 interactive live LCD cockpits (ship, cargo, playfield, PvP warning, enemy scan, signal status)
    - Automatic door closing mechanism
    - Automatic shield activation
    - Plant recognition
    - Inventory boxes with overview display
    - Automatic raw material feed for constructor
    - Goods distribution system and inventory overview
    - Automatic engines
    - Complete signal control in the cockpit
    - Warning display when the shield generator is switched off
    - 2 teleporters (1x network, 1x script long-distance teleporter)
    - Complete medical station and sanitary facilities
    - Recycle / Deconstruct scripts
    - Automatic filling of O2, energy and Pentaxid
    - Automatic refueling (O2, energy and Pentaxid) and ammunition of docked ships
    - Automatic ambient lighting
    - Decoration scripts for landing pad and shield energy
    - Deck plans
    - Protected landing deck
    - Big hangar
    - Indoor garage with ramp for small vehicles
    - CPU T4

    20 scripts (6 reserve LCDs) and extended signal logic
    https://github.com/GitHub-TC/EmpyrionScripting

    EmpyrionScripting> = 5.10.1 is required for full functionality

    Thanks to:
    - Wahnfriedenator
    - shadowiviper

    =======================================================
    Nun auch mit Füllstandsverlauf
    upload_2020-9-26_20-51-40.png
     
    #185
    Last edited: Sep 26, 2020
  6. nottrox ¯\ (ツ) /¯

    nottrox ¯\ (ツ) /¯ Captain

    Joined:
    Jul 27, 2018
    Messages:
    193
    Likes Received:
    263

    hey,
    what am i doing wrong when i get lines full of {{devicesoftype}} error Object reference not set to an instance of an object on the Output LCD?
    I am way too unfamiliar with coding to get this and i don't find time to work myself through it.
     
    #186
    Last edited: Oct 2, 2020
    Ephoie likes this.
  7. nottrox ¯\ (ツ) /¯

    nottrox ¯\ (ツ) /¯ Captain

    Joined:
    Jul 27, 2018
    Messages:
    193
    Likes Received:
    263
    #187
    Ephoie likes this.
  8. Turist[40k]

    Turist[40k] Ensign

    Joined:
    Oct 4, 2020
    Messages:
    7
    Likes Received:
    1
    Spent quite a lot of time and still unable to find basic things like:
    {{devicesoftype structure type}} - what are possible types, where are they listed? Of course i see it being used here and there with different types, but which document should i refer to to get all possible types?
    What are the attributes for the each device type?

    I really fell like i`m missing some basic document like API guide which is some kind of public knowledge... :(

    I have read the documentation here https://github.com/GitHub-TC/EmpyrionScripting and checked the examples as well as the scripts in this thread. Unfortunately they are mostly quite heavily "obfuscated" by bells& whistles like coloring, pseudo graphics etc making them really hard to read for the person totally unfamiliar with HTML :)
     
    #188
    Ephoie likes this.
  9. me777

    me777 Commander

    Joined:
    Aug 18, 2020
    Messages:
    384
    Likes Received:
    131
    You got the wrong thread (even as it is mixed up already and it seems it's not enforced annymore...) this one is for sharing scripts only.
    also i had the same question in the right thread and got an answer: https://empyriononline.com/threads/mod-empyrion-scripting-mod.49290/page-9#post-420265
     
    #189
    Ephoie likes this.
  10. Ephoie

    Ephoie Captain

    Joined:
    Jan 27, 2018
    Messages:
    329
    Likes Received:
    515
    @Hummel-o-War ;)
     
    #190
  11. Khas

    Khas Ensign

    Joined:
    Oct 18, 2020
    Messages:
    7
    Likes Received:
    4
    Hi there, sorry in advance, i'm not sure this is the right place, but didn't found any other solution.

    I've been lurking around here for quite some time, studying yours greats scripts. And to start with, i would like to thank you all.
    I'd liked to share mine but i'm sure i'm not as good.
    Then since someone ask me to release my ship which make extensive use of many of yours scripts that i've modified, may i ask you if i can, obviously giving you credits, publish it?
     
    #191
    Ephoie likes this.
  12. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    991
    Likes Received:
    707
    @Khas No problem for me. I think it's great when the players do something with the scripting and expand the game.
    And if Eleon extends the API with constructor control, autominer and the ship / base / world information, we can do a lot more. Hope remains ;-)
     
    #192
    Ephoie likes this.
  13. Ephoie

    Ephoie Captain

    Joined:
    Jan 27, 2018
    Messages:
    329
    Likes Received:
    515
    @Khas Yes, please share.
     
    #193
  14. Homunk

    Homunk Lieutenant

    Joined:
    Mar 22, 2020
    Messages:
    74
    Likes Received:
    26
    Hi everybody,

    I have a question about the "Docked AutoAmmo" script (part of Vega AI).
    Basically Igot it to work, but..
    if there are various Sv with different weapons docked, the ammo is loaded to all of them, no matter if the SV has mounted weapons which use the ammo.

    I am using the latest version 5.10.8 of the mod and play SP.
    What am I doing wrong?

    Thanks
     
    #194
  15. Khas

    Khas Ensign

    Joined:
    Oct 18, 2020
    Messages:
    7
    Likes Received:
    4
    Since you ask:

    LCDScript: Script:AmmoBars
    LCDProjectorOutput: AmmoBars

    Description: i found it difficult keep an eye on all ammo types for turrets during combat so i developed this Projector to be placed near piloting seat, it changes colors of actual ammo number based on fixed values: 500 flashing red/white, under 2000 yellow, over 2000 green. Also i set the bar to be 100% at 2000 left. Has room to be combined with others scripts.
    Suitable for 1,25 wide projector, adjustable height
    20201020120152_1.jpg
    Code:
    {{~fontsize 7}}
    {{~set 'E' '<indent=239.3>║</indent>'}}
    {{~set 'L' (concat '║' @root.data.E)}}
    <line-height=7><align=center>AMMUNITIONS:
     </align>
    ╔{{~bar 1 0 1  52 '═'}}╗{{~#scroll 30 1 1}}
    {{~#items @root.E.S 'AMMO CONTAINER NAME HERE'}}
    {{@root.data.L}}
    ║ <color=#FFF>{{name}}</color> <indent=80%>[<color=#{{~#test count leq '500'}}{{intervall 1}}F11{{else}}FFF{{/intervall}}{{else}}{{~#test count leq '2000'}}FA0{{else}}{{~#test count ge '2000'}}1F1{{/test}}{{/test}}{{/test}}>{{Count}}</color>]</indent>{{@root.data.E}}
    {{@root.data.L}}
    ║ <size=6,5><color=#{{~#test count leq '500'}}{{intervall 1}}F11{{else}}FFF{{/intervall}}{{else}}{{~#test count leq '2000'}}FA0{{else}}{{~#test count ge '2000'}}1F1{{/test}}{{/test}}{{/test}}>{{~format count '{0,3:0.0}'}}</color>/<color=#F0F>{{format 2000 '{0,3:0.0}'}}</color></size><indent=30%><color=#F11>⚛ {{bar count 0 2000 12 '▒' '<color=#300>░</color>'}}<indent=80%><size=6,5><b><color=#FFF>{{~math count '/' 2000}}{{~format . '{0,8:P2}'}}{{~/math}}</color></b></size></indent></color></indent>{{@root.data.E}}
    {{@root.data.L}}
    ╟{{bar 1 0 1  52 '─'}}╢{{/items}}{{/scroll}}
    ╚{{bar 1 0 1  52 '═'}}╝
    </line-height>
    
     
    #195
    Ephoie likes this.
  16. Khas

    Khas Ensign

    Joined:
    Oct 18, 2020
    Messages:
    7
    Likes Received:
    4
    LCDScript: Script:SwitchesInfo
    LCDProjectorOutput: SwitchesInfo
    Description:This is my stupid version of the HUD switches panel, it's not perfect since looking from the right it glitches the buttons, but i saw it's diffrent from the Astic version and maybe can give some ideas? as you see it has room for others scripts as well.
    20201020124101_1.jpg
    Code:
    <size=70%><line-height=9>
    {{#signals E.S '*'}}
    {{#each .}}{{#if State}}{{~set 'S' (substring (concat '<cspace=-5><color=#232323><size=88%>◖<size=95%>■■■■</size>◗</size></color></cspace><cspace=-10><color=green><size=100%> ◉</size></color></cspace>' Name) 0 162)}}{{else}}{{~set 'S' (substring (concat '<cspace=-5><color=#232323><size=88%>◖<size=95%>■■■■</size>◗</size></color></cspace><cspace=-20><color=red><size=95%> ◎</size></color></cspace>    ' Name) 0 162)}}{{/if}}{{set 'A' (calc @root.Data.A '+' 1)}}{{set 'B' (calc @root.Data.A '%' 2)}}{{set 'C' (calc @root.Data.A '%' 3)}}{{#test @root.Data.C eq 0}}<indent=68%>{{@root.Data.S}}</indent>
    {{else}}{{#test @root.Data.B neq 0}}<indent=0>{{@root.Data.S}}</indent>{{else}}<indent=34%>{{@root.Data.S}}</indent>{{/test}}{{/test}}{{/each}}
    {{/signals}}
    
    
    May i ask something as well?
    I noticed the "#fill this" now only works with O2 Bottle and Fuel Cells/Packs. Before it could work as well with Small O2 bottle, Emergency O2, and BioFuel. Something has changed?
     
    #196
    Last edited: Oct 20, 2020
    Ephoie likes this.
  17. Homunk

    Homunk Lieutenant

    Joined:
    Mar 22, 2020
    Messages:
    74
    Likes Received:
    26
    Just to let you know. I found a solution for the above problem, which is probably not the smartest, but after fiddling around with the script for hours, I'm happy it works.

    Ok, here it is: I set up an own "Docked AutoAmmo" script for each of my SV and HV (added 1,2... to the original script name) using the same switch for all.

    Here is one example:
    Code:
    Script:DockedAutoAmmo1*
    AusgabeLCD: DockedAutoAmmoHangar
    Schalter:   sw_autoammo
    ---------------------------------------
    {{~set 'LimitToType' 'SV,HV'}}<pos=0>◜</pos><pos=188>◝</pos>
    <align=center><i><size=100%>Angedockte Fahrzeuge automatisch aufmunitionieren</size></i>
    </align><pos=0>◟</pos><pos=188>◞</pos>
    {{~#getswitch @root.E.S 'sw_autoammo'}}{{#if SwitchState}}
    {{~#each @root.E.S.DockedE}}
    {{#test Name 'eq' 'Aetron'}}
    {{~set 'IDs' '2104,2213'}}
    {{~devices S 'Box-Ammo*'}}{{#each .}}
    {{~set 'IDs' (concat @root.Data.IDs ',' (substring (replace CustomName '#' ',') 8))}}
    {{~/each}}{{/devices}}
    {{#items @root.E.S 'Box-Ammo*'}}
    {{~#test Id in @root.Data.IDs}}
    {{~#math (configattr Id 'StackSize') '/' 8}}
    {{~set 'Stacks' (int (max 10 .))}}
    {{~/math}}
    {{~#test Count ge @root.Data.Stacks}}
    {{~#move . ../../../S 'Box-Ammo*' @root.Data.Stacks}}{{/move}}
    {{~/test}}{{/test}}{{/items}}{{/test}}{{/each}}
    <align=center><size=80%>
    <color=green>Automatisches Aufmunitionieren der angedockten Fahrzeuge aktiviert.
    </color></size></align>
    {{else}}
    
    <align=center><size=80%>
    <color=red>Automatisches Aufmunitionieren der angedockten Fahrzeuge deaktiviert.
    </color></size></align>
    {{/if}}{{/getswitch}}
     
     
     
     
     
    <size=50%>
    {{~set 'IDs' '2104,2213'}}
    {{~#each @root.E.S.DockedE}}
    {{#test EntityType in @root.Data.LimitToType}}
    {{~devices S 'Box-Ammo*'}}{{#each .}}
    {{~set 'IDs' (concat @root.Data.IDs ',' (substring (replace CustomName '#' ',') 8))}}
    {{~/each}}{{/devices}}{{/test}}{{/each}}
    {{~#getitems @root.E.S 'Box-Ammo*'}}
    {{~#itemlist . @root.Data.IDs}}
    {{~#math (configattr Id 'StackSize') '/' 8}}
    {{~set 'Stacks' (max '10' .)}}
    {{~/math}}
    {{#test Count 'le' @root.Data.Stacks}}
    <indent=6>◉ <color=red>Nicht genug: <color=#00cccc>{{i18n Id 'Deutsch'}}</color> (<color=orange>{{Count}} ➠ #{{@root.Data.Stacks}}</color>)</color></indent>
    {{else}}
    <indent=6>◉ <color=green>Ausreichend:</color> <color=#00cccc>{{i18n Id 'Deutsch'}}</color> (<color=orange>{{Count}} ➠ #{{@root.Data.Stacks}}</color>)</indent>
    {{/test}}
    {{/itemlist}}{{/getitems}}
     
    #197
  18. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    991
    Likes Received:
    707
    Das "Ungemach" kommt leider daher das die Funktion
    Code:
    public interface IContainer : IDevice
    int AddItems(int type, int count);
    nicht mehr so funktioniert wie früher (und eigentlich gedacht) :-(
    Wenn 'count' nicht mehr in den Container "passt" (z.B. wegen Gewichtsbeschränkung) sollte die Funktion die Anzahl der NICHT hinzugefügten zurückliefern. Nun wird offenbar immer der ganze 'count' abgewiesen wenn es nicht passt.

    --> Es funktioniert nur, wenn der Zielcontainer mindestens eine zu transferierende Stackgröße fassen kann

    Also entweder die Stackgröße verandern z.B. 4 -> 8 in
    Code:
    {{~#math (configattr Id 'StackSize') '/' 4}}
    oder die Ammoboxen der SV/HVs größer machen

    ODER
    auf einen Fix von Eleon warten.
     
    #198
  19. |LG|Judge

    |LG|Judge Lieutenant

    Joined:
    Sep 9, 2015
    Messages:
    19
    Likes Received:
    1
    @ASTIC

    muss man noch etwas vorraussetzen damit deine scripts resp. das schiff mit seinen scripts funktioniert ?
    Habe den Mod runtergeladen lokal installiert ohne EAH gestartet, jedoch funktionieren alle Storage anzeigen nicht.

    hast du da ne Idee was es sein könnte ?
     
    #199
  20. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    991
    Likes Received:
    707
    1. Nicht den Quellcode sondern die compilierte Fassung (https://github.com/GitHub-TC/EmpyrionScripting/releases Datei: EmpyrionScripting.zip !!!) herunterladen und in [EGS]\Content\Mods entpacken
    2. EAC muss ausgeschaltet sein für die lokalen Mods, für Serverinstallationen muss EAC eingeschaltet sein damit evtl. installierte lokale Mods nicht dazwischen funken

    Dann sollte das ohne weitere Anpassungen laufen.
     
    #200
    Last edited: Mar 10, 2023
    Ephoie likes this.

Share This Page