[MOD EXT] Empyrion Scripting - Scripts

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

  1. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    It is not possible to authorize individual script commands
     
    #741
  2. Krucifix

    Krucifix Ensign

    Joined:
    Nov 22, 2019
    Messages:
    15
    Likes Received:
    10
    At a later time, would it be? Something as per a config file with true/false statements?
     
    #742
  3. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    No, it's not planned and I wouldn't want it either because then the scripting would be set differently from server to server and the questions and the lack of understanding why something works here and not somewhere else would be a source of frustration.
     
    #743
  4. BloodAngel099

    BloodAngel099 Lieutenant

    Joined:
    Jan 24, 2023
    Messages:
    33
    Likes Received:
    2
    Can I get some help with a script? I found it on a ship call Vega AI. The ship does have some issues with its scripts as I have had crashes caused by it, so if anyone else goes to load it be careful. I have been cherry picking the scripts I like from it and trying to rework them for my own use. The ammo script I particularly like because it also includes a weapon list/count. I would like to rearrange the data within the script to show:
    Qty Turret Ammo

    I have been able to rework scripts in the past with my limited knowledge, but I am struggling with this one. I do not understand enough about the scripting language to understand how to call the data when its needed essentially. I can kind of understand what is going on, but still a lot of "no clue" going around. The script also for some reason partially collapses in on itself when ammo is empty. I have tried to correct this with adjusting the formatting but I clearly am not understanding something as I cant get this to work with out adding blank likes where I don't want them. Could some one rework this script to show the data as I mentioned earlier? Having the two different versions would be helpful to compare and hopefully give me a better understanding of the scripting language used.

    {{~set 'WeaponsIDs' ''}}
    {{~set 'AmmoIDs' ''}}
    {{#devices E.S 'RESW-*'}}
    {{#each .}}
    {{~set 'WI' (configattr Id 'WeaponItem')}}
    {{~set 'AT' (configattrbyname
    @root.Data.WI
    'AmmoType')}}
    {{~set 'AI' (configattrbyname
    @root.Data.AT
    'Id')}}
    {{~#test @root.Data.WI in
    @root.Data.WeaponIDs}}
    {{~#lookupblock @root.Data (concat 'WeaponCount' @root.Data.WI)}}
    {{~#math . '+' 1}}
    {{~set (concat 'WeaponCount' @root.Data.WI) .}}
    {{~/math}}
    {{~/lookupblock}}
    {{else}}
    {{~set 'WeaponIDs'
    (concat @root.Data.WeaponIDs
    ',' @root.Data.WI)}}
    {{~set (concat 'WeaponCount' @root.Data.WI) 1}}
    {{/test}}
    {{~#test @root.Data.AI in
    @root.Data.AmmoIDs}}{{else}}
    {{~set 'AmmoIDs'
    (concat @root.Data.AmmoIDs
    ',' @root.Data.AI)}}
    {{~/test}}
    {{~/each}}
    {{~/devices}}
    {{~setcache 'WeaponsIDs' Data.WeaponIDs}}
    {{~setcache 'AmmoIDs' Data.AmmoIDs}}


    <align=center>
    <pos=15%><size=200%><sprite name="Ammunition">
    </size></align>
    {{~#getitems E.S 'RESCC*'}}
    {{~#itemlist . @root.Data.AmmoIDs}}
    {{#test Id in @root.Data.AmmoIDs}}
    <pos=20%>{{i18n Id}}
    {{~#test Count eq 0}}
    {{~#intervall 1}}
    <pos=80%><color=red>Empty</color>
    {{~/intervall}}
    {{~else}}
    <pos=80%>{{Count}}
    {{/test}}
    {{/test}}
    {{/itemlist}}
    {{/getitems}}<size=80%>
    <pos=50%><sprite name="SystemStatus_Bar">
    </size><size=3>
    {{~#split Data.WeaponIDs ',' true}}
    {{#each .}}
    <pos=50%>
    {{~lookup @root.Data
    (concat 'WeaponCount' .)}}<pos=54%>
    {{~i18n .}}
    {{/each}}
    {{/split}}</size>​
     
    #744
  5. [TOG] Xukisy

    [TOG] Xukisy Ensign

    Joined:
    Oct 15, 2020
    Messages:
    22
    Likes Received:
    7
    I'm trying to write a DB DiscoveredPOIs script but I cannot get the syntax correct. Please help point me in the correct direction. The SQL code I'm trying to replicate is:

    SELECT SolarSystems.name,Playfields.name,Entities.name ,Entities.isremoved,Entities.isdead
    FROM DiscoveredPOIs
    JOIN Entities ON DiscoveredPOIs.poiid = Entities.entityid
    JOIN Playfields ON Entities.pfid = Playfields.pfid
    JOIN SolarSystems ON SolarSystems.ssid = Playfields.ssid
    WHERE
    Entities.name LIKE '%Alloy Synthesis Factory%'
    AND Entities.isremoved = 0


    I tried:

    {{db DicoveredPOIs "Entities.name in '*Alloy*'"}}
    {{/db}}


    But I get error "{{db}} error Object reference not set to an instance of an object"

    Hopefully this makes sense. Basically I want to put the name of the POI I discovered or partial name and search to find where I found them before.


    This is as close but it doesn't restrict to desired result. If I remove the {{test}} this I get a list of the first screen with all results:

    POIData
    {{#db 'DiscoveredPOIs' 1000 'Entities.Name'}}
    {{#each .}}
    {{##test Entities.Name in 'Alloy Synthesis Factory'}}
    {{~Entities.name }}:
    {{~playfields.name}}
    {{~SolarSystems.name}}
    {{/test}}
    {{/each}}
    {{/db}}

    This is latest attempt shows all but not the ones with Tovera in the name. I was expecting the SQL to filter using the passed details. I suspect my Syntax is out:
    POIData
    {{set Q (concat 'Entities.Name LIKE 'Tovera'')}}
    {{#db 'DiscoveredPOIs' 'Entities.Name asc' @root.Data.Q}}
    {{#each .}}
    {{~Entities.name }}:
    {{~playfields.name}}
    {{~SolarSystems.name}}
    {{/each}}
    {{/db}}
     
    #745
    Last edited: Jul 25, 2023
  6. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    Try this
    Code:
    SELECT SolarSystems.name,Playfields.name,Entities.name ,Entities.isremoved,Entities.isdead
    FROM DiscoveredPOIs
    JOIN Entities ON DiscoveredPOIs.poiid = Entities.entityid
    JOIN Playfields ON Entities.pfid = Playfields.pfid
    JOIN SolarSystems ON SolarSystems.ssid = Playfields.ssid
    WHERE Entities.isremoved = 0 {additionalWhereAnd}
    because the {additionalWhereAnd} is for the query addon from the using script like the

    Code:
    {{#db 'DiscoveredPOIs' "Entities.name LIKE '%Alloy Synthesis Factory%' "}}
    ...
    {{/db}}
    and you can use the build in "DiscoveredPOIs" DB query if you only want the result for you and your faction.
    Code:
    SELECT * FROM DiscoveredPOIs
    JOIN Entities ON DiscoveredPOIs.poiid = Entities.entityid
    JOIN Playfields ON Entities.pfid = Playfields.pfid
    JOIN SolarSystems ON SolarSystems.ssid = Playfields.ssid
    WHERE (Entities.isremoved = 0 AND ((DiscoveredPOIs.facgroup = 1 AND DiscoveredPOIs.facid = 100) OR (DiscoveredPOIs.facgroup = 0 AND DiscoveredPOIs.facid = 100))) {additionalWhereAnd}
    
    if you add your own you can give your query another name like "AlloverDiscoveredPOIs"
     
    #746
    [TOG] Xukisy likes this.
  7. [TOG] Xukisy

    [TOG] Xukisy Ensign

    Joined:
    Oct 15, 2020
    Messages:
    22
    Likes Received:
    7
    @ASTIC thanks for responding. I may not have explained properly what I'm trying to do. I'm happy with my faction discovered POI but I cannot get the script to filter it to the search criteria. Here is the script (code on right and result on the left) I'm trying but the result below is not filtering on the '%Alloy Synthesis Factory%'. It's giving me back all my discovered poi without the filter. I've pasted the code below the image for easy copy/paste.




    [​IMG]



    POIData
    {{#db 'DiscoveredPOIs' "Entities.name LIKE '%Alloy Synthesis Factory%' "}}
    {{#each .}}
    {{~SolarSystems.name}}:
    {{~Playfields.name}}:
    {{~Entities.name}}
    {{/each}}
    {{/db}}
     
    #747
    Last edited: Jul 28, 2023
  8. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    Check if your script contains the placeholder
    {additionalWhereAnd}
    at the end because this is replaced with the statement from the command
     
    #748
  9. [TOG] Xukisy

    [TOG] Xukisy Ensign

    Joined:
    Oct 15, 2020
    Messages:
    22
    Likes Received:
    7
    My understanding your scripts already do that so I don't need to write my own custom script into your configuration. I'm only interested in my clans discovered POIs and and your DiscoveredPOIs script already has the {additionalWhereAnd} I was expecting the above script to filter into the {additionalWhereAnd} as per below documentation from GitHub.

    Shouldn't this already filter the SQL to '%Alloy Synthesis Factory%'?

    {{#db 'DiscoveredPOIs' "Entities.name LIKE '%Alloy Synthesis Factory%' "}}
    .
    .
    .
    {/db>




    [​IMG]
     
    #749
  10. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    Should actually, I can test it next week when I'm back home
     
    #750
    [TOG] Xukisy likes this.
  11. [TOG] Xukisy

    [TOG] Xukisy Ensign

    Joined:
    Oct 15, 2020
    Messages:
    22
    Likes Received:
    7
    Ooo, think I got it. If you want to use {additionalWhereAnd} it requires you to put in {top} and {OrderBy} values. Then it works. Here is an example of a successful Tovera-Class Dreadnought search:

    Code:
    POIData
    {{#db 'DiscoveredPOIs' 20 Entities.name 'Entities.name like "%Tovera%"' }}
    {{#each .}}
    {{~SolarSystems.name}}:
    {{~Playfields.name}}:
    {{~Entities.name}}
    {{/each}}
    {{/db}}
    
     
    #751
    ASTIC likes this.
  12. [TOG] Xukisy

    [TOG] Xukisy Ensign

    Joined:
    Oct 15, 2020
    Messages:
    22
    Likes Received:
    7
    An even better update.

    Search for your/clan Discovered POIs


    You will need 2 LCDs and a sensor/pressure plate.

    1) Create an LCD and name it "Script : Dialog" (without the spaces) and paste the below code into the text box
    2) Create a Sensor or Pressure Plate and name it ShowDialog and put ShowDialog into Signal Logic Tx Signal box.
    3) Create another LCD and name it Dialog
    4) Stand on sensor. Type in some search text into the input box and click "Search". Your Search should appear on the LCD named "Dialog"
    5) Enjoy

    Code:
    {{#dialog 'ShowDialog'
    'Type in Search Box below and click "Search" to search'
    ''
    'Search'
    '0' '2' '200'
    ''
    'true'
    ''
    'Fine Select'
    }}
    {{set 'QT' (concat '[DiscoveredPOIs' PlayerInput ']')}}
    {{set 'Q' (concat 'Entities.name LIKE "%' PlayerInput '%"')}}
    {{setcacheblock 'PFQRT'}}
    DiscoveredPOIs {{@root.Data.QT}}:
    {{/setcacheblock}}
    {{#setcacheblock 'PFQR'}}
    {{#db 'DiscoveredPOIs' 99 'Entities.name asc' @root.Data.Q}}
    {{#each .}}
    {{~SolarSystems.name}}:
    {{~Playfields.name}}:
    {{~Entities.name}}
    {{/each}}
    {{/db}}
    {{/setcacheblock}}
    {{/dialog}}
    {{CacheData.PFQRT}}
    {{CacheData.PFQR}}
    
     
    #752
    Last edited: Aug 15, 2023
    ASTIC likes this.
  13. BugiTree

    BugiTree Ensign

    Joined:
    Oct 3, 2022
    Messages:
    24
    Likes Received:
    0
    Ist in der Version 1.10.1 die " Config_Example.ecf " nicht mehr vorhanden ? Oder habe ich da etwas verpasst. :confused:
     
    #753
  14. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    Ja die hat Eleon offenbar entfernt - die Daten stehen (hoffentlich alle) in den anderen ECF Dateien drin ;-)
     
    #754
  15. BugiTree

    BugiTree Ensign

    Joined:
    Oct 3, 2022
    Messages:
    24
    Likes Received:
    0
    Ich habe bisher alles für mich relevante in der " BlocksConfig.ecf " und in der " ItemsConfig.ecf " gefunden. :)
    Alles was ich in der vorherigen Version angepaßt bzw. geändert hatte. :rolleyes:
     
    #755
  16. MrGReaper

    MrGReaper Lieutenant

    Joined:
    Jun 27, 2015
    Messages:
    61
    Likes Received:
    13
    Hi, I currently have this as my sorting script:
    Code:
    var infoOutLcds = CsRoot.GetDevices<ILcd>(CsRoot.Devices(E.S, "DaveSort"));
    if (infoOutLcds.Length == 0)
    {
        return;
    }
    
    int[] ammoSmall = { 4246, 4247, 4248, 4250, 4256, 4261, 5697, 5848, 7197, 7199, 7201, 7234 };
    int[] ammoLarge = { 4152, 4248, 4249, 4253, 4254, 4257, 4258, 4259, 4260, 4261, 4262, 4263, 4264, 4265, 4266, 4267, 4268, 5698, 5716, 5717, 5719, 5720, 5721, 5722, 5724, 5730, 5849, 7106, 7108, 7167, 7257, 7268, 5718, 5735, };
    int[] ammoHand = { 4147, 4148, 4149, 4150, 4151, 4153, 4154, 4156, 4157, 4158, 4160, 4162, 4163, 5696, 5702, 5703, 5935 };
    
    int[] FuelAir = { 4159, 4176, 4177, 4186, 4314, 4335, 4336, 4421, 6009 };
    
    int[] Deco = { 289, 330, 927, 928, 929, 1281, 1719, 2069, 2724, 2725 };
    int[] BlocksLarge = { 396, 399, 402, 405, 411, 462, 545, 1075, 1322, 1386, 1395, 1481, 2224, 2916 };
    int[] BlocksSmall = { 380, 2925, 1690, 837, 836, 974, 976, 1020, 1021, 1478, 1479, 99999999 };
    int[] ShipGuns = { 552, 683, 1650, 4196, 4197, 4198, 4199, 4200, 4201, 4202, 4203, 4204, 4205, 4206, 4207, 4208, 4209, 4210, 4211, 4211, 4212, 4213, 4214, 4215, 4216, 4217, 4218, 4219, 4221, 4222, 4223, 4224, 4225, 4226, 4227, 4228, 4229, 4230, 4231, 4232, 4233, 4234, 4236, 4237, 4238, 4239, 4272, 2170, 430, 1649, 1663, 1673, 432, 1659, 1660, 1661, 1662, 1663, 1664, 1665, 1666, 1667, 1668, 1669 };
    int[] Thrusters = { 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 772, 2900, 999999 };
    int[] Weapons = { 4099, 4100, 4101, 4102, 4103, 4105, 4106, 4110, 4111, 4112, 4128, 4138, 5651, 5657, 5661, 7217 };
    int[] WeaponsADV = { 4113, 4114, 4116, 4120, 4121, 4122, 4123, 4124, 4125, 4126, 4129, 4130, 4131, 4132, 4133, 4134, 4139, 4140, 4141, 4142, 4896, 5847, 7212, 7216, 7226, 7227, 7260, 7261, 4897 };
    int[] Tools = { 4098, 4104, 4115, 4117, 4119, 4127, 4136, 4137, 4796 };
    int[] Armour = { 4698, 4699, 4700, 4701, 7219, 7220 };
    int[] Boosts = { 4717, 4718, 4719, 4720, 4721, 4722, 4723, 4724, 4725, 4747, 4750, 4751, 4752, 5402, 5403, 5404, 7461, 7462, 7463, 7464 };
    int[] CraftingMaterials = { 4303, 4304, 4305, 4307, 4308, 4309, 4310, 4311, 4312, 4313, 4315, 4316, 4319, 4320, 4321, 4322, 4323, 4324, 4325, 4326, 4327, 4328, 4329, 4330, 4331, 4333, 4334, 4337, 4338, 4339, 4340, 4340, 4342, 4343, 4346, 4350, 4357, 4358, 4360, 4361, 4362, 4363, 4364, 4374, 4375, 4376, 4377, 4378, 4379, 4380, 4381, 4401, 2224, 4296, 4298, 4299, 4300, 4301, 4302, 4306, 4314, 4317, 4319, 4341, 5097, 5105, 5107, 5108, 5109, 5114, 5706, 5707, 5708, 5734, 5923, 5924, 5925, 5928, 5996, 5997, 6000, 6001, 6003, 6005, 6006, 7203, 7297, 7301, 7303, 7310, 7312, 7320, 7331, 7343, 7344, 7345, 7513, 5921, 5920, 5912, 5913, 5914, 5928, 5923, 5943, 5927 };
    int[] ores = { 4296, 4297, 4298, 4299, 4300, 4301, 4302, 4317, 4318, 4332, 4345, 4359, 4362, 4365 };
    int[] Food = { 4373, 4396, 4397, 4398, 4399, 4402, 4409, 4410, 4417, 4419, 4420, 4424, 4426, 4432, 4434, 4442, 4444, 4457, 4458, 4459, 4460, 4461, 4463, 4465, 4467, 4468, 4469, 4470, 4471, 4472, 4473, 4477, 4479, 4481, 4482, 4490, 5699, 7458 };
    int[] Medical = { 4403, 4404, 4423, 4425, 4430, 4433, 4437, 4441, 4464, 4474, 4475, 4476, 4478, 4483, 4484, 4485, 4486, 4487, 4488, 4489, 4493, 5715, 5904, 7316, 7446, 7448, 7450, 7452, 7453, 7454 };
    int[] Plants = { 4400, 4405, 4406, 4407, 4411, 4412, 4413, 4414, 4415, 4416, 4418, 4422, 4428, 4431, 4436, 4438, 4439, 4440, 4443, 4445, 4446, 4447, 4448, 4449, 4450, 4451, 4452, 4453, 4453, 4454, 4455, 4456, 4466, 4480, 4491, 4492, 2126 };
    int[] CVStuff = { 259, 260, 263, 266, 278, 291, 336, 343, 420, 457, 462, 468, 469, 498, 545, 564, 628, 653, 714, 717, 720, 724, 839, 934, 960, 962, 1002, 1008, 1016, 1034, 1035, 1112, 1128, 1129, 1136, 1253, 1257, 1278, 1304, 1321, 1370, 1371, 1372, 1486, 1490, 1494, 1513, 1549, 1571, 1588, 1627, 1628, 1682, 1683, 1687, 1689, 1691, 1692, 1706, 1711, 1712, 1808, 1811, 1956, 2029, 2084, 2236, 2237, 2732, 2772, 1500, 1095, 1465, 781 };
    int[] BaseStuff = { 99999999 };
    int[] Commodities = { 4344, 4347, 4366, 4367, 5102, 5103, 5106, 5111, 5112, 5115, 5913, 5914, 5916, 5917, 7514, 7515, 997805401, 558, 5925, 5924, 5926, 5911 };
    int[] DataStuff = { 5406, 5407, 5926, 400305401, 400505401, 401105401, 60120, 5401, 5405, 640405401, 640605401 };
    int[] crap = { 4107, 4135, 4348, 4349, 4351, 4352, 4353, 4354, 4355, 4356, 4429, 2179, 5932, 5933, 1485, 1386, 1387, 1388, 1389, 1390, 1391, 1392, 1393, 1394 };
    
    var sItems = CsRoot.Items(E.S, "A1SortingBox");
    string temp = "";
    foreach (var item in sItems)
    {
        if (ammoHand.Contains(item.Id))
        {
            foreach (ILcd lcd in infoOutLcds)
            {
                temp = lcd.GetText();
                lcd.SetText($"{item.Name} (ID: {item.Id}) x {item.Count}{Environment.NewLine} {temp} ");
                //no idea how to make the text scroll so this becomes useless fast
            }
            var ammo = CsRoot.Move(item, E.S, "*ammoH*");
    
            continue;
        }
        if (ammoSmall.Contains(item.Id))
        {
            foreach (ILcd lcd in infoOutLcds)
            {
                temp = lcd.GetText();
                lcd.SetText($"{item.Name} (ID: {item.Id}) x {item.Count}{Environment.NewLine} {temp} ");
            }
            var ammo = CsRoot.Move(item, E.S, "*ammoS*");
            continue;
        }
        if (ammoLarge.Contains(item.Id))
        {
            foreach (ILcd lcd in infoOutLcds)
            {
                temp = lcd.GetText();
                lcd.SetText($"{item.Name} (ID: {item.Id}) x {item.Count}{Environment.NewLine} {temp} ");
            }
            var ammo = CsRoot.Move(item, E.S, "*ammoL*");
            continue;
        }
        if (FuelAir.Contains(item.Id))
        {
            foreach (ILcd lcd in infoOutLcds)
            {
                temp = lcd.GetText();
                lcd.SetText($"{item.Name} (ID: {item.Id}) x {item.Count}{Environment.NewLine} {temp} ");
            }
            var fuel = CsRoot.Move(item, E.S, "*SpareFuel*");
            continue;
        }
        if (Deco.Contains(item.Id))
        {
            foreach (ILcd lcd in infoOutLcds)
            {
                temp = lcd.GetText();
                lcd.SetText($"{item.Name} (ID: {item.Id}) x {item.Count}{Environment.NewLine} {temp} ");
            }
            var decolist = CsRoot.Move(item, E.S, "*Deco*");
            continue;
        }
        if (BlocksLarge.Contains(item.Id))
        {
            foreach (ILcd lcd in infoOutLcds)
            {
                temp = lcd.GetText();
                lcd.SetText($"{item.Name} (ID: {item.Id}) x {item.Count}{Environment.NewLine} {temp} ");
            }
            var BlocksLargelist = CsRoot.Move(item, E.S, "*BlocksLarge*");
            continue;
        }
        if (BlocksSmall.Contains(item.Id))
        {
            foreach (ILcd lcd in infoOutLcds)
            {
                temp = lcd.GetText();
                lcd.SetText($"{item.Name} (ID: {item.Id}) x {item.Count}{Environment.NewLine} {temp} ");
            }
            var BlocksSmalllist = CsRoot.Move(item, E.S, "*BlocksSmall*");
            continue;
        }
        if (ShipGuns.Contains(item.Id))
        {
            foreach (ILcd lcd in infoOutLcds)
            {
                temp = lcd.GetText();
                lcd.SetText($"{item.Name} (ID: {item.Id}) x {item.Count}{Environment.NewLine} {temp} ");
            }
            var ShipGunslist = CsRoot.Move(item, E.S, "*ShipGuns*");
            continue;
        }
        if (Thrusters.Contains(item.Id))
        {
            foreach (ILcd lcd in infoOutLcds)
            {
                temp = lcd.GetText();
                lcd.SetText($"{item.Name} (ID: {item.Id}) x {item.Count}{Environment.NewLine} {temp} ");
            }
            var Thrusterslist = CsRoot.Move(item, E.S, "*Thrusters*");
            continue;
        }
        if (Weapons.Contains(item.Id))
        {
            foreach (ILcd lcd in infoOutLcds)
            {
                temp = lcd.GetText();
                lcd.SetText($"{item.Name} (ID: {item.Id}) x {item.Count}{Environment.NewLine} {temp} ");
            }
            var Weaponslist = CsRoot.Move(item, E.S, "*WeaponsBox*");
            continue;
        }
        if (WeaponsADV.Contains(item.Id))
        {
            foreach (ILcd lcd in infoOutLcds)
            {
                temp = lcd.GetText();
                lcd.SetText($"{item.Name} (ID: {item.Id}) x {item.Count}{Environment.NewLine} {temp} ");
            }
            var WeaponsADVlist = CsRoot.Move(item, E.S, "*WeaponsADV*");
            continue;
        }
        if (Tools.Contains(item.Id))
        {
            foreach (ILcd lcd in infoOutLcds)
            {
                temp = lcd.GetText();
                lcd.SetText($"{item.Name} (ID: {item.Id}) x {item.Count}{Environment.NewLine} {temp} ");
            }
            var Toolslist = CsRoot.Move(item, E.S, "*Tools*");
            continue;
        }
        if (Armour.Contains(item.Id))
        {
            foreach (ILcd lcd in infoOutLcds)
            {
                temp = lcd.GetText();
                lcd.SetText($"{item.Name} (ID: {item.Id}) x {item.Count}{Environment.NewLine} {temp} ");
            }
            var Armourlist = CsRoot.Move(item, E.S, "*Armour*");
            continue;
        }
        if (Boosts.Contains(item.Id))
        {
            foreach (ILcd lcd in infoOutLcds)
            {
                temp = lcd.GetText();
                lcd.SetText($"{item.Name} (ID: {item.Id}) x {item.Count}{Environment.NewLine} {temp} ");
            }
            var Boostslist = CsRoot.Move(item, E.S, "*Boosts*");
            continue;
        }
        if (CraftingMaterials.Contains(item.Id))
        {
            foreach (ILcd lcd in infoOutLcds)
            {
                temp = lcd.GetText();
                lcd.SetText($"{item.Name} (ID: {item.Id}) x {item.Count}{Environment.NewLine} {temp} ");
            }
            var CraftingMaterialslist = CsRoot.Move(item, E.S, "*CraftingMaterials*");
            continue;
        }
        if (ores.Contains(item.Id))
        {
            foreach (ILcd lcd in infoOutLcds)
            {
                temp = lcd.GetText();
                lcd.SetText($"{item.Name} (ID: {item.Id}) x {item.Count}{Environment.NewLine} {temp} ");
            }
            var oreslist = CsRoot.Move(item, E.S, "*oresBox*");
            continue;
        }
        if (Food.Contains(item.Id))
        {
            foreach (ILcd lcd in infoOutLcds)
            {
                temp = lcd.GetText();
                lcd.SetText($"{item.Name} (ID: {item.Id}) x {item.Count}{Environment.NewLine} {temp} ");
            }
            var Foodlist = CsRoot.Move(item, E.S, "*Food*");
            continue;
        }
        if (Medical.Contains(item.Id))
        {
            foreach (ILcd lcd in infoOutLcds)
            {
                temp = lcd.GetText();
                lcd.SetText($"{item.Name} (ID: {item.Id}) x {item.Count}{Environment.NewLine} {temp} ");
            }
            var Medicallist = CsRoot.Move(item, E.S, "*Medical*");
            continue;
        }
        if (Plants.Contains(item.Id))
        {
            foreach (ILcd lcd in infoOutLcds)
            {
                temp = lcd.GetText();
                lcd.SetText($"{item.Name} (ID: {item.Id}) x {item.Count}{Environment.NewLine} {temp} ");
            }
            var Plantslist = CsRoot.Move(item, E.S, "*Plants*");
            continue;
        }
        if (CVStuff.Contains(item.Id))
        {
            foreach (ILcd lcd in infoOutLcds)
            {
                temp = lcd.GetText();
                lcd.SetText($"{item.Name} (ID: {item.Id}) x {item.Count}{Environment.NewLine} {temp} ");
            }
            var CVStufflist = CsRoot.Move(item, E.S, "*CVStuff*");
            continue;
        }
        if (BaseStuff.Contains(item.Id))
        {
            foreach (ILcd lcd in infoOutLcds)
            {
                temp = lcd.GetText();
                lcd.SetText($"{item.Name} (ID: {item.Id}) x {item.Count}{Environment.NewLine} {temp} ");
            }
            var BaseStufflist = CsRoot.Move(item, E.S, "*BaseStuff*");
            continue;
        }
        if (Commodities.Contains(item.Id))
        {
            foreach (ILcd lcd in infoOutLcds)
            {
                temp = lcd.GetText();
                lcd.SetText($"{item.Name} (ID: {item.Id}) x {item.Count}{Environment.NewLine} {temp} ");
            }
            var Commoditieslist = CsRoot.Move(item, E.S, "*Commodities*");
            continue;
        }
        if (DataStuff.Contains(item.Id))
        {
            foreach (ILcd lcd in infoOutLcds)
            {
                temp = lcd.GetText();
                lcd.SetText($"{item.Name} (ID: {item.Id}) x {item.Count}{Environment.NewLine} {temp} ");
            }
            var DataStufflist = CsRoot.Move(item, E.S, "*DataStuff*");
            continue;
        }
        if (crap.Contains(item.Id))
        {
            foreach (ILcd lcd in infoOutLcds)
            {
                temp = lcd.GetText();
                lcd.SetText($"{item.Name} (ID: {item.Id}) x {item.Count}{Environment.NewLine} {temp} ");
            }
            var craplist = CsRoot.Move(item, E.S, "*crapBox*");
            continue;
        }
        var miList = CsRoot.Move(item, E.S, "*DestBox*");
        miList.ForEach(mi =>
        Console.WriteLine(
        $"{mi.Id}\n" +
        $"{mi.Count}\n" +
        $"\n" +
        ""));
    }
    As you can see I am hard coding the ID's of the items... I did this script a while back and just now having to re-learn how to do the scripting.

    I noticed in Configuration.json there are some auto generated ID lists. How do I go about using those lists in my script?
    lets take Ids "Ore" as an example
    do I need to reference it as Configuration.Ids.Ore ie (if (Configuration.Ids.Ore.Contains(item.Id)) (and guessing its not ID either?)

    Do i need to make an array of each section so i can reference them... and if so what type are they?
     
    #756
    Xyberwolf likes this.
  17. Xyberwolf

    Xyberwolf Ensign

    Joined:
    Jan 29, 2017
    Messages:
    5
    Likes Received:
    1
    Small world! I was just working on this myself and would like to know the solution as well.
    Though, I'm using HBS vs C#.
     
    #757
  18. MrGReaper

    MrGReaper Lieutenant

    Joined:
    Jun 27, 2015
    Messages:
    61
    Likes Received:
    13
    For HBS it seems to be @root.Ids.*listName*
    https://github.com/GitHub-TC/EmpyrionScripting#predefined-id-lists
    The github is very unhelpful when it comes to c# thought lol (i cant get my head around HBS, but c# is an old old old friend lol)
    I am completly stumped for c# but hopefully this helps you on the HBS side?
     
    #758
    Xyberwolf likes this.
  19. MrGReaper

    MrGReaper Lieutenant

    Joined:
    Jun 27, 2015
    Messages:
    61
    Likes Received:
    13
    Here is the question I just asked on the github repo, it may get a response here lol and describes better what I am trying to suss out:

    Looking at the section on predefined IDs, I can see that the IDs in the configuration file are all uptodate etc but I dont know how to reference these lists?

    It shows an example that uses LUA? @root.Ids.WeaponHV
    but what is that in C#?

    Ultimately i want to change:
    Code:
    int[] Armour = { 4698, 4699, 4700, 4701, 7219, 7220 }; var sItems = CsRoot.Items(E.S, "A1SortingBox"); string temp = ""; foreach (var item in sItems) { if (Armour.Contains(item.Id)) { foreach (ILcd lcd in infoOutLcds) { temp = lcd.GetText(); lcd.SetText($"{item.Name} (ID: {item.Id}) x {item.Count}{Environment.NewLine} {temp} "); } var Armourlist = CsRoot.Move(item, E.S, "*Armour*"); continue; } }
    (example is an extract from my script and unlikely to work on its own, just done to show how I am doing things now)

    To matching the items name ( item.Name ) to a name in the list so:

    Code:
    if (HowEverWeGetConfigurationList.Ids.Armour.contains(item.Name)
    But I need to know how to get that list lol
     
    #759
  20. ASTIC

    ASTIC Rear Admiral

    Joined:
    Dec 11, 2016
    Messages:
    1,085
    Likes Received:
    731
    Code:
    public class ModMain{
    public static void Main(IScriptModData r)
    {
     r.Ids ...
    
    its defined here
        public interface IScriptModData
        {
    ...
            Dictionary<string, string> Ids { get; }
            Dictionary<string, string> PlainIds { get; }
            Dictionary<string, string> NamedIds { get; }
    
    or direct with
    Code:
    return $"\nIngotIds: {Ids["Ingot"]}\n" ;
    
    take a look in the DemoCV Script ship, the second floor displays the things in C#

    [​IMG]
     
    #760
    MrGReaper likes this.

Share This Page