Space Engineers

Space Engineers

[SEE SUPERGATE PSA] Stargate Modpack (Economy Support!)
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");
}
}
Last edited by BloodLustAngel; 17 Sep, 2019 @ 2:37am
< >
Showing 1-2 of 2 comments
Sigmund Froid 7 Feb, 2020 @ 3:46am 
It's no IMyFunctionalBlock as it can't be turned off, it's IMyTerminalBlock
SalazarWindriver 23 Feb, 2020 @ 6:49am 
wait what is this program trying to do?
< >
Showing 1-2 of 2 comments
Per page: 1530 50