Re: OXP Development Best Practices
Posted: Sat Jul 21, 2012 5:32 pm
Ah, yes.
But yours is XML and mine's openstep so it's easier to read
But yours is XML and mine's openstep so it's easier to read
For information and discussion about Oolite.
https://bb.oolite.space/
I have seen that too and thought it odd. With Smivs (my first example) version the Name.oxp folder is there at the top so you can just grab it and drop into the Addons folder on your PC. With the version you mentioned you have to go one level deeper first before dragging and dropping.El Viejo wrote:That's how I find many OXPs packaged already - it makes sense to me, but that means zilch!PhantorGorth wrote:... surely that having a folder Name is redundant?
I’d like to clarify this a bit.Ahruman wrote:
- There are a great deal of custom functions which are not differentiated from callbacks used by the game. Our recommendation is that internal script functions have names beginning with
_
or$
.
_
and $
are permitted characters at the start of an identifier which are very obviously not lowercase letters. (A convention I now use, but which isn’t used in the Oolite built-in scripts, is to use $
for custom properties and _
for variables used to hide state in closures, a pattern I’m not going to go into here.)[]
syntax, like this["& what a clever name!"] = 3;
. But that would be silly.new
operator. The constructors you’re most likely to see in Oolite scripts are Vector3D
and Quaternion
, as in let v = new Vector3D(1, 0, 0);
. These very roughly correspond to classes in other object-oriented languages._
or $
. This isn’t very interesting for most scripts, but could be useful for libraries. For example, a library might export a constructor Frob
like so:
Code: Select all
this.name = "ahruman_frobLibrary";
this.Frob = function Frob(x)
{
// Set up this as a Frob object here.
Object.defineProperty(this, "x", { get: function () { return x; } });
}
Frob.prototype.plusOne = function plusOne()
{
return this.x + 1;
}
Code: Select all
this.startUp = function ()
{
let frobLib = worldScripts["ahruman_frobLibrary"];
let myFrob = new frobLib.Frob(3);
log("frobLib.test", myFrob.plusOne()); // Logs 4.
}
Code: Select all
this.sc_configuration_both = 0;
this.sc_string2bool = function(setting)
{
if ( setting === "true" )
{ return true;}
else
{ return false;};
};
Code: Select all
this.sc_configuration_both = 0;
this._sc_string2bool = function(setting)
{
if ( setting === "true" )
{ return true;}
else
{ return false;};
};
Code: Select all
this._sc_configuration_both = 0;
this._sc_string2bool = function(setting)
{
if ( setting === "true" )
{ return true;}
else
{ return false;};
};
I'm using a mission screen in my oxp to show market data of some secondary stations just like the main station market data can be viewed in flight by pressing f8. If the use of mission screen in flight is not preferred, what is the preferred way of doing this?The use of mission screens in flight is considered obsolete.
In 1.77.1? Wait until the player docks, then show them. The problem is that there are some fairly irritating bugs with mission screens in flight - try displaying a mission screen while the player is using the docking computer, for an obvious one that's still unfixed (and I think may have been even more serious in earlier versions). On a conceptual level, locking the player out of their flight controls is a potentially serious problem.spara wrote:If the use of mission screen in flight is not preferred, what is the preferred way of doing this?
Thanks, that clarifies it. I suggest mentioning that on the wiki page too.cim wrote:The problem is that there are some fairly irritating bugs with mission screens in flight...
On a conceptual level, I would like to be able to extend the in-built f5, f6, f7 and f8 screens so that for example pressing multiple times f8 would rotate through other selected local markets. Just like f5 currently two rotates displays. At the moment the only way I have been able to do anything like that is through a mission screen.cim wrote:On a conceptual level, locking the player out of their flight controls is a potentially serious problem.
Oh, there are a lot of goodies waiting in 1.79, haven't been able to make the switch yet. I still constantly find new oxp-wise usable things in 1.77.1 .cim wrote:1.79 introduces multi-function displays: between those and primable equipment controls you should be able to display a fair amount of text and give some choice controls. Have a look at the tutorial for an example.
Yes, they're in the nightly builds.Keeper wrote:Are the new HUD entries working? I'll have to add them to my HUD and work on their sizes/positions if so (assuming there is a way to make them show up already).
Check out the tutorial scenarioKeeper wrote:But how can I see the multi-function displays in action? Is there any core element or OXP that uses them yet?
Odd - worked when I last tried it out. How many items of primable equipment do you have installed?Keeper wrote:Bug in drawPrimedEquipment: When using n_bars=3, after switching from "None", the top line reads the same as the new primed line, instead of reading "None". Also, n_bars=2 is the same as n_bars=3. Anticipated function was to show primed equipment on upper line and the next queued equipment on a lower line (i.e., like n_bars=3 but without the top "previously selected" line).