[MOD EXT] Empyrion Scripting - Scripts

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

  1. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    Da du vermutlich die Liste der Items "scrollen" möchtest musst du den scroll Befehl hier - um die "items" - eintragen (habe ich aber nicht getestet)

    Code:
    {{#devicesoftype E.S 'Container'}}
    {{#each .}}
    Found: {{CustomName}}
    {{#if CustomName}}
    {{#items @root.E.S CustomName}}
    -{{format Count '{0,5}'}} {{i18n id 'Deutsch'}}
    {{/items}}
    {{#devices @root.E.S
    (concat CustomName 'LCD*')}}
    {{#each .}}
    {{#settextblock .}}
    {{../../../CustomName}}:
    {{~islocked @root.E.S ../../../.}}(locked){{/islocked}}
    {{~#scroll 20 2}}
    {{#items @root.E.S ../../../CustomName}}
    -{{format Count '{0,5}'}} {{i18n id 'Deutsch'}}
    {{/items}}
    {{/scroll}}
    {{/settextblock}}
    {{/each}}
    {{/devices}}
    {{/if}}
    {{/each}}
    {{/devicesoftype}}
     
    #301
  2. Murdok

    Murdok Ensign

    Joined:
    Jul 12, 2021
    Messages:
    5
    Likes Received:
    0
    werde das bei gelegenheit mal testen ob es funktioniert.

    ich hätte da auch noch eine weitere frage.


    das pve/pvp script ( mit der red alert ausgabe ), lösst sich das eigentlich umstellen/umändern das anstelle der textausgabe auf einem definierten lcd, eine signalleuchte im pve gebiet grün leuchtet und in einem pvp gebiet rot blinkt???

    bzw lässt sich sowas generell umsetzen oder macht das script da nicht mit?
     
    #302
  3. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    Klar, du kannst per Script einen Schalter setzen dessen Signal dann die Lampen steuert
     
    #303
  4. Murdok

    Murdok Ensign

    Joined:
    Jul 12, 2021
    Messages:
    5
    Likes Received:
    0

    da kommt direkt die nächste frage, wie mach ich das?
     
    #304
  5. Murdok

    Murdok Ensign

    Joined:
    Jul 12, 2021
    Messages:
    5
    Likes Received:
    0


    Ich muß Dir leider mitteilen das mir das display mit dem code leider nichts ausgibt
     
    #305
  6. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    Die Stelle war nur der "locked" Fall
    Code:
    {{#devicesoftype E.S 'Container'}}
    {{#each .}}
    Found: {{CustomName}}
    {{#if CustomName}}
    {{~#scroll 4 2}}
    {{#items @root.E.S CustomName}}
    -{{format Count '{0,5}'}} {{i18n id 'Deutsch'}}
    {{/items}}
    {{/scroll}}
    {{#devices @root.E.S
    (concat CustomName 'LCD*')}}
    {{#each .}}
    {{#settextblock .}}
    {{../../../CustomName}}:
    {{~islocked @root.E.S ../../../.}}(locked){{/islocked}}
    {{~#scroll 4 2 1}}
    {{#items @root.E.S ../../../CustomName}}
    -{{format Count '{0,5}'}} {{i18n id 'Deutsch'}}
    {{/items}}
    {{/scroll}}
    {{/settextblock}}
    {{/each}}
    {{/devices}}
    {{/if}}
    {{/each}}
    {{/devicesoftype}}
    so funktioniert es 'normal'
    upload_2021-7-23_10-27-1.png
    upload_2021-7-23_10-27-21.png
     
    #306
  7. Murdok

    Murdok Ensign

    Joined:
    Jul 12, 2021
    Messages:
    5
    Likes Received:
    0


    habe das script nwelches bei dir scheinbar funktioniert mit copy paste ausprobiert, ergebnis sieht man auf den bildern
     

    Attached Files:

    • 1.jpg
      1.jpg
      File size:
      620.8 KB
      Views:
      111
    • 2.jpg
      2.jpg
      File size:
      681.9 KB
      Views:
      110
    #307
  8. rchamp26

    rchamp26 Ensign

    Joined:
    Jun 23, 2021
    Messages:
    4
    Likes Received:
    3

    Hi Sephrajin, I've been working on getting this integrated into my BA (and eventually a CV build) for 1.5.x + RE. I've got the automove cargo script working on the BA, but having challenges with the autofill script. I had to change the IDs in the script for the oxygen fuel and pentaxid, so the LCD display properly detected them in my defined cargo box (using the default "Output Power" box defined in the script).

    I have a few questions. Is there something else needed to define to send the resources to the ship? when i switch on, and wait a few minutes, nothing transfers. I have made sure that the SV is docked AND powered off. Also i can't find a way to adjsut the formatting for the resources to show below the placed switch like the automove script works. any ideas?

    I don't see anything else in the script that tells the base to send the resources to the docked vessel. Maybe that fill command needs some massaging?


    LCD Input: Script:AutofillDockedVessels
    LCD Output: AutofillDockedVessels
    switch: sw_autofill
    switch signal: sw-autofill



    Code:
    {{~set 'LimitToType' 'SV,HV'}}
    <pos=0>◜</pos><pos=188>◝</pos>
    <align=center><i><size=150%>Autofill docked vessels</size></i>
    </align><pos=0>◟</pos><pos=188>◞</pos>
    {{#getswitch @root.E.S 'sw_autofill'}}
    {{#if SwitchState}}
    
    
    
    
    {{~#each @root.E.S.DockedE}}
    {{#test EntityType in @root.Data.LimitToType}}
    {{#items @root.E.S 'Output Power'}}
    {{#test Count get 1000}}
    
    
    
    {{#test id eq 4176}}
    {{#fill ../this ../../../S 'Oxygen' 100}}{{/fill}}
    {{/test}}
    {{#test id eq 4314}}
    {{#fill ../this ../../../S 'Fuel' 100}}{{/fill}}
    {{/test}}
    {{#test id eq 4342}}
    {{#fill ../this ../../../S 'Pentaxid' 100}}{{/fill}}
    {{/test}}
    {{/test}}
    {{/items}}
    {{/test}}
    {{/each}}
     
     
    {{else}}
    <color=red>Switch this lever to automatically fuel up your docked vessels.</color>
    
    
    {{/if}}{{/getswitch}}
    <size=90%>
    {{~set 'IDs' '4314,4176,4342'}}
    {{~#itemlist @root.E.S.items @root.Data.IDs}}
    {{#test count le 1000 }}
    <indent=6>◉ <color=red>Not Enough: <color=#00cccc>{{Name}}</color> (<color=orange>{{Count}}</color>)</color></indent>
    {{else}}
    <indent=6>◉ <color=green>Plenty:</color> <color=#00cccc>{{Name}}</color></indent>
    {{/test}}
    {{/itemlist}}
    </size>
     

    Attached Files:

    #308
  9. Khas

    Khas Ensign

    Joined:
    Oct 18, 2020
    Messages:
    7
    Likes Received:
    4
    Two things you can also check:

    Code:
    {{#test EntityType in @root.Data.LimitToType}}
    {{#items @root.E.S 'Output Power'}}
    {{#test Count get 1000}}
    
    need more than 1000 of the resource in the 'Output Power' container, and the entity must be in the type list, so:
    Code:
    {{~set 'LimitToType' 'SV,HV'}}
    
    Only SV or HV (you can add CV type if you wish)

    of course you also need the proper switch state.
    Hope it helps ;)
     
    #309
  10. me777

    me777 Commander

    Joined:
    Aug 18, 2020
    Messages:
    406
    Likes Received:
    138
    Hi,
    I made a Ship detection script with the new position feature. (replacement for a motion sensor)
    Works for ships and a list of pilots. ('me777' in example)
    Does not trigger on spacesuits.
    needs switcvh for output ('doors' in example)

    You have to set the center for the detection in the script, i did not put extra variables for that as it only needs to be set once (in the three math lines).

    Code:
    <align=center>
    {{~set 'out' '0'}}
    {{~#entitiesbyname '*',200}}
    {{~#each .}}
    {{~#test .S.Pilot.Name in 'me777'}}
    Welcome
    Ship: {{Name}}:{{Id}}
    Pilot: {{.S.Pilot.Name}}
    {{~#globaltostructpos @root.E.S Pos}}
    {{~math x '-' 1}}{{set 'dx' .}}{{/math}}
    {{~math y '-' 125}}{{set 'dy' .}}{{/math}}
    {{~math z '-' -63}}{{set 'dz' .}}{{/math}}
    X: {{@root.data.dx}} Y: {{@root.data.dy}} Z: {{abs @root.data.dz}}
    <size=300%>
    {{~#test @root.data.dx leq '-4'}}
    →
    {{~/test}}
    {{~#test @root.data.dx geq '4'}}
    ←
    {{~/test}}
    {{~#test @root.data.dy leq '-4'}}
    ↑
    {{~/test}}
    {{~#test @root.data.dy geq '4'}}
    ↓
    {{~/test}}
    </size>
    {{~#test (abs @root.data.dx) leq '9'}}{{#test (abs @root.data.dy) leq '9'}}{{abs @root.data.dz}}{{#test (abs @root.data.dz) leq '45'}}{{set 'out' '1'}}{{/test}}{{/test}}{{/test}}
    {{~/globaltostructpos}}{{/test}}
    {{~/each}}
    {{~#test @root.data.out eq '1'}}{{setswitch @root.E.S 'doors' true}}
    Open
    {{~else}}{{setswitch @root.E.S 'doors' false}}
    Locked
    {{~/test}}
    {{~/entitiesbyname}}
    </align>
    
    Use as you please, but share if you have improvements ;)
     
    #310
    Last edited: Aug 5, 2021
    Ephoie likes this.
  11. Sephrajin

    Sephrajin Rear Admiral

    Joined:
    Dec 22, 2017
    Messages:
    916
    Likes Received:
    2,918
    Sorry I have not been playing for a BIG while... (like 1.0 release)
    Also it (scripts) had stoped me from getting my ships done, thus I lost interest in the game alltogether.
    I have no idea if Astic had since changed anything.
    It did work back then, why that no longer is the case (just for you?), I dont konw.

    I answer here only to be polite as I seen you taged me, I have no intention to dig into this.
    I just started a new project (CV) after, idk... 1-3 years.. i lost track... and I do not want to get overhelmed by scripts again.
    Sorry.
     
    #311
    Xyberwolf likes this.
  12. me777

    me777 Commander

    Joined:
    Aug 18, 2020
    Messages:
    406
    Likes Received:
    138
    BA have no DockedE as you can not really dock to a BA, you just land on it like on terrain. this only works with CV, maybe with SV and HV.
    try {{~#entitiesbyname '*',200}}
     
    #312
    Ephoie and Sephrajin like this.
  13. Roteshertz

    Roteshertz Ensign

    Joined:
    Nov 28, 2017
    Messages:
    6
    Likes Received:
    1
    Gibt es eine Möglichkeit mir den Inhalt einer Kiste in Deutsch anzeigen zu lassen?

    Is there a way to display the contents of a box in German?
     
    #313
  14. me777

    me777 Commander

    Joined:
    Aug 18, 2020
    Messages:
    406
    Likes Received:
    138
    {{i18n Key}} (anstatt {{Name}})
    https://github.com/GitHub-TC/EmpyrionScripting <- die offizielle Anleitung ist recht gut. Ist in deutsch und englisch.
     
    #314
  15. Roteshertz

    Roteshertz Ensign

    Joined:
    Nov 28, 2017
    Messages:
    6
    Likes Received:
    1
    Das habe ich schon ausprobiert ,Problem die Items werden mir jetzt doppelt angezeigt, einmal auf Deutsch und einmal in Englisch
     
    #315
  16. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    Nur den Teil mit dem i18n verwenden, nichts sonst. Du kannst dir das auf dem Demo CV auch ansehen. Dort wird die Sprache etc. dann auch über ein zentrales 'CultureInfo' LCD eingestellt
     
    #316
    Last edited: Aug 9, 2021
  17. Ranix

    Ranix Ensign

    Joined:
    Aug 28, 2021
    Messages:
    13
    Likes Received:
    2
    Name: BA Power Log
    Description: Hackeneyed modification of Shadowviper's graph to show battery consumption over time

    Picture:
    upload_2021-8-28_6-26-56.png


    LCD Input Name: Script:[+120]FuelLog, Script:FuelLogAxis
    (one won't likely be using both fuel logs on the same structure so this is fine to leave alone)

    LCD Output Name/Setup: Look in the P menu under 'Statistics' in the top-center battery tab to find out how much battery capacity you use, and punch this number in for the 'Cap' variable. My base has 49000, as shown, so I put 49000 there. I couldn't figure out a way to get the max fuel with battery + fuel tank capacity, or a way to get the max battery power, of a base. So this is the best I can do.

    upload_2021-8-28_6-33-41.png

    (Original instructions from Shadowviper) FuelLog + FuelLogAxis, both as projector blocks with width/height 1. Offset both projectors so they are on the same blockspace, with 'FuelLog' being rotated 90 degress clockwise - so the first letter of "Enter text" appears in the top right corner pointing down. As the script is a [+N] new data is added to the "top" and pushes previous bars "down", but being rotated 90deg the "top" is now the far right. The 2nd projector is then used for the axis and numbering as a single screen cannot rotate only some of its text, so the numbers are the right way up.

    Paint the block behind black and/or texture as desired. To give a glassy/screen type look the screenshot above has the projection 0.25 in front of the block and placing the full glass heavy window over the top to give a 'thick screen' effect.

    The modulus in FuelLog causes the script to run once per hour, with a text size that fits in 120 columns across the screen - increasing the length of the log should just be a case of increasing the modulus on line 2 e.g. changing 60 to 120 would mean it only runs once every 2 minutes, so 120 lines covers 4 hours instead of 2.
    LCD Input Script:
    Script:[+120]FuelLog
    Code:
    {{set 'Cap'  49000}}
    {{fontsize 2}}
    {{#test (calc @root.CycleCounter '%' 60) eq 0}}
    <indent=28><line-height=0><color=#1cb2f5>
    {{~bar (calc @root.Data.Cap '-' (calc (calc @root.E.S.Fuel '-' @root.E.S.FuelTank.Capacity) '+' (calc @root.E.S.FuelTank.Capacity '-' @root.E.S.FuelTank.Content))) 0 @root.Data.Cap 60 '<color=#000>█</color>' '█'~}}
    </color>
    </line-height><line-height=3.2>
    {{/test}}
    
    Script:FuelLogAxis
    Code:
    {{set 'Cap'  49000}}
    <size=6><indent=5%>Battery:{{~math (calc (calc @root.E.S.Fuel '-' @root.E.S.FuelTank.Capacity) '+' (calc @root.E.S.FuelTank.Capacity '-' @root.E.S.FuelTank.Content)) '/' @root.Data.Cap}}
    {{~format . '{0,8:P4}'}}{{/math}}</indent><indent=50%>{{#use E.S.FuelTank~}}
    <color=#F00>☢ {{bar Content 0 Capacity 15 '▒' '<color=#300>░</color>'}}<indent=50%><size=4><b><color=#FFF>{{~math Content '/' Capacity}}{{~format . '{0,8:P2}'}}{{~/math}}</color></b></size></indent></color>
    {{/use~}}
    </indent><indent=0>{{bar 1 0 1 65 '─'}}</indent></size>
    <line-height=4>{{fontsize 8}}
    <size=4>100%</size>
    <indent=8%>{{bar 1 0 1 7 '║
    '}}</indent>
    <size=4>75%</size>
    <indent=8%>╟<color=#CCCCCC40>{{bar 1 0 1 33 '─'}}</color>
    {{bar 1 0 1 7 '║
    '}}</indent>
    <size=4>50%</size>
    <indent=8%>╟<color=#CCCCCC40>{{bar 1 0 1 33 '─'}}</color>
    {{bar 1 0 1 9 '║
    '}}</indent>
    <size=4>25%</size>
    <indent=8%>╟<color=#CCCCCC40>{{bar 1 0 1 33 '─'}}</color>
    {{bar 1 0 1 9 '║
    '}}</indent>
    <indent=8%>╚{{bar 1 0 1 33 '═'}}
    <size=4><indent=5%>-2h</indent><indent=50%>-1h</indent><indent=95%>-0s</indent></size>
    
     
    #317
    Necroz and ASTIC like this.
  18. Ranix

    Ranix Ensign

    Joined:
    Aug 28, 2021
    Messages:
    13
    Likes Received:
    2
    Name: Bay Level Display
    Description: Compact display of cargo bay volume

    Picture:
    upload_2021-8-30_7-54-45.png
    upload_2021-8-30_7-55-33.png


    LCD Input Name: Script:Baylevels

    LCD Output Name/Setup: Baylevels, expects 1 wide and any height
    upload_2021-8-30_7-57-7.png

    LCD Input Script: Just change the "~split" line to have the names of your cargo bays instead of mine. Should support any number of cargo bays within reason.
    Script:Baylevels
    Code:
    Targets:Baylevels
    <line-height=0><br></line-height>{{~split 'Production Bay One,Production Bay Two,Production Bay Three,RECYCLING' ','}}{{set 'Targets' .}}{{/split}}{{#each @root.Data.Targets}}<line-height=0>{{set 'Vol' 0}}{{#devices @root.E.S @value}}{{set 'Cap' .0.Device.VolumeCapacity}}{{/devices}}{{#items @root.E.S @value}}{{set 'Vol' (calc @root.Data.Vol '+' (calc (configattr Id 'Volume') '*' Count))}}{{/items}}{{@value}}:
    <align=right>{{~math @root.Data.Vol '/' @root.Data.Cap}}{{~format . '{0,8:P0}'}}{{/math}}</align>
    <color=red>{{bar @root.Data.Vol 0 @root.Data.Cap 20 '░' '<color=#0f0000>░</color>'}}</color></line-height>
    <line-height=-8><br></line-height>
    {{/each}}
    
     
    #318
    Last edited: Aug 30, 2021
  19. b1rdY< <3 SweetY :3

    b1rdY< <3 SweetY :3 Ensign

    Joined:
    Apr 25, 2016
    Messages:
    1
    Likes Received:
    0
    Kann mir bitte wer erklären, wie ich die Ausgabe auf Deutsch bekomme? Ich habe dieses Script von Seite 1 Kopiert und auf "Deutsch" umgestellt, leider sind die Erze noch immer Ore´s und die Barren noch "Ingots", kann mir wer hier hilfestellung geben bitte?

    Code:
    CultureInfo:
    
    {
      "LanguageTag": "de-DE",
      "i18nDefault": "Deutsch",
      "UTCplusTimezone": 2
    }
    Code:
    {{~set 'H' 'Materials'}}
    {{~set 'T' '1000'}}
    {{~#split '#15FC05,#8FF904,#F4DC04,#F99C04,#FC6305,#CE1818' ','}}{{set 'C' .}}{{/split}}
    {{~set 'IDs' '4296,4297,4298,4299,4300,4301,4317,4318,4332,4345,4328,4302'}}
    {{~#split @root.ScriptId ':'}}{{devices @root.E.S .1}}{{#split (substring (i18n .0/Id 'Deutsch') 4) ' '}}{{set 'SS' .0}}{{/split}}{{/devices}}{{/split}}
    {{~concat '<color=#FFF><align=center><size=200%>' @root.Data.H '</size></align>'}}
    <align=center>{{bar 1 0 1  45 '═'}}</align>
    {{#sortedeach @root.E.S.Items 'Count' true}}{{~#test Id in @root.Data.IDs}}{{set 'X' (concat @root.Data.X Id',')}}{{setblock 'D' ~}}
    {{@root.Data.D}}{{Name}}:{{format Count '{0,6:N0}'}}:
    {{~#test Count geq @root.Data.T}}{{@root.Data.C.0}}{{else}}
    {{~#test Count ge (calc @root.Data.T '*' '0.75')}}{{@root.Data.C.1}}{{else}}
    {{~#test Count ge (calc @root.Data.T '*' '0.50')}}{{@root.Data.C.2}}{{else}}
    {{~#test Count ge (calc @root.Data.T '*' '0.25')}}{{@root.Data.C.3}}{{else}}{{@root.Data.C.4}}{{/test}}{{/test}}{{/test}}{{/test}};{{~/setblock}}
    {{~/test}}{{~/sortedeach}}
    {{~#itemlist @root.E.S.Items @root.Data.IDs}}{{#test Id in @root.Data.X}}{{else}}{{set 'D' (concat @root.Data.D Name ':' (format 0 '{0,6:N0}') ':' @root.Data.C.5 ';')}}{{/test}}{{/itemlist}}
    {{~#split @root.Data.D ';' true}}{{#each .}}{{#split . ':'}}
    {{~#test @root.Data.SS eq '1x2'}}{{~fontsize 6}}{{~#test (calc @Index '%' 3) eq 2}}{{set 'P' '67,90'}}{{else}}{{~#test (calc @Index '%' 3) eq 1}}{{set 'P' '32,56'}}{{else}}
    {{set 'P' '0,20'}}{{/test}}{{/test}}{{else}}
    {{~#test @root.Data.SS eq '1x1'}}{{~fontsize 4}}{{~#test (calc @Index '%' 2) eq 1}}{{set 'P' '52,85'}}{{else}}
    {{set 'P' '0,34'}}{{/test}}{{else}}{{fontsize 3}}
    {{set 'P' '0,80'}}{{/test}}{{/test}}
    {{~#split @root.Data.P ','}}{{~concat '<color=' ../.2 '><indent=' .0 '%>◉ ' ../.0 '</indent> <indent=' .1 '%>' ../.1 '</indent></color>' ~}}{{/split}}
    {{~/split}}{{~/each}}{{~/split}}
    [​IMG]
     

    Attached Files:

    #319
  20. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    @root.Data.D Name ':' (format 0 '{0,6:N0}')

    in

    umbauen, denn Name ist immer der englische Bezeichner
    PS: bei i18n die Sprache am besten immer weglassen da sie dann aus der CultureInfo genommen wird
     
    #320

Share This Page