Re: Scripters cove
Posted: Thu Jan 13, 2011 8:04 pm
Just checkEric Walch wrote:it still makes sense to check for "ship.docked == true
if (ship.docked). Explicitly comparing to true serves no purpose except in specialized situations.For information and discussion about Oolite.
https://bb.oolite.space/
Just checkEric Walch wrote:it still makes sense to check for "ship.docked == true
if (ship.docked). Explicitly comparing to true serves no purpose except in specialized situations.If I get this right you are talking about custom_views? If so thenCaptSolo wrote:Could someone please tell me the Oolite coordinate system as it pertains to the view screen? Thanks
Thanks for your reply. Should have been more specific as I was referring to the Forward, rear, left and right views. But I figured it out by studying the hud.plist. I have made a copy of that file to the Add Ons folder to tinker with.Svengali wrote:If I get this right you are talking about custom_views? If so thenCaptSolo wrote:Could someone please tell me the Oolite coordinate system as it pertains to the view screen? Thanks
[wiki]Shipdata.plist[/wiki] (custom_views), view_position is X,Y,Z - [0,0,0] should be the center.
[wiki]Quaternion[/wiki]
A good overview about Oolite
http://wiki.alioth.net/index.php/Catego ... _scripting
Code: Select all
{ // scanner
alpha = 1.0;
selector = "drawScanner:";
x = 0;
y = 60;
y_origin = -1;
height = 72.0;
width = 288.0;
rgb_color = (1.0, 0.0, 0.0);
},
this.$setUpSystem() in the Anarchies-script can be called from anywhere (including the JS-console, which is particularly useful for playtesting) with worldScripts.Anarchies.$setUpSystem().worldScript (see here), which is followed by the script name (the one specified in this.name at the top of your world script). There are some special rules if your script name contains a SPACE.You are right.DaddyHoggy wrote:If you say how, others will benefit from your discovery...
Code: Select all
worldScripts["scriptname"]["functionname"](args);That you need to include "this." when writing it down as string is new to me. I always used:Okti wrote:The method is
I tried it at the first place but I forgot to add this. before the function nameCode: Select all
worldScripts["scriptname"]["functionname"](args);
Code: Select all
worldScripts.scriptname.functionname(args)Code: Select all
worldScripts["scriptname"].functionname(args)"Capt Murphy"]Anyone know if the variable ship_trade_in_factor in the save file is visible to JS and if so what's the property to access it (player.ship.something???).
ship_trade_in_factor is not exposed.Eric Walch wrote:Both go without a "this". Writing down as string is only needed when the string contains special characters. A scriptname might contain such characters, but a function never.
foo.bar is purely shorthand for foo["bar"]. There is no difference in behaviour. As such, foo["Fred Bloggs"] = function () {} is perfectly valid.