[mod] Empyrion Scripting Mod

Discussion in 'Empyrion API' started by ASTIC, May 25, 2019.

Tags:
  1. Amenophis

    Amenophis Ensign

    Joined:
    Jul 16, 2018
    Messages:
    7
    Likes Received:
    0
    #421
  2. Amenophis

    Amenophis Ensign

    Joined:
    Jul 16, 2018
    Messages:
    7
    Likes Received:
    0
    I have another question (sorry for the double post)

    I use the following code to transform a lever into a "toggle button" that allow to use the "Toggle" option of a signal receiver properly :
    Code:
    root.CsRoot.Devices(root.E.S, "LeverToggle*").ForEach(t =>
    {
        if (t.SwitchState)
        {
            t.SwitchState = false;
        }
    });
    It's work like a charm with all levers named "LeverToggle[X]" but not with those named simply "LeverToggle". How to include them too without creating a second loop without wildcard?

    Removing a letter like this "LeverToggl*" works but I don't find it very clean. Is there another way?
     
    #422
  3. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    Works fine on my seting

    [​IMG]
     
    #423
  4. Amenophis

    Amenophis Ensign

    Joined:
    Jul 16, 2018
    Messages:
    7
    Likes Received:
    0
    Strange...

    Anyway I have another much more serious problem.

    I am on a solo game and when I change playfield. All SaveGameScripts stop working. I tested with mine already. But also with Floorplan from the EmpyrionScripting-Collection Github.

    No more SaveGameScripts are executed when changing Playfield. No error in the console, but I see that the changes made to the scripts are still detected. I have to quit the game and restart it

    Do you know where this could come from?

    I tried on a dedicated server and I do not encounter this problem (but as this game is full bugged ... this time it is the signal receivers set in toggle that do not work and it does not come from the script or the mod ...)
     
    #424
  5. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    This is unfortunately a bug in the API of Empyrion which only occurs in SinglePlayer. The ship you control as a pilot does NOT appear in the lists of structures after a playfield change. Therefore the scripting no longer has access.
    Unfortunately, Eleon has ignored this error so far. The only way out is to play via a dedicated server
     
    #425
  6. Amenophis

    Amenophis Ensign

    Joined:
    Jul 16, 2018
    Messages:
    7
    Likes Received:
    0
    Thanks for your answers.

    I have to admit that I'm a little bummed by Eleon... I bought Empyrion several years ago during the Early because I saw great potential in it. But I feel like the developers don't really pay attention to the problems of their game and I have a hard time understanding how they could release it from the early in such a state....

    Anyway... this is not the topic or the place to talk about it.

    Thanks for your mod which is really great
     
    #426
  7. BloodAngel099

    BloodAngel099 Lieutenant

    Joined:
    Jan 24, 2023
    Messages:
    34
    Likes Received:
    2
    Just as a FYI, if you use a teleporter to go to a different playfield and then teleport back scripts will work again. It is annoying and is the reason I limit script usage on some of my ships.
     
    #427
  8. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    Yep, as I said, only the ship you change as pilot is affected.
    The teleporter is another “workaround”
     
    #428
  9. Daimonicon

    Daimonicon Lieutenant

    Joined:
    Nov 4, 2019
    Messages:
    69
    Likes Received:
    15
    Hello,
    I have a problem with the readability of the text output, both info values and errors or internal notes.
    The output scrolls too fast to read anything unless you are fast enough to access the LCD to read a snapshot.

    Code:
    {{~scroll 13 1}}{{#entitiesbyname '*'}}
    {{#each .}}
    {{#test @root.E.Id 'neq' Id}}
    <size=5><color=orange>{{Name}}:</color></size>
    <size=4>{{#deconstruct . 'Salvage*'}}
      min: {{MinPos}}
      max: {{MaxPos}}
      current X: {{X}}
      current Y: {{Y}}
      current Z: {{Z}}
      TotalBlocks: {{TotalBlocks}}
      CheckedBlocks: {{CheckedBlocks}}
      RemovedBlocks: {{RemovedBlocks}}
    </size>
    {{else}}
    - {{/deconstruct}}
    {{/test}}
    {{/each}}
    {{/entitiesbyname}}{{/scroll}}
    Does anyone know how to make the text readable?
     
    #429
  10. Daimonicon

    Daimonicon Lieutenant

    Joined:
    Nov 4, 2019
    Messages:
    69
    Likes Received:
    15
    Is it possible that the harvest script is not able to harvest eggs from the respective plant? At least in my case it can't, although it seems to do something according to the log, but not a single egg ends up in the target refrigerator.

    {{#blocks E.S -1 129 -4 4 129 -2}}
    {{~#each .}}
    {{Id}} {{i18n Id}}
    X: {{~Position.X}} // Y: {{~Position.Y}} // Z:{{~Position.Z}}
    --
    {{/each}}
    {{~#harvest @root.E.S . 'AutoFarm' 5 129 -4 false}}
    Harvest:
    {{i18n Id}}➔ {{~i18n ChildOnHarvestId}} get {{DropOnHarvestCount}}: {{~i18n DropOnHarvestId}}
    --
    {{/harvest}}
    {{/blocks}}

    This is what the console shows when harvesting the eggs. The area consists of 18 fields, all other plants are harvested without any problems except for the eggs.
    [​IMG]

    Edit: I can now narrow it down further - I get "Natural Stimulant" instead of the egg. Whereby the description definitely says yield is 1x egg.
     
    #430
    Last edited: Aug 27, 2024
  11. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    Works exactly as expected for me (tested with RE2)

    [​IMG]

    Your destination container may be full or it may be packed in another container (with the same name)
     
    #431
  12. Daimonicon

    Daimonicon Lieutenant

    Joined:
    Nov 4, 2019
    Messages:
    69
    Likes Received:
    15
    That probably doesn't make troubleshooting any easier if it works for you. I have updated from my previous version 13.1.0 to the latest version. My assumption was wrong I get vegetables instead of eggs not “Natural Stimulant” as I thought. Container was not full at all but I emptied it completely anyway and another container can't be because all 16 other plants are harvested and assigned without any problems. I have also tested what I get when harvesting without a script and it is actually eggs.

    I have made two videos, maybe they will give you some more information. 1x on my ship 1x on your script demo prefab - with the same result.



     
    #432
  13. Daimonicon

    Daimonicon Lieutenant

    Joined:
    Nov 4, 2019
    Messages:
    69
    Likes Received:
    15
    It throws up a few errors from time to time, however Empyrion does this even if everything else works. Maybe you can get something from the log file?

    HTML:
    https://gist.github.com/Daimonicon/654439ab0c117c7cf73b69e00da989dd
     
    #433
  14. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    In single player you have to add a OverrideScenarioPath e.g.
    Code:
    "OverrideScenarioPath": "C:\SteamGames\steamapps\workshop\content\383120\2550354956",
    in your "EGS\Saves\Games\Savegamepath\Mods\EmpyrionScripting\Configuration.json" file - because the API in SP doesent support the scenario info.

    AND ... the default ECF config is
    Code:
    { Block Id: 1181, Name: BulbShroomStage3, Ref: ElderberryStage1
    
      Model: @models2/Entities/Farming/Misc/BulbShroomStage3Prefab
      Class: CropsGrown
      AllowedInBlueprint: false, display: true
      { Child DropOnHarvest
        Item: Vegetables
        Count: 1
      }
    
    ;-)
     
    #434
  15. Daimonicon

    Daimonicon Lieutenant

    Joined:
    Nov 4, 2019
    Messages:
    69
    Likes Received:
    15
    And what happens if the scenario is not loaded from the workshop sources?
    My path is: E:\Spiele\Steam\SteamLibrary\steamapps\common\Empyrion - Galactic Survival\Content\Scenarios\Reforged Eden 2 Beta

    Should I then add my path there?

    Oh, the originals are actually vegetables :) The one from RE2 looks like this:

    { Block Id: 1181, Name: BulbShroomStage3, Ref: ElderberryStage1
    Model: @models2/Entities/Farming/Misc/BulbShroomStage3Prefab
    Class: CropsGrown
    CropType: Egg, display: true
    CropYield: 1, display: true
    AllowedInBlueprint: false, display: true
    { Child DropOnHarvest
    Item: Egg
    Count: 1
    }
    { Child CropsGrown
    OnHarvest: BulbShroomYoungStage3
    OnDeath: PlantDead2
    }
    # ShowUser: NoButCSV # reported by HWS
    PickupTarget: BulbShroomYoungStage1
    TemplateRoot: BulbShroomYoungStage2
    XpFactor: 1.0
    }
     
    #435
  16. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    Yes
     
    #436
  17. Daimonicon

    Daimonicon Lieutenant

    Joined:
    Nov 4, 2019
    Messages:
    69
    Likes Received:
    15
    Thank you for your help. I still get vegetables instead of eggs. But I only planted them as a placeholder - maybe I'll find the cause somehow. But I'm rid of all the error messages in any case :)
     
    #437
  18. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    Remember to double the \ in the path in the json file
    Code:
    E:\\Spiele\\Steam\\SteamLibrary\\steamapps\\common\\Empyrion - Galactic Survival\\Content\\Scenarios\\Reforged Eden 2 Beta
     
    #438
    Daimonicon likes this.
  19. awgsknite

    awgsknite Ensign

    Joined:
    Oct 11, 2024
    Messages:
    3
    Likes Received:
    0
    I was told on the emp discord to ask in here in these forums but idk where to ask so here is my question: How would I locate an enemy core using Astic scripting ? You can show players in the area, sort through inventory and many other things with this scripting so what how about locating an enemy core and stating where it is located or showing where it is located somehow ?
     
    #439
  20. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    As server operator/admin you could write a savegamescript which searches other structures for blocks (e.g. the core). As a normal player this is forbidden and would also be considered “cheating” ;-)
     
    #440

Share This Page