[MOD EXT] Empyrion Scripting - Scripts

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

  1. _DefLock_

    _DefLock_ Ensign

    Joined:
    Jun 15, 2022
    Messages:
    3
    Likes Received:
    0
    Hey, nice sorting script Scipt. the problem is i cant get the constructor refill running? any fixes for this?
     
    #501
  2. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    993
    Likes Received:
    707
    If you are offline the constructor will calculate once completely how many items could be created and "calculated" them. If the calculation shows that the resources "run out" the production is taken out of the pipeline.
    Since it is unfortunately not possible via API to address the constructor, you can not, at the moment, also restart via script.
    Here we must hope that Eleon extends the API.
     
    #502
  3. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    993
    Likes Received:
    707
    C# Scripting can now be restricted to SaveGameScripts only
    https://github.com/GitHub-TC/EmpyrionScripting/releases/tag/10.0.1

    With the 1.8 the processing of the C# scripts of the players is unfortunately broken. You must therefore limit it to the SaveGame scripts SaveGame (CargoTeleport, Floorplan, etc... works) or disable it completely None.

    When the bug is fixed I will report here.

    • Please set in your [EGS Savegamepath]\Mods\EmpyrionScripting\Configuration.json the following setting
      "CsScriptsAllowedFor": "SaveGame",
      or
      "CsScriptsAllowedFor": "None",
     
    #503
  4. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    993
    Likes Received:
    707
    Unfortunately, the 1.8 has bugs with the execution of C# scripts. Please set it to
    Code:
     [EGS Savegamepath]\Mods\EmpyrionScripting\Configuration.json
    "CsScriptsAllowedFor": "None",
    until further notice,
     
    #504
    gustavpezka likes this.
  5. Shadowpheonix

    Shadowpheonix Lieutenant

    Joined:
    May 19, 2022
    Messages:
    44
    Likes Received:
    11
    Using Luke Benko's variant of the Dynamic Sorting Script, is there a way to make it include Ammo Boxes & Controllers, Fridges, and Harvest Controllers?
     
    #505
  6. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    993
    Likes Received:
    707
    https://github.com/GitHub-TC/EmpyrionScripting/releases/tag/11.0.0 C# Script fix for 1.8
    The C# scripts working again under 1.8 (bug in mono->Unity->EGS) but this involves a different necessary setting in the configuration file
    Code:
    "ExecMethod": "ThreadPool",
    This is necessary because EGS seems to have changed some other things internally that would otherwise terminate the playfield :-(
    So here is some testing to do and please report bugs you notice to me so I can collect and evaluate them
     
    #506
    Blitzello and me777 like this.
  7. me777

    me777 Commander

    Joined:
    Aug 18, 2020
    Messages:
    384
    Likes Received:
    131
    Hi, ASTIC.
    Kurze Frage:
    Ist es beabsichtigt das E.S.Items bei eroberten (ehemals npc) Strukturen nicht funktioniert?
     
    #507
  8. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    993
    Likes Received:
    707
    Wenn du einen kern setzen kannst und die Struktur auf deinen Faktion läuft sollte es gehen, jedoch weis ich nicht ob die API diese geänderten Daten auch überträgt oder immer noch meldet das dies eine POI ist.
     
    #508
  9. me777

    me777 Commander

    Joined:
    Aug 18, 2020
    Messages:
    384
    Likes Received:
    131
    Dann muss es an der API liegen - Kern war drauf und ich hatte auch strom für die lcds, ich konnte auch von der Station mein Schiff einsehen, aber über die Items der Station war nichts auszulesen. Naja währe ja auch etwas zu einfach wenn man so an die Fracht kommt. Aber ich war neugirig ob es geht. Ob wohl ein neu gesetzter Container angezeigt wird... Weitere Tests nötig ;)
     
    #509
  10. me777

    me777 Commander

    Joined:
    Aug 18, 2020
    Messages:
    384
    Likes Received:
    131
    Ich habe noch ein richtiges Problem:

    ich setze mit
    {{~lights @root.E.S 'batt'}}
    {{~lightcolor . '00FF00'}}
    {{/lights}}
    ein Licht (Flare).
    Das blitzt nur kurz auf und geht wieder aus, als ob das {{/lights}} es wieder aus macht.

    Vor einiger Zeit (pre-1.8 patch) ging das noch. (blieb an)
     
    #510
  11. swg2you

    swg2you Ensign

    Joined:
    Sep 28, 2015
    Messages:
    6
    Likes Received:
    0
    Hello.
    Here is my little script for growing plants monitoring and plant lighting automation.

    [​IMG]

    All "Plant Grow Light" must be in a group and must have a custom name.
    HTML:
    {{! Growing Plant Monitor v.1 by swg}}
    {{! all Growing Light must be named }}
    {{! change the wildcard if necessary}}
    {{devices  E.S '*'}}
    {{#each .}}
    {{test .Id eq 564}}
    {{CustomName}}:<indent=5>
    {{set 'GrowLightOn' false}}
    {{math Position.Y '-' 1}}
    {{#each '+*-'}}
    {{math ../../Position.X . 1}}
    {{#each '+*-'}}
    {{math ../../../../Position.Z . 1}}
    {{block @root.E.S ../../ ../../../../ .}}
    {{test .id 'in' '593,599,602,707,643,611,467,
    1169,709,1173,1177,1181,1369,1529,1533,
    1599,1603,2163,2167,2171,1329,0'}}
    <color=orange>{{else}}
    {{set 'GrowLightOn' true}}
    <color=green>{{/test}}
    {{~test .id 'in' '0'}}◌
    {{~else}}◉ {{i18n .id}}
    {{~/test}}</color>
    {{~/block}}
    {{/math}}
    {{/each}}
    {{/math}}
    {{/each}}
    {{/math}}</indent>
    {{setactive . @root.Data.GrowLightOn}}
    {{/test}}
    {{/each}}
    {{/devices}}
    ---
    
    Logic:
    We go through all the custom named blocks and if it is a growth lamp, then we look at what is under it. We display the names of the plants, and if all the plants are ripe, we turn off the growth lamp.

    If you have many gardens, you can change the wildcard character in the 4th line of the script to select a certain group of lamps or a single lamp.

    For example, you have 4 gardens (2 on the left and 2 on the right side) and you want to put monitor per side. Name the left lamps "GrowLightL" and the right lamps "GrowLightR", then in the left script the 4th line will be "{{devices E.S '*L'}}" and right "{{devices E.S '*R'}}" accordingly.

    When trying to get {{E.S.Players.[0].DrivingEntity.Name}} I get an exception if the player is not in the seat. How to correctly handle the situation when DrivingEntity is empty?
    Workarounds are not suitable, the question is exactly how to check whether the field is initialized!
     
    #511
  12. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    993
    Likes Received:
    707
    @swg2you with .length you have access to the length of an array and with "if" you can test a not null object
     
    #512
  13. swg2you

    swg2you Ensign

    Joined:
    Sep 28, 2015
    Messages:
    6
    Likes Received:
    0
    Thanks for your reply my friend.
    I expected the following code to work correctly:
    HTML:
    {{#if E.S.Players.[0].DrivingEntity.Name}}
    some
    {{/if}}
    
    But instead I get the error:
    "Exception has been thrown by the target of an invocation."

    ...If it's not difficult for you, please point out my mistake.
     
    #513
  14. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    993
    Likes Received:
    707
    Code:
    {{#test E.S.Players.length 'ge' 0}}
    {{#if E.S.Players.[0].DrivingEntity}}
    Do something with  E.S.Players.[0].DrivingEntity.Name
    {{/if}}
    {{/test} }
    Info E.S.Pilot gives you the pilot of the vessel direct
     
    #514
  15. swg2you

    swg2you Ensign

    Joined:
    Sep 28, 2015
    Messages:
    6
    Likes Received:
    0
    It doesn't work for me my friend.
    E.S.Players.[0].DrivingEntity - exists and passing the test
    Code:
    {{#test E.S.Players.length 'ge' 0}}
    {{#if E.S.Players.[0].DrivingEntity}}
    Hello {{E.S.Players.[0].DrivingEntity}}
    {{/if}}
    {{/test}}
    gives output "Hello EmpyrionScripting.DataWrapper.EntityData"
    at the same time
    Code:
    {{#test E.S.Players.length 'ge' 0}}
    {{#if E.S.Players.[0].DrivingEntity}}
    Hello {{E.S.Players.[0].DrivingEntity.Name}}
    {{/if}}
    {{/test}}
    gives an error "{test} [1 ge 0 ]:Exception has been thrown by the target of an invocation. 13:23:50"

    Empyrion 1.8.3 3849 04-10:26, EmpyrionScripting by ASTIC/TC Version:11.0.0.0, EAC Disabled, SP.
    I observed this error half a year ago, which I wrote about in "issues": https://github.com/GitHub-TC/EmpyrionScripting/issues/8

    upd:
    Thanks for your mod, it's introduced me to a lot of new interesting stuff.
     
    #515
    Last edited: Jul 4, 2022
  16. Sephrajin

    Sephrajin Rear Admiral

    Joined:
    Dec 22, 2017
    Messages:
    916
    Likes Received:
    2,917
    Try this:
    Code:
      --== People on Board ==--
         Pilot today is: {{E.S.Pilot.Name}}
         We welcome our passengers today:
    {{#each E.S.Passengers}}
          - {{Name}}
    {{/each}}
     
    #516
    Germanicus likes this.
  17. Sephrajin

    Sephrajin Rear Admiral

    Joined:
    Dec 22, 2017
    Messages:
    916
    Likes Received:
    2,917
    Long worked on, even longer break... soon to be done.

    [​IMG]

    [​IMG]
     
    #517
    Pete 3 and Germanicus like this.
  18. swg2you

    swg2you Ensign

    Joined:
    Sep 28, 2015
    Messages:
    6
    Likes Received:
    0
    Thanks for your answer, my friend, but the problem is that trying to access some data - leads to an error that cannot be handled correctly (at least I haven't found such a way).
    We are not talking about a way to get the names of the pilot or passengers, but about a possible bug in the mod.
     
    #518
  19. swg2you

    swg2you Ensign

    Joined:
    Sep 28, 2015
    Messages:
    6
    Likes Received:
    0
    [​IMG]
    Script:
    Empyrion Power Controller v.1 - Saves energy by turning off devices after crafting



    Solution description:
    - Сonsumption power drop is used as a signal source.
    - Transient processes are filtered by 3-stroke delay line.
    As a result, automation errors are possible when the transition processes of different blocks overlap. But I think it's better than nothing and allows you to save a lot of energy, especially important for structures powered by solar panels.

    The work algorithm is as follows:
    We look at the difference between the previous consumption of the base and the current one (taking into account the delay line) and if the difference coincides with the difference for the known block - we deactivate the block.

    In this version, the following blocks have been added:
    [id] [delta] [block name]
    962 270 Food Processor
    1628 245 Small Constructor
    960 490 Large Constructor
    714 1496 Advanced Constructor
    1371 815 Deconstructor
    1132 2452 Furnace
    ---
    p.s.
    I will be glad for your testing and feedback. Thanks.
     
    #519
    Last edited: Jul 6, 2022
  20. GATTO

    GATTO Ensign

    Joined:
    Feb 25, 2022
    Messages:
    15
    Likes Received:
    4
    By any chance anyone has updated this one? the Id's return something else (ramps) and some return nothing (Tested in Reforged Eden)
     
    #520

Share This Page