I have a total of 19 bulk doors throughout the ship. I need to track if each one has been opened for the first time and if they are currently open or closed. As this can cause a lot of different affects on the environment. I can do this with a very long if and true/false setup but was wondering if anybody might have a clever code to handle the check. Thanks.
Can you set a door to be 1 if it’s never been opened. 2 if it’s currently closed. 3 if it’s opened for the first time. And 4 if it’s been previously opened?
Then do a *if <3 will tell you it’s closed. And *if >2 will tell you it’s open. And when you need to check to see if it’s been opened before you can check the individual numbers?
At least that way you’re tracking all possible door states on the one variable.
Hmmm my mind is turning not sure if it will make the code smaller but still a great idea. Will have to grind the gears in my head to see if I can make it function in and easy method.
Part of the checks comes in with the heater and power demand. As they are running on battery backup which heats only a small area and as each door is open or closed will increase/decrease the demand on the heater causing more drain on the battery accordingly to how many have been left open. Requiring a rather cumbersome check.
Hrrm sounds like you might be overthinking it. Sounds like a simple (well fairly simple) *gosub counter, with a check if it has been run before or not. The first time it runs the counter. It would be setting the doors status (way easier if they all are closed at start but a few more lines could fix that). The second time it is run the counter would go through the doors checking if their statuses changed, also with the number of times it has changed if you want to keep track of that (ie power/heat loss).
That is my nature to overthink thingsjust ask @CJW LOL. I think a combination of what you’re telling me and the idea from @FairyGodfeather will make the solution rather simple. Thanks as always for all your awesome help.
Lol, I was tempted in writing a small example for it, but I just woke up from my nap lol.