[MOD EXT] Empyrion Scripting - Scripts

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

  1. The Pfaffinator

    The Pfaffinator Ensign

    Joined:
    Oct 18, 2024
    Messages:
    3
    Likes Received:
    0
    Thank you so much!
    Yeah, I get it makes things more troublesome by making the game available on different platforms, but the benefit I guess is that now more people have an opportunity to enjoy such an amazing game.
     
    #941
  2. Pantera

    Pantera Administrator Staff Member

    • Developer
    • Moderator
    Joined:
    Aug 15, 2016
    Messages:
    3,238
    Likes Received:
    5,676
    #942
  3. BloodAngel099

    BloodAngel099 Lieutenant

    Joined:
    Jan 24, 2023
    Messages:
    34
    Likes Received:
    2
    @ASTIC, I am trying to incorporate orderbylist into the following script. Would I be able to use orderbylist somehow after the itemlist section of code, but before the split @root.Data.D at the end? If I am understanding the code correctly this would be the best place to handle reorganizing the data.

    The goal is the have this script show a static list of ingots and how many exist aboard the ship. If none exist instead of removing the line it would show 0.

    Code:
    {{~set 'T' '8000'}}
    {{~#split '#15FC05,#8FF904,#F4DC04,#F99C04,#FC6305,#CE1818' ','}}{{set 'C' .}}{{/split}}
    {{~set 'IDs' '4329,4173,4319,4321-4327,4331,4333,4339,4346,4360,4363,4366,4376,4444,7301,7343,'}}
    {{~#split @root.ScriptId ':'}}
    {{~#devices @root.E.S .1}}
    {{~#split (substring (i18n .0/Id 'English') 4) ' '}}{{/split}}
    {{~/devices}}
    {{~/split}}
    <color=#FFF><align=center><size=200%>Ingots</size></align>
    <align=center>{{bar 1 0 1 45 '═'}}</align>
    
    {{#sortedeach @root.E.S.Items 'Count' 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 . ':'}}
    {{fontsize 3}}{{~concat '<color=' ./.2 '><indent=8%>◉ ' ./.0 '</indent> <indent=74%>' ./.1 '</indent></color>' ~}}{{/split}}{{~/each}}{{~/split}}
     
    #943
  4. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    'itemlist' already returns the items in the order of the IDs and possibly with 0. or do you want to achieve something else?
     
    #944
  5. BloodAngel099

    BloodAngel099 Lieutenant

    Joined:
    Jan 24, 2023
    Messages:
    34
    Likes Received:
    2
    I want to achieve something else, but similar.

    From what I can tell the "sortedeach" section of the code puts together an array of the items I am looking for in IDs that have a quantity above 0. Itemlist then is used to add the items from the IDs list that have a value of 0 to the end of the array. Because of this items that have a value are always listed 1st, then items that have no value are listed at the end.

    I was hoping to use orderbylist to take the entire array after its been built and rearrange it based on the order given in IDs, then print to LCD. This way for example Stone Dust (ID:4329) would always be at the top of my list regardless of what its value is.
     
    #945
    Last edited: Nov 22, 2024 at 8:46 AM

Share This Page