[mod] Empyrion Scripting Mod

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

Tags:
  1. Myrmidon

    Myrmidon Rear Admiral

    Joined:
    Mar 26, 2016
    Messages:
    1,734
    Likes Received:
    2,066
    I was talking about the videos....
     
    #241
  2. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,074
    Likes Received:
    729
    Ok, the next video about the "Mobile-Carrier" i will try to make in english.
     
    #242
    Myrmidon likes this.
  3. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,074
    Likes Received:
    729
    Now with >= 7.1.0 easy localization of your structure (this vid is in english)
     
    #243
    Myrmidon likes this.
  4. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,074
    Likes Received:
    729
  5. Alex Ringess

    Alex Ringess Ensign

    Joined:
    Apr 1, 2018
    Messages:
    5
    Likes Received:
    1
    Hi.
    So, I try the deconstruct function with the code you provide on the video called "Script07".
    I placed a screen called Recyclage, and another called Script:Recyclage on my CV.

    On the Script:Recyclage screen, I put the following code :

    {{#entitiesbyname @Root '*'}}
    {{#each .}}
    {{#devices S (concat 'Core-Destruct-' Id)}}
    {{../Name}}:{{../Id}}
    {{deconstruct @Root .. 'Salvage'}}
    {{/devices}}
    {{/each}}
    {{/entitiesbyname}}

    'Salvage' is the destination container name.

    After that, I spawned a small ship near the CV, renamed its core to Core-Destruct-2358 (its Id is 2358).
    Then, I switch its ownership to my own faction.

    Nothing happened excepting the following text the mod putted on the screen called Script :

    Reached end of template before block expression 'deconstruct' was closed 18:31:36


    I guess I did something wrong but I don't have a single clue of what, so if someone could help me.
    Thanks.
     
    #245
  6. Homunk

    Homunk Lieutenant

    Joined:
    Mar 22, 2020
    Messages:
    74
    Likes Received:
    26
    Just answered it on Discord, but here we go again..
    Your script is missing the closing {{/deconstruct}}
    That's why you get the error..

    The script I use for this looks a bit different.. and the names for the script and LCD are "Demontage", which of course you may replace with whatever you like.

    Code:
    Targets: LCD Demontage
    <size=40%>
    {{fontsize 7}}
    
    {{/each}}
    {{/entitiesbyname}}
    {{#entitiesbyname '*'}}
    {{#each .}}
    {{#devices S (concat 'Core-Destruct-')ID}}
    {{../Name}}:{{../Id}}
    {{deconstruct .. 'Deconstruct Controller 1'}}
      min: {{MinPos}}
      max: {{MaxPos}}
      current X: {{X}}
      current Y: {{Y}}
      current Z: {{Z}}
      TotalBlocks: {{TotalBlocks}}
      CheckedBlocks: {{CheckedBlocks}}
      RemovedBlocks: {{RemovedBlocks}}
    {{/deconstruct}}
    {{/devices}}
    
    {{/each}}
    {{/entitiesbyname}}
    </size>
    Hope it helps
    Good luck..
     
    #246
    ASTIC and Alex Ringess like this.
  7. Alex Ringess

    Alex Ringess Ensign

    Joined:
    Apr 1, 2018
    Messages:
    5
    Likes Received:
    1
    How stupid I am :D
    Gonna try it now.
    Many thanks.
     
    #247
  8. Alex Ringess

    Alex Ringess Ensign

    Joined:
    Apr 1, 2018
    Messages:
    5
    Likes Received:
    1
    I just tried your script after adapting it to my context and it's working like a charm.
    Many thanks again :)
     
    #248
    Homunk likes this.
  9. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,074
    Likes Received:
    729
    #249
    Preston and Alex Ringess like this.
  10. Omegablade88

    Omegablade88 Ensign

    Joined:
    Jun 8, 2021
    Messages:
    2
    Likes Received:
    0
    @ASTIC

    Hello Everyone, I actually made account to post this:) First of all, thanks Astic for AMAZING work, this is purely God's work and it makes game so much better, thanks!

    I have some troubles with making antenna/radar mods work, I assume I'm doing something wrong (I just started any script usage today). So far I can make LCD screens work, they show objects, but for example Pirate Capital Vessel, is invisible, I have no idea how to make it displayed on Radar/Antenna LCDs. I saw in code CV is specified, along all factions including Pirate, but it just doesnt show on the screen.

    I tried to solve it, but I'm just a bit too newbie to work around this - I use scan/Enemy scan scripts, with antenna & radar scripts in save folder (I think this part is fine, I see script working to some extent).

    Also, Asteroid radar didnt really work (only shown asteroids closer than 3km, so not much of a radar:), I exchanged it to proxy, and now it shows everything (not optimal, but it works in pretty much useful way) - I saw one person also had same issue, but you guys didn't find solution, at least I couldn't find it.

    But mostly, I would love to see enemy vessels/capital vessels on enemy scan LCD - is there any way to do it?

    Sorry to bother you, I's just so close and I really have no clue how to fix this:)
     
    #250
  11. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,074
    Likes Received:
    729
    @Omegablade88
    It depends on many factors. The names must fit or you can only filter via proxy which can be anything. You can also influence it by changing the DSL distances in the gameoptions.yaml - but this can affect the memory consumption/performance.
    Another possibility is to increase the radar range itself so that you don't need these scripts.
     
    #251
  12. Omegablade88

    Omegablade88 Ensign

    Joined:
    Jun 8, 2021
    Messages:
    2
    Likes Received:
    0
    Appreciate your response - I will try to tinker with things you mentioned - and possibly later go through your documentation provided at github.

    Thanks for taking your time to help and for amazing mod:)
     
    #252
  13. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,074
    Likes Received:
    729
  14. Preston

    Preston Commander

    Joined:
    Jul 6, 2017
    Messages:
    124
    Likes Received:
    25
    Hey ASTIC, today I started the update of my server and the mod to the actual versions and I have a little trouble.

    I decided to recreate a empty custom configuration file "~\Empyrion\Games\MyGame\Mods\EmpyrionScripting\CsCompilerConfiguration.json" and refill it with my settings from my documentation like before:
    Code:
    {
      "WithinLearnMode": true,
      "CustomAssemblies": ["CustomDLLs\EgsEsExtension.dll"],
      "Usings": ["EgsEsExtension", "EgsEsExtension.Scripts", "EgsEsExtension.Locales"],
      "AssemblyReferences": [],
      "SymbolPermissions": {
       "SaveGame": ["EgsEsExtension", "EgsEsExtension.*"]
      }
    }
    But something is missing. The Script-Tracker says:
    Code:
    Microsoft.CodeAnalysis.Scripting.CompilationErrorException: (1,1): error CS0246: The type or namespace name 'Locales' could not be found (are you missing a using directive or an assembly reference?)
      at Microsoft.CodeAnalysis.Scripting.ScriptBuilder.ThrowIfAnyCompilationErrors (Microsoft.CodeAnalysis.DiagnosticBag diagnostics, Microsoft.CodeAnalysis.DiagnosticFormatter formatter) [0x0005c] in <f838c9c4d287404580d07c873cf45639>:0
      at Microsoft.CodeAnalysis.Scripting.ScriptBuilder.CreateExecutor[T] (Microsoft.CodeAnalysis.Scripting.ScriptCompiler compiler, Microsoft.CodeAnalysis.Compilation compilation, System.Boolean emitDebugInformation, System.Threading.CancellationToken cancellationToken) [0x00040] in <f838c9c4d287404580d07c873cf45639>:0
      at Microsoft.CodeAnalysis.Scripting.Script`1[T].GetExecutor (System.Threading.CancellationToken cancellationToken) [0x0002b] in <f838c9c4d287404580d07c873cf45639>:0
      at Microsoft.CodeAnalysis.Scripting.Script`1[T].RunAsync (System.Object globals, System.Func`2[T,TResult] catchException, System.Threading.CancellationToken cancellationToken) [0x0001b] in <f838c9c4d287404580d07c873cf45639>:0
      at EmpyrionScripting.CsCompiler.CsCompiler+<>c__DisplayClass28_0`1[T].<GetExec>b__0 (System.Object rootObject) [0x0018e] in <3feacf6e9d0644ac86ee08c4d4214701>:0 
    Do I miss something or has something changed in the internal source path behaviour?
     
    #254
  15. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,074
    Likes Received:
    729
    i changed the init script "EgsEsExtensionRun.cs" first line to
    Code:
    var lng = EgsEsExtension.Locales.Locales.Language.enGB;
    and then it work - but there seems to be some strange things happens because normally this wont be needed ?!?!

    By the way your IDs in the "ItemStructureTree.ecf" needs an update for the new ID ranges.
    The EAH has a dialog for converting, you can call it without really using the EAH.

    upload_2021-6-20_12-26-59.png
     
    #255
    Last edited: Jun 20, 2021
  16. Preston

    Preston Commander

    Joined:
    Jul 6, 2017
    Messages:
    124
    Likes Received:
    25
    I could not await to fix the Tree-File since I red about this nasty pointless ID thing in the patchnotes :rolleyes:. Thanks for the hint with the EAH dialog. I would never have found it on my own.:D

    But the your solution for the script does not work for me. I changed the line:
    Code:
    var lng = EgsEsExtension.Locales.Locales.Language.deDE;
    
    CpuInfDev.Run(CsRoot.Root, lng);              // draws defective devices
    CpuInfCpu.Run(CsRoot.Root, lng);              // draws processor device health information
    CpuInfHll.Run(CsRoot.Root, lng);                // draws a structure damage overview scheme
    
    CpuInfBox.Run(CsRoot.Root, lng);              // draws container fill levels
    CpuInfBay.Run(CsRoot.Root, lng);             // draws docked vessel data
    CpuInfThr.Run(CsRoot.Root, lng);              // draws thruster health information
    CpuInfWpn.Run(CsRoot.Root, lng);              // draws weapon health information
    
    CpuCvrSrt.Run(CsRoot.Root, lng);              // reads levels and items needs and try to preserve the item count for specified containers
    CpuCvrPrg.Run(CsRoot.Root, lng);             // gather all items from defined containers/vessels (much logic/security conditions)
    CpuCvrFll.Run(CsRoot.Root, lng);              // reads item requests from vessels and try to refill it (much logic/security conditions)
    
    CpuInfS.Run(CsRoot.Root, lng);                // draws compact information overview for smaller displays
    CpuInfL.Run(CsRoot.Root, lng);                // draws information overview for bigger displays
    But the Scripttracker output just changed to:
    Code:
    Microsoft.CodeAnalysis.Scripting.CompilationErrorException: (1,11): error CS0103: The name 'EgsEsExtension' does not exist in the current context
      at Microsoft.CodeAnalysis.Scripting.ScriptBuilder.ThrowIfAnyCompilationErrors (Microsoft.CodeAnalysis.DiagnosticBag diagnostics, Microsoft.CodeAnalysis.DiagnosticFormatter formatter) [0x0005c] in <f838c9c4d287404580d07c873cf45639>:0
      at Microsoft.CodeAnalysis.Scripting.ScriptBuilder.CreateExecutor[T] (Microsoft.CodeAnalysis.Scripting.ScriptCompiler compiler, Microsoft.CodeAnalysis.Compilation compilation, System.Boolean emitDebugInformation, System.Threading.CancellationToken cancellationToken) [0x00040] in <f838c9c4d287404580d07c873cf45639>:0
      at Microsoft.CodeAnalysis.Scripting.Script`1[T].GetExecutor (System.Threading.CancellationToken cancellationToken) [0x0002b] in <f838c9c4d287404580d07c873cf45639>:0
      at Microsoft.CodeAnalysis.Scripting.Script`1[T].RunAsync (System.Object globals, System.Func`2[T,TResult] catchException, System.Threading.CancellationToken cancellationToken) [0x0001b] in <f838c9c4d287404580d07c873cf45639>:0
      at EmpyrionScripting.CsCompiler.CsCompiler+<>c__DisplayClass28_0`1[T].<GetExec>b__0 (System.Object rootObject) [0x0018e] in <3feacf6e9d0644ac86ee08c4d4214701>:0
    
    The first node in the call chain seems not to be reachable. Maybe the CustomDLLs subfolder is not correct referrenced?
    Where did you put the "EgsEsExtension.dll"?
     
    #256
  17. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,074
    Likes Received:
    729
    hmm normal location and
    Code:
    {
      "WithinLearnMode": true,
      "CustomAssemblies": [
        "CustomDLLs\\EgsEsExtension.dll"
      ],
      "Usings": [
        "EgsEsExtension",
        "EgsEsExtension.Scripts",
        "EgsEsExtension.Locales"
      ],
      "AssemblyReferences": [],
      "SymbolPermissions": {
        "Player": [],
        "Admin": [],
        "SaveGame": [
          "EgsEsExtension",
          "EgsEsExtension.*"
        ]
      }
    }
    "C:\steamcmd\empyrion.server\Saves\Games\DefaultRE\Mods\EmpyrionScripting\CustomDLLs\EgsEsExtension.dll"
     
    #257
  18. Preston

    Preston Commander

    Joined:
    Jul 6, 2017
    Messages:
    124
    Likes Received:
    25
    2x "\"!

    I love path concatenating!....works even with:
    Code:
    Locales.Language lng = Locales.Language.deDE;
    :cool:
    Thanks
     
    #258
  19. Preston

    Preston Commander

    Joined:
    Jul 6, 2017
    Messages:
    124
    Likes Received:
    25
    And want to say thanks for the change you made in the container access and stability. While hunting down a bug this afternoon I do not notice any freeze or irregularity in the controlpanel like before the update.
     
    #259
    ASTIC likes this.
  20. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,074
    Likes Received:
    729
    #260
    Last edited: Jun 23, 2021

Share This Page