Space Engineers

Space Engineers

Oxygen Sensor (Works in Vanilla SE - No mods needed)
58 条留言
Sagittarius 2017 年 11 月 23 日 上午 11:29 
Hey, could this be updated to the current patch state? Sadly theres a new error to the Line 47 Error
Teto <3 2017 年 2 月 26 日 下午 12:20 
I have a problem witht this. This is the Error:
Program(50,67): Error: 'IMyBlockGroup' does not contain a definition for 'Blocks' and no extension method 'Blocks' accepting a first argument of type 'IMyBlockGroup' could be found(are you missing a using directive or an assembly reference?)
Please help because your idea is great!
Rikkavidu_GER 2015 年 9 月 22 日 上午 9:39 
Hi. Your Script has a Error. What with Blockgroups or so what.
Genius 2015 年 9 月 13 日 下午 5:51 
You have to change "blockGroups = GridTerminalSystem.BlockGroups;"
to "GridTerminalSystem.GetBlockGroups(blockGroups);"
This script is obsolete.
That One R.O.B. 2015 年 8 月 4 日 上午 8:49 
i have an error on line 47 as well i also have a iscussion about it
WortexCZ 2015 年 8 月 1 日 下午 10:15 
Same here. Error at line 47.
sir_evilfish 2015 年 7 月 17 日 下午 12:55 
Hi! It seems the script does not work anymore after the last game update (from today, ver 1.091). There is a compile error at line 47. Anyone else has the same problem?
nogare321 2015 年 4 月 14 日 下午 7:55 
Thanks!
Kesuke  [作者] 2015 年 4 月 14 日 上午 10:00 
of course nogare321.
nogare321 2015 年 4 月 12 日 下午 3:07 
I'm trying to learn how to program in C# for this game. That being said, I've noticed that sections of your code say what I'm trying to do. Would it be ok for me to use your sections (with me citing your steam name) in my scripts?
Kebabcp 2015 年 4 月 6 日 上午 4:18 
maybie a video showing how to set it up...
acheaen 2015 年 4 月 2 日 下午 9:56 
can anyone check the script in the discussions board and see what i cant
[S7G] String 2015 年 4 月 1 日 下午 2:28 
This isn't a mod its a script? Lol
So he is right when he says "No mods needed " :)
commander.bert 2015 年 4 月 1 日 下午 1:40 
great idea and good program, I like it.
only thing, if you use it in the construction phase, you have to start the program new after adding some parts
DiabetiMark 2015 年 3 月 31 日 下午 10:27 
I could try that one, thanks
@[K.I.] Freedom's Flame
Freedom's Flame 2015 年 3 月 31 日 下午 8:49 
@Mark Perhaps rather than activating the blocks directly through the programmable block just have the script turn on a timer block that will activate a separate programmable block that then changes the state of all the lights each tick. Then when oxygen comes back have a script that will turn off that timer block and will activate another that turns all the flashing lights specifically to their "off" state, rather than just changing their state.
Kiba 2015 年 3 月 31 日 下午 4:46 
Why not upload the script to steam workshop like others have done?
DiabetiMark 2015 年 3 月 31 日 上午 11:09 
One more question.

I've got Interior lights setup as Light Alarm <ZONE>
and tried to expand your awesome code a little : 3
didn't go that well haha.

I tried to setup to search (just like the "Air Vent") for blocks with Light Alarm in it,
then when a zone gets depressurized, the lights go on (and each light is setup to be flickering etc. ) So just OnOff_On & OnOff_Off had to be changed for each block containing Light Alarm
to turn on when depressurized, and off when pressurized.

anyone got a piece of code for me ^^
I would really appreciate it :)


- Mark
(:USstar:I love this piece of code :gmod:J :USstar: )
Kesuke  [作者] 2015 年 3 月 31 日 上午 10:30 
Gherkin - This isn't a mod mate. This is all possible in Vanilla SE using the programmable block. The only thing uploaded is a savegame. You can do all this in your own worlds with the programmable block.
Kesuke  [作者] 2015 年 3 月 31 日 上午 10:28 
Nice one Mark! Glad you got it sorted :ftlrebel:
Kesuke  [作者] 2015 年 3 月 31 日 上午 10:28 
FiveSeveN - Tyco - A Walk
Paveway 2015 年 3 月 31 日 上午 10:26 
Im sorry to bother you, but what song was included in the video?
SioxerNikita 2015 年 3 月 31 日 上午 7:03 
#CluelessIsClueless, It's a world, a savegame, an Ingame script which is not a mod.
DiabetiMark 2015 年 3 月 31 日 上午 4:40 
It's working like a charm!
thanks for your help!
nicely done!

thanks for sharing :)

(it was the modded Air Vents which caused the problems ;))

- Mark
maxxal22 2015 年 3 月 31 日 上午 2:08 
i think he means no othert modded stuff needed
ethobat 2015 年 3 月 31 日 上午 1:23 
>no mods needed
>is a mod
Kesuke  [作者] 2015 年 3 月 30 日 下午 6:45 
It was indeed Tyco :)
Riparian 2015 年 3 月 30 日 下午 6:32 
Brilliant and useful! Thank you for this, I will surely be implimenting this in my future ships. The song for the vid was by tyco right? Either way, great tutorial vid too, gave me a good understanding of how this whole thing works.
Mojo 2015 年 3 月 30 日 下午 3:56 
@LVMPD Explorer Matt, I was playing around with a simple room, I mean simple, and I kept getting the reading there was a leak... for some reason angle blocks that were attached to glass was the leak...all vanilla..replaced angled with square no leak, put angles back leak..possible that it may be your issue?
[S7G] String 2015 年 3 月 30 日 下午 3:54 
Can you also get it to toggle certain lights to flash red colour please would be pretty sweeet .
Nice work too with the sound block alarm script haha LCDs look great
DiabetiMark 2015 年 3 月 30 日 下午 3:11 
That I haven't taught of that one before!
that might actually be it :/

I'm so sorry, and glad that you might have found the cause of the problem!
I'm going to give it a try tomorrow!
I'll let you know!

Anyway!
thanks for your help, time and awesome concept!


- Mark
Kesuke  [作者] 2015 年 3 月 30 日 下午 3:07 
Mark I suspect your issue might be from a modded block looking at the ship. Right now the oxygen system only seems to work properly with the vanilla blocks. The game seems to think some full height mod blocks that look like they should contain oxygen are actually empty. I suspect you've got a leak somewhere, probably from a mod block.

The door shouldn't be tricking the game. You could test your theory by adding a vent into the gap between the doors. I doubt it will fix your problem (because I don't think that is the problem). I think you have an air leak somewhere.
DiabetiMark 2015 年 3 月 30 日 下午 2:23 
Hello Kesuke, thanks for your respond.

I hope I won't bother you too much.
the LCD's were already working at that time, maybe I wasn't that clear,
the LCD's do update when I change the name of a air vent (It shows the data on screen with how "All X zones are pressurized." and the "Life Support:" strings.)

only it doesn't respond to unpressurized rooms.

so it shows the amount of zones / pressurizers, but not when one gets depressurized / pressurized...

Thanks for your time, and sharing this cool concept of LCD with oxygen alarm ;)

M.Moose 2015 年 3 月 30 日 下午 2:18 
I would but I can't, not until it's finished. Also I know for a fact that there is no hole. But I do have multiple pressurized rooms (connected by two doors). I think the problem is that when I open the door it makes the system think its not pressurized since it doesn't have an air vent inside of it. (the gap between the doors is 1 block).

But here is a reference model of what I have:

http://psteamcommunity.yuanyoumao.com/sharedfiles/filedetails/?id=275097654

I built this but I am working on an FPS-Friendly version right now with an Oxygen system
(This is an old outdated ship without the proper insulation needed for an oxygen system)

Kesuke  [作者] 2015 年 3 月 30 日 下午 1:48 
Matt, if you like upload your world to the workshop and I'll take a look. Sounds like a hole somewhere in the ship design (you don't have a depressurized central corridor or something like that do you?).
M.Moose 2015 年 3 月 30 日 下午 12:33 
Mine is now working properly. but I can't tell if this is a bug with the oxygen or the script, but it seems that everytime I open a door in my ship (that is pressurizedand leads to another pressurized area) it depressurizes every room in my ship and with the alarm going off and the doors closing on me it is starting to get a bit frustrating. Besides the Issues this is still a great script none the less.
Kesuke  [作者] 2015 年 3 月 30 日 下午 12:07 
Also, make sure you have put your LCD screens into a block group called Oxygen LCD panels (you can call the panels whatever you want individually, but they need to belong to a group with the name Oxygen LCD Panels - case sensitive as well so make sure it is spelt right)
Kesuke  [作者] 2015 年 3 月 30 日 下午 12:06 
Hi Mark, make sure you have set the LCD's to yourself as the block owner, the display public text and everybody-read only.

I have noticed that since Thursdays update sometimes the screens glitch out. This will probably be fixed next week. If that happens just recompile the script in the editor and it seems to fix it.
DiabetiMark 2015 年 3 月 30 日 上午 11:06 
Ok, got the timer to work ^^ (silly me)
but stil haven't figured out why the screens aren't showing, and the alarm doesn't ring when a zone with a configurd airvent doesn't work
DiabetiMark 2015 年 3 月 30 日 上午 11:01 
I tried it myself, boot and the same as LVMPD Explorer Matt. When I vented the oxygen of the zone, it doesn't show up on the LCD.

What I noticed though, is that the timer isn't being started automatically, which may point to the code not being fully executed. tried to figure it out myself, but couldn't find the problem. the programmable block doesn't give an error whilst manually updating it.
further I can say that when I add a airvent conveyor block, and name it Air Vent <ZONE NAME etc.> nothing happens on the LCD's, but when I manually execute the code (Through the programmable block and / or timer) it update's. Which may point that the code is incorrect / incomplete after the Air Vent increment count and before the restart timer piece.

I hope someone could figure this one for me ^^
and find a fix, where I couldn't.
thx for trying / helping me!
(Stil not sure if it is the code which is wrong or I)

(And Kesuke, thx for the code anyway :) )

- [Dangny] Mark
M.Moose 2015 年 3 月 30 日 上午 8:36 
For some reason when I went to vent out a room on my ship to see if it would work nothing seemed to happen on the screens. it said they were all pressurized even though the room had lost all oxygen. I'm pretty sure I set everything up right. Is there something I may have missed?
BoneHero 2015 年 3 月 30 日 上午 8:35 
Now that the game has those airtight hangar doors, is it possible to use this script to trigger "emergency seals" to seal off the hull breach from spesific room? Im quite sure it is but I have no idea how this programming works...
Trion3 2015 年 3 月 30 日 上午 8:11 
if only i am able to code
C3ntron 2015 年 3 月 30 日 上午 3:07 
I like it!

Works very well and I took the liberty to 'expand' your script to change an intererior light color to reflect the status of a room:


//Definition:
List<IMyTerminalBlock> airLight = SearchBlocksByName("Air Light");
//Add to vent-check loop
VentLocation = airVents[i].CustomName.Substring(8);

// Change light color to status:
// If( (IsDepressurizing) || etc etc )
LightColor = Color.Red;
// Else if (!IsDepressurizing)
LightColor = Color.Green;

// At the end of for-loop
SetColorOfLight(airLight, VentLocation, LightColor);

void SetColorOfLight(List<IMyTerminalBlock> blocks, string Location, Color color)
{ for (int i = 0; i < blocks.Count; i++)
{ IMyInteriorLight light = blocks[i] as IMyInteriorLight;
if( !(blocks[i].CustomName.IndexOf(Location) == -1)){
light.SetValue("Color", color);
}
}
}
Probably the search of the right interior light could have been nicer, but right now I only knew the 'for' loop as a solution ;-)
John Shepard 2015 年 3 月 29 日 下午 10:33 
thsi is PREETY DAMN GOOD!!!!
TheCrazyCabbage 2015 年 3 月 29 日 下午 1:11 
Added the section to close the doors, i keep getting an error; 'main Method not found, please add main method into script'
Kesuke  [作者] 2015 年 3 月 29 日 上午 9:08 
Baron Samedi - Very, very easily. Find this part in the code;

if(pressureStatus == "Depressurized") {
alarm.GetActionWithName("PlaySound").Apply(alarm);
} else {
LCDText += " All " + airVents.Count + " zones are currently pressurised";
}

And change it to this;

if(pressureStatus == "Depressurized") {
alarm.GetActionWithName("PlaySound").Apply(alarm);
// Close all doors when pressure is lost
List<IMyTerminalBlock> allDoors = new List<IMyTerminalBlock>();
GridTerminalSystem.GetBlocksOfType<IMyDoor>(allDoors);
for (int i = 0; i < allDoors.Count; i++) {
allDoors .GetActionWithName("Open_Off").Apply(allDoors );
}
} else {
LCDText += " All " + airVents.Count + " zones are currently pressurised";
}

And that will close all doors on the ship when pressure is lost :)
Kesuke  [作者] 2015 年 3 月 29 日 上午 9:08 
Candum - The timer doesn't need to trigger itself. The script triggers the timer when it completes. This is to prevent the timer trying to trigger the script if it is already in progress.

bill4725 - You can have as many (or few) vents and LCD's. You don't need to make the number of vents and LCDs match. The problem you had was probably that the ownership of the LCDs wasn't set to you and the public text wasn't set to "Everybody" and "read only". I'm glad you got it fixed. Let me know if you still have trouble and maybe upload it to the workshop.

kyrkbarron - If you want to exclude an air vent from this system simply give it a name that doesn't begin with "Air Vent".
jarhead 2015 年 3 月 29 日 上午 6:21 
I have not downloaded yet but when I do I am going totry to make this scallable so you can have 1 lcd with 20 vent s or the other way around.
sapper4725 2015 年 3 月 29 日 上午 4:42 
Got it working turns out if you have 5 vents you need 5 LCD's in the group I only had 4 added a fifth and it worked