[MOD EXT] Empyrion Scripting - Scripts

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

  1. Mycroft_Groks

    Mycroft_Groks Lieutenant

    Joined:
    Aug 17, 2018
    Messages:
    43
    Likes Received:
    7
    Got it... I had it as #items E.S 'Trade*' and it should have been #Items @root.E.S 'Trade*'.
     
    #601
  2. MrGReaper

    MrGReaper Lieutenant

    Joined:
    Jun 27, 2015
    Messages:
    55
    Likes Received:
    13
    Having trouble getting my script into the lcd:


    int[] ammoSmall = { 4246, 4247, 4248, 4250, 4256, 4261, 5697, 5848, 7197, 7199, 7201, 7234 };
    int[] ammoLarge = { 4152, 4248, 4249, 4253, 4254, 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 };
    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 };

    int[] Deco = { 289, 330, 927, 928, 929, 1281, 1719, 2724 };
    int[] BlocksLarge = { 396, 399, 402, 405, 411, 462, 545, 1075, 1322, 1386, 1395, 1481, 2224 };
    int[] BlocksSmall = { 99999999};
    int[] ShipGuns = { 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 };
    int[] Thrusters = { 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, 7227, 7260, 7261 };
    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, 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 };
    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, 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 };
    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 };
    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, 1712, 1808, 1811, 1956, 2029, 2084, 2236, 2237, 2732, 2772 };
    int[] BaseStuff = {99999999 };
    int[] Commodities = { 4344, 4347, 4366, 4367, 5102, 5103, 5106, 5111, 5112, 5115, 5913, 5914, 5916, 5917, 7514, 7515 };
    int[] DataStuff = { 5406, 5407, 5926, 400305401, 400505401, 401105401, 601205401 };
    int[] crap = { 4107, 4135, 4348, 4349, 4351, 4352, 4353, 4354, 4355, 4356, 4429 };

    var sItems = CsRoot.Items(E.S, "A1SortingBox");


    foreach (var item in sItems)
    {
    if (ammoHand.Contains(item.Id))
    {
    var ammo = CsRoot.Move(item, E.S, "ammoHBox*");
    continue;
    }
    if (ammoSmall.Contains(item.Id))
    {
    var ammo = CsRoot.Move(item, E.S, "ammoSBox*");
    continue;
    }
    if (ammoLarge.Contains(item.Id))
    {
    var ammo = CsRoot.Move(item, E.S, "ammoLBox*");
    continue;
    }
    if (FuelAir.Contains(item.Id))
    {
    var fuel = CsRoot.Move(item, E.S, "SpareFuel*");
    continue;
    }
    if (Deco.Contains(item.Id))
    {
    var decolist = CsRoot.Move(item, E.S, "DecoBox*");
    continue;
    }
    if (BlocksLarge.Contains(item.Id))
    {
    var BlocksLargelist = CsRoot.Move(item, E.S, "BlocksLargeBox*");
    continue;
    }
    if (BlocksSmall.Contains(item.Id))
    {
    var BlocksSmalllist = CsRoot.Move(item, E.S, "BlocksSmallBox*");
    continue;
    }
    if (ShipGuns.Contains(item.Id))
    {
    var ShipGunslist = CsRoot.Move(item, E.S, "ShipGunsBox*");
    continue;
    }
    if (Thrusters.Contains(item.Id))
    {
    var Thrusterslist = CsRoot.Move(item, E.S, "ThrustersBox*");
    continue;
    }
    if (Weapons.Contains(item.Id))
    {
    var Weaponslist = CsRoot.Move(item, E.S, "WeaponsBox*");
    continue;
    }
    if (WeaponsADV.Contains(item.Id))
    {
    var WeaponsADVlist = CsRoot.Move(item, E.S, "WeaponsADVBox*");
    continue;
    }
    if (Tools.Contains(item.Id))
    {
    var Toolslist = CsRoot.Move(item, E.S, "ToolsBox*");
    continue;
    }
    if (Armour.Contains(item.Id))
    {
    var Armourlist = CsRoot.Move(item, E.S, "ArmourBox*");
    continue;
    }
    if (Boosts.Contains(item.Id))
    {
    var Boostslist = CsRoot.Move(item, E.S, "BoostsBox*");
    continue;
    }
    if (CraftingMaterials.Contains(item.Id))
    {
    var CraftingMaterialslist = CsRoot.Move(item, E.S, "CraftingMaterialsBox*");
    continue;
    }
    if (ores.Contains(item.Id))
    {
    var oreslist = CsRoot.Move(item, E.S, "oresBox*");
    continue;
    }
    if (Food.Contains(item.Id))
    {
    var Foodlist = CsRoot.Move(item, E.S, "FoodBox*");
    continue;
    }
    if (Medical.Contains(item.Id))
    {
    var Medicallist = CsRoot.Move(item, E.S, "MedicalBox*");
    continue;
    }
    if (Plants.Contains(item.Id))
    {
    var Plantslist = CsRoot.Move(item, E.S, "PlantsBox*");
    continue;
    }
    if (CVStuff.Contains(item.Id))
    {
    var CVStufflist = CsRoot.Move(item, E.S, "CVStuffBox*");
    continue;
    }
    if (BaseStuff.Contains(item.Id))
    {
    var BaseStufflist = CsRoot.Move(item, E.S, "BaseStuffBox*");
    continue;
    }
    if (Commodities.Contains(item.Id))
    {
    var Commoditieslist = CsRoot.Move(item, E.S, "CommoditiesBox*");
    continue;
    }
    if (DataStuff.Contains(item.Id))
    {
    var DataStufflist = CsRoot.Move(item, E.S, "DataStuffBox*");
    continue;
    }
    if (crap.Contains(item.Id))
    {
    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" +
    ""));
    }


    The lcd is only letting me put:


    int[] ammoSmall = { 4246, 4247, 4248, 4250, 4256, 4261, 5697, 5848, 7197, 7199, 7201, 7234 };
    int[] ammoLarge = { 4152, 4248, 4249, 4253, 4254, 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 };
    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 };

    int[] Deco = { 289, 330, 927, 928, 929, 1281, 1719, 2724 };
    int[] BlocksLarge = { 396, 399, 402, 405, 411, 462, 545, 1075, 1322, 1386, 1395, 1481, 2224 };
    int[] BlocksSmall = { 99999999};
    int[] ShipGuns = { 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 };
    int[] Thrusters = { 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, 7227, 7260, 7261 };
    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, 4


    no idea how to fix this?
     
    #602
  3. MrGReaper

    MrGReaper Lieutenant

    Joined:
    Jun 27, 2015
    Messages:
    55
    Likes Received:
    13

    Well 2 years on and you saved my bacon!



    int[] ammoSmall = { 4246, 4247, 4248, 4250, 4256, 4261, 5697, 5848, 7197, 7199, 7201, 7234 };
    int[] ammoLarge = { 4152, 4248, 4249, 4253, 4254, 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 };
    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 };

    int[] Deco = { 289, 330, 927, 928, 929, 1281, 1719, 2724 };
    int[] BlocksLarge = { 396, 399, 402, 405, 411, 462, 545, 1075, 1322, 1386, 1395, 1481, 2224 };
    int[] BlocksSmall = { 99999999};
    int[] ShipGuns = { 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 };
    int[] Thrusters = { 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, 7227, 7260, 7261 };
    int[] Tools = { 4098, 4104, 4115, 4117, 4119, 4127, 4136, 4137, 4796 };
    int[] Armour = { 4698, 4699, 4700, 4701, 7219, 7220 };
    // install1 ^
    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, 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 };
    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, 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 };
    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 };
    // install2 ^
    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, 1712, 1808, 1811, 1956, 2029, 2084, 2236, 2237, 2732, 2772 };
    int[] BaseStuff = {99999999 };
    int[] Commodities = { 4344, 4347, 4366, 4367, 5102, 5103, 5106, 5111, 5112, 5115, 5913, 5914, 5916, 5917, 7514, 7515 };
    int[] DataStuff = { 5406, 5407, 5926, 400305401, 400505401, 401105401, 601205401 };
    int[] crap = { 4107, 4135, 4348, 4349, 4351, 4352, 4353, 4354, 4355, 4356, 4429 };

    var sItems = CsRoot.Items(E.S, "A1SortingBox");


    foreach (var item in sItems)
    {
    if (ammoHand.Contains(item.Id))
    {
    var ammo = CsRoot.Move(item, E.S, "ammoHBox*");
    continue;
    }
    if (ammoSmall.Contains(item.Id))
    {
    var ammo = CsRoot.Move(item, E.S, "ammoSBox*");
    continue;
    }
    if (ammoLarge.Contains(item.Id))
    {
    var ammo = CsRoot.Move(item, E.S, "ammoLBox*");
    continue;
    }
    // install3 ^
    if (FuelAir.Contains(item.Id))
    {
    var fuel = CsRoot.Move(item, E.S, "SpareFuel*");
    continue;
    }
    if (Deco.Contains(item.Id))
    {
    var decolist = CsRoot.Move(item, E.S, "DecoBox*");
    continue;
    }
    if (BlocksLarge.Contains(item.Id))
    {
    var BlocksLargelist = CsRoot.Move(item, E.S, "BlocksLargeBox*");
    continue;
    }
    if (BlocksSmall.Contains(item.Id))
    {
    var BlocksSmalllist = CsRoot.Move(item, E.S, "BlocksSmallBox*");
    continue;
    }
    if (ShipGuns.Contains(item.Id))
    {
    var ShipGunslist = CsRoot.Move(item, E.S, "ShipGunsBox*");
    continue;
    }
    if (Thrusters.Contains(item.Id))
    {
    var Thrusterslist = CsRoot.Move(item, E.S, "ThrustersBox*");
    continue;
    }
    if (Weapons.Contains(item.Id))
    {
    var Weaponslist = CsRoot.Move(item, E.S, "WeaponsBox*");
    continue;
    }
    if (WeaponsADV.Contains(item.Id))
    {
    var WeaponsADVlist = CsRoot.Move(item, E.S, "WeaponsADVBox*");
    continue;
    }
    if (Tools.Contains(item.Id))
    {
    var Toolslist = CsRoot.Move(item, E.S, "ToolsBox*");
    continue;
    }
    if (Armour.Contains(item.Id))
    {
    var Armourlist = CsRoot.Move(item, E.S, "ArmourBox*");
    continue;
    }
    // install4 ^
    if (Boosts.Contains(item.Id))
    {
    var Boostslist = CsRoot.Move(item, E.S, "BoostsBox*");
    continue;
    }
    if (CraftingMaterials.Contains(item.Id))
    {
    var CraftingMaterialslist = CsRoot.Move(item, E.S, "CraftingMaterialsBox*");
    continue;
    }
    if (ores.Contains(item.Id))
    {
    var oreslist = CsRoot.Move(item, E.S, "oresBox*");
    continue;
    }
    if (Food.Contains(item.Id))
    {
    var Foodlist = CsRoot.Move(item, E.S, "FoodBox*");
    continue;
    }
    if (Medical.Contains(item.Id))
    {
    var Medicallist = CsRoot.Move(item, E.S, "MedicalBox*");
    continue;
    }
    if (Plants.Contains(item.Id))
    {
    var Plantslist = CsRoot.Move(item, E.S, "PlantsBox*");
    continue;
    }
    if (CVStuff.Contains(item.Id))
    {
    var CVStufflist = CsRoot.Move(item, E.S, "CVStuffBox*");
    continue;
    }
    if (BaseStuff.Contains(item.Id))
    {
    var BaseStufflist = CsRoot.Move(item, E.S, "BaseStuffBox*");
    continue;
    }
    if (Commodities.Contains(item.Id))
    {
    var Commoditieslist = CsRoot.Move(item, E.S, "CommoditiesBox*");
    continue;
    }
    // install5
    if (DataStuff.Contains(item.Id))
    {
    var DataStufflist = CsRoot.Move(item, E.S, "DataStuffBox*");
    continue;
    }
    if (crap.Contains(item.Id))
    {
    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" +
    ""));
    }
    //install6 ^
    /*
    * I had to create 6 lcds called install1 to install6
    *
    *then use the following script in another lcd to put them together (stupid text limits!)
    {{set 'Output' 'C#:DaveSorter'}}
    {{set 'SourceScripts' 'install1,install2,install3,install4,install5,install6'}}

    {{split @root.Data.SourceScripts ","}}
    {{#each .}}
    {{~devices @root.E.S .}}
    {{setblock 'text'}}
    {{@root.data.text}}
    {{gettext ../0}}
    {{#if .}}
    {{.}}
    {{/if}}
    {{/gettext}}
    {{/setblock}}
    {{/devices}}
    {{/each}}
    {{/split}}

    {{~devices @root.E.S @root.data.Output}}
    {{settextblock .0}}
    {{@root.data.text}}
    {{/settextblock}}
    {{/devices}}
    */


    I split the program up into 6 screens, then used your script to install them :)

    Couldnt find a better way explained, but this worked YAY
     
    #603
  4. MrGReaper

    MrGReaper Lieutenant

    Joined:
    Jun 27, 2015
    Messages:
    55
    Likes Received:
    13
    Ok so a few questions about C# coding of scripts:

    1) Is there a better way than above to put in a long script (lets face it with that lcd limit... long is overstating it)?
    2) I can see how to get a device list but not how to manipulate a device, activate/deactivate it, how do we get a list of all devices and turn on or off specificly named ones?
    3) as 2 but with signals, I was able to get a list of ControlPanelSignals and pick out the one I want by name...but the state (which i assume is on or off) only has a getter, no setter. Whats the correct way to turn on a signal from a script?

    EDIT

    Thought I had found the answer to 2...


    var shieldLevel = E.S.ShieldLevel;
    var devices = CsRoot.Devices(E.S, "*ShieldLow*");
    if (shieldLevel < 50000)
    {
    foreach(var device in devices)
    {
    device.Active = true;
    Console.WriteLine("Shield level: " + shieldLevel+Environment.NewLine+"ALERT SHIELDS LOW");
    }
    }
    if (shieldLevel > 50000)
    {
    foreach (var device in devices)
    {
    device.Active = false;
    Console.WriteLine("Shield level: " + shieldLevel);
    }
    }

    but the lcd displays "This script is only allowed in SaveGameScripts" guessing that means single player? I play on a server with a couple of mates (running a mates only server)
    So an adjustment to question 2.... how do we do it on a server?
     
    #604
    Last edited: Jan 23, 2023
  5. me777

    me777 Commander

    Joined:
    Aug 18, 2020
    Messages:
    384
    Likes Received:
    131
    1) not sure, on lcd i only do small handlebar scripts, for c# i normally use savegamescripts
    2) not in empyrion api so not possible exept for the switch block
    3) as 2)

    only way i'm aware of is placing a switch block and turn it on/off
     
    #605
  6. MrGReaper

    MrGReaper Lieutenant

    Joined:
    Jun 27, 2015
    Messages:
    55
    Likes Received:
    13
    I would be happy to turn on and off a switch block, i can make that work for my needs lol, can that be done in multiplayer or is that limited to single player?
    I cant get my head around the handlebar (lua?) scripting. c# is an old friend though do you know if the ability to post longer programs is coming to the multiplayer mode? guessing its a limit of the game that can only be overridden in single player.

    Think i shall just play for a bit before work and sulk that the game devs have restricted multiplayer to much for some scripts to be possible lol.

    My massive auto sorting script works though... too much of a pain in the rear to edit it as its spread over 6 lcds....but it works :)
     
    #606
  7. me777

    me777 Commander

    Joined:
    Aug 18, 2020
    Messages:
    384
    Likes Received:
    131
    actually the scripting mod works better on a server, in singleplayer some api stuff does not work right (game bug) and probably won't get fixed too soon (teleport player and message popups for example)

    considder savegame scripts if you got control over a server or run a server local. I made my sort script in c# and ingame i have lcds with the list of stuff that i want to get moved.

    and about the c# way to set a switch i actually don't know...
     
    #607
  8. MrGReaper

    MrGReaper Lieutenant

    Joined:
    Jun 27, 2015
    Messages:
    55
    Likes Received:
    13
    I have control over the server (I am the admin and the mug that pays for it lol)
    Have i misunderstood what saveGameScript means? I assumed it was single player? Doing a site search of it is not revealing much. The script mod is confusingly documented and the videos tend to be in german (understandable as I believe thats the native language of the coder, but youtube subs are not exactly good at translating lol)

    On the possibility of a switch:

    In the c# lighting demo on the workshop script object. I saw a reference that looked up lights with a name, it then changed thier colour.

    in my test script:

    var devices = CsRoot.Devices(E.S, "*ShieldLow*");

    should make a list of all devices on E.S (seems to be the grid the lcd is attached to) that have ShieldLow in thier name.

    foreach(var device in devices) { //stuff } is a standard c# command, it basically means go through the list in devices and each time it does it has the item in that list referenced as "device" (very handy command, very basic too but including it here in case someone unfamiliar with c# see this post later on)

    in this context device.Active is a valid boolean that has a getter and a setter. so that should turn it on and off... assuming that is what Active means in this context lol.


    Theres no errors in the script I can see other than its not letting me run it, telling me that it needs to be a saveGameScript... which I assumed meant singleplayer, but now not so sure?

    [​IMG]
     
    #608
    Last edited: Jan 23, 2023
  9. me777

    me777 Commander

    Joined:
    Aug 18, 2020
    Messages:
    384
    Likes Received:
    131
    just put the .cs files from the project into the folder inside the server savegame, mine is C:\servers\empyrionserver\Saves\Games\DediGame\Mods\EmpyrionScripting\Scripts

    there also can be subfolders, like CV SV BA ir the ID of the entity the script should apply to.

    https://github.com/GitHub-TC/EmpyrionScripting#savegame-scripts
    that is the general description of the savegfamescripts, works the same for c#
    and it even reloads the script or starts it at runtime, no need for server restart.
     
    #609
  10. MrGReaper

    MrGReaper Lieutenant

    Joined:
    Jun 27, 2015
    Messages:
    55
    Likes Received:
    13
    Ah ok though that opens a couple of questions,

    1) My sorting script thats too long for an LCD can that go into the script folder of the server and still be used?
    2) assuming 1 is a yes... do I create a davesSorting.cs file and put exactly what I would put into an LCD into the cs file?
    3) how do I reference that script from a ship? ie how do I tell an lcd to use the script?
    4) can i reference the script from different ships?


    *********************EDIT*******************

    To answer my own questions now that I finally got a chance to load the game....

    1) and 2) I created a .cs file with exactly what was in the LCD screen and put it in the scripts folder, named it DaveTestOne.cs.
    I named a lcd screen DaveTestOne
    The script appears to be working on all ships.... regardless of if they have the monitor set to that name or not..... not ideal :(

    3) still need to know this!

    4) every ship has the script... seems you can have it for one ship (by naiming it after the ID) or for every ship... no way to have it on just the ships you want it on..... ARGHHHHHHHHHHHHHHHHHH
     
    #610
    Last edited: Jan 24, 2023
  11. me777

    me777 Commander

    Joined:
    Aug 18, 2020
    Messages:
    384
    Likes Received:
    131
    the script runs for all matching entitys filtered by the folder (eg only on BA if you put it in filder BA or only on 1 ship if you put the id as folder)

    the solution is to add acheck at the beginning of the script, you check at the verry startt if a device with the right name is there if not return (i.e. the output lcd or a container)
    or you do a foreach over the found lcds and if none is found it does nothing (thats the way i do most my scripts)

    take a look at the cargoteleport script fron astic
    https://github.com/GitHub-TC/Empyri...EmpyrionScripting.Examples/CargoTeleporter.cs
    I do the 2 checks at the begin even as i don't exaclty know why they are there and then the same style find devices and do a foreach over them. works just fine.

    oh, and the savegame scripts only run every 10 seconds, but for cargo moving it is enough.
     
    #611
  12. MrGReaper

    MrGReaper Lieutenant

    Joined:
    Jun 27, 2015
    Messages:
    55
    Likes Received:
    13
    These two checks?


    Code:
    if (!(rootObject is IScriptSaveGameRootData root)) return;
    if (root.E.Faction.Id == 0) return;

    I get what the second is doing and may actually adjust that to only run if the ID matches our faction ID (mates server so we are all one faction) but no idea what the first one is doing

    I see:
    Code:
    var infoOutLcds = root.CsRoot.GetDevices<ILcd>(root.CsRoot.Devices(root.E.S, "CargoOutInfo*"));
    guessing this should work
    Code:
                var infoOutLcds = CsRoot.GetDevices<ILcd>(CsRoot.Devices(E.S, "DaveSort"));
                if (infoOutLcds.Length == 0)
                {
                    return;
                }
    This is the current sortng script as it is in a file called DaveTestOne.cs in the savescript folder I havent added any checks to it yet as cant test for a bit:


    Code:
                int[] ammoSmall = { 4246, 4247, 4248, 4250, 4256, 4261, 5697, 5848, 7197, 7199, 7201, 7234 };
                int[] ammoLarge = { 4152, 4248, 4249, 4253, 4254, 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, 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 };
                int[] Thrusters = { 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 };
                // install1 ^
                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 };
                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 };
                // install2 ^
                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};
                int[] BaseStuff = {99999999 };
                int[] Commodities = { 4344, 4347, 4366, 4367, 5102, 5103, 5106, 5111, 5112, 5115, 5913, 5914, 5916, 5917, 7514, 7515, 997805401, 558};
                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 };
    
                var sItems = CsRoot.Items(E.S, "A1SortingBox");
    
    
                foreach (var item in sItems)
                {
                    if (ammoHand.Contains(item.Id))
                    {
                        var ammo = CsRoot.Move(item, E.S, "*ammoH*");
                        continue;
                    }
                    if (ammoSmall.Contains(item.Id))
                    {
                        var ammo = CsRoot.Move(item, E.S, "*ammoS*");
                        continue;
                    }
                    if (ammoLarge.Contains(item.Id))
                    {
                        var ammo = CsRoot.Move(item, E.S, "*ammoL*");
                        continue;
                    }
                    // install3 ^
                    if (FuelAir.Contains(item.Id))
                    {
                        var fuel = CsRoot.Move(item, E.S, "*SpareFuel*");
                        continue;
                    }
                    if (Deco.Contains(item.Id))
                    {
                        var decolist = CsRoot.Move(item, E.S, "*Deco*");
                        continue;
                    }
                    if (BlocksLarge.Contains(item.Id))
                    {
                        var BlocksLargelist = CsRoot.Move(item, E.S, "*BlocksLarge*");
                        continue;
                    }
                    if (BlocksSmall.Contains(item.Id))
                    {
                        var BlocksSmalllist = CsRoot.Move(item, E.S, "*BlocksSmall*");
                        continue;
                    }
                    if (ShipGuns.Contains(item.Id))
                    {
                        var ShipGunslist = CsRoot.Move(item, E.S, "*ShipGuns*");
                        continue;
                    }
                    if (Thrusters.Contains(item.Id))
                    {
                        var Thrusterslist = CsRoot.Move(item, E.S, "*Thrusters*");
                        continue;
                    }
                    if (Weapons.Contains(item.Id))
                    {
                        var Weaponslist = CsRoot.Move(item, E.S, "*WeaponsBox*");
                        continue;
                    }
                    if (WeaponsADV.Contains(item.Id))
                    {
                        var WeaponsADVlist = CsRoot.Move(item, E.S, "*WeaponsADV*");
                        continue;
                    }
                    if (Tools.Contains(item.Id))
                    {
                        var Toolslist = CsRoot.Move(item, E.S, "*Tools*");
                        continue;
                    }
                    if (Armour.Contains(item.Id))
                    {
                        var Armourlist = CsRoot.Move(item, E.S, "*Armour*");
                        continue;
                    }
                    // install4 ^
                    if (Boosts.Contains(item.Id))
                    {
                        var Boostslist = CsRoot.Move(item, E.S, "*Boosts*");
                        continue;
                    }
                    if (CraftingMaterials.Contains(item.Id))
                    {
                        var CraftingMaterialslist = CsRoot.Move(item, E.S, "*CraftingMaterials*");
                        continue;
                    }
                    if (ores.Contains(item.Id))
                    {
                        var oreslist = CsRoot.Move(item, E.S, "*oresBox*");
                        continue;
                    }
                    if (Food.Contains(item.Id))
                    {
                        var Foodlist = CsRoot.Move(item, E.S, "*Food*");
                        continue;
                    }
                    if (Medical.Contains(item.Id))
                    {
                        var Medicallist = CsRoot.Move(item, E.S, "*Medical*");
                        continue;
                    }
                    if (Plants.Contains(item.Id))
                    {
                        var Plantslist = CsRoot.Move(item, E.S, "*Plants*");
                        continue;
                    }
                    if (CVStuff.Contains(item.Id))
                    {
                        var CVStufflist = CsRoot.Move(item, E.S, "*CVStuff*");
                        continue;
                    }
                    if (BaseStuff.Contains(item.Id))
                    {
                        var BaseStufflist = CsRoot.Move(item, E.S, "*BaseStuff*");
                        continue;
                    }
                    if (Commodities.Contains(item.Id))
                    {
                        var Commoditieslist = CsRoot.Move(item, E.S, "*Commodities*");
                        continue;
                    }
                    // install5
                    if (DataStuff.Contains(item.Id))
                    {
                        var DataStufflist = CsRoot.Move(item, E.S, "*DataStuff*");
                        continue;
                    }
                    if (crap.Contains(item.Id))
                    {
                        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" +
                    ""));
                }
    (also YAY found how to insert code on this forum lol)

    It does not include any of the standard class file stuff... its not setting up functions, so not really object based lol, just the script as it would be on an lcd...
    The example you link me to is more like a traditional class...infact many parts of it would not work with our it being like that.. the very first line checks a variable passed on by the function.

    Are all your save game scripts setup like the cargo one? did you have to use the same public class name etc.... can you drop in a couple of examples?
     
    #612
    Last edited: Jan 24, 2023
  13. me777

    me777 Commander

    Joined:
    Aug 18, 2020
    Messages:
    384
    Likes Received:
    131
    Yes, all with the using and class and everything. I'm not sure how it handles raw cs code, but i think ASTIC did pull a few tricks to make it work.


    Code:
    using Eleon.Modding;
    using EmpyrionScripting;
    using EmpyrionScripting.CustomHelpers;
    using EmpyrionScripting.DataWrapper;
    using EmpyrionScripting.Interface;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System;
    
    
    public class soll
    {
        public string Name { get; set; }
        public int Zahl { get; set; }
        public string ZielStructur { get; set; }
        public string ZielContainer { get; set; }
        public string QuellContainer { get; set; }
    }
    public class quellen
    {
        public string container { get; set; }
    }
    public class tanken
    {
        public string Name { get; set; }
        public int Zahl { get; set; }
        public string ZielStructur { get; set; }
        public string QuellContainer { get; set; }
    }
    public class ModMain
    {
    
    
        public static void Main(IScriptModData rootObject)
        {
            if (!(rootObject is IScriptSaveGameRootData root)) return;
            if (root.E.Faction.Id == 0) return;
            List<string> FuelItems = new List<string>()
            {
                "Fuel Cell",
                "Dual Fuel Cell",
                "Promethium Hydrocell"
    
            };
            List<string> Pentax = new List<string>()
            {
                "Refined Pentaxid"
            };
            List<string> o2 = new List<string>()
            {
                "Oxygen Bottle"
            };
    
    
            List<soll> solls = new List<soll>();
    
            List<quellen> quellens = new List<quellen>();
            List<tanken> tankens = new List<tanken>();
    
    
    
    
            var ILcds = root.CsRoot.GetDevices<ILcd>(root.CsRoot.Devices(root.E.S, "AutoTransferInfo*"));
            var LLLcd = root.CsRoot.GetDevices<ILcd>(root.CsRoot.Devices(root.E.S, "AutoTransferList*"));
            //WriteTo(ILcds, $"TEST-1-");
    
            if (LLLcd.Length == 0)
            {
                if (ILcds.Length > 0)
                    WriteTo(ILcds, "kein LCD AutoTransferList*");
                return;
            }
    
            var xl = root.CsRoot.Items(root.E.S, "Add");
            xl.ForEach(xx =>
            {
                WriteTo(ILcds, "ADD: " + xx.Name);
            }
            );
            if (root.DeviceLockAllowed == false)
            {
                return;
            }
            var lines = new List<string>();
            string quellcontainername = null;
            string zielcontainername = null;
            string zielID = root.E.Id.ToString();
            string[] separators = { "\r\n", "\r", "\n" };
            //WriteTo(ILcds, $"lcds:   {LLLcd.Length} ");
            LLLcd.ForEach(L =>
            {
    
                string text = L.GetText();
    
                lines.AddRange(text.Split(separators, StringSplitOptions.RemoveEmptyEntries));
    
            });
            foreach (string line in lines)
            {
                if (line.StartsWith("@"))
                {
                    quellcontainername = line.Substring(1);
                    quellen Q = new quellen { container = quellcontainername };
                    //WriteTo(ILcds, $"qc {quellcontainername}");
                    if (quellens.Contains(Q))
                    {
                        continue;
                    }
                    quellens.Add(Q);
                }
                else if (line.StartsWith("+"))
                {
                    zielcontainername = line.Substring(1);
                    //WriteTo(ILcds, $"zc {zielcontainername}");
                }
                else if (line.StartsWith("!"))
                {
                    if (line.Length > 2)
                        zielID = line.Substring(1);
                    else
                        zielID = root.E.Id.ToString();
                    //WriteTo(ILcds, $"zstrukt {zielID} {root.CsRoot.EntitiesById(zielID).FirstOrDefault().Id}");
                }
                else if (line.StartsWith("."))
                {
                    //WriteTo(ILcds, $"tanken 1");
                    string[] values = line.Substring(1).Split(',');
                    if (values.Length == 2)
                    {
                        //int iid = 0;
                        int ianz = 0;
                        string iname = values[0];
                        if ((iname.Length > 2) && (int.TryParse(values[1], out ianz)))
                        {
                            if (quellcontainername == null)
                            {
                                WriteTo(ILcds, $"Fehler Quellcontainer {quellcontainername}");
                                return;
                            }
    
    
                            if (ianz < 0 || ianz > 100)
                            {
                                WriteTo(ILcds, $"Fehler anzahl {line} (bei tanklen in 0-100%)");
                                return;
                            }
                            else
                            {
                                tankens.Add(new tanken() { Name = iname, Zahl = ianz, QuellContainer = quellcontainername, ZielStructur = zielID });
                            }
                        }
                    }
    
                }
                else if (line.StartsWith("#"))
                {
                    //kommentar ignorieren
                }
                else if (quellcontainername != null && zielcontainername != null)
                {
                    string[] values = line.Split(',');
                    //WriteTo(ILcds, $"debug{values.Length} ");
                    if (values.Length == 2)
                    {
                        //int iid = 0;
                        int ianz = 0;
                        string iname = "";
                        iname = values[0];
                        if ((iname.Length > 2) && (int.TryParse(values[1], out ianz)))
                        {
                            if (quellcontainername == null)
                            {
                                WriteTo(ILcds, $"Fehler Quellcontainer {quellcontainername}");
                                return;
                            }
                            if (zielcontainername == null)
                            {
                                WriteTo(ILcds, $"Fehler Quellcontainer {zielcontainername}");
                                return;
                            }
                            else
                            {
                                solls.Add(new soll() { Name = iname, Zahl = ianz, QuellContainer = quellcontainername, ZielContainer = zielcontainername, ZielStructur = zielID });
                                //WriteTo(ILcds, $"solls:   {ianz} {iname} in {zielcontainername} von {quellcontainername}");
                            };
                        }
                    }
                    else
                    {
                        if (line.Length > 2)
                            WriteTo(ILcds, $"Fehler: {line}---");
                    }
                }
                else WriteTo(ILcds, $"else:   ");
            }
    
            int pst = 0;
            int sx = 1;
    
            if (root.CacheData.TryGetValue("st", out var st))
            {
                int.TryParse(st.ToString(), out pst);
            }
            int schritt = 0;
            if (pst >= quellens.Count() - 1) pst = -1;
    
            //WriteTo(ILcds, $"start st: {pst} {schritt} {quellens.Count()}");
            while (schritt < sx && pst < quellens.Count() - 1)
            {
    
                pst++;
                root.CacheData["st"] = pst;
                //WriteTo(ILcds, $"gespeichert st: {pst}");
    
                var C = quellens.ElementAt(pst);
                /*
                bool r =false;
                quellens.ForEach(C => {
                */
                root.CsRoot.Items(root.E.S, C.container).ForEach(I =>
                {
                    //WriteTo(ILcds, $"TEST-{solls.Count}//--");
    
                    solls.Where(s => s.QuellContainer == C.container && s.Name == I.Name).ToList().ForEach(TI =>
                    {
                        try
                        {
                            var zs1 = root.CsRoot.EntitiesById(TI.ZielStructur);
                            if (zs1.Count() == 0)
                            {
                                WriteTo(ILcds, $"Fehler kein ziel: {TI.ZielStructur}");
                            }
                            else
                            {
                                var zs = zs1.FirstOrDefault().S;
    
                                IList<IItemMoveInfo> MiList;
                                if (TI.Zahl == 0)
                                    MiList = root.CsRoot.Move(I, zs, TI.ZielContainer);
                                else
    
                                {
                                    MiList = root.CsRoot.Move(I, zs, TI.ZielContainer, TI.Zahl);
                                }
                                MiList.ForEach(Mi =>
                                {
                                    schritt++;
                                    if (root.E.Id.ToString() == TI.ZielStructur)
                                        WriteTo(ILcds, $"{Mi.Count} {root.CsRoot.I18n(Mi.Id)} [{Mi.Id}] von {C.container} in {TI.ZielContainer}");
                                    else
                                        WriteTo(ILcds, $"{Mi.Count} {root.CsRoot.I18n(Mi.Id)} [{Mi.Id}] von {C.container} in {TI.ZielContainer} auf {root.CsRoot.EntitiesById(TI.ZielStructur).FirstOrDefault().Name}");
                                });
                            }
                        }
                        catch
                        {
                            var zs1 = root.CsRoot.EntitiesById(TI.ZielStructur);
                            WriteTo(ILcds, $"Fehler catch verschieben: {TI.ZielStructur} {zs1.Count()}");
    
    
                        }
                        if (schritt > sx) return;
                    });
                    if (schritt > sx) return;
                });
                if (schritt > sx) return;
            };
    
    
            tankens.ForEach(T =>
            {
                try
                {
                    var zs1 = root.CsRoot.EntitiesById(T.ZielStructur);
                    if (zs1.Count() == 0)
                    {
                        //WriteTo(ILcds, $"Fehler kein ziel: {T.ZielStructur}");
                    }
                    else
                    {
                        var zs = zs1.FirstOrDefault().S;
                        IList<IItemMoveInfo> MiList;
                        var Item = root.CsRoot.Items(root.E.S, T.QuellContainer).Where(S => S.Name == T.Name);
                        if (Item.Count() > 0)
                        {
                            if (FuelItems.Contains(T.Name))
                            {
                                if (zs1.FirstOrDefault().S.FuelTank.ItemsNeededForFill(Item.FirstOrDefault().Id, 1000) > 0)
                                {
                                    MiList = root.CsRoot.Fill(Item.FirstOrDefault(), zs1.FirstOrDefault().S, StructureTankType.Fuel);
                                    MiList.ForEach(MI =>
                                    {
                                        WriteTo(ILcds, $"Aufgetankt: {MI.Count} {root.CsRoot.I18n(MI.Id)} [{MI.Id}] von {T.QuellContainer} in Treibstofftank auf {zs1.FirstOrDefault().Name}");
                                    });
                                }
                            }
                            else if (Pentax.Contains(T.Name))
                            {
                                if (zs1.FirstOrDefault().S.PentaxidTank.ItemsNeededForFill(Item.FirstOrDefault().Id, 1000) > 0)
                                {
                                    MiList = root.CsRoot.Fill(Item.FirstOrDefault(), zs1.FirstOrDefault().S, StructureTankType.Pentaxid);
                                    MiList.ForEach(MI =>
                                    {
                                        WriteTo(ILcds, $"Aufgetankt: {MI.Count} {root.CsRoot.I18n(MI.Id)} [{MI.Id}] von {T.QuellContainer} in Pentaxidtank auf {zs1.FirstOrDefault().Name}");
                                    });
                                }
                            }
                            else if (o2.Contains(T.Name))
                            {
                                if (zs1.FirstOrDefault().S.OxygenTank.ItemsNeededForFill(Item.FirstOrDefault().Id, 1000) > 0)
                                {
                                    MiList = root.CsRoot.Fill(Item.FirstOrDefault(), zs1.FirstOrDefault().S, StructureTankType.Oxygen);
                                    MiList.ForEach(MI =>
                                    {
                                        WriteTo(ILcds, $"Aufgetankt: {MI.Count} {root.CsRoot.I18n(MI.Id)} [{MI.Id}] vopn {T.QuellContainer} in Sauerstofftank auf {zs1.FirstOrDefault().Name}");
                                    });
                                }
                            }
                            else
                            {
                                WriteTo(ILcds, $"Fehler tanken: {T.Name} {T.QuellContainer} {T.ZielStructur} {T.Zahl}");
                            }
                        }
                        else
                        {
                            WriteTo(ILcds, $"Es Fehlt: {T.Name}");
                        }
                    }
                }
                catch
                {
                    WriteTo(ILcds, $"Fehler catch tanken: {T.Name} {T.ZielStructur}");
                }
            });
        }//ende Main//
        private static void WriteTo(ILcd[] lcds, string text)
        {
            lcds.ForEach(L => L.SetText($"{text}\n{L.GetText()}"));
        }
    }
    Code:
    using Eleon.Modding;
    using EmpyrionScripting.Interface;
    using System.Linq;
    using UnityEngine;
    
    public class ModMain
    {
        private static bool DoWarp = false;
        private static bool DoWarplock = false;
        private static readonly float langle = 5;
        private static readonly int SaveDistance = 1000;
        //private static string armed = "SAVE";
        public static void Main(IScriptModData rootObject)
        {
            if (!(rootObject is IScriptSaveGameRootData root)) return;
            if (root.E.Faction.Id == 0) return;
            if((root.E.EntityType != EntityType.CV)&&(root.E.EntityType != EntityType.SV)) return;
    
            var infoOutLcds = root.CsRoot.GetDevices<ILcd>(root.CsRoot.Devices(root.E.S, "WarpLCD"));
            if (infoOutLcds.Length == 0) return;
            var Sig = root.E.S.ControlPanelSignals.Where(sig => sig.Name == "Warp").FirstOrDefault();
            if (Sig == null) return;
    
            //WriteTo(infoOutLcds, $"test {S.Name} {S.State}");
            if (Sig.State && !DoWarplock)
            {
                DoWarplock = true;
                DoWarp = true;
            }
            else if (!Sig.State && !DoWarplock)
            {
                DoWarplock = false;
            }
            infoOutLcds.ForEach(L => L.SetText(""));
            root.GetCurrentPlayfield().Entities.ForEach(Ent =>
            {
                if (Ent.Value.Faction.Equals(root.E.Faction) && (Ent.Value.Id != root.E.Id) && (Ent.Value.Type != EntityType.Player))
                {
                    var Tvect = Ent.Value.Position - root.E.Pos;
                    var angle = UnityEngine.Vector3.Angle(root.E.Forward.normalized, (Ent.Value.Position - root.E.Pos).normalized);
                    //if(UnityEngine.Vector3.Angle(root.E.Pos, ) { }
                    //WriteTo(infoOutLcds, $"{Ent.Value.Name} {Tvect.magnitude} {angle}");
                    if (DoWarp && (angle < langle) && (Tvect.magnitude > 2 * SaveDistance))
                    {
                        Vector3 WarpTarget = Ent.Value.Position - (Tvect.normalized * (float)SaveDistance * (float)1.05);
                        bool WarpTargetClear = true;
                        root.GetCurrentPlayfield().Entities.ForEach(Ent2 =>
                        {
                            if (((Ent2.Value.Position - Tvect).magnitude < SaveDistance) && (Ent2.Value.Id != Ent.Value.Id))
                            {
                                WarpTargetClear = false;
                            }
                        });
                        if (WarpTargetClear)
                        {
                            DoWarp = false;
                            //IEntity myEnt = root.E.GetCurrent();
                            //myEnt.Position = myEnt.Position + myEnt.Forward * Tvect.magnitude;
                            root.E.S.Pilot.Teleport(WarpTarget);
                            WriteTo(infoOutLcds, $"WARP!!");
                        }
                        else
                        {
                            WriteTo(infoOutLcds, "Warp Blocked");
                        }
                    }
                }
            });
        }
        private static void WriteTo(ILcd[] lcds, string text)
        {
            lcds.ForEach(L => L.SetText($"{text}\n{L.GetText()}"));
        }
    }
    And I just noticed a bit of a improovement needed for the first one, the Lists should probably be outside the main...

    The first one is my sorter script it uses lcds with commands and itemnames to move stuff
    the first letter can be special to give commands to the script:
    ! selects the target id (without parameter itself)
    @ source container name
    + target container neme
    . refuel (the following item determines the tank to use)
    # comment (ignores this line)
    else it expects a itemname then a , then the target count to fill to (if fuel then 0-100%, but that is broken somehow)
    the special command stay set until it is overwritten by the same special command.
    example lcd list:
    Code:
    @Output Power
    #myHelios P Module 1 4033
    !4033
    .Promethium Hydrocell,100
    .Refined Pentaxid,100
    .Oxygen Bottle,90
    #Garden Food 4037
    !4037
    .Promethium Hydrocell,100
    .Refined Pentaxid,100
    .Oxygen Bottle,90
    #Garden Mat 4038
    !4038
    .Promethium Hydrocell,100
    .Refined Pentaxid,100
    .Oxygen Bottle,90
    #my Helios 9.6M Storage 4039
    !4039
    .Promethium Hydrocell,100
    .Refined Pentaxid,100
    .Oxygen Bottle,90
    #The Dauntless - 1Q 4040
    !4040
    .Promethium Hydrocell,100
    .Refined Pentaxid,100
    .Oxygen Bottle,90
    #M2 Mining Barge - Helios 60027
    !60027
    .Promethium Hydrocell,100
    .Refined Pentaxid,100
    .Oxygen Bottle,90
    #_D2 Dropship - Helios
    !324001
    .Promethium Hydrocell,100
    .Refined Pentaxid,100
    .Oxygen Bottle,90
    #HM1 Miner - 2 106010
    !106010
    .Promethium Hydrocell,100
    .Refined Pentaxid,100
    .Oxygen Bottle,90
    #The Boom-Box 321002
    !321002
    .Promethium Hydrocell,100
    .Refined Pentaxid,100
    .Oxygen Bottle,90
    !
    .Promethium Hydrocell,100
    .Refined Pentaxid,100
    .Oxygen Bottle,90
    the second one expects 2 thing a lcd called "WarpLCD" and a signal "Warp" in the ship control pannel. when the signal is changed fron off to on and there are friendly ships infront it teleports the player and the ship he is piloting to within 1 km of the friendly ships.
     
    #613
    MrGReaper likes this.
  14. MrGReaper

    MrGReaper Lieutenant

    Joined:
    Jun 27, 2015
    Messages:
    55
    Likes Received:
    13
    Ok current 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, 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, 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 };
                int[] Thrusters = { 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 };
                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 };
                int[] BaseStuff = { 99999999 };
                int[] Commodities = { 4344, 4347, 4366, 4367, 5102, 5103, 5106, 5111, 5112, 5115, 5913, 5914, 5916, 5917, 7514, 7515, 997805401, 558 };
                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 };
    
                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 and it lists items even if it cant move them...ie container locked...it does not dupe items though, just lists them to the lcd multiple times
                        }
                        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" +
                    ""));
                }
    Needs a screen Called DaveSort or it wont work
    outputs to the DaveSort screen/ screens

    bugs: outputs text as though a transfer has happened even if it hasnt... no dupe, just a double or tripple text line....hmmm
     
    #614
  15. MrGReaper

    MrGReaper Lieutenant

    Joined:
    Jun 27, 2015
    Messages:
    55
    Likes Received:
    13
    For some reason it didnt show me this post originally, will read through it properly once at work/ Just wanted to thank you for the help and advice, it is appreciated
     
    #615
  16. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    991
    Likes Received:
    707
    #616
  17. Mycroft_Groks

    Mycroft_Groks Lieutenant

    Joined:
    Aug 17, 2018
    Messages:
    43
    Likes Received:
    7
    Check your DMs, please
     
    #617
  18. lolodu099

    lolodu099 Ensign

    Joined:
    Dec 12, 2016
    Messages:
    9
    Likes Received:
    1
    Would it be possible to take a ammo refil script and turn it into a check for X* transfer all from X* to Drop Box (froma a BA to a docked CV/SV)
    that way y can transfer entier cargo from my land base to then my space one or is it imposible to do ? (dunno if its okay to ask it here tell me and message will be removed if possible)
     
    #618
  19. Mycroft_Groks

    Mycroft_Groks Lieutenant

    Joined:
    Aug 17, 2018
    Messages:
    43
    Likes Received:
    7
    I have something just like that. It will empty a SV into a carrier and then with a flip of a switch, will empty the carrier when it's docked.

    Sv has an OUTGOING box that's dumped into the CVs dumpbox. Flip the switch and the contents of the carrier dumps into an outgoing box for the base to grab all the materials.
     
    #619
  20. Mycroft_Groks

    Mycroft_Groks Lieutenant

    Joined:
    Aug 17, 2018
    Messages:
    43
    Likes Received:
    7
    Code:
    {{!Automated Cargo Transporter- V1.1}}
    {{!LCD Name: Script:AutoMove}}
    {{~set 'Evac' '[FFFFFF]*OUTGOING*'}}
    <pos=0>◜</pos>       <color=red><u><b>SHODAN Core Systems</color></u></b><pos=88>◝</pos>
    <pos=0>◟</pos>            <i><size=125%>Automove cargo</size></i><pos=88>◞</pos></size>
    {{#getswitch @root.E.S 'CORE_Automove'}}
    {{#if SwitchState}}
    
    <color=green><b><u><align=center>Receive Mode Enabled</align></u></b></color>
    
    Scanning:
    {{scroll 5 1}}
    {{~#each @root.E.S.DockedE}}
    <indent=6>◉ <color=grey>{{Name}}</color></indent>
    {{#items S '[FFFFFF]*OUTGOING*'}}
    {{move this @root.E.S '[FFFFFF]*DUMP BOX*'}}
    {{/move}}
    {{/items}}
    {{/each}}
    {{/scroll}}
    
    {{else}}
    
    <size=175%><align=center><color=yellow><u>WARNING!!</u></size></color>
    <size=125%><color=red>Evacuation Mode Enabled!</color></size></align>
    {{#items @root.E.S 'Hold -*,Food*,Trade*'}}
    {{move this @root.E.S @root.Data.Evac}}
    {{/move}}
    {{/items}}
    
    {{/if}}{{/getswitch}}
    See if this helps you get where you need to go.
     
    #620

Share This Page