[mod] Empyrion Scripting Mod

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

Tags:
  1. Mycroft_Groks

    Mycroft_Groks Lieutenant

    Joined:
    Aug 17, 2018
    Messages:
    51
    Likes Received:
    8
    I've also noticed lately that some scripts will randomly stop working for no reason and I can't get them back up unless I delete the LCDs,Switches and containers attached to the script.
     
    #361
  2. Blood Cloud

    Blood Cloud Ensign

    Joined:
    Sep 7, 2022
    Messages:
    10
    Likes Received:
    0
    Maybe it is server related ? (we are on the same server :) Often a relog fixes the scripts.
     
    #362
  3. Mycroft_Groks

    Mycroft_Groks Lieutenant

    Joined:
    Aug 17, 2018
    Messages:
    51
    Likes Received:
    8
    Having a small issue with this one. Pretty sure I need a {{each}} command or list all the LCD panels and do a {{split}}.
    Issue I'm having is not all LCDs show the banner. One or two will alwys work and update, but the rest won't.

    Any ideas?

    Code:
    {{set 'ShipName' E.Name}}
    {{set 'FactionName' 'MSC'}}
    {{set 'CargoDoors' 'Signage -Cargo Door*'}}
    {{set 'BannerSign' 'Signage -Banner*'}}
    
    {{devices @root.E.S @root.Data.CargoDoors}}
    {{settextblock .0}}<size=+32><i><b><color=purple><u><color=red><align=left>{{@root.Data.FactionName}}</align>
    <line-height=-60px><size=+10>
    <color=white><align=right><pos=160>-Shipyards</u></size></color></align></pos></line-height>
    <pos=168><size=-1><color=yellow>{{@root.Data.ShipName}}</i></size></color>
    <line-height=+65px><size=+20><color=orange>
    <align=center>Constructor Bay Access</size>
    {{/settextblock}}
    {{/devices}}
    
    {{devices @root.E.S @root.Data.BannerSign}}
    {{settextblock .0}}<size=+32><i><b><color=purple><u><color=red><align=left>{{@root.Data.FactionName}}</align>
    <line-height=-60px><size=+10>
    <color=white><align=right><pos=160>-Shipyards</u></size></color></align></pos></line-height>
    <pos=168><size=-1><color=yellow>{{@root.Data.ShipName}}</i></size></color>
    {{/settextblock}}
    {{/devices}}
     
    #363
  4. Shadowpheonix

    Shadowpheonix Lieutenant

    Joined:
    May 19, 2022
    Messages:
    46
    Likes Received:
    12
    The ".0" in your "{{settextblock .0}}" specifies the first match, which means it will only update a single LCD. Try this instead (note: I am unable to test in game right now, so cannot guarantee it will work although I am fairly certain it will)...
    Code:
    {{set 'ShipName' E.Name}}
    {{set 'FactionName' 'MSC'}}
    {{set 'CargoDoors' 'Signage -Cargo Door*'}}
    {{set 'BannerSign' 'Signage -Banner*'}}
    
    {{devices @root.E.S @root.Data.CargoDoors}}
    {{#each .}}
    {{settextblock .}}<size=+32><i><b><color=purple><u><color=red><align=left>{{@root.Data.FactionName}}</align>
    <line-height=-60px><size=+10>
    <color=white><align=right><pos=160>-Shipyards</u></size></color></align></pos></line-height>
    <pos=168><size=-1><color=yellow>{{@root.Data.ShipName}}</i></size></color>
    <line-height=+65px><size=+20><color=orange>
    <align=center>Constructor Bay Access</size>
    {{/settextblock}}
    {{/each}}
    {{/devices}}
    
    {{devices @root.E.S @root.Data.BannerSign}}
    {{#each .}}
    {{settextblock .}}<size=+32><i><b><color=purple><u><color=red><align=left>{{@root.Data.FactionName}}</align>
    <line-height=-60px><size=+10>
    <color=white><align=right><pos=160>-Shipyards</u></size></color></align></pos></line-height>
    <pos=168><size=-1><color=yellow>{{@root.Data.ShipName}}</i></size></color>
    {{/settextblock}}
    {{/each}}
    {{/devices}}
     
    #364
  5. Mycroft_Groks

    Mycroft_Groks Lieutenant

    Joined:
    Aug 17, 2018
    Messages:
    51
    Likes Received:
    8
    YUP! That did it! thanx man! I'm still not up on the . or 0 or . .//.. stuff.
     
    #365
  6. Mycroft_Groks

    Mycroft_Groks Lieutenant

    Joined:
    Aug 17, 2018
    Messages:
    51
    Likes Received:
    8
    Anyone else having severe issues with scripts and displays since the hotfix? None of my scripts run right and any of my compiled ones using an installer are hit or miss with function, but all have display issues. Was not having this issues before the 12 hotfix. Hotfix 11 was causing visual display issues, but the functions of the scripts worked fine.

    Blood? are you experiencing the same thing?
     
    #366
    kfurrow likes this.
  7. Shadowpheonix

    Shadowpheonix Lieutenant

    Joined:
    May 19, 2022
    Messages:
    46
    Likes Received:
    12
    I have had issues with LCD, Light, and Spotlight blocks disappearing (as in the entire block is visibly gone, not just the text or the light from it) when my view is at particular angles. If I move my view to another position, the blocks suddenly re-appear. Not sure if this is affecting script functionality or not, but would not be surprised if it is. (The scripts I use all seem to be working OK, but I don't run anything that is constantly visible, meaning I wouldn't notice if they occasionally failed and recovered on a later passthrough.)
     
    #367
  8. Preston

    Preston Commander

    Joined:
    Jul 6, 2017
    Messages:
    124
    Likes Received:
    25
    Hi Astic,

    I was recently trying to implement the playfield details you mentioned in your last release video.
    Maybe I'm blind but I cannot find the "Details" Property at the playfield object in C#.
    Is the access to the playfield details somewhere else?

    [​IMG]

    And another question: I read at the release note in Github that the latest version has "add exception handling". Does this relate to my timeout issue of "CsRoot.Items"? If yes I must say my issue on my big structure with "CsRoot.Items" still persists but no exception is thrown.
     
    #368
    Last edited: May 1, 2023
  9. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,074
    Likes Received:
    729
    Sorry i forgot to add it to the C# scripts.
    https://github.com/GitHub-TC/EmpyrionScripting/releases/tag/11.4.3
    will fix this

    Code:
    public interface IPlayfieldData
    {
    ...
            IPlayfieldDetails Details { get; }
    ...
    }
    public interface IPlayfieldDetails
    {
        bool AtmosphereBreathable { get; }
        double AtmosphereDensity { get; }
        double AtmosphereO2 { get; }
        string Description { get; }
        double Gravity { get; }
        double PlanetAxis { get; }
        int PlanetSize { get; }
        string PlanetType { get; }
        string PlayfieldType { get; }
        double Radiation { get; }
        int[] TemperatureMinMax { get; }
    }
    
    The exceptions concerned a mix of SP and MP installation, as Eleon now apparently also loads local mods in spite of EAC.

    Unfortunately, I have not yet had time to analyse your error with the large structures :-(
     
    #369
    Preston likes this.
  10. Preston

    Preston Commander

    Joined:
    Jul 6, 2017
    Messages:
    124
    Likes Received:
    25
    There seems to be a little issue with the temperature array:

    Or does a "Space" playfield not create a array at all? "m" in space shows a temperature.

    [​IMG]

    Code:
    ...
    displayManager.AddLogEntry(string.Format("PlanetType: {0}", rootPlayfield.Details.PlanetType));
    displayManager.AddLogEntry(string.Format("PlayfieldType: {0}", rootPlayfield.Details.PlayfieldType));
    displayManager.AddLogEntry(string.Format("Radiation: {0}", rootPlayfield.Details.Radiation));
    displayManager.AddLogEntry(string.Format("TemperatureMinMax: {0}", string.Join(", ", rootPlayfield.Details.TemperatureMinMax)));
    
     
    #370
    Last edited: May 1, 2023
  11. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,074
    Likes Received:
    729
    On planet playfields we have

    Code:
    TemperatureMinMax:
    - 0
    - 40
    
    in space playfields there is only
    Code:
    TemperatureDay: -84
    :confused:

    I have to add these too... or map it to own properties

    https://github.com/GitHub-TC/EmpyrionScripting/releases/tag/11.4.4
    Add TemperatureDay & TemperatureMin & TemperatureMax properties

    Code:
    public interface IPlayfieldDetails
    {
    ...
        int[] TemperatureMinMax { get; }
        int TemperatureDay { get; }
        int TemperatureMin { get; }
        int TemperatureMax { get; }
    ...
    }
     
    #371
    Last edited: May 2, 2023
  12. Preston

    Preston Commander

    Joined:
    Jul 6, 2017
    Messages:
    124
    Likes Received:
    25
    That means if a specific field of the Details property is present depends on the playfield?
    Does this apply to the temperature only or to other Details fields, too?
    Maybe it would be helpful to have these "conditional present" fields as nullable type to have the "validity" information directly in the value of the field.
     
    #372
  13. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,074
    Likes Received:
    729
    Code:
    int TemperatureMin { get; }
    int TemperatureMax { get; }
    are mapped properties to the correct values (regardless of which playfield it is) ;-)
     
    #373
  14. Preston

    Preston Commander

    Joined:
    Jul 6, 2017
    Messages:
    124
    Likes Received:
    25
    I was thinking a little bit bigger. Fields liks "AtmosphereBreathable", "AtmosphereDensity", "AtmosphereO2", "Gravity", "PlanetAxis" or "PlanetSize" have no meaningful sense for a space playfield. So I would assume they are not present in a space playfield config file.
    To pay attention to this "physical fact" its not helpful to just blow all these "zero values" to a display. For a smart display I have to determine which value is valid.

    And upto now I can just implement a "clunky manual string check" on the PlayfieldType string value to get a vague idea which parameter could be valid.
     
    #374
  15. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,074
    Likes Received:
    729
    Checking for the playfield type is always useful because then the specific information can be displayed better/more meaningfully
     
    #375
  16. Preston

    Preston Commander

    Joined:
    Jul 6, 2017
    Messages:
    124
    Likes Received:
    25
    To rely on a "free text type" I would avoid at most costs. This creates a complex and difficult to maintain dependency.

    Which Parameters are valid at which type string at which playfield from which modder?
     
    #376
  17. zeridoz

    zeridoz Ensign

    Joined:
    Apr 4, 2023
    Messages:
    1
    Likes Received:
    0
    is there a way for scripsts to sort items without having to have every single item id posted in the script?
     
    #377
  18. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,074
    Likes Received:
    729
    #378
  19. kkin形影

    kkin形影 Ensign

    Joined:
    Oct 17, 2022
    Messages:
    23
    Likes Received:
    0
    Targets:二楼菜地
    二楼菜地冰箱
    {{#items E.S '二楼'}}
    {{Count}} {{key}}
    {{/items}}


    二楼菜地冰箱
    371840 MoneyCard
    10S6 Fruit
    660 Naturalstimulant
    660 HerbalLeaves
    1584 PlantProtein

    I am a player from China, how to display the materials in the cargo box in Chinese, use: {{Count}} {{zh-CN key}}, prompt script error.
     
    #379
  20. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,074
    Likes Received:
    729
    You can set the "CultureInfo" LCD
    https://github.com/GitHub-TC/EmpyrionScripting#language-format-time-of-the-outputs
    the "i18nDefault" from "English" to "Chinese (simplified)" or "Chinese (traditional)" (these are the tags fom the ...\Empyrion - Galactic Survival\Content\Extras\Localization.csv)
     
    #380

Share This Page