[MOD EXT] Empyrion Scripting - Scripts

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

  1. BloodAngel099

    BloodAngel099 Lieutenant

    Joined:
    Jan 24, 2023
    Messages:
    31
    Likes Received:
    2
    I am working on having a single script that both refuels vessels tanks that dock to my carrier but also refills predefined reserve container on the docked vessels as well. I keep getting Reached end of template before the expression was closed. Can someone help?

    EDIT: I think I solved my problem, I believe it wasn't recalling the RST-FillRes amounts. I am no longer getting any kind of a error but the script only fills tanks. It wont transfer any items to the docked ships, any suggestions? Code updated.

    Code:
    <align=center><color=yellow><size=4>{{!Auto Fuel}}</size></color>
    <size=60%><color=#444444>{{!Docked}}</size></align>
    <size=30%><color=white>
    {{#getswitch @root.E.S 'RST-AutoFuelDocked'}}
        {{#if SwitchState}}
    {{!Tanks}}
            {{~set 'IDs' '4421,4342,4176,4177,4314,4335'}}
            {{~#each @root.E.S.DockedE}}
                {{#if S.IsPowerd}}
                {{else}}
                    {{#items @root.E.S 'RSTCE1*'}}
                        {{~#math (configattr Id 'StackSize') '/' 500}}
                        {{~set 'Stacks' (int (max 100 .))}}
                        {{~/math}}
                        {{~#test Count ge @root.Data.Stacks}}
                            {{~#test Id in @root.Data.IDs}}
                                {{~#fill ../this ../../../S 'Oxygen' 100}}{{/fill}}
                                {{~#fill ../this ../../../S 'Fuel' 100}}{{/fill}}
                                {{~#fill ../this ../../../S 'Pentaxid' 100}}{{/fill}}
                            {{~/test}}
                        {{/test}}
                    {{/items}}
    {{!Reserves}}
                    {{~set 'RST-FillRes-Fuel' 25}}
                    {{~set 'RST-FillRes-Oxygen' 25}}
                    {{~set 'RST-FillRes-Pentaxid' 125}}
                    {{~set 'LimitToType' 'CV'}}
                    {{~#test EntityType in @root.Data.LimitToType}}
                        {{~set 'RST-FillRes-Fuel' 200}}
                        {{~set 'RST-FillRes-Oxygen' 200}}
                        {{~set 'RST-FillRes-Pentaxid' 1000}}
                    {{/test}}
                    {{~#items @root.E.S 'RSTCE1*'}}
                        {{~#test Id in '4421'}}
                            {{~#test Count ge @root.Data.RST-FillRes-Fuel}}
                                {{~#move ../this ../../../S '*CE11-[1AA5DD][c]Fuel' @root.Data.RST-FillRes-Fuel}}
                                {{/move}}
                            {{/test}}
                        {{/test}}
                        {{~#test Id in '4176'}}
                            {{~#test Count ge @root.Data.RST-FillRes-Oxygen}}
                                {{~#move ../this ../../../S '*CE12-[2EE8DE][c]Oxygen' @root.Data.RST-FillRes-Oxygen}}
                                {{/move}}
                            {{/test}}
                        {{/test}}
                        {{~#test Id in '4342'}}
                            {{~#test Count ge @root.Data.RST-FillRes-Pentaxid}}
                                {{~#move ../this ../../../S '*CE13-[FF33C2][c]Pentaxid' @root.Data.RST-FillRes-Pentaxid}}
                                {{/move}}
                            {{/test}}
                        {{/test}}
                    {{/items}}
                {{/if}}      
            {{/each}}
        {{/if}}
    {{/getswitch}}
    </size>
    
     
    #901
    Last edited: Aug 29, 2024
  2. BloodAngel099

    BloodAngel099 Lieutenant

    Joined:
    Jan 24, 2023
    Messages:
    31
    Likes Received:
    2
    I was able to finally figure out how to transfer items from my carrier to docked vessels. My new issue is that because my reserve containers are different sizes depending on the ship some of them will fill while others wont. I have figured out that if the container doesnt have enough room for the amount set it wont transfer any items. Is it possible to have it transfer as many items as it can fit up to a maximum amount?

    Code:
    <align=center><color=yellow><size=4>{{!Auto Fuel}}</size></color>
    <size=60%><color=#444444>{{!Docked}}</size></align>
    <size=30%><color=white>
    
    {{#getswitch @root.E.S 'RST-AutoFuelDocked'}}
        {{#if SwitchState}}
    {{!Tanks}}
            {{~set 'IDs' '4421,4342,4176,4177,4314,4335'}}
            {{~#each @root.E.S.DockedE}}
                {{#if S.IsPowerd}}
                {{else}}
                    {{#items @root.E.S 'RSTCE1*'}}
                        {{~#math (configattr Id 'StackSize') '/' 500}}
                        {{~set 'Stacks' (int (max 100 .))}}
                        {{~/math}}
                        {{~#test Count ge @root.Data.Stacks}}
                            {{~#test Id in @root.Data.IDs}}
                                {{~#fill ../this ../../../S 'Oxygen' 100}}{{/fill}}
                                {{~#fill ../this ../../../S 'Fuel' 100}}{{/fill}}
                                {{~#fill ../this ../../../S 'Pentaxid' 100}}{{/fill}}
                            {{~/test}}
                        {{/test}}
                    {{/items}}
    {{!Reserves}}
                    {{~set 'RST-FillRes-Fuel' 200}}
                    {{~set 'RST-FillRes-Oxygen' 200}}
                    {{~set 'RST-FillRes-Pentaxid' 1000}}
                    {{~#items @root.E.S 'RSTCE1*'}}
                        {{~#test Id in '4421'}}
                            {{~#test Count ge 400}}
                                {{~#move . ../../../S '*CE11-[1AA5DD][c]Fuel' @root.Data.RST-FillRes-Fuel}}
                                {{/move}}
                            {{/test}}
                        {{/test}}
                        {{~#test Id in '4176'}}
                            {{~#test Count ge 500}}
                                {{~#move . ../../../S '*CE12-[2EE8DE][c]Oxygen' @root.Data.RST-FillRes-Oxygen}}
                                {{/move}}
                            {{/test}}
                        {{/test}}
                        {{~#test Id in '4342'}}
                            {{~#test Count ge 500}}
                                {{~#move . ../../../S '*CE13-[FF33C2][c]Pentaxid' @root.Data.RST-FillRes-Pentaxid}}
                                {{/move}}
                            {{/test}}
                        {{/test}}
    
                    {{/items}}
                {{/if}}       
            {{/each}}
        {{/if}}
    {{/getswitch}}
    </size>
     
    #902
  3. Shadow_Ninja

    Shadow_Ninja Ensign

    Joined:
    Sep 7, 2024
    Messages:
    2
    Likes Received:
    0
    So we have a server using the scripts. I was wondering if there is a way to use the scripts without it requiring credits to work. Specifically the recycle script. Unless you put credits in the container it doesn't do anything.
     
    #903
  4. KritterBizkit

    KritterBizkit Ensign

    Joined:
    Aug 31, 2024
    Messages:
    2
    Likes Received:
    0
    I have a good bit of credits to give you for the scripts. I also created a Faction Bank with a few Mil in there. :)
     
    #904
  5. Bar0th

    Bar0th Lieutenant

    Joined:
    Oct 13, 2016
    Messages:
    7
    Likes Received:
    19
    If you are the admin, just edit the Mods\EmpyrionScripting\Configuration.json within the save folder. Change DeconstructSalary and RecycleSalary Amounts to 0, and it's back to the way it was.
     
    #905
    Shadow_Ninja likes this.
  6. Shadow_Ninja

    Shadow_Ninja Ensign

    Joined:
    Sep 7, 2024
    Messages:
    2
    Likes Received:
    0
    Awesome, tyvm :)
     
    #906
  7. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,062
    Likes Received:
    725
    #907
    Last edited: Sep 8, 2024
  8. BloodAngel099

    BloodAngel099 Lieutenant

    Joined:
    Jan 24, 2023
    Messages:
    31
    Likes Received:
    2
    @ASTIC I am using a modified version of the ore/ingot/components display. Is there a way to get the script to sort the items in the order they are given instead of always changing to ascending? For example in this code I have Graphite (4292) at the end of the IDs but it always shows it first.

    Note: I do realize the section sortedeach is set to ids, but even when I take that section of the code out I noticed that the script always seems to sort by id number ascending by default. Left it in because if there is a chance of sorting the way I am asking I figured I would need it left in.

    Code:
    {{~set 'H' 'Ores'}}
    {{~set 'T' '4000'}}
    {{~#split '#15FC05,#8FF904,#F4DC04,#F99C04,#FC6305,#CE1818' ','}}{{set 'C' .}}{{/split}}
    {{~set 'IDs' '4296-4302,4317-4318,4328,4332,4338,4345,4359,4362,4365,7300,7342,7344,4358,4292,'}}
    {{~#split @root.ScriptId ':'}}
    {{~#devices @root.E.S .1}}
    {{~#split (substring (i18n .0/Id 'English') 4) ' '}}{{set 'SS' .0}}{{/split}}
    {{~/devices}}
    {{~/split}}
    {{~concat '<color=#FFF><align=center><size=200%>' @root.Data.H '</size></align>'}}
    <align=center>{{bar 1 0 1 45 '═'}}</align>
    {{#sortedeach @root.E.S.Items 'Id' false}}{{~#test Id in @root.Data.IDs}}{{set 'X' (concat @root.Data.X Id ',')}}{{setblock 'D' ~}}
    {{@root.Data.D}}{{i18n Id}}:{{format Count '{0,6:N0}'}}:
    {{~#test Count geq @root.Data.T}}{{@root.Data.C.0}}{{else}}
    {{~#test Count ge (calc @root.Data.T '*' '0.75')}}{{@root.Data.C.1}}{{else}}
    {{~#test Count ge (calc @root.Data.T '*' '0.50')}}{{@root.Data.C.2}}{{else}}
    {{~#test Count ge (calc @root.Data.T '*' '0.25')}}{{@root.Data.C.3}}{{else}}{{@root.Data.C.4}}{{/test}}{{/test}}{{/test}}{{/test}};{{~/setblock}}
    {{~/test}}{{~/sortedeach}}
    {{~#itemlist @root.E.S.Items @root.Data.IDs}}{{#test Id in @root.Data.X}}{{else}}{{set 'D' (concat @root.Data.D (i18n Id) ':' (format 0 '{0,6:N0}') ':' @root.Data.C.5 ';')}}{{/test}}{{/itemlist}}
    {{~#split @root.Data.D ';' true}}{{#each .}}{{#split . ':'}}
    {{~#test @root.Data.SS eq '1x2'}}{{~fontsize 6}}{{~#test (calc @Index '%' 3) eq 2}}{{set 'P' '67,90'}}1x2A{{else}}{{~#test (calc @Index '%' 3) eq 1}}{{set 'P' '32,56'}}1x2B{{else}}
    {{set 'P' '0,20'}}1x2C{{/test}}{{/test}}{{else}}
    {{~#test @root.Data.SS eq '1x1'}}{{~fontsize 4}}{{~#test (calc @Index '%' 2) eq 1}}{{set 'P' '52,85'}}1x1A{{else}}
    {{set 'P' '0,34'}}1x1B{{/test}}{{else}}{{fontsize 3}}
    {{set 'P' '8,74'}}{{/test}}{{/test}}
    {{~#split @root.Data.P ','}}{{~concat '<color=' ../.2 '><indent=' .0 '%>◉ ' ../.0 '</indent> <indent=' .1 '%>' ../.1 '</indent></color>' ~}}{{/split}}
    {{~/split}}{{~/each}}{{~/split}}
     
    #908
  9. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,062
    Likes Received:
    725
    There is currently no function that sorts items according to an ID list. I'll think about it...
     
    #909
  10. BloodAngel099

    BloodAngel099 Lieutenant

    Joined:
    Jan 24, 2023
    Messages:
    31
    Likes Received:
    2
    Okay, thank you!
     
    #910
  11. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,062
    Likes Received:
    725
  12. BloodAngel099

    BloodAngel099 Lieutenant

    Joined:
    Jan 24, 2023
    Messages:
    31
    Likes Received:
    2

Share This Page