[MOD EXT] Empyrion Scripting - Scripts

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

  1. kkin形影

    kkin形影 Ensign

    Joined:
    Oct 17, 2022
    Messages:
    21
    Likes Received:
    0
    Is your problem solved? My server also has this problem.
     
    #821
  2. meigrafd

    meigrafd Ensign

    Joined:
    Jan 23, 2024
    Messages:
    6
    Likes Received:
    0
    downgrading to EGS v12.0.1 solved it for me.
    downgrading to v12.0.1 solved it for us.
     
    #822
  3. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,004
    Likes Received:
    709
    @meigrafd @kkin形影
    I have just tested it on a fresh installation and everything works with the current version.
    Maybe you should delete the "EGS\Saves\Games\[Savegamenameame]\Mods\EmpyrionScripting\Configuration.json"
    so that it is recreated with the current default settings.
    There may be incompatible entries in your settings
     
    #823
  4. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,004
    Likes Received:
    709
    #824
    Last edited: Feb 24, 2024
    The_Hammander likes this.
  5. Turist[40k]

    Turist[40k] Ensign

    Joined:
    Oct 4, 2020
    Messages:
    12
    Likes Received:
    1
    Hello

    would appreciate some help with scripting syntaxis here. Modified EnemyScan here (nevermind that all entities are listed, that`s for gebug purposes).

    Code:
    {{set 'AntennaIds' '1365,1877,1878,1879,1880,1880,1881,1882,1883,1884,262'}}
     
    {{#devices @root.E.S '40KScn2=*'}}
    {{#each .}}
    {{#split CustomName '='}}
    {{set 'RadarPos' .1}}
    {{#if .2}}
    {{set 'Size' .2}}
    {{else}}
    {{set 'Size' '100%'}}
    {{/if}}
    {{#if .3}}
    {{set 'ScrollLines' .3}}
    {{else}}
    {{set 'ScrollLines' '100'}}
    {{/if}}
    {{/split}}
    {{#settextblock .}}
    <size={{@root.Data.Size}}>--- 20K scan | {{@root.E.Name}} [{{@root.E.Id}}]: {{@root.E.Pos}} ---
    Entity<indent=27%>Faction</indent><indent=40%>X</indent><indent=55%>Y</indent><indent=70%>Z</indent><indent=85%>Distance</indent>
    {{#split @root.Data.RadarPos ','}}
    {{#block @root.E.S .0 .1 .2}}
    {{#test Id in @root.Data.AntennaIds}}
    {{#scroll @root.Data.ScrollLines 1 @root.Data.ScrollLines}}
    {{#entitiesbyname '*' 20000 'BA,CV,SV,HV,EnemyDrone,TroopTransport,Proxy'}}
    {{#sortedeach . 'Distance'}}<color=grey>{{#test Faction.Group in 'Alien,Zirax,Kriel,Pirates,Admin'}}<color=red>{{/test}}{{#test Faction.Group in 'Talon,Polaris,UCH'}}<color=green>{{/test}}{{#test Faction.Group in 'NoFaction'}}<color=yellow>{{/test}}
    {{~format (i18n Name) '{0,-20} '}}<indent=27%>[
    {{~Faction.Group}}]<indent=40%></indent>
    {{~format Pos.X '{0,6:00000} '}}</indent><indent=55%>
    {{~format Pos.Y '{0,6:00000} '}}</indent><indent=70%>
    {{~format Pos.Z '{0,6:00000} '}}</indent><indent=85%>
    {{~format Distance '△={0:00000}'}}</indent></color>
    {{/sortedeach}}
    {{/entitiesbyname}}
    {{/scroll}}
    {{else}}
    No Antenna found at {{@root.Data.RadarPos}}
     
    {{#split @root.Data.AntennaIds ','}}
    {{#each .}}
    ({{.}}) {{i18n . 'English'}}
    {{/each}}
    {{/split}}
    {{/test}}
    {{/block}}
    {{/split}}
    
    <color=#88888840>Time on board: {{datetime}}
    </color>
    </size>
    {{/settextblock}}
    {{/each}}
    {{/devices}}
    questions:
    1) format Pos.X '{0,6:00000} ' - that is just the workaround to solve that i was not able to make all coordinates be formatted like "take all 6 symbol places without leading zeroes, aligned right". How to do it correctly?

    2) tried to add math to {{~format Distance '△={0:00000}'}}</indent></color> to convert from meters to kilometers but have failed miserably. Is it possible to do "inline" at all or should i go like was shown here https://empyriononline.com/threads/mod-ext-empyrion-scripting-scripts.92458/page-39#post-464424 ?
    It seems to be impossible to do with custom formatting, is it correct that format string ishould be composed according to this https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-numeric-format-strings ?
     
    #825
  6. Turist[40k]

    Turist[40k] Ensign

    Joined:
    Oct 4, 2020
    Messages:
    12
    Likes Received:
    1
    Nice idea, thanks. I tried it and it generally works, tried to modify it a little bit but...

    1) There is very inconstant and significant delay between when i click "F" (i have used access terminal block instead of pressure plate/sensor) and when dialog box appears, it may be required to press button multiple times. I suppose this is because the signal is like on/off and it have to align in time with the script which is being run at the intervals. Probably adding signal logic with latch/and delayed reset could be the way around this?

    2) i`m clearly not getting something here but this {{~Entities.Faction.Group}} does not return anything, but every entity should have those, isn`t it?

    3) after the dialog has fired the result appears with 2 empty rows at the top (above the header), after the script updates and does this part
    {{CacheData.PFQRT}}
    {{CacheData.PFQR}}
    everything is fine and the text begins at 1st row

    is it correct that:
    3.1) #dialog block is carried out only once on each activation of the "ShowDialog" signal
    3.2) the whole script runs always in the background (unless LCD is switched off) and only last part with fetching two cached blocks is executed

    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 {{@root.Data.QT}}:{{/setcacheblock}}
    {{#setcacheblock 'PFQR'}}
    {{#db 'DiscoveredPOIs' 99 'Entities.name asc' @root.Data.Q}}
    {{#each .}}
    {{~SolarSystems.name}}:
    {{~Playfields.name}}:
    {{~Entities.name}}
    {{~Entities.Faction.Group}}
    {{/each}}
    {{/db}}
    {{/setcacheblock}}
    {{else}}
    {{setcacheblock 'PFQRT'}}DiscoveredPOIs <no input>:{{/setcacheblock}}
    {{setcacheblock 'PFQR'}}<empty>{{/setcacheblock}}
    {{/ok}}
    {{/dialog}}
    {{CacheData.PFQRT}}
    {{CacheData.PFQR}}
    
     
    #826
  7. The_Hammander

    The_Hammander Ensign

    Joined:
    Feb 20, 2024
    Messages:
    1
    Likes Received:
    0
    Hello! I've spent the last few weeks trying to understand how to write/tweak these scripts, and I just can't do it. I found a base by -=5!nN|05=- that has what I'm looking for, but I believe the IDs are outdated, so it doesn't work, but I can't fully tell what's happening in the code, so I don't know how to update it. Link to the base: https://steamcommunity.com/sharedfiles/filedetails/?id=2213059019

    The following is what I believe to be the main sorting script, but I don't understand how it supposed to work initially, aside from starting in SubStorage? Though the script won't move any items around currently, tried deposting in a few different boxes and nothing happened

    Code:
    {{fontsize 3}}
    {{#items E.S 'SubStorage'}}
    {{#devices @root.E.S 'Box-*'}}
    {{#each .}}
    {{#split CustomName '-'}}
    {{#test Length eq '3'}}
    {{#split .2 '/'}}
    {{set 'Ids' (concat . ',')}}
    {{/split}}
    {{#test ../../../../Id 'in' @root.Data.Ids}}
    {{#move ../../../../../.
    @root.E.S ../../../CustomName}}
    From {{Source}}
    to {{Destination}}
     at {{datetime 'dd. u\m HH:mm:ss'}}:
     - {{format Count '{0,5}'}} :
    {{~Name}}
    {{/move}}
    {{/test}}
    {{/test}}
    {{/split}}
    {{/each}}
    {{/devices}}
    {{/items}}
    [​IMG]
    [​IMG]
    [​IMG]

    And then there's a 2nd script that I think takes X amount of certain material IDs and moves them into a main crafting box, but either these are old IDs or I couldn't find any that matched as far as base crafting components go:

    Code:
    {{set 'first' '1'}}
    {{#items E.S 'Box-*'}}
    {{set 'MaxCount' '1998'}}
    {{#test Id 'eq' 2373}}
    {{set 'MaxCount' '0'}}
    {{/test}}
    {{#test Id 'eq' 2396}}
    {{set 'MaxCount' '600'}}
    {{/test}}
    {{#test Id in '2294,2128'}}
    {{set 'MaxCount' '100'}}
    {{/test}}
    {{#test Id in '2356,2375,2382,2385,2393,2403,2416,2426,2427,2428,2430,2435,2436,2437,2438,2439,2441'}}
    {{set 'MaxCount' '0'}}
    {{/test}}
    {{move this @root.E.S 'MainStorage' @root.Data.MaxCount}}
    {{#if @root.Data.first}}
    {{set 'first' ''}}
    To {{Destination}} at {{datetime 'dd. u\m HH:mm:ss'}}:
    {{/if}}
    {{~set 'moved' '1'}}
    {{format Count '{0,5}'}} : {{Name}}
    {{/move}}
    {{/items}}
    {{#if @root.Data.moved}}
    -------------------------------------------
    {{/if}}
    [​IMG]

    [​IMG]


    Any help would be greatly appreciated!

    Edit: Added photos of the script screens & outputs
     
    #827
    Last edited: Mar 11, 2024
  8. Grandirus

    Grandirus Commander

    Joined:
    Jan 24, 2017
    Messages:
    43
    Likes Received:
    131
    Don't know if it stills valid but, what's the codes for CV Weapons?
    I'm trying to find by myself but with no luck.
     
    #828
  9. Clocked

    Clocked Ensign

    Joined:
    May 13, 2024
    Messages:
    2
    Likes Received:
    1
    Hello
    I have been working on this registry search script it does work however on a MP server I'm not sure what factions discovered POI it is pulling from because it is not mine.
    Any feedback on how I can get it to pull from myself or my factions discovered POIs would be greatly appreciated.

    <size=2><align=center><color=#0de805>
    {{#scroll 500 1}}
    {{#db 'DiscoveredPOIs' 500 'SolarSystems.name asc' 'Entities.name like "%Hydroflux%" ' @root.E.Faction.Id }}
    {{#each .}}
    {{~SolarSystems.name}}->
    {{~Playfields.name}}->
    {{~Entities.name}}
    {{/each}}
    {{/db}}
    {{/scroll}}
     
    #829
  10. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,004
    Likes Received:
    709
    A 100 has accidentally slipped into the SQL instead of the fraction.
    You can easily fix this by replacing the 100 in the "Configuration.json" of the ScriptingMod in the savegame in the SQL of "DiscoveredPOIs" with @FactionId

    https://github.com/GitHub-TC/EmpyrionScripting/releases/tag/13.0.3
     
    #830
  11. Clocked

    Clocked Ensign

    Joined:
    May 13, 2024
    Messages:
    2
    Likes Received:
    1
    Thank you so much! Appreciate your assistance and your mod is the most amazing piece of work ever!
     
    #831
    ASTIC likes this.
  12. Preston

    Preston Commander

    Joined:
    Jul 6, 2017
    Messages:
    124
    Likes Received:
    25
    I recently ran into the issue that my script runs fine with the actual version of Empyrion Scripting at singleplayer, but at multiplayer the server not even boot.

    I activated all debugging and logging options in the Empyrion Scripting settings but I cannot find a log file anywhere. Am I looking at the wrong place or do my script produce such an error, that not even an logfile can be created?
     
    #832
  13. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,004
    Likes Received:
    709
    What about the logs (Dedicated & Playfield) in [EGS]\Logs\NNNN maybe they give hints - maybe you can send them to me via PM
     
    #833
  14. ctthespian

    ctthespian Ensign

    Joined:
    Jul 13, 2022
    Messages:
    3
    Likes Received:
    0
    How do you disable the costs?
     
    #834
  15. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,004
    Likes Received:
    709
    set the "Amount" to 0
    EGS\Saves\Games\[Savegamename]\Mods\EmpyrionScripting\Configuration.json
    Code:
      "DeconstructSalary": {
        "ItemName": "MoneyCard",
        "Amount": 0
      },
      "RecycleSalary": {
        "ItemName": "MoneyCard",
        "Amount": 0
      },
    
     
    #835
  16. ctthespian

    ctthespian Ensign

    Joined:
    Jul 13, 2022
    Messages:
    3
    Likes Received:
    0
    I assumed this would be the case. When I tried that change I got a divide by 0 when the script tried to run the destruct script.
     
    #836
  17. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,004
    Likes Received:
    709
    #837

Share This Page