Space Engineers

Space Engineers

[SEE SUPERGATE PSA] Stargate Modpack (Economy Support!)
BloodLustAngel 2019 年 9 月 17 日 上午 2:34
Gate detection with a Programming block is bugged and wont detect the gate at all. when i try to detect the block it says has no functional Block
Trying to get the gate to detect with the programable block but its not being detected as a functional block

Code if you want to try:
//x2,0,Universe\6Gate#Universe\6Gate,0[5]1:=:true[7]%3,0,#Sounds,56[5]2:100#3:100#4:10,,7[5]%4,0,Universe\6Gate#Universe\6Gate,0,,2:false[3]1:=:false[7]%3,0,#Sounds,56[7]8[5]%[3]1.1.1
// Above is your LOAD LINE. Copy it into Visual Script Builder to load your script.
// dco.pe/vsb

void Main(string argument)
{
// block declarations
string ERR_TXT = "";
List<IMyTerminalBlock> l0 = new List<IMyTerminalBlock>();
IMyFunctionalBlock v0 = null;
if(GridTerminalSystem.GetBlockGroupWithName("Universe Gate") != null) {
GridTerminalSystem.GetBlockGroupWithName("Universe Gate").GetBlocksOfType<IMyFunctionalBlock>(l0);
if(l0.Count == 0) {
ERR_TXT += "group Universe Gate has no Functional Block blocks\n";
}
else {
for(int i = 0; i < l0.Count; i++) {
if(l0.CustomName == "Universe Gate") {
v0 = (IMyFunctionalBlock)l0;
break;
}
}
if(v0 == null) {
ERR_TXT += "group Universe Gate has no Functional Block block named Universe Gate\n";
}
}
}
else {
ERR_TXT += "group Universe Gate not found\n";
}
List<IMyTerminalBlock> l1 = new List<IMyTerminalBlock>();
IMySoundBlock v1 = null;
if(GridTerminalSystem.GetBlockGroupWithName("Sounds") != null) {
GridTerminalSystem.GetBlockGroupWithName("Sounds").GetBlocksOfType<IMySoundBlock>(l1);
if(l1.Count == 0) {
ERR_TXT += "group Sounds has no Sound Block blocks\n";
}
else {
for(int i = 0; i < l1.Count; i++) {
if(l1.CustomName == "Sound Block") {
v1 = (IMySoundBlock)l1;
break;
}
}
if(v1 == null) {
ERR_TXT += "group Sounds has no Sound Block block named Sound Block\n";
}
}
}
else {
ERR_TXT += "group Sounds not found\n";
}

// display errors
if(ERR_TXT != "") {
Echo("Script Errors:\n"+ERR_TXT+"(make sure block ownership is set correctly)");
return;
}
else {Echo("");}

// logic
if(v0.Enabled == true) {
v1.Volume = (float)100;
v1.Range = (float)100;
v1.LoopPeriod = (float)10;
v1.ApplyAction("PlaySound");
}
else if(v0.Enabled == false) {
v1.ApplyAction("StopSound");
}
}
最后由 BloodLustAngel 编辑于; 2019 年 9 月 17 日 上午 2:37
< >
正在显示第 1 - 2 条,共 2 条留言
Sigmund Froid 2020 年 2 月 7 日 上午 3:46 
It's no IMyFunctionalBlock as it can't be turned off, it's IMyTerminalBlock
SalazarWindriver 2020 年 2 月 23 日 上午 6:49 
wait what is this program trying to do?
< >
正在显示第 1 - 2 条,共 2 条留言
每页显示数: 1530 50