In the Topic Homemade Space-Flightsimulator Oolite Cockpit Panel, I and hopefully others start to make flight control panels.
Now we would like to switch on a big red light on red alert, but nobody knows how to make an OXP (or has time for it), that calls an external script like "RedAlert.py" in the program folder. Or just write the alert condition into a file, that is readable by external programs.
I there a genius dude out there, who can help us ?
Who can make an OXP for the Cockpit makers ?
Moderators: winston, another_commander
Re: Who can make an OXP for the Cockpit makers ?
Code: Select all
this.name = "Alert Log Script";
this.author = "Thargoid";
this.copyright = "Creative Commons: attribution, non-commercial, sharealike";
this.description = "Write alert state to the log.";
this.version = "1.00";
"use strict";
this.alertConditionChanged = function(newCondition, oldCondition)
{ log(this.name, "Alert condition changed to " + newCondition); }
Put that OXP into your AddOns folder, and now whenever your alert condition changes you will get a message written into your latest.log file. You'll see things like
[Alert Log Script]: Alert condition changed to 0
or [Alert Log Script]: Alert condition changed to 2
(preceded by a time-stamp) where:0 - Docked
1 - Green
2 - Yellow
3 - Red
Oolite can't write to any file other than latest.log (and your save game file of course, but that's not what we want here).
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
- Smivs
- Retired Assassin
- Posts: 8408
- Joined: Tue Feb 09, 2010 11:31 am
- Location: Lost in space
- Contact:
Re: Who can make an OXP for the Cockpit makers ?
OK, completely bonkers idea that almost certainly wouldn't work but might point to a way that could.
Make a couple of .ogg files of one second duration, a single frequency each. Detect red alert using js (as above) and play the first .ogg once. This is an audible indicator that you have gone to red alert, but (here's the clever bit), your cockpit panel also receives the audio out from the game, and will look for that one specific frequency. When it does, it turns your Big Red Light on. When you exit red alert the second .ogg is triggered, and you get an 'all clear' sound and your console turns off the Big Red Light.
You would have to ensure that none of the game sound effects will trigger this, but this might be resolveable by doing clever things with the .ogg files, or even editing the game sounds to remove the frequencies used.
As I said, just a crazy thought...
Make a couple of .ogg files of one second duration, a single frequency each. Detect red alert using js (as above) and play the first .ogg once. This is an audible indicator that you have gone to red alert, but (here's the clever bit), your cockpit panel also receives the audio out from the game, and will look for that one specific frequency. When it does, it turns your Big Red Light on. When you exit red alert the second .ogg is triggered, and you get an 'all clear' sound and your console turns off the Big Red Light.
You would have to ensure that none of the game sound effects will trigger this, but this might be resolveable by doing clever things with the .ogg files, or even editing the game sounds to remove the frequencies used.
As I said, just a crazy thought...
Commander Smivs, the friendliest Gourd this side of Riedquat.
Re: Who can make an OXP for the Cockpit makers ?
Wow, that was a fast answer and it's working, woo hoo!
Thank you Thargoid !
So, I'm away for programming, soldering, bending and welding...
Thank you Thargoid !
So, I'm away for programming, soldering, bending and welding...