[MOD EXT] Empyrion Scripting - Scripts

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

  1. Luke Benko

    Luke Benko Ensign

    Joined:
    Mar 30, 2021
    Messages:
    12
    Likes Received:
    3
    I am still learning the code, I am trying to get it into a separate LCD as a "Config File" To make it easier to edit, However I am not that good at coding, and am lost in what I am attempting. I am looking through Name: Dynamic Transfer/Sorting System on page 1 to see if I can figure out how he pulled the info off the screen, instead of checking a bunch of variables, check a list of variables all at once, and put all overflow in unsorted (to be manually sorted), however I am at a bit of an impasse here. I do not want the script to write to the file, just read from it, check containers with the names on the containers (if missing a container to print that container is missing) , then sort per config file. If there is anyone willing to work on this with me(give me some hints on what to do) I would be more than happy to post it here :) I have a bunch of ideas, but want to get it functional first, then add to it, to make it look more appealing to the eye. I am on discord zernon916#0766 if anyone wants to join in.
     
    #441
  2. Nathan Jurgens

    Nathan Jurgens Lieutenant

    Joined:
    May 18, 2016
    Messages:
    52
    Likes Received:
    5
    I never got the Name: Dynamic Transfer/Sorting System to work myself.
    and I am working on a solution to that myself (one screen with 'target' locations that are read for the sorter to process)
    Its not Dynamic (you have to populate the sort LCD screen yourself)
    At the moment, it auto unloads docked modules, then 'sorts' the stuff it unloaded into ores and everything else, and ores are transferred to another docked module to be 'processed'.

    Created ammo are then transfer back into the right ammo boxes.

    Part of my bigger loading and unloaded docked modules on my modular carrier

    Once I get that working perfectly, I will post it here, sounds like the same thing your trying. Maybe we can get it working if we both try it.
     
    #442
    Last edited: May 5, 2022
  3. Luke Benko

    Luke Benko Ensign

    Joined:
    Mar 30, 2021
    Messages:
    12
    Likes Received:
    3
    I look forward to it ^.^ I hope can figure it out. I am working on figuring out howto read another LCD screen, and pull info off of it, once I get that done, then I will figure out the {{move}} code for it.
     
    #443
  4. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,094
    Likes Received:
    735
    @Nathan Jurgens Convert positions from global <-> structure
    Code:
    ## Positions (structure and world)
    + {{structtoglobalpos structure (vector | x y z)}}
      + Returns the world coorinates of structurepos structure (vector | x y z)
    
    + {{globaltostructpos structure (vector | x y z)}}
      + Returns the position (vector | x y z) of the world coordinates from the point of view of the structure
    
     
    #444
    Nathan Jurgens likes this.
  5. CheesyWamBam

    CheesyWamBam Ensign

    Joined:
    May 6, 2022
    Messages:
    3
    Likes Received:
    0
    Hi all.

    Firstly, thank you for the amazing mod Astic. Only just discovered it and it's a game changer. Awesome work.

    Secondly, I can't code at all. Proper noob. I am a copy and paste king but that's as far as my coding goes unfortunately. I am playing with it though and trying to work it out but I'm struggling a bit with 1 of the scripts, namely the Inventory Sorter. I see some others can't seem to get it to work but I feel I'm missing something completely with it.

    Am I right in thinking I need 3 LCD screens. One for the code (+30sorter something), one called SorterDB and one called Sorter?
    Also 2 containers named Input and Unsorted.
    Do I need to amend code and add id's etc?

    Apologies if I'm way off or asking proper bone questions :)
     
    #445
  6. Luke Benko

    Luke Benko Ensign

    Joined:
    Mar 30, 2021
    Messages:
    12
    Likes Received:
    3
    The Inventory Sorter script is currently glitchy. A few of us are working on a new one. Should have mine out in the next few days. (Hopefully).
     
    #446
  7. CheesyWamBam

    CheesyWamBam Ensign

    Joined:
    May 6, 2022
    Messages:
    3
    Likes Received:
    0
    Ah ok, not me just being completely useless then lol. Was trying to get it to work on the Carapace C7. A sorter would be the pinnacle on that boat :)
     
    #447
  8. Luke Benko

    Luke Benko Ensign

    Joined:
    Mar 30, 2021
    Messages:
    12
    Likes Received:
    3
    Ok, so I am stuck . Maybe a little help or push to the right answer would be amazing. Right now I am trying to check a cargo container named Box-Input for an id on another LCD screen database. I know the items are in the container (I put them there). I can use test function on another LCD to verify they are there, and the right ID. If the item is there then show Tested True in green, else Tested False and show all data from config screen to make sure I didnt screw something up. It ALWAYS tests false, so I get the False info, even though the items are in the container. What am I missing?

    LCD Screen 'Config'
    Code:
    Pistol:4148,4099,4116,4126,4110,4131,4156
    AutoRifle:4111,4120,4132,4150,4102,4133
    Shotgun:4100,4105,4123,4154
    Minigun:4101,4149
    LaserRifle:4112,4122,4134,4124,4157
    Sniper:4103,4114,4121,4151
    Rocket:4106,4129,4130,4161,4147
    Plasma:4113,4125,4160
    CTools:4107,4115,4118,4119,4127,4135,4136,4137,4135,4158,4128
    
    Script:Sorter
    Code:
    {{~devices @root.E.S 'Config'}}
    {{set 'DB' .0}}
    {{gettext .0}}
    {{split . '\n'}}
    {{set 'I' .}}
    {{/split}}
    {{/gettext}}
    {{/devices}}
    {{items E.S 'Box-Input'}}
    {{#each @root.data.I}}
    {{#split . ':'}}
    {{set 'F' .1}}
    {{test Id in @root.data.F }}
    {{set 'G' .0}}
    <color=green>
    Tested True
    </color>
    {{else}}
    {{set 'G' .0}}
    <color=red>{{concat @root.data.F ''}}
    </color>
    {{/test}}
    {{/split}}
    {{/each}}
    {{/items}}
    
    
     
    #448
  9. Luke Benko

    Luke Benko Ensign

    Joined:
    Mar 30, 2021
    Messages:
    12
    Likes Received:
    3
    So while I am stuck on my code, I was able to figure out the Dynamic Sorting! ALL Storage devices must me named! You can not use the default names. ANY DECO that has storage must be removed! This gets rid of the deviceoftype error. Then it will work as needed. I would however put that on a switch to only have it on when you want it on, otherwise it will cause lag. Also the updating of the database still seams to be really glitchy. I would remove the last line, then update the database manualy, and it seems to work perfectly, I will continue testing and let you all know ^.^
     
    #449
    Last edited: May 7, 2022
  10. Entoarox

    Entoarox Ensign

    Joined:
    May 7, 2022
    Messages:
    2
    Likes Received:
    0
    Hi, I am trying to create a more generic Harvest script which can just be plug&played if you name the gardener npc & fridge blocks, but for some reason despite it looking correct, it does not seem to actually harvest:

    Code:
    Report:<size=2>
    {{~devices @root.E.S 'Gardener'}}
    {{~set 'GX' this.[0].Position.X}}
    {{~set 'GY' this.[0].Position.Y}}
    {{~set 'GZ' this.[0].Position.Z}}
    {{~devicesoftype @root.E.S 'Light'}}
    {{~#each .}}
    {{~test BlockType 'eq' 564}}
    - {{i18n Id}} <sup>({{Position.X}}, {{Position.Y}}, {{Position.Z}})</sup>
    {{~set 'FX' (calc Position.X '-' 1)}}
    {{~set 'FY' (calc Position.Y '+' 1)}}
    {{~set 'FZ' (calc Position.Z '-' 1)}}
    {{~set 'TX' (calc Position.X '+' 1)}}
    {{~set 'TY' (calc Position.Y '-' 1)}}
    {{~set 'TZ' (calc Position.Z '+' 1)}}
    {{~blocks @root.E.S  @root.data.FX @root.data.FY @root.data.FZ @root.data.TX @root.data.TY @root.data.TZ}}
    {{#each .}}
    -- {{i18n Id}} <sup>({{Position.X}}, {{Position.Y}}, {{Position.Z}})</sup>
    {{/each}}
    {{harvest @root.E.S . 'MainFridge' @root.data.GX @root.data.GY @root.data.GZ}}
      -- Harvest: {{i18n Id}}➔
    {{~i18n ChildOnHarvestId}}
    get {{DropOnHarvestCount}}:
    {{~i18n DropOnHarvestId}}
    {{~/harvest}}
    {{else}}-- No Blocks{{/blocks~}}
    {{/test~}}
    {{/each~}}
    {{/devicesoftype}}
    {{else}}
    No Gardener Found!
    {{/devices}}
    If you could give me any input as to why this seems to not work, that'd be awesome!

    Edit: Nvm, I found the issue - The harvest command wont work at all if one of the blocks in the targeted volume is not a harvestable block >_<

    Edit2: Okay, it is working... but not for Eden hydroponics bays (And yes, I have the latest version with hydroponics fix)
     
    #450
    Last edited: May 8, 2022
  11. Nathan Jurgens

    Nathan Jurgens Lieutenant

    Joined:
    May 18, 2016
    Messages:
    52
    Likes Received:
    5
    SP or on a Server? Cause in SP you also need to set the override directory or the hydroponics bays do not work

    Server side works, SP works if override directory is set correct. But never got Co-Op to work, cause it can't find the scenario
     
    #451
    Last edited: May 8, 2022
  12. Entoarox

    Entoarox Ensign

    Joined:
    May 7, 2022
    Messages:
    2
    Likes Received:
    0
    CO-OP, but I did set the scenario path just in case, still not affecting the hydroponics bays.
     
    #452
  13. CheesyWamBam

    CheesyWamBam Ensign

    Joined:
    May 6, 2022
    Messages:
    3
    Likes Received:
    0
    @Luke Benko There's a ship on the workshop called the RoebuckStarter. Author is Noob. He seems to have a functional sorter working on it. I had a look but then realised I have no idea what I'm looking at lol. Might be of some use to you though
     
    #453
  14. Luke Benko

    Luke Benko Ensign

    Joined:
    Mar 30, 2021
    Messages:
    12
    Likes Received:
    3
    @CheesyWamBam Thanks Looking into it. I hope it will point me in the right dirrection.
     
    #454
  15. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,094
    Likes Received:
    735
    You should reduce the Y coordinate by -1 in both cases to be on the safe side (and because it is more efficient) because the plants can only be below the lamp.
     
    #455
  16. Nathan Jurgens

    Nathan Jurgens Lieutenant

    Joined:
    May 18, 2016
    Messages:
    52
    Likes Received:
    5
    I need some help editing some logic in the Astra Blade if anyone cans see where I went wrong.
    https://steamcommunity.com/sharedfiles/filedetails/?id=2802720553

    Anyone got good examples using landing gear signals used in scripts?
    I got the engines turning off and on based on pilot in seat or not
    I got the "up" engines staying on when in around a planet and the pilot gets up
    But having a hard time working out the code to then turn off those engines with the landing gear is down cause I can't get the script to read the signal from the landing gear. I can read custom ones but not ones create by circuit logic.

    I thought I had it working but I was wrong
     
    #456
  17. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,094
    Likes Received:
    735
    @Nathan Jurgens
    Unfortunately the API does not offer me the possibility to query signals simply by name, but only switches.
    So you have to assign the signal to a switch. Alternatively you can query the "active" state of a device e.g. a lamp which is controlled by this signal.
     
    #457
  18. Nathan Jurgens

    Nathan Jurgens Lieutenant

    Joined:
    May 18, 2016
    Messages:
    52
    Likes Received:
    5
    Thank you. I have two switches controlled by the code and that works great. I will add a light, get that controlled by the signal and then query that device. Just wanted to make sure there was no other way.

    Thanks again for the help
     
    #458
  19. Salt The Fries

    Salt The Fries Ensign

    Joined:
    Mar 29, 2021
    Messages:
    9
    Likes Received:
    5
    Hi, hi! Recently updated to 9.2.2, and suddenly a large number of my scripts quit working...

    I traced the cause to the E.S.Items token not providing any results in CV/SV/HV's, but works fine in Bases.

    Sample code -
    (Works for BASE, but not CV/SV/HV)
    {{#each E.S.Items}}
    - [{{format Id '{0,4}'}}]:{{format Count '{0,5}'}} {{Name}} {{Key}}
    {{/each}}

    Is this intended behavior?
     
    #459
  20. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,094
    Likes Received:
    735
    It works on a CV also
    upload_2022-5-10_20-57-50.png
    but in SP the game API has the bug that the ship with which you leave the playfield is no longer listed in the next as a structure in the API.
     
    #460

Share This Page