[MOD EXT] Empyrion Scripting - Scripts

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

  1. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    993
    Likes Received:
    707
    Do you play in SP or MP on a server?
     
    #421
  2. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    993
    Likes Received:
    707
    @Nathan Jurgens @Homunk
    The problem in the SP with RE is that the API does not transfer the scenario correctly when it comes from Steamworkshop. I will build in the Konfiguiration times a parameter with which you can override the savegame. This must then be done manually, and with each new savegame again, but it is the only solution to get to the right RE files

    Here is the logfile from my start with RE (from Workshop) in SP -> no scenario infos :-(
    Code:
    19-20:24:54.438 22_24 -LOG- {EmpyrionScripting} InitGameDependedData [ForceInit:True]:
    AppFolder.Content:C:\SteamGames\steamapps\common\Empyrion - Galactic Survival\Client/../Content
    AppFolder.Mod:C:\SteamGames\steamapps\common\Empyrion - Galactic Survival\Client/../Content/Mods
    AppFolder.Root:C:\SteamGames\steamapps\common\Empyrion - Galactic Survival\Client/..
    AppFolder.SaveGame:C:\SteamGames\steamapps\common\Empyrion - Galactic Survival\Client/../Saves/Games/RE-SP
    AppFolder.Dedicated:
    AppFolder.Cache:C:\SteamGames\steamapps\common\Empyrion - Galactic Survival\Client/../Saves/Cache
    AppFolder.ActiveScenario: -> CurrentScenario:
    ...
    19-20:24:54.439 22_24 -LOG- {EmpyrionScripting} LocalisationData from 'C:\SteamGames\steamapps\common\Empyrion - Galactic Survival\Client/../Content\Extras\Localization.csv'
    19-20:24:54.506 22_24 -LOG- {EmpyrionScripting} EmpyrionScripting ReadConfigEcf: ContentPath:C:\SteamGames\steamapps\common\Empyrion - Galactic Survival\Client/../Content Scenario: ->
    19-20:24:54.508 22_24 -LOG- {EmpyrionScripting} ReadBlockMappingFile: BlockIdMapping API:[3354]
    19-20:24:54.512 22_24 -LOG- {EmpyrionScripting} ReadBlockMappingFile: BlockIdMapping FileC:\SteamGames\steamapps\common\Empyrion - Galactic Survival\Client/../Saves/Games/RE-SP\blocksmap.dat:[3354]
    19-20:24:54.513 22_24 -LOG- {EmpyrionScripting} ReadEcfFiles
    19-20:24:54.513 22_24 -LOG- {EmpyrionScripting} EmpyrionScripting C:\SteamGames\steamapps\common\Empyrion - Galactic Survival\Client/../Content\Configuration\Templates.ecf: start
    19-20:24:54.529 22_24 -LOG- {EmpyrionScripting} EmpyrionScripting C:\SteamGames\steamapps\common\Empyrion - Galactic Survival\Client/../Content\Configuration\Templates.ecf: #456
    19-20:24:54.529 22_24 -LOG- {EmpyrionScripting} EmpyrionScripting C:\SteamGames\steamapps\common\Empyrion - Galactic Survival\Client/../Content\Configuration\BlocksConfig.ecf: start
    19-20:24:54.631 22_24 -LOG- {EmpyrionScripting} EmpyrionScripting C:\SteamGames\steamapps\common\Empyrion - Galactic Survival\Client/../Content\Configuration\BlocksConfig.ecf: #2186
    19-20:24:54.631 22_24 -LOG- {EmpyrionScripting} EmpyrionScripting C:\SteamGames\steamapps\common\Empyrion - Galactic Survival\Client/../Content\Configuration\ItemsConfig.ecf: start
    19-20:24:54.675 22_24 -LOG- {EmpyrionScripting} EmpyrionScripting C:\SteamGames\steamapps\common\Empyrion - Galactic Survival\Client/../Content\Configuration\ItemsConfig.ecf: #639
    
     
    #422
  3. Nathan Jurgens

    Nathan Jurgens Lieutenant

    Joined:
    May 18, 2016
    Messages:
    52
    Likes Received:
    5
    I test in SP and then play in MP (on a server with the scripting installed)
    Doe not work at all in SP and half works in MP (the two new Eden Forge weapons are missing but was find when they were using 8.1 script)
    But most likely a setup issue, will play around with it.
     
    #423
  4. Nathan Jurgens

    Nathan Jurgens Lieutenant

    Joined:
    May 18, 2016
    Messages:
    52
    Likes Received:
    5
    Using your script, I got it to work, but I have to dock exactly (as in -10,128,22) I just need to learn how to change the test to a range (2 blocks range)

    Code:
    {{~set 'HA2' False}}
    {{~set 'LimitToType' 'CV'}}
    <align=center><color=white>Hanger 2
    {{#sort E.S.DockedE 'Name'}}{{#each .}}
    {{#globaltostructpos @root.E.S Pos}}
    {{#test x eq -10}}
    {{#test y eq 128}}
    {{#test z eq 22}}
    {{~set 'HA2' True}}
    {{/test}}{{/test}}{{/test}}
    {{/globaltostructpos}}
    {{#ok @root.Data.HA2}}
    {{Name}}<color=red>
    {{~#if S.IsPowerd}} !! ON !! {{/if}}
    {{~use S.FuelTank}}<color=green>
    ☢{{~math Content '/' Capacity}}
    {{~format . '{0,8:P2} '}}</color>
    {{~/math}}{{/use}}
    {{~use S.OxygenTank}}<color=#2ECCFA>✇
    {{~math Content '/' Capacity}}
    {{~format . '{0,8:P2} '}}
    {{~/math}}{{/use}}</color>
    {{~use S.PentaxidTank}}<color=purple>⚛
    {{~math Content '/' Capacity}}
    {{~format . '{0,8:P2} '}}
    {{~/math}}</color>
    {{~/use}}
    {{/ok}}
    {{/each}}{{/sort}}
    
    
    
     
    #424
    Last edited: Apr 20, 2022
  5. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    993
    Likes Received:
    707
    #425
  6. Homunk

    Homunk Lieutenant

    Joined:
    Mar 22, 2020
    Messages:
    74
    Likes Received:
    26
    Hi Astic,
    where in Configuration.json would I place:
    "OverrideScenarioPath": "C:\\SteamGames\\steamapps\\workshop\\content\\383120\\2550354956",

    Forget this post. I found it and got it to work.:):thumpUp:
     
    #426
    Last edited: Apr 20, 2022
  7. Homunk

    Homunk Lieutenant

    Joined:
    Mar 22, 2020
    Messages:
    74
    Likes Received:
    26
    Astic, you are a genius, thank you very much for your help. All is working now. :)
     
    #427
    Tyrion and ASTIC like this.
  8. Nathan Jurgens

    Nathan Jurgens Lieutenant

    Joined:
    May 18, 2016
    Messages:
    52
    Likes Received:
    5
    With the lastest patch, I have got everything working in both SP and MP.

    Thanks again for all the hard work. Really love the slowed down recycle, you can watch as it delayers ships, very very cool.
    The auto harvesting working perfectly.

    The only script here I have not got to work is Name: Dynamic Transfer/Sorting System
     
    #428
    Last edited: Apr 21, 2022
    ASTIC likes this.
  9. Nathan Jurgens

    Nathan Jurgens Lieutenant

    Joined:
    May 18, 2016
    Messages:
    52
    Likes Received:
    5
    Now that I have all the scripts working, I wonder wonder what else can be done.

    When a ship detects you, it gets ! in its name and that means its coming in to attack. Can that be 'detected' in a script? So I can make a red alert script that only trigger when something is 3km away and is going to attack? (going to have it changes all internal lights to flashing red)

    Also anyway to 'read' what a repair bay block wants to do a repair and then transfer what is needs to the the repair bay from a cargo container?
     
    #429
    Last edited: Apr 25, 2022
  10. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    993
    Likes Received:
    707
    Unfortunately the answer to both questions is no, the API in the current version does not allow this. :-(
     
    #430
  11. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    993
    Likes Received:
    707
    First step to "external" data...
    upload_2022-4-29_20-13-30.png
     
    #431
  12. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    993
    Likes Received:
    707
    #432
  13. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    993
    Likes Received:
    707
  14. Nathan Jurgens

    Nathan Jurgens Lieutenant

    Joined:
    May 18, 2016
    Messages:
    52
    Likes Received:
    5
    Is the X,Y,Z location of the pilot known in variables?
    I have two pilot controls (one forward facing, one rear)
    And I want to turn on the main guns depending on which is being used.
    I can turn off all guns (when no pilot) but I really need to find his location before I can script the rest.
     
    #434
  15. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    993
    Likes Received:
    707
    EmpyrionScripting: 9.2.2 with player/pilot "Position" property
    https://github.com/GitHub-TC/EmpyrionScripting/releases/tag/9.2.2
     
    #435
  16. Nathan Jurgens

    Nathan Jurgens Lieutenant

    Joined:
    May 18, 2016
    Messages:
    52
    Likes Received:
    5
    Wow, Thank you.

    I have used so many of your scripts in my Battle Carrier. Thanks again
    https://steamcommunity.com/sharedfiles/filedetails/?id=2802720553

    I have tried to name and edit all the scripts in my Battle Carrier to make it easy for people to copy the code. Really want to see more servers using your scripts.

    I used edited Radar scripts on my server
    (I copy the CV scripts subfolder to SV so SV can use them too and add the Reforge Eden Long Ranger scanner to the list of valid blocks)
     
    #436
    Last edited: May 3, 2022
  17. Luke Benko

    Luke Benko Ensign

    Joined:
    Mar 30, 2021
    Messages:
    12
    Likes Received:
    3
    Has anyone figured out Name: Dynamic Transfer/Sorting System or another sorting system? I would love to look at it and use if possible? I am not much of a scripter/coder.
     
    #437
  18. Nathan Jurgens

    Nathan Jurgens Lieutenant

    Joined:
    May 18, 2016
    Messages:
    52
    Likes Received:
    5
    player/pilot "Position" property is the X,Y,Z location in the playfield, so I just minus the E.Pos current X,Y,Z in the playfield to get a location of the player/pilot relative to the structure, or is there coordinates from the point of view of the structure already of the player like globaltostructpos

    Code:
    {{set 'MiningCockpit' False}}
    {{~#test (calc E.S.Pilot.Position.X '-' E.Pos.X) geq 35}}
    {{~#test (calc E.S.Pilot.Position.X '-' E.Pos.X) leq 36}}
    {{~#test (calc E.S.Pilot.Position.Y '-' E.Pos.Y) geq 17}}
    {{~#test (calc E.S.Pilot.Position.Y '-' E.Pos.Y) leq 18}}
    {{~#test (calc E.S.Pilot.Position.Z '-' E.Pos.Z) geq 43}}
    {{~#test (calc E.S.Pilot.Position.Z '-' E.Pos.Z) leq 44}}
    {{set 'MiningCockpit' True}}
    {{/test}}{{/test}}{{/test}}{{/test}}{{/test}}{{/test}}
    
    Cause that code, I would expect the output to be fixed, but moving the ship around the difference between the pilot location and the ship change too much
     
    #438
    Last edited: May 4, 2022
  19. Luke Benko

    Luke Benko Ensign

    Joined:
    Mar 30, 2021
    Messages:
    12
    Likes Received:
    3
    Code:
    {{fontsize 4}}
    {{set 'PSTL' '4148,4099,4116,4126,4110,4131,4156'}}
    {{set 'AR' '4111,4120,4132,4150,4102,4133'}}
    {{set 'SHTGN' '4100,4105,4123,4154'}}
    {{set 'MINI' '4101,4149'}}
    {{set 'LSRRF' '4112,4122,4134,4124,4157'}}
    {{set 'SNPRL' '4103,4114,4121,4151'}}
    {{set 'RCKTL' '4106,4129,4130,4161,4147'}}
    {{set 'PSMCNN' '4113,4125,4160'}}
    {{set 'Tools' '4107,4115,4118,4119,4127,4135,4136,4137,4135,4158,4128'}}
    {{#items E.S 'Box-Input'}}
    {{#test Id in @root.data.PSTL}}
    {{move this @root.E.S 'Pistols' 10000}}
    {{SourceE.Name}}:{{Source}}->
    {{~DestinationE.Name}}:{{Destination}}
    {{format Count '{0,5}'}} : {{i18n Id 'English'}}
    {{/move}}{{else}}
    {{#test Id in @root.data.AR}}
    {{move this @root.E.S 'AutoRifles'}}
    {{SourceE.Name}}:{{Source}}->
    {{~DestinationE.Name}}:{{Destination}}
    {{format Count '{0,5}'}} : {{i18n Id 'English'}}
    {{/move}}{{else}}
    {{#test Id in @root.data.SHTGN}}
    {{move this @root.E.S 'Shotguns'}}
    {{SourceE.Name}}:{{Source}}->
    {{~DestinationE.Name}}:{{Destination}}
    {{format Count '{0,5}'}} : {{i18n Id 'English'}}
    {{/move}}{{else}}
    {{#test Id in @root.data.MINI}}
    {{move this @root.E.S 'MiniGun'}}
    {{SourceE.Name}}:{{Source}}->
    {{~DestinationE.Name}}:{{Destination}}
    {{format Count '{0,5}'}} : {{i18n Id 'English'}}
    {{/move}}{{else}}
    {{#test Id in @root.data.LSRRF}}
    {{move this @root.E.S 'LaserRifle'}}
    {{SourceE.Name}}:{{Source}}->
    {{~DestinationE.Name}}:{{Destination}}
    {{format Count '{0,5}'}} : {{i18n Id 'English'}}
    {{/move}}{{else}}
    {{#test Id in @root.data.SNPRL}}
    {{move this @root.E.S 'SniperRifle'}}
    {{SourceE.Name}}:{{Source}}->
    {{~DestinationE.Name}}:{{Destination}}
    {{format Count '{0,5}'}} : {{i18n Id 'English'}}
    {{/move}}{{else}}
    {{#test Id in @root.data.RCKTL}}
    {{move this @root.E.S 'RocketLauncher'}}
    {{SourceE.Name}}:{{Source}}->
    {{~DestinationE.Name}}:{{Destination}}
    {{format Count '{0,5}'}} : {{i18n Id 'English'}}
    {{/move}}{{else}}
    {{#test Id in @root.data.PSMCNN}}
    {{move this @root.E.S 'PlasmaCannon'}}
    {{SourceE.Name}}:{{Source}}->
    {{~DestinationE.Name}}:{{Destination}}
    {{format Count '{0,5}'}} : {{i18n Id 'English'}}
    {{/move}}{{else}}
    {{#test Id in @root.data.Tools}}
    {{move this @root.E.S 'Tools'}}
    {{SourceE.Name}}:{{Source}}->
    {{~DestinationE.Name}}:{{Destination}}
    {{format Count '{0,5}'}} : {{i18n Id 'English'}}
    {{/move}}{{/test}}{{/test}}{{/test}}{{/test}}{{/test}}{{/test}}{{/test}}{{/test}}{{/test}}{{/test}}{{/test}}{{/item}}
    

    I need to make this a bit smaller? I am very new to coding / scripting, any help would be appreciated. Plus I have a bunch more to add to it, like ores, ingots, crafting matts, more ammos, so any way to put the PSTL, AR, ... into another screen, any help really.
     
    #439
  20. Nathan Jurgens

    Nathan Jurgens Lieutenant

    Joined:
    May 18, 2016
    Messages:
    52
    Likes Received:
    5
    The mod already groups of lot of ids together so you do not need to create your own custom list since they are already created in the Configuration file
    You can add your own directly to that file so you do not need to define them in the code

    Eg
    "Ids": {
    "Ore": ",AluminiumOre,CobaltOre,CopperOre,ErestrumOre,GoldOre,IronOre,MagnesiumOre,NeodymiumOre,PentaxidOre,PromethiumOre,SiliconOre,TitanOre,ZascosiumOre,",
     
    #440
    Last edited: May 4, 2022

Share This Page