[MOD EXT] Empyrion Scripting - Scripts

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

  1. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,020
    Likes Received:
    715
    EmpyrionScripting 8.0.0
    https://github.com/GitHub-TC/EmpyrionScripting/releases/tag/8.0.0
    With this I made a (quite nasty) hack to get the C# compiler for the C# scripts working again. Since Eleon had scrapped this with the 1.7.2.

    ATTENTION: Before unpacking the ZIP file delete the old [EGS]\Content\Mods\EmpyrionScripting directory, because many DLLs are "dropped".
     
    #341
  2. Homunk

    Homunk Lieutenant

    Joined:
    Mar 22, 2020
    Messages:
    74
    Likes Received:
    26
    Sorry, but unfortunately it doesn't work, at least on my computer. I use "EgsEsExtension_1_0" from Preston. I think this is the player's name.
    It produces only never ending error messages at the console.
     
    #342
  3. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,020
    Likes Received:
    715
    I'll take a look at what this DLL is all about.
    This version enables C# scripts for the first time again.
     
    #343
  4. Homunk

    Homunk Lieutenant

    Joined:
    Mar 22, 2020
    Messages:
    74
    Likes Received:
    26
    Thank you
     
    #344
  5. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,020
    Likes Received:
    715
    Preston: EgsEsExtension recompile dll and fix
    https://github.com/GitHub-TC/EmpyrionScripting/releases/tag/8.0.1
     
    #345
    Homunk likes this.
  6. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,020
    Likes Received:
    715
    #346
    ...M-o-H... likes this.
  7. Thorgroem

    Thorgroem Ensign

    Joined:
    Feb 19, 2022
    Messages:
    7
    Likes Received:
    0
    Hi Astic,
    - Is it possible to make a loop like the command "For" in over language ?
    - Is there a variable like for gasoline tank, oxygen or pentaxide for containers: When I put several different objects; I would like it to give me the total count and not, each count. I'm trying to create a graphical gauge for a container.
    Thank for all.
     
    #347
  8. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,020
    Likes Received:
    715
    E.S.Items contains ALL items of your containers
     
    #348
  9. Thorgroem

    Thorgroem Ensign

    Joined:
    Feb 19, 2022
    Messages:
    7
    Likes Received:
    0
    Hello Astic,

    I have a problem on a data format issue:
    I'm scripting a result to an LCD to total the Minerals container item:

    Script:LCD_Minerais
    Code :

    Code:
    {{~items E.S. '###Minerais###'}}{{~Count}}{{~/items}}

    LCD_Minerais
    Résultat :

    3
    1​

    Script:LCD_Calcul
    Code :

    Code:
        {{~set 'N' 0}}
        {{~devices E.S. 'LCD_Minerais'}}
        {{~gettext .0}}
        {{~set 'C' .}}
        {{~#split @root.Data.C ','}}
        {{set 'D' .}}
        {{~#each .}}
        {{~set 'T1' (lookup @root.Data.D @root.Data.N)}}
        {{~set 'N' (calc @root.Data.N '+' 1)}}
        {{~set 'T' (calc @root.Data.T '+' @root.Data.T1)}}
        {{~/each}}{{@root.Data.T}}
        {{/split}}{{/gettext}}{{/devices}}
    
    
    LCD_Calcul
    Résultat :

    4​

    - Now I am looking to retrieve the result on LCD_Calcul

    Script:LCD_Test
    Code:
    {{~#devices E.S. 'LCD_Calcul'}}
    {{#gettext .0}}{{set 'C1' .}}{{test @root.Data.C1 in '1-4'}}
    {{set 'T' '-0- OK
    {{else}}
    {{set 'T' '-0- NOPE'}}
    {{/test}}{{@root.Data.T}}
    LCD_Test
    Résultat :

    4​

    -0- NOPE​

    The problem :
    I think the value I'm getting is not in the correct format.
    The returned 4 is not a numeric format but rather a string, so {{test @root.Data.C1 in '1-4'}} gives me a false value.

    Is there a function to change the format of a value?

    thank you for your answers
     
    #349
  10. me777

    me777 Commander

    Joined:
    Aug 18, 2020
    Messages:
    384
    Likes Received:
    132
    I had a similar problem with comparing numbers, if I remember right i solved it by using {{math Value '*' 1 }}
    also there is {{int (value)}} but i did not get it to work.

    ps i think '1-4' would not work it should be something like '1,2,3,42'
     
    #350
  11. Thorgroem

    Thorgroem Ensign

    Joined:
    Feb 19, 2022
    Messages:
    7
    Likes Received:
    0
    Ty me777 I'll try !
     
    #351
  12. Aaron(Wakfu)

    Aaron(Wakfu) Commander

    Joined:
    Jun 1, 2021
    Messages:
    124
    Likes Received:
    53
    hey, is there a script to take all devices off a cv? also if a server has astics scripts installed, can you use that one you did with the HUD, cool looking hud.
     
    #352
  13. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,020
    Likes Received:
    715
    #353
  14. Nathan Jurgens

    Nathan Jurgens Lieutenant

    Joined:
    May 18, 2016
    Messages:
    52
    Likes Received:
    5
    Still very new to playing around with scripts.
    At the moment, my display script for what is docked to a set hanger is just based on the docked ships name, but I prefer if I can change that to the docked ships name of the core

    What do I replace {{#test Name eq 'Ship2'}}
    with to look at the name of the core on the ship instead of the docked ships name?

    Code:
    {{~set 'LimitToType' 'CV'}}
    <align=center><color=white>Hanger 1
    {{/devices}}
    {{#sort E.S.DockedE 'Name'}}{{#each .}}
    {{#test EntityType in @root.Data.LimitToType}}
    {{#test Name eq 'Ship2'}}
    {{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}}
    {{/test}}{{/test}}{{/each}}{{/sort}}
    
     
    #354
    Last edited: Apr 5, 2022
  15. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,020
    Likes Received:
    715
    The function "in" can also handle ranges like "1-4", for this the values are converted to the type of the value to be searched. This can lead to the desired behavior not occurring, especially with texts. Therefore, a text value should be converted into a number beforehand.
    Code:
    {{set V '42'}}
    ...
    {{test (int @root.Data.V) in '1-99'}}
    ...
     
    #355
  16. Nathan Jurgens

    Nathan Jurgens Lieutenant

    Joined:
    May 18, 2016
    Messages:
    52
    Likes Received:
    5
    Anyone got a \Mods\EmpyrionScripting\Configuration.json file that has been updated for the new blocks in Eden Forge 1.7?
    Or can check my one to confirm I got them all?

    Also very impressed by what the scripting can do. I guess you can't use it to auto trigger fuel creations in an constructor? As in transfer raw resource to a container by script and then tell the constructor to make fuel?
     
    #356
  17. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,020
    Likes Received:
    715
    1. I am building the version 9.0.0 where you can specify the IDs in the config file also by name. So you can insert the dynamic objects from RE 1.7 there without it would disturb the vanilla operation of the mod. In addition, the lists are then robust against extensions of the scenario.
    2. Unfortunately I can not reach the constructor via API. My request to Eleon to include this in the API has been ignored so far. :-(
     
    #357
    Myrmidon likes this.
  18. Nathan Jurgens

    Nathan Jurgens Lieutenant

    Joined:
    May 18, 2016
    Messages:
    52
    Likes Received:
    5
    Does the
    Name: Dynamic Transfer/Sorting System
    still work?
    Can't get it to work and I have not seen it in any sample blueprint
     
    #358
    Grin likes this.
  19. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,020
    Likes Received:
    715
    Comming soon with the 9.0.0 the ID lists in the configuration file declared with names (id will be automaticaly converted) - so there can be names from RE also as "dynamic" elements
    Code:
      "Ids": {
        "Ore": ",AluminiumOre,CobaltOre,CopperOre,ErestrumOre,GoldOre,IronOre,MagnesiumOre,NeodymiumOre,PentaxidOre,PromethiumOre,SiliconOre,TitanOre,ZascosiumOre,",
        "Ingot": ",CobaltIngot,CopperIngot,CrushedStone,ErestrumIngot,GoldIngot,IronIngot,MagnesiumPowder,NeodymiumIngot,PentaxidCrystal,PlatinBar,PromethiumPellets,RockDust,SathiumIngot,SiliconIngot,ZascosiumIngot,",
        "BlockL": ",AlienBlocks,AlienLargeBlocks,ConcreteArmoredBlocks,ConcreteBlocks,ConcreteDestroyedBlocks,GrowingPot,GrowingPotConcrete,GrowingPotWood,HeavyWindowBlocks,HullArmoredLargeBlocks,HullCombatFullLarge,HullCombatLargeBlocks,HullFullLarge,HullLargeBlocks,HullLargeDestroyedBlocks,HullThinLarge,LadderBlocks,PlasticLargeBlocks,StairsBlocks,StairsBlocksConcrete,StairsBlocksWood,TrussLargeBlocks,WindowArmoredLargeBlocks,WindowLargeBlocks,WindowShutterLargeBlocks,WoodBlocks,",
        "BlockS": ",ArtMassBlocks,HullArmoredSmallBlocks,HullSmallBlocks,HullSmallDestroyedBlocks,ModularWingBlocks,PlasticSmallBlocks,TrussSmallBlocks,VentilatorCubeQuarter,WindowArmoredSmallBlocks,WindowShutterSmallBlocks,WindowSmallBlocks,WingBlocks,",
        "Medic": ",AlienParts03,AntibioticInjection,AntibioticPills,Medikit01,Medikit02,Medikit03,Medikit04,RadiationImmunityShot,RadiationPills,StomachPills,",
        "Food": ",AkuaWine,AnniversaryCake,Beer,BerryJuice,Bread,Cheese,EmergencyRations,FruitJuice,FruitPie,HotBeverage,MeatBurger,Milk,Pizza,Sandwich,Steak,Stew,VegetableJuice,VeggieBurger,",
        "Ingredient": ",5312,AlienParts01,AlienParts03,AlienTooth,AloeVera,ConfettiMossScrapings,FireMossScrapings,Fruit,HerbalLeaves,Meat,PlantProtein,RottenFood,Spice,TrumpetGreens,Vegetables,",
        "Sprout": ",AlienPalmTreeStage1,AlienPlantTube2Stage1,AlienplantWormStage1,BigFlowerStage1,BulbShroomYoungStage1,CobraLeavesPlantStage1,CoffeePlantStage1,CornStage1,DesertPlant20Stage1,DurianRoot,ElderberryStage1,InsanityPepperStage1,MushroomBellBrown01Stage1,PearthingStage1,PumpkinStage1,SnakeweedStage1,TomatoStage1,WheatStage1,",
        "Tools": ",Chainsaw,ColorTool,ConcreteBlocks,ConstructorSurvival,DrillT2,Explosives,Flashlight,LightWork,LightWork02,MobileAirCon,MultiTool,MultiToolT2,OreScanner,OxygenGeneratorSmall,PlayerBike,RadarSuitT1,TextureTool,WaterGenerator,",
        "ArmorMod": ",ArmorHeavyEpic,",
        "DeviceL": ",AlienNPCBlocks,ArmorLocker,ATM,BlastDoorLargeBlocks,BoardingRampBlocks,CloneChamber,CockpitBlocksCV,ConstructorT0,ConstructorT1V2,ConstructorT2,ContainerAmmoControllerLarge,ContainerAmmoLarge,ContainerControllerLarge,ContainerExtensionLarge,ContainerLargeBlocks,ContainerPersonal,Core,CoreNoCPU,CPUExtenderBAT2,CPUExtenderBAT3,CPUExtenderBAT4,Deconstructor,DetectorCV,DoorArmoredBlocks,DoorBlocks,ElevatorMS,ExplosiveBlocks,ExplosiveBlocks2,Flare,FoodProcessorV2,ForcefieldEmitterBlocks,FridgeBlocks,FuelTankMSLarge,FuelTankMSLargeT2,FuelTankMSSmall,Furnace,GeneratorBA,GeneratorMS,GeneratorMST2,GravityGeneratorMS,HangarDoorBlocks,HumanNPCBlocks,LandClaimDevice,LandinggearBlocksCV,LCDScreenBlocks,LightLargeBlocks,LightPlant01,MedicalStationBlocks,OfflineProtector,OxygenStation,OxygenTankMS,OxygenTankSmallMS,PentaxidTank,Portal,RampLargeBlocks,RCSBlockMS,RCSBlockMS_T2,RemoteConnection,RepairBayBA,RepairBayBAT2,RepairBayConsole,RepairBayCVT2,RepairStation,SensorTriggerBlocks,ShieldGeneratorBA,ShieldGeneratorBAT2,ShieldGeneratorPOI,ShutterDoorLargeBlocks,SolarGenerator,SolarPanelBlocks,SolarPanelSmallBlocks,SpotlightBlocks,TeleporterBA,ThrusterMSDirectional,ThrusterMSRound2x2Blocks,ThrusterMSRound3x3Blocks,ThrusterMSRoundBlocks,VentilatorBlocks,",
        "DeviceS": ",ArmorLockerSV,CloneChamberHV,ConstructorHV,ConstructorSV,Core,CPUExtenderHVT2,CPUExtenderHVT3,CPUExtenderHVT4,DetectorHVT1,DoorBlocksSV,Flare,ForcefieldEmitterBlocks,FridgeSV,FuelTankSV,FuelTankSVSmall,GeneratorSV,GeneratorSVSmall,HoverBooster,HoverEngineLarge,HoverEngineSmall,HoverEngineThruster,LightSS01,MedicStationHV,OxygenTankSV,PentaxidTankSV,RCSBlockGV,RCSBlockSV,RemoteConnection,ShieldGeneratorHV,ThrusterGVJetRound1x3x1,ThrusterGVRoundBlocks,ThrusterGVRoundLarge,ThrusterGVRoundLargeT2,ThrusterGVRoundNormalT2,ThrusterJetRound1x3x1,ThrusterJetRound2x5x2,ThrusterJetRound2x5x2V2,ThrusterJetRound3x10x3,ThrusterJetRound3x10x3V2,ThrusterJetRound3x13x3,ThrusterJetRound3x13x3V2,ThrusterJetRound3x7x3,ThrusterSVDirectional,ThrusterSVRoundBlocks,ThrusterSVRoundLarge,ThrusterSVRoundLargeT2,ThrusterSVRoundNormalT2,VentilatorBlocks,WarpDriveSV,",
        "WeaponPlayer": ",AssaultRifle,AssaultRifleEpic,AssaultRifleT2,Chainsaw,ColorTool,DrillT2,Explosives,LaserPistol,LaserPistolT2,LaserRifle,LaserRifleEpic,Minigun,MinigunEpic,MultiTool,Pistol,PistolEpic,PistolT2,PulseRifle,RocketLauncher,RocketLauncherEpic,RocketLauncherT2,ScifiCannon,ScifiCannonEpic,Shotgun,Shotgun2,Shotgun2Epic,Sniper,Sniper2,Sniper2Epic,TextureTool,",
        "WeaponHV": ",DrillAttachment,DrillAttachmentLarge,DrillAttachmentT2,SawAttachment,TurretGVArtilleryBlocks,TurretGVMinigunBlocks,TurretGVPlasmaBlocks,TurretGVRocketBlocks,TurretGVToolBlocks,WeaponSV02,",
        "WeaponSV": ",WeaponSV01,WeaponSV02,WeaponSV03,WeaponSV04,WeaponSV05,WeaponSV05Homing,",
        "WeaponCV": ",DrillAttachmentCV,SentryGunBlocks,TurretMSArtilleryBlocks,TurretMSLaserBlocks,TurretMSProjectileBlocks,TurretMSRocketBlocks,TurretMSToolBlocks,TurretZiraxMSLaser,TurretZiraxMSPlasma,TurretZiraxMSRocket,WeaponMS01,WeaponMS02,",
        "WeaponBA": ",SentryGunBlocks,TurretBaseArtilleryBlocks,TurretBaseLaserBlocks,TurretBaseProjectileBlocks,TurretBaseRocketBlocks,",
        "AmmoPlayer": ",12.7mmBullet,5.8mmBullet,50Caliber,8.3mmBullet,DrillCharge,MultiCharge,PulseLaserChargePistol,PulseLaserChargeRifle,SciFiCannonPlasmaCharge,ShotgunShells,SlowRocket,SlowRocketHoming,",
        "AmmoHV": ",15mmBullet,ArtilleryRocket,FastRocket,TurretGVPlasmaCharge,",
        "AmmoSV": ",15mmBullet,FastRocket,FastRocketHoming,PlasmaCannonChargeSS,PulseLaserChargeSS,RailgunBullet,",
        "AmmoCV": ",15mmBullet,30mmBullet,5.8mmBullet,FastRocketMS,FlakRocketMS,LargeRocketMS,PulseLaserChargeMS,PulseLaserChargeMSWeapon,TurretMSPlasmaCharge,",
        "AmmoBA": ",15mmBullet,30mmBullet,5.8mmBullet,FastRocketBA,FlakRocket,LargeRocket,PulseLaserChargeBA,TurretBAPlasmaCharge,"
      },
     
    #359
    johngazon, Nathan Jurgens and Homunk like this.
  20. Grin

    Grin Lieutenant

    Joined:
    Aug 20, 2015
    Messages:
    6
    Likes Received:
    5
    Also wondering. Can't seem to get it to work. It keeps printing
    "{{devicesoftype}} error Object reference not set to an instance of an object"
    to the "Sorter" LCD panel.
     
    #360

Share This Page