[MOD EXT] Empyrion Scripting - Scripts

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

  1. bbk.3164

    bbk.3164 Commander

    Joined:
    May 17, 2016
    Messages:
    235
    Likes Received:
    85
    @ASTIC - there is a PROBLEM in the script:
    Script "Deconstructor" :
    1) when it removes "heavy armored windows" - then there is NO GROUPING (!)
    These "heavy armored windows" have many shapes, just like building blocks .... BUT - heavy windows DO NOT GROUP into a common block, as building blocks (!)

    [​IMG]

    2) when the script parses each layer of the ship or base - I noticed that it "LOSES" a lot of devices,
    For example - "Very Large Engine" (red) - has dimensions of 3x6x3, there are 16 of them in the "Xen'uan Carrier" ship, but the Deconstructor removed only 8 pieces (!)
    There are 327 fuel tanks in it, but I took off only 17 pcs (!)
    Please check the "Deconstructor" script on the "Xen'uan Carrier"

    [​IMG]
    ....... I had x5 ships that had copies of the "Deconstructor" script on them, but 4 of them were DISABLED so that the scripts on them were NOT PERFORMED (!) ... but for some reason the missing 300 fuel tanks ended up IN ANOTHER SHIP. which was disabled (!)

    3) ... and also - if 1 ship is dismantled several times = then the Script removes a DIFFERENT NUMBER OF BLOCKS AND MATERIALS (!) ... for example, in the 1st test, 130 blocks out of 150 were removed, ... in the 2nd test, it was 124 blocks out of 150 (!)
    What is this - the error of removal ?! or script errors?!
     
    #701
    Last edited: Mar 28, 2023
  2. me777

    me777 Commander

    Joined:
    Aug 18, 2020
    Messages:
    384
    Likes Received:
    132
    @bbk.3164
    I got a question for you...

    Why are you this rude?
    Is it normal to write ALL CAPITAL LETTERS for you?
    You know in most civilized countrys that is considered extremly rude (!) (as is this with the exclemation mark)

    Alsao you talk like you are ASTICs boss or like he ows you something.
    It is the other way around you owe him for creating the mod and allowing everyone including you to use it.
    The least thing you can do is use those 2 brain cells you seem to use only for posting rude comments for figuring stuff out yourself, or at least write comments in a constructive and respectful manner.
     
    #702
    Slam Jones and ASTIC like this.
  3. Mycroft_Groks

    Mycroft_Groks Lieutenant

    Joined:
    Aug 17, 2018
    Messages:
    47
    Likes Received:
    7
    You don't need the '{{~set 'PerishL'(concat Ids.Food Ids.Ingredient Ids.Sprout ',4459,4460,4469,4470,4471,4472,5699,')}}'. You can just use the IDs, such as this '{{~set 'PerishL' '4459,4460,4469,4470,4471,4472,5699,'}}'

    What you have is a simpler way to do the sorting than I have on my ships. I'll be on CG tonight around 9 PM EST. Msg me in game and I will show you my scripting system I've been designing if you want ideas.
     
    #703
  4. Shadowpheonix

    Shadowpheonix Lieutenant

    Joined:
    May 19, 2022
    Messages:
    44
    Likes Received:
    11
    Actually, this would only be true if you were to manually specify all the IDs included in the Ids.Food, Ids.Ingredient, and Ids.Sprout groups as well as those 7 individual items. ;)
     
    #704
    Blood Cloud likes this.
  5. Blood Cloud

    Blood Cloud Ensign

    Joined:
    Sep 7, 2022
    Messages:
    10
    Likes Received:
    0
    [​IMG]




    LCD Input name: Script:ShieldStatus

    LCD output name: ShipStatus


    LCD OUTPUT DIMENSIONS (best use a LCD Projector)
    WIDTH: 1.00
    HEIGHT: 0.5

    DESCRIPTION:
    For when the battle gets heated and the Shield percentage is just out of the view :)

    The Display has 3 states.
    1) Big Red: if shields are OFF
    2) Big RED: if shields are below Smin (%)

    3) Small normal: shield percentage


    adjust the code below to YOUR preferences:

    Set the SMax number to the value of your max shields (Eleon does not provide this)
    Set Smin to the percentage you want the warning 0.4 = 40%


    LCD Input Script:
    Code:
    {{set 'SMax' 171850}}
    {{set 'SMin' '0.4'}}
    {{set 'SCur' E.S.ShieldLevel}}
    <align=center>
    {{if @root.E.S.IsShieldActive}}
    {{~math @root.Data.SCur '/' @root.Data.SMax }}{{set 'SPer' .}}{{~/math}}
    {{test @root.Data.SPer 'leq' @root.Data.SMin}}
    {{fontsize 15}}
    <color=red>Shield:{{~format @root.Data.SPer '{0,8:P2}'}}</color>
    {{else}}
    {{fontsize 7}}
    Shield:{{~format @root.Data.SPer '{0,8:P2}'}}
    {{/test}}
    {{else}}
    {{fontsize 15}}
    <color=red>Shield: OFF</color>
    {{/if}}
    </align>
     
    #705
  6. Onki

    Onki Ensign

    Joined:
    Apr 10, 2023
    Messages:
    1
    Likes Received:
    0
    Weiss jemand wie ich bei dem Sortierscript

    "Dynamic Transfer/Sorting System"

    Ich Einfügen kann das gewisse Container ignoriert werden oder eine liste erstellen mit Containern das nur die angesprochen werden? Bzw das Zeug nur da gelagert wird? Wir haben eine grosse Base und momentan packt das Script sachen die ausm Constructor kommen in die Lagerboxen anderer Spieler anstatt in die dafür vorgesehenen

    Zb das man einfügen könnte das es nur container mit dem Preset " Lager " verwendet oder Container mit " xxx " im namen ignoriert?

    {{fontsize 2}}{{~set 'F' '1'}}
    {{~set 'I' 'Input'}}{{set 'CI' 'Constructor Input'}}{{set 'O' 'Constructor Output'}}{{set 'U' 'Unsorted'}}
    {{~devices @root.E.S 'SorterDB'}}{{set 'DB' .0}}{{gettext .0}}{{split . '\n'}}{{set 'C' .}}{{/split}}{{/gettext}}{{/devices}}
    {{~#devicesoftype @root.E.S 'Container'}}{{#each .}}{{set 'T' ''}}{{set 'M' 0}}
    {{#split CustomName '-'}}{{set 'n' .}}{{/split}}
    {{~#test @root.data.n.0 in (concat @root.Data.I ',' @root.Data.O ',' @root.Data.U)}}
    {{~#items @root.E.S CustomName}}{{set 'G' @root.data.U}}
    {{#each @root.data.C}}{{#split . ':'}}{{~#test ../../Id in .1}}{{~#test @root.data.CI neq .0}}{{set 'G' .0}}{{/test}}{{/test}}{{/split}}{{/each}}
    {{~#test ../CustomName neq @root.Data.G}}
    {{~move this @root.E.S (concat @root.Data.G '*')}}{{set 'M' 1}}
    {{set 'T' (concat @root.data.T '
    ' ../Name ' - ' Count '<indent=55%>❲' Source ' ➤ ' Destination '❳</indent>')}}
    {{/move}}{{/test}}{{/items}}{{else}}{{set 'x' ''}}
    {{~#each @root.Data.C}}{{#split . ':'}}{{#test @root.data.n.0 eq .0}}{{set 'x' .1}}{{/test}}{{/split}}{{/each}}
    {{~items @root.E.S CustomName}}{{#test Id in @root.data.x}}{{else}}{{set 'x' (concat @root.data.x Id ',')}}{{/test}}
    {{~#test Id in @root.data.CID}}
    {{~move this @root.E.S (concat @root.Data.CI '*') 50}}{{set 'M' 1}}
    {{set 'T' (concat @root.data.T '
    ' ../Name ' - ' Count '<indent=55%>❲' Source ' ➤ ' Destination '❳</indent>')}}
    {{/move}}{{/test}}{{/test}}{{/items}}
    {{~#if @root.data.x}}{{#if @root.data.n.1}}{{else}}{{set 'D' (concat @root.data.D @root.data.n.0 ':' @root.data.x "
    ")}}{{/if}}{{/if}}{{#test @root.data.n.0 eq @root.data.CI}}{{set 'CID' @root.data.x}}{{/test}}{{/test}}
    {{#if @root.data.M}}
    <align=center><color=#FFD><size=120%>Transfer - {{datetime 'HH:mm'}}</size></color></align>
    {{@root.data.T}}
    <align=center><color=#FFD><size=4>{{bar 1 0 1 10 '╼╾'}}</size></color></align>
    {{/if}}{{/each}}{{/devicesoftype}}
    {{settext @root.Data.DB @root.Data.D}}
     
    #706
    Last edited: Apr 11, 2023
  7. eggofevil

    eggofevil Ensign

    Joined:
    Jan 16, 2023
    Messages:
    24
    Likes Received:
    3
    Hello!
    Sorry for elementary questions. I'm trying to understand, how all this working )))
    Trying to get all device properties through Devices helper, but get this error: {{devices}} error Exception has been thrown by the target of an invocation.

    The code example is
    Code:
    {{set 'Separator' '---'}}
    {{#devices @root.E.S 'TestCargoBox'}}
    {{0.CustomName}}
    {{#each .0}}
    {{.}}
    {{/each}}
    {{/devices}}
    
    {{@Data.Separator}}
    {{#devices @root.E.S 'TestFuelTank'}}
    {{0.CustomName}}
    {{#each .0}}
    {{@index}}
    {{/each}}
    {{/devices}}
    
    {{@Data.Separator}}
    {{#devices @root.E.S 'DataIn'}}
    {{0.CustomName}}
    {{#each .0}}
    {{@key}}
    {{/each}}
    {{/devices}}
    so, the output is:
    Code:
    TestCargoBox
    VectorInt3 7/128/-1
    EmpyrionScripting.DataWrapper.ContainerData
    {{devices}} error Exception has been thrown by the target of an invocation.
    ---
    TestFuelTank
    0
    1
    2
    {{devices}} error Exception has been thrown by the target of an invocation.
    ---
    DataIn
    Position
    Device
    SendSignalName
    {{devices}} error Exception has been thrown by the target of an invocation.
    And the questions are:
    - What is thist error, what i'm doing wrong?
    - Is there any way to get all device properties without this error?
    - Is there any way to target device besides devices or block helpers?
    - As I've understand, all sorting scripts are using independent LCD's to store items ID data, is there any other way? Like @Data store for current script but not temporary and reachable from all scripts?
     
    #707
  8. SCP-953

    SCP-953 Ensign

    Joined:
    Apr 7, 2023
    Messages:
    2
    Likes Received:
    0
    i know im missing something been trying to figure out the dynamic sorting system for a few weeks now, i got containers to register when something is put in but i cant figure out why it wont sort items all boxes are custom named and some are labeled
     
    #708
  9. Shadowpheonix

    Shadowpheonix Lieutenant

    Joined:
    May 19, 2022
    Messages:
    44
    Likes Received:
    11
    If you are using Luke Benko's version of the Dynamic Sorter, then if it is updating the SorterDB LCD the sort should also be working. Are you dropping the items you want sorted into the box named 'Input' (without the quotes)? What does your output LCD show?
     
    #709
    SCP-953 likes this.
  10. SCP-953

    SCP-953 Ensign

    Joined:
    Apr 7, 2023
    Messages:
    2
    Likes Received:
    0
    that was 100% the problem changed the name of the box to input and boom started transferingyou are awesome thank you i was thinking it had to be I box name or 'I' input box name tried many diffrent combos
     
    #710
    Last edited: Apr 23, 2023
  11. eggofevil

    eggofevil Ensign

    Joined:
    Jan 16, 2023
    Messages:
    24
    Likes Received:
    3
    Ok, another question...
    Example:
    Code:
    {{set 'SomeName' 'Some_Name'}}
    {{setcache @Data.SomeName 'SomeData'}} {{! This work}}
    {{@CacheData.Some_Name}} {{! This work}}
    {{@[email protected]}}  {{! This don't}}
    {{@CacheData/@Data.SomeName}} {{! This don't}}
    {{use @Data.SomeName}}
    {{this}} {{! This work}}
    {{@CacheData.this}} {{! This don't}}
    {{/use}}
    
    So, how can I get data from @CacheData, using some variable, except direct name?
     
    #711
  12. Shadowpheonix

    Shadowpheonix Lieutenant

    Joined:
    May 19, 2022
    Messages:
    44
    Likes Received:
    11
    Use the 'lookup' command.
    Code:
    {{lookup @CacheData @Data.SomeName}}
     
    #712
    eggofevil likes this.
  13. eggofevil

    eggofevil Ensign

    Joined:
    Jan 16, 2023
    Messages:
    24
    Likes Received:
    3
    It works. Thank you!
     
    #713
  14. eggofevil

    eggofevil Ensign

    Joined:
    Jan 16, 2023
    Messages:
    24
    Likes Received:
    3
    This has one issue...
    For example I have @Data.SomeData wich is dictionary ['x': 'some data', 'y':'', 'z': 'some data']
    So, if I'll try to
    {{lookupblock @Data.SomeData 'y'}}
    Some code
    {{ /lookupblock}}
    Some code will not be executed
     
    #714
  15. Shadowpheonix

    Shadowpheonix Lieutenant

    Joined:
    May 19, 2022
    Messages:
    44
    Likes Received:
    11
    From what I understand, 'Lookup' and 'LookupBlock' are not really intended for direct code control like that. Instead, use 'if' or 'test'.
    IE: Something like this...
    Code:
    {{if (lookupblock @Data.SomeData 'y')}}
    Some Code
    {{/if}}
    
    {{#test (lookupblock @Data.SomeData 'y') eq 'Whatever'}}
    Some Code
    {{/test}}
     
    #715
    eggofevil likes this.
  16. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,015
    Likes Received:
    712
    In your earlier example @Data.SomeData is not a dictionary so your "Some code" is not executed because it does not find "y".
    Code:
    {{#lookupblock @CacheData @Data.SomeName}}
    Some code
    {{else}}
    If not found
    {{/lookupblock}}
    will work
     
    #716
    Last edited: May 1, 2023
    eggofevil likes this.
  17. eggofevil

    eggofevil Ensign

    Joined:
    Jan 16, 2023
    Messages:
    24
    Likes Received:
    3
    Ok, thank you for answers! Didn't think to use {{else}} with {{#lookupblock }} :)))
     
    #717
  18. Dougmhz

    Dougmhz Ensign

    Joined:
    Nov 12, 2019
    Messages:
    1
    Likes Received:
    0
    I would like to set up an LCD that would list all of our factioned bases and display their distance in light years.
    We play on a hosted, multi-player server running 1.9.x.
    Does anyone have a script that will do this or have any insight as to how this could be done?
     
    #718
  19. Whiskey

    Whiskey Ensign

    Joined:
    May 11, 2023
    Messages:
    1
    Likes Received:
    0
    Hello. I'm facing the problem that output display doesn't show anything. Display names (output and input) are correct. The script code is copied from the original post. Output display size is 0.5x0.5 however the display does not show anything and its says:

    Code:
    <line-height=4><color=#FFF>
    </color></line-height>
     
    #719
  20. OmahaBR

    OmahaBR Ensign

    Joined:
    May 17, 2023
    Messages:
    1
    Likes Received:
    0
    HI team, i'm no coder, and i'm really lame on that actually, i've read all of this thread and i want to congratulate you all for the hard work and excelent insights you gave me.

    I want a script that i couldnt make it alone: Is there a way to create a script to empty all of the containers (even those cilindrical rare ones if possible **:rolleyes:**) for a POI for ship containing a core of mine?

    For example: I go and destroy a Tovera. Can i core it, put a green core, name it so the script runs and then all of the contents are transfered to a container called "Loot" on my ship.

    Is it possible? An help would be greatly appreciated.
     
    #720

Share This Page