[MOD EXT] Empyrion Scripting - Scripts

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

  1. [TOG] Xukisy

    [TOG] Xukisy Ensign

    Joined:
    Oct 15, 2020
    Messages:
    25
    Likes Received:
    8
    #1001
  2. Clocked

    Clocked Ensign

    Joined:
    May 13, 2024
    Messages:
    4
    Likes Received:
    1
    Does not work it states Object reference not set to an instance of an object........the script as is works using item IDs I am just attempting to make it work using Item Keys instead
     
    #1002
  3. Palmeza

    Palmeza Ensign

    Joined:
    Aug 27, 2023
    Messages:
    3
    Likes Received:
    0
    @ASTIC Help pls ;)


     
    #1003
  4. NonRidiculousAdjective

    NonRidiculousAdjective Ensign

    Joined:
    Mar 23, 2025
    Messages:
    2
    Likes Received:
    0
    Heya, is there any way to reference any of the ship/base statistics? Such as power left or time before out of power? All scripts focus on items or fuel, but I am curious about power in general.
     
    #1004
  5. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,114
    Likes Received:
    742
    A few values about the energy are available and used in the DemoCV and other blueprints from the workshop.

    What will be offered by the API is also accessible via scripting - unfortunately the API will not be extended by Eleon
     
    #1005
  6. NonRidiculousAdjective

    NonRidiculousAdjective Ensign

    Joined:
    Mar 23, 2025
    Messages:
    2
    Likes Received:
    0
    I can't seem to find DemoCV, could you please let me know how to reference the battery charge level and time remaining if possible?
     
    #1006
  7. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,114
    Likes Received:
    742
    #1007
  8. Maszaan

    Maszaan Ensign

    Joined:
    May 31, 2022
    Messages:
    4
    Likes Received:
    0
    Good evening all. I am having issues and need some assistance.
    Issue: scipts do not work in game
    What I have done:
    1.downloaded from https://github.com/GitHub-TC/EmpyrionScripting/releases
    2. Turned eac off and then tried eac on both didnt work and heard different people tell me on and off
    3. Put DL in C:\Servers\Empyrion\Content\Mods
    4.made LCD's in game as instructed
    5. made sure nomenclature was correct for normal Cargo box(not container but tested ) and script
    6. added a ton of money in box
    7. nothing shows up on 2nd lcd except default enter text here

    I hope i am doing something dumb wrong and you fine folks can help.
     
    #1008
    Last edited: May 9, 2025
  9. lood

    lood Ensign

    Joined:
    May 30, 2025
    Messages:
    3
    Likes Received:
    0
    Hello,
    I'm looking for a script that displays information about a base station's energy consumption on LCD monitors.
    Consumption, solar battery level, etc.
    Is it possible to retrieve this data in a script? If so, how?
    Thanks in advance.
     
    #1009
  10. me777

    me777 Commander

    Joined:
    Aug 18, 2020
    Messages:
    411
    Likes Received:
    142
    Code:
    {{~set 'c' (calc @root.E.S.Fuel '-' @root.E.S.FuelTank.Content)}}
    <size=6><indent=5%>Powerusage: {{~format @root.E.S.PowerConsumption '{0,8}'}}
    Fuel:{{math @root.E.S.FuelTank.Content '/' @root.E.S.FuelTank.Capacity}}{{~format . '{0,8:P2}' }}{{/math}}
    Battery:{{math @root.Data.c '/' 28000}}{{~format . '{0,8:P2}' }}{{/math}}
    Battery:{{format @root.Data.c '{0,8:F4}'}}
    {{~math @root.Data.c '-' @root.CacheData.c1}}{{set 'v' .}}
    BCharge:{{format . '{0,8:F4}'}}{{/math}}
    {{~setcache 'c1' @root.Data.c}}
    
    the first Battery: line shows % but is only correct when you replace the 28000 by the capacity of your battery - luckily the secone Battery: line shows the current value, so if it tops out you know your total capacity.
     
    #1010
    ASTIC likes this.
  11. lood

    lood Ensign

    Joined:
    May 30, 2025
    Messages:
    3
    Likes Received:
    0
    Amazing. Perfect, Thank you very much !
    I'm looking for a wiki or something like that to know all the variables that can be used with Empyrion scripting.
     
    #1011
  12. me777

    me777 Commander

    Joined:
    Aug 18, 2020
    Messages:
    411
    Likes Received:
    142
    there are 2 sources, the github page and the demo spaceship - both have links on this page.
    the github readme might be a litle bit behind, but the important stuff is there plus you can look in the source and see the magic ASTIC is doing.
    the demo ship shows how to use the scripts ingame, I often spawn it with admin screw around and delete it again. (needs a server, in creative some stuff does not work as intended, blame the gamedevs)
     
    #1012
    lood likes this.
  13. lood

    lood Ensign

    Joined:
    May 30, 2025
    Messages:
    3
    Likes Received:
    0
    Thank you !!
     
    #1013
  14. thelich

    thelich Ensign

    Joined:
    Aug 11, 2020
    Messages:
    2
    Likes Received:
    1
    Name:
    Simple seller script

    Description:
    Simple script which sells all items in container 'ForSale' at 1/4 price (change VM value if you want other reduction value)
    You need create signal in Control Panel Main tab and name it 'Sell'.
    Also this script uses elevated functions, so you need to set structure, where you install this script, to Private and add your player ID (make sure you surround it with ") to "ElevatedGroups" list in Configuration.json. Use di console command to get your player ID - it is in the line with Exp and level. If you wand this script to run in your faction's building, then you need to write your faction id in config instead. One of the way to get your faction id is to insert this
    Code:
    {{@root.E.Faction.Id}}
    into the script after "fontsize" command. Your faction id should appear on the output LCD. You can remove this command block after you noted your faction Id.

    LCD Input name:
    Script:[+45]Sell

    LCD output name:
    Sell

    LCD OUTPUT DIMENSIONS
    WIDTH: 1
    HEIGHT: 1

    LCD Input Script:
    Code:
    {{fontsize 3}}
    {{~#getsignal @root.E.S 'Sell'}}{{#if .}}{{set 'I' 'ForSale'}}{{set 'M' (configid 'MoneyCard')}}{{set 'T' ''}}{{set 'TC' 0}}{{set 'VM' 0,25}}
    {{~#devices @root.E.S @root.Data.I}}{{set 'D' .[0]}}{{/devices}}{{#lockdevice @root.E.S @root.Data.D}}
    {{~#items @root.E.S @root.Data.I}}{{test Id neq @root.Data.M}}{{#math @root.Data.VM '*' (configattr ../Id 'MarketPrice')}}{{set 'V' .}}
    {{~#math . '*' ../../Count}}{{set 'TC' . }}{{/math}}{{/math}}
    {{~removeitems @root.Data.D ../Id ../Count}}{{additems @root.Data.D @root.Data.M (int @root.Data.TC)}}
    {{~set 'T' (concat @root.data.T '
    Sold ' (i18n ../Id) '<indent=55%>❲' ../Count ' x ' @root.Data.V ' ➤ ' (int @root.Data.TC) '❳</indent>')}}
    {{~/test}}{{/items}}
    {{~#if @root.data.T}}
    <align=center><size=120%>Sell - {{datetime 'HH:mm'}}</size></align>
    {{@root.data.T}}
    <align=center><size=4>{{bar 1 0 1 10 '╼╾'}}</size></align>
    {{~/if}}{{/lockdevice}}{{/if}}{{/getsignal}}
    
     
    #1014
    Last edited: Jul 15, 2025
    ASTIC likes this.
  15. Turist[40k]

    Turist[40k] Ensign

    Joined:
    Oct 4, 2020
    Messages:
    13
    Likes Received:
    1
    Hello, guys

    i`m trying to do something which should be simple but can not wrap my head around that.
    There is a script showing list of discovered POIs matching part of user input

    Code:
    {{#dialog 'ShowDialog'
    'Discovered POIs Registry Search'
    'Type part of the name in Search Box below and click "Search" to proceed'
    'Search'
    '0' '2' '200'
    ''
    'true'
    ''
    'Input search item...'
    }}
    {{#ok PlayerInput}}
    {{set 'QT' (concat ' *' PlayerInput '*')}}
    {{set 'Q' (concat 'Entities.name LIKE "%' PlayerInput '%"')}}
    {{setcacheblock 'PFQRT'}}--- DiscoveredPOIs matching {{@root.Data.QT}} ---{{/setcacheblock}}
    {{#setcacheblock 'PFQR'}}
    {{#db 'DiscoveredPOIs' 99 'Entities.name asc' @root.Data.Q}}
    {{#each .}}
    {{~SolarSystems.name}}:
    {{~Playfields.name}}:
    {{~Entities.name}}
    {{/each}}
    {{/db}}
    {{/setcacheblock}}
    {{else}}
    {{setcacheblock 'PFQRT'}}--- DiscoveredPOIs matching <no input> ---{{/setcacheblock}}
    {{setcacheblock 'PFQR'}}<empty>{{/setcacheblock}}
    {{/ok}}
    {{/dialog}}
    {{CacheData.PFQRT}}
    {{CacheData.PFQR}}
    i`d like to output faction info (or missing core) and distance between playfields in LY (where the entity is located and current one).
    I am not able to figure out list of available objects and their respective attributes returned by the DiscoveredPOIs query.
     
    #1015
  16. jasonrr987

    jasonrr987 Ensign

    Joined:
    Aug 13, 2025
    Messages:
    2
    Likes Received:
    2
    Are there currently any working dynamic sorting scripts? I tried the one with sorterdb, it catalogs items but it won't move them I have a Input and an Unsorted container but I get nothing other than the indexing.
     
    #1016

Share This Page