[mod] Empyrion Scripting Mod

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

Tags:
  1. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    991
    Likes Received:
    707
    Or is the "new line" not a simple \n but a full CRLF \r\n
    ?
    P.s. Note: Distinct removes duplicated entries

    Vielleicht kannst du auch so die Texte bereinigen
    sOutput = System.Text.Encoding.ASCII.GetString(System.Text.Encoding.ASCII.GetBytes(sInput));
    Ggf. Musst du in der csconfiguration.json noch die entsprechenden Dinge freischalten
     
    #81
  2. Preston

    Preston Commander

    Joined:
    Jul 6, 2017
    Messages:
    123
    Likes Received:
    25
    Thanks to you both. After being directed to additional characters I hit delete and backspace "everywhere" :) and got the first positiv result.
    I would assume this "magical" characters are the lcd-auto-inserted line breaks if the line hits the end of the lcd textbox. Maybe mixed up with some \cr and/or \lf relics. I especially used the '\n' character to avoid \cr\lf issues....

    But Trim() does the job. I copied the polluted text back in the lcd and read it in with "Trim" and the string compare works flawless.
     
    #82
  3. Preston

    Preston Commander

    Joined:
    Jul 6, 2017
    Messages:
    123
    Likes Received:
    25
    I noticed to gather rather quickly a bunch of "standard methods" I use in several c# savegamescripts again and again.

    Will there be (one shiny day :)) the possibility to have libraries, includes or some sort of makro-handling to maintain such methods (with paramters and arguments) at one central place and just tell the script to load the actual one from this place?
    (Or maybe it is already and I don't notice it?!)
     
    #83
  4. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    991
    Likes Received:
    707
    Ich habe das selber noch nicht ausprobiert aber in der Datei [EGS]Saves\Games\[SaveGame]\Mods\EmpyrionScripting\CsCompilerConfiguration.json kannst du in dem Abschnitt "AssemblyReferences" deine DLL hinzufügen und im Abschnitt "Usings" das using auf deinen Namespace eintragen. Dann kannst du in den SaveGame scripten das benutzen (für die anderen Scripte müsstest du noch die "erlaubten" Namen in die "SymbolPermissions" eintragen)
     
    #84
  5. Preston

    Preston Commander

    Joined:
    Jul 6, 2017
    Messages:
    123
    Likes Received:
    25
    I had no luck upto now to use a .dll.

    I wrote a simple class and build a .dll:
    [​IMG]

    I copied the .dll to the save game path: (I tested the mod root path, too)
    [​IMG]

    I added the entries to the configuration like you said: (I tested the reference entry without the file extension, too)
    [​IMG]

    All savegamescripts do not run any more, probably with the same error which occurs at ingame scripts:
    [​IMG]

    In the ingame testscript is no call to my namespace at all. This message occurs even at an empty script.

    Do I have to set special dependencies in visual studio to build a suitable .dll?
    I choosed "C# ClassLibrary for .Net Standard"
    Or do I miss something else?
     
    #85
  6. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    991
    Likes Received:
    707
    Please try this:
    • Compile your DLL for .NET 4.6
    • AssemblyReferences add your DLL without the extension
    • Masne
    • Maybe your DLL have in the mod directory
     
    #86
  7. Preston

    Preston Commander

    Joined:
    Jul 6, 2017
    Messages:
    123
    Likes Received:
    25
    I had to recreate a new project as "C# class library for desktop" to be able to select .Net 4.6:
    [​IMG]

    I corrected the configuration:
    [​IMG]

    And copied the new .dll to both directories:
    [​IMG]

    With the same result. I even restarted the server to prevent possible .dll loading issues.
    The empty script says:
    [​IMG]
    :(
     
    #87
  8. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    991
    Likes Received:
    707
    Ok, habe zurzeit leider keine Idee mehr dazu. Ich bin ab dem Wochenende wieder zu Hause und werde das dann mal selber ausprobieren und sehen warum es nicht funktioniert.
     
    #88
    Germanicus likes this.
  9. Preston

    Preston Commander

    Joined:
    Jul 6, 2017
    Messages:
    123
    Likes Received:
    25
    Ok, thanks for the infos, help and hints so far.
    I'm looking excited to the weekend. :)
     
    #89
    Germanicus likes this.
  10. tachyon

    tachyon Commander

    Joined:
    Aug 12, 2015
    Messages:
    92
    Likes Received:
    134
    Would it be possible to use IEntity.Position in combination with IStructure.GlobalToStructPos to determinate where a player is located on a structure? This would be really cool.
     
    #90
    shadowiviper and Sephrajin like this.
  11. shadowiviper

    shadowiviper Commander

    Joined:
    Apr 13, 2020
    Messages:
    89
    Likes Received:
    144
    If you get that working let me know - I tried a while back to do the same with a docked sv on a cv. I wanted to work out the SV's position on the CV's internal coordinate grid so I could show which docking platform it was on/turn on landing lights.

    Tried a few variations with looking at the global position of both ships cores and comparing the offset with the offset of a light (on the landing pad) from the core. I had it partially work on a base as the offset never changed, but on a Cv as soon as the parent moved all the coordinates changed so abandoned it as impossible. Hope you have better luck
     
    #91
    Sephrajin likes this.
  12. Preston

    Preston Commander

    Joined:
    Jul 6, 2017
    Messages:
    123
    Likes Received:
    25
    After the last mod update the configuration.json in the savegame folder seems to be ignored.

    I updated the mod files and deleted the configuration file in the savegame folder to see at which place the mod recreate it.
    Then I changed the savegame script intervall to 5000ms but the mod still cycles in 10000ms steps.

    [​IMG]

    Would you have a look, please?
     
    #92
  13. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    991
    Likes Received:
    707
    upload_2020-8-8_11-30-5.png

    With the new "InGame" info data you can also see the values of the mod in the game.
    With DetailedScriptsInfoData = true even per script as shown in the screenshot here.
    Version: https://github.com/GitHub-TC/EmpyrionScripting/releases/download/5.7.2/EmpyrionScripting.zip
     
    #93
    Germanicus likes this.
  14. Preston

    Preston Commander

    Joined:
    Jul 6, 2017
    Messages:
    123
    Likes Received:
    25
    The Mod "thinks" it uses the configuration.json:
    [​IMG]

    But it doesn't:
    [​IMG]
    [​IMG]
    ;)
     
    #94
    Germanicus likes this.
  15. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    991
    Likes Received:
    707
    Ich vermute du greift auf ein Device zu so das ein DeviceLock notwendig ist und damit
    Diese (zentrale) Einstellung benötigt einen Neustart des Spieles.
     
    #95
  16. Preston

    Preston Commander

    Joined:
    Jul 6, 2017
    Messages:
    123
    Likes Received:
    25
    Ah, ok. Because even the Ids table in this file is changeable at runtime I assumed that this should be possible with this setting, too.

    I restarted the server and the new intervall settings is used, thanks.

    I uploaded my configuration file if you want to add my added groups to the standard file. The "Component" group is not nearly complete. I had no time until now to let my script pick the missing ids.
    But the other new groups should be complete by config file.
     

    Attached Files:

    #96
  17. Ostentatiou5

    Ostentatiou5 Ensign

    Joined:
    Aug 9, 2020
    Messages:
    13
    Likes Received:
    9
    Hi ASTIC,

    I have a question about the deconstruct script. Would it be possible to change it to break it down to the mats, instead of the specific blocks?

    Thanks
     
    #97
  18. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    991
    Likes Received:
    707
    It would of course be much more complex and time-consuming (and less error-prone) to analyze the blocks down to the recipes - but feasible.
    But actually you have the deconstructor for exactly that ;-)
     
    #98
  19. Ostentatiou5

    Ostentatiou5 Ensign

    Joined:
    Aug 9, 2020
    Messages:
    13
    Likes Received:
    9
    Yeah, that's what I am doing now :)

    Also, thanks for the scripting engine, it's fantastic.
     
    #99
  20. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    991
    Likes Received:
    707
    #100
    Last edited: Aug 10, 2020
    shadowiviper likes this.

Share This Page