Who can make an OXP for the Cockpit makers ?

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

Post Reply
User avatar
SwissMäc
Competent
Competent
Posts: 33
Joined: Wed May 10, 2006 7:54 pm
Location: Zürich

Who can make an OXP for the Cockpit makers ?

Post 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 :oops: (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 ?
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Re: Who can make an OXP for the Cockpit makers ?

Post 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).
User avatar
Smivs
Retired Assassin
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 ?

Post 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...
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
SwissMäc
Competent
Competent
Posts: 33
Joined: Wed May 10, 2006 7:54 pm
Location: Zürich

Re: Who can make an OXP for the Cockpit makers ?

Post 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... :mrgreen:
Post Reply