Page 1 of 1
Who can make an OXP for the Cockpit makers ?
Posted: Tue Sep 04, 2012 8:40 pm
by SwissMäc
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 ?
Re: Who can make an OXP for the Cockpit makers ?
Posted: Tue Sep 04, 2012 9:24 pm
by Thargoid
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); }
Save the above as "script.js" then make a folder called "AlertLog.oxp" (or whatever you want to call it). Then make a sub-folder within that called "Config" and drop the script.js file in there.
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).
Re: Who can make an OXP for the Cockpit makers ?
Posted: Tue Sep 04, 2012 10:49 pm
by Smivs
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...
Re: Who can make an OXP for the Cockpit makers ?
Posted: Tue Sep 04, 2012 11:40 pm
by SwissMäc
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...