[MOD EXT] Empyrion Scripting - Scripts

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

  1. BugiTree

    BugiTree Ensign

    Joined:
    Oct 3, 2022
    Messages:
    24
    Likes Received:
    0
    Jetzt läuft es erstmal, Koordinaten waren es..beginnen mit links unten dann rechts oben...;):)
     
    #561
    Last edited: Oct 23, 2022
  2. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    Coloring the new displays ;-)
     
    #562
  3. Simucad

    Simucad Ensign

    Joined:
    Nov 16, 2022
    Messages:
    1
    Likes Received:
    0
    Hallo,
    ich versuche aus meiner Unsort kiste anhand der ids.Medic alles in meine medicbox zu verschieben nur irgendwie mach ich etwas falsch im code
    meine code sieht momentan so aus

    Code:
    {{fontsize 4}}
    {{#items E.S 'Unsort'}}
    {{#test id in Ids.Medic}}
    {{move this @root.E.S 'medicbox'}}
    {{SourceE.Name}}:{{Source}}->
    {{~DestinationE.Name}}:{{Destination}}
    {{format Count '{0,5}'}} : {{i18n Id}}
    {{/move}}
    {{/test}}
    {{/items}}
    ich vermute mal das diese zeitel {{#test id in Ids.Medic}} völlig falsch ist allerdings hab ich auch nur wenig ahnung von sowas, kann mir bitte jemand helfen ?
     
    #563
  4. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    Du bist bei dem 'test' im Scope der 'items'. Die Liste der 'Ids' ist aber nur im root verfügbar. Also musst du hier schon mal
    Code:
    {{#test id in @root.Ids.Medic}}
    hinschreiben.
     
    #564
  5. Mycroft_Groks

    Mycroft_Groks Lieutenant

    Joined:
    Aug 17, 2018
    Messages:
    51
    Likes Received:
    8
    Is there a way to alter this script to allow me to rearm ships with different quantities of ammo? loading 2500 heatsinks 15mm and plasma charges is perfectly fine, but not things llike mk.22 bombs or Sledgehammer torpedos.

    How can I load say 2500 15mm rounds and only 24 mk. 22 bombs and 6 torpedos?
     
    #565
  6. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    Add the IDs of the ammunition you also want to distribute
     
    #566
  7. me777

    me777 Commander

    Joined:
    Aug 18, 2020
    Messages:
    406
    Likes Received:
    138
    I would add the amount to the id list (like{{~set 'IDs' '4152#2500,4261#2000,4258#20 ....) and replace the stack calculation lines with splitting the entrys with the new divider.
     
    #567
  8. Mycroft_Groks

    Mycroft_Groks Lieutenant

    Joined:
    Aug 17, 2018
    Messages:
    51
    Likes Received:
    8
    I'm fairly new to this, so I'm not fully sure of what you mean. Could you give me an example of how the code would look?

    Another question I was wondering about was how can I make custom item groups on an LCD and have other scripts call on that custom item group?
    Example SmeltOre :4297-4300,4317,4318..............And put that on LCD named "Groups". Not sure if I'm explaining what I'm trying to accomplish.

    If interested, this is what I have so far.
    https://steamcommunity.com/sharedfiles/filedetails/?id=2899308404
     
    #568
    Last edited: Dec 9, 2022
  9. me777

    me777 Commander

    Joined:
    Aug 18, 2020
    Messages:
    406
    Likes Received:
    138
    I looked at the code you posted again - I don't get what the lines
    Code:
    {{~devices S 'Ammunition*'}}{{#each .}}
    {{~set 'IDs' (concat @root.Data.IDs ',' (substring (replace CustomName '#' ',') 8))}}
    {{~/each}}{{/devices}}
    do, it seems like it extracts something from the name of the cargoboxes, but the substring is 8 while the string "Ammunition" is 10 - does this even work?

    I would make a additional lcd witch contains the target ship id and a list for each with ammo id (or better name) and amount.
    this way it is easy to change something and the script gets clearer.
     
    #569
  10. me777

    me777 Commander

    Joined:
    Aug 18, 2020
    Messages:
    406
    Likes Received:
    138
    @ASTIC:
    Ich kann momentan nirgends finden welche Werte für "devicesoftype" zulässig sind; eventuell kann das in der Anleitung ergänzt werden?
    Danke.
     
    #570
  11. Mycroft_Groks

    Mycroft_Groks Lieutenant

    Joined:
    Aug 17, 2018
    Messages:
    51
    Likes Received:
    8
    It pulls ammo from any box with the prefix 'Ammunition -' and checks the levels of ammo in the SV/HV. If the levels in the SV are not right, the script fills the SV to to appropriate levels.

    That's not my code, that was done by another on this forum. The output screen shows the ammo amounts.
     
    #571
    Last edited: Dec 9, 2022
  12. Mycroft_Groks

    Mycroft_Groks Lieutenant

    Joined:
    Aug 17, 2018
    Messages:
    51
    Likes Received:
    8
    Another question and this one relates directly to one of my scripts. I have a sorting script that places items in certain containers on the same ship. IF I wanted to move the items from a CV to a docked SV, would I change '@root.E.S' in the last part of the script after the move command....

    Code:
    {{!Sorter -Hold (Ingots/Raw Materials)-}}
    {{!LCD Name: Script:Sort_IngotsRaw}}
    {{#items E.S '[FFFFFF]'}}
    {{~set 'Unsorted' ''}}
    {{~set 'Amount' ''}}
    
    {{!Ores for Refining}}
    {{#test Id in '4297-4301,4317,4318,4332,4345,4359,4365,7300,7304-7308,7342,7350,7351,7358-7363'}}
    {{~set 'Unsorted' 'Input -Decon/Furnaces'}}
    {{/test}}
    
    {{!Titanium/Erestrum/Aluminium}}
    {{#test Id in '4360,4326,4362'}}
    {{~set 'Unsorted' 'Hold -Ingots(Ti/Ere/Al)'}}
    {{/test}}
    
    {{!Iron/Copper/Magnesium}}
    {{#test Id in '4320,4324,4296,4319'}}
    {{~set 'Unsorted' 'Hold -Ingots(Fe/Cu/Mn)'}}
    {{/test}}
    
    {{!Cobalt/Silicon/Zascosium}}
    {{#test Id in '4322,4321,4327'}}
    {{~set 'Unsorted' 'Hold -Ingots(Co/Si/Zas)'}}
    {{/test}}
    
    {{!Neodymium/Sathium/Platinum}}
    {{#test Id in '4323,4333,4366'}}
    {{~set 'Unsorted' 'Hold -Ingots(Neo/Sat/Pt)'}}
    {{/test}}
    
    {{!Gold/Silver/Tungsten}}
    {{#test Id in '4346,7345,7343'}}
    {{~set 'Unsorted' 'Hold -Ingots(Au/Ag/W)'}}
    {{/test}}
    
    {{!Magmacite/Voidium}}
    {{#test Id in '7301,7302'}}
    {{~set 'Unsorted' 'Hold -Ingots(Mag/Void)'}}
    {{/test}}
    
    {{!Rare Items}}
    {{#test Id in '4344,4347,5146-5190,5395-5412,5995,6008-6010,7341,7510-7512,7514,7515'}}
    {{~set 'Unsorted' 'Hold -Vault'}}
    {{/test}}
    
    {{!Crushed Stone}}
    {{#test Id in '4328'}}
    {{~set 'Unsorted' 'Hold -Crushed Stone'}}
    {{/test}}
    
    {{!Trade}}
    {{#test Id in '5098,5100-5107,5109-5117,6001,7332-7339,7352-7356,7369-7375,7521-7532'}}
    {{~set 'Unsorted' 'Trade'}}
    {{/test}}
    
    {{!Hull Blocks}}
    {{#test Id in '380-413'}}
    {{~set 'Unsorted' 'Hold -Hull Blocks*'}}
    {{/test}}
    
    {{#ok @root.Data.Unsorted}}
    {{#move ../. @root.E.S @root.Data.Unsorted @root.Data.Amount}}
    {{datetime}}
    {{Source}} -> {{Destination}}
    {{format Count '{0,5}'}}:
    {{/move}}
    {{/ok}}
    {{/items}}
    .....To @root.E.S.DOCKED? Would that move the items to the destination box on the SV?
     
    #572
    Last edited: Dec 9, 2022
  13. me777

    me777 Commander

    Joined:
    Aug 18, 2020
    Messages:
    406
    Likes Received:
    138
    @root.E.S.Docked is a list of all docked ships, #move needs a single ship. so a #each and a #test is also needed to select the right ship from this list.
     
    #573
  14. Mycroft_Groks

    Mycroft_Groks Lieutenant

    Joined:
    Aug 17, 2018
    Messages:
    51
    Likes Received:
    8
    Could you give me an example of this code? I'd like to see if it'll suit my needs, but I have no clue what you mean by the new divider.
     
    #574
  15. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    Du findest sie in der API Doku auf deinem Rechner
    [EGS]/Content/Extras/Modding%20Doc/html/_mod_enums_8cs.html#af12d002794dd69bbed2bd8b6323dcd81
     
    #575
  16. me777

    me777 Commander

    Joined:
    Aug 18, 2020
    Messages:
    406
    Likes Received:
    138
    Danke.
    Schon die nächste Frage (oder ises sogar n bug?):
    Bei "{{~#items @root.E.S 'Ammo*'}}" wird ein Container mit Namen "Ammo" mit einbezogen,
    aber bei "{{#move . @root.data.target.S "Ammo*" ../../.1}}" wird der Container "Ammo" nicht befüllt, aber Container "Ammo1" oder "Ammo2" gehen.
     
    #576
  17. Mycroft_Groks

    Mycroft_Groks Lieutenant

    Joined:
    Aug 17, 2018
    Messages:
    51
    Likes Received:
    8
    well, that code works exactly as it's supposed to. If you go back a few pages in this thread, you will see it posted. I'm looking for a smaller code to do the same job as this AND allow me to change the ammo amount based on the item ID.

    You previously wrote...
    Could you give me an example of this code? I'd like to see if it'll suit my needs, but I have no clue what you mean by the new divider.
     
    #577
  18. me777

    me777 Commander

    Joined:
    Aug 18, 2020
    Messages:
    406
    Likes Received:
    138
    Sorry for not answering, I was trying to write example code, but my handlebars is really nothing to show...
    The first comment was towards ASTIC as the #move reacts different to wildcards than the #items.

    about the divider i proably used the wrong word.
    It is a character (like a # or : ) that can be used to split the list, or rather each item in the list and use those to construct the move command.
    As I did not yet manage to get it working it probably was not the best idea, it just is not as easy as i thought it would be.

    But I'm still curious what the line
    Code:
    {{~set 'IDs' (concat @root.Data.IDs ',' (substring (replace CustomName '#' ',') 8))}}
    does, I just can't figure it out...
     
    #578
  19. Mycroft_Groks

    Mycroft_Groks Lieutenant

    Joined:
    Aug 17, 2018
    Messages:
    51
    Likes Received:
    8
    You'd have to ask Dorimanx. He wrote the code. All I know is it does what it's advertised to do....restock docked ships with ammo.
     
    #579
  20. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    Korrekt, in Version 11.1.11 ist dies gefixed
    https://github.com/GitHub-TC/EmpyrionScripting/releases/tag/11.1.11
     
    #580
    me777 likes this.

Share This Page