Space Engineers

Space Engineers

View Stats:
Помогите решить проблему со скриптом
Писал скрипт для своего бура, однако при запуске с любым из аргументов выдает ошибку:" Обнаружено исключение во время выполнения скрипта: Object reference of an object.
at Program.Main(String argument)
at
Sandbox.Game.Entities.Blocks.MyProgrammableBlock.<>c__DisplayClass46_0.<ExecuteCode>b__0(IMyGridProgram program)

at
Sandbox.Game.Entities.Blocks.MyProgrammableBlock.RunSandboxedProgramActionCore(Action'1
actions,
String&
response)"
Сам скрипт:

//Start
IMyPistonBase piston1;
IMyShipConnector conector1;
List<IMyShipDrill> Drills;
IMyBlockGroup DrillGroup;
IMyInventory Container;
bool iscargofull;
bool pistonpos;
string tr = "true";
string fa = "false";

Program()
{
piston1 = GridTerminalSystem.GetBlockWithName("Piston1") as IMyPistonBase;
conector1 = GridTerminalSystem.GetBlockWithName("Conector1") as IMyShipConnector;
Drills = new List<IMyShipDrill>();
DrillGroup = GridTerminalSystem.GetBlockGroupWithName("Drills");
DrillGroup.GetBlocksOfType<IMyShipDrill>(Drills);
Runtime.UpdateFrequency = UpdateFrequency.Update1;
Container = GridTerminalSystem.GetBlockWithName("Cargo1") as IMyInventory;
}
void Main(string argument)
{
while (argument == tr)
{
iscargofull = false;
conector1.Disconnect();
drel("OnOff_On");
piston1.Extend();
while (iscargofull == false)
{
if (Container.VolumeFillFactor >= 0.01)
{
piston1.Retract();
drel("OnOff_Off");
iscargofull = true;
}
}
while(pistonpos == false)
{
if (piston1.CurrentPosition == 1)
{
conector1.Connect();
pistonpos = true;
}
}
while (iscargofull == true)
{
if (Container.VolumeFillFactor == 0)
{
iscargofull = false;
}
}

}
while (argument == fa)
{
pistonpos = false;
piston1.Retract();
drel("OnOff_Off");
while(pistonpos == false)
{
if (piston1.CurrentPosition == 1)
{
pistonpos = true;
conector1.Connect();
}
}
}
}
void drel(string ip)
{
foreach (IMyShipDrill drill in Drills)
{
drill.ApplyAction(ip);
}
}
//Finish
< >
Showing 1-1 of 1 comments
Гусь 16 Sep @ 7:49am 
Ваня
< >
Showing 1-1 of 1 comments
Per page: 1530 50