Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

Scripters cove

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

Moderators: winston, another_commander

User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Thargoid wrote:
Commander McLane wrote:
saint wrote:
One question. Is it possible to have a ship bound to a character and have that character unique (that is, you can meet him until he's alive)?
This is a bit creepy, you know. :shock:
Says the Commander who wrote the Flying Dutchman ;)
Well, yeah :lol: ; but the Flying Dutchman is more a case of was-once-alive than hasn't-yet-been-alive.

*** static noise ***
User avatar
saint
Dangerous
Dangerous
Posts: 75
Joined: Fri Jul 24, 2009 5:17 pm
Location: 45.371747 N, 12.011885 E - Sol III
Contact:

Post by saint »

Hmmm.... Unlive edible poets...

Btw, as for the Flying Dutchman, do i need oolite>1.65 ho have working turrets ?
Image
Cmdr. Saint, Golden Gladstone with 4 leaves Clovers of the Most Noble Order or The B.D.c.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

saint wrote:
Btw, as for the Flying Dutchman, do i need oolite>1.65 ho have working turrets ?
Hmm, although I don't see the connection between the Dutchman and turrets; if you are talking about working turrets for player ships, and about really working, as in: without any issues, you would need at least the current trunk version, and even that wouldn't be really working.

If you just want to try out turrets on your ship (at your own risk), you need the latest test release 1.72.2.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

I just noticed that apple has changed the syntax rules for plist's in OSX 10.5. It is now compatible with the rule as used on windows:

Every element of an array ends now with an ,:

Code: Select all

(
    element1,
    element2,
    element3,
)
or

Code: Select all

(
   {
   },
   {
   },
   {
   },
)
Specially the last , in an array was allowed with windows but not with OSX 10.4. This sometimes resulted in code readable by windows but not on a mac.

I just noticed that the mac plist editor that ships with OSX 10.5, now always ends the elements in an array with a , as shown in my examples above. (No preferences to put it off to save it in a way as it was before).

This means code saved with this editor will be unreadable on Mac OSX 10.4 (tiger) or earlier! Be warned for those that write oxp's on a mac.
User avatar
wackyman465
---- E L I T E ----
---- E L I T E ----
Posts: 831
Joined: Thu Nov 06, 2008 10:15 pm
Location: Currently hunting you down in an Imperial Courier

Post by wackyman465 »

What's the mac .plist editor? I've got leopard but haven't seen it, and I just use textedit.
I shot him back first. That is to say, I read his mind and fired before he would have fired on me. No, sir, he wasn't a fugitive.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

It goes by the clever secret code name “Property List Editor”. It’s installed with Xcode.
User avatar
wackyman465
---- E L I T E ----
---- E L I T E ----
Posts: 831
Joined: Thu Nov 06, 2008 10:15 pm
Location: Currently hunting you down in an Imperial Courier

Post by wackyman465 »

ooh.. and there was me using a demo vers of plist edit pro... well I'll put that on as soon as I get back to where my OSX install disc is.
I shot him back first. That is to say, I read his mind and fired before he would have fired on me. No, sir, he wasn't a fugitive.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

wackyman465 wrote:
ooh.. and there was me using a demo vers of plist edit pro....
After noticing that the current macs plist editor generates a plist that probably generates errors with older Mac OS, I also used plist edit pro. That still saves in a way old macs and windows can read the plists.
User avatar
Cmd. Cheyd
---- E L I T E ----
---- E L I T E ----
Posts: 934
Joined: Tue Dec 16, 2008 2:52 pm
Location: Deep Horizon Industries Manufacturing & Research Site somewhere in G8...

Post by Cmd. Cheyd »

This is probably Easy-As-Dirt™, but how can I toggle a variable within one OXP's script from a second OXP's script?

Code: Select all

OXP_A
.....Script.js
..........Var Foo = False;

OXP_B
.....Script.js
..........Oxp_A.Script.Foo = True;
[/i]

Is it a simple issue of using:

Code: Select all

OXP_A
.....Script.js
..........This.Foo = False;

OXP_B
.....Script.js
..........This.Foo = True;
[/i]
User avatar
wackyman465
---- E L I T E ----
---- E L I T E ----
Posts: 831
Joined: Thu Nov 06, 2008 10:15 pm
Location: Currently hunting you down in an Imperial Courier

Post by wackyman465 »

Eric Walch wrote:
wackyman465 wrote:
ooh.. and there was me using a demo vers of plist edit pro....
After noticing that the current macs plist editor generates a plist that probably generates errors with older Mac OS, I also used plist edit pro. That still saves in a way old macs and windows can read the plists.
I don't mind just using textedit anyway..
I shot him back first. That is to say, I read his mind and fired before he would have fired on me. No, sir, he wasn't a fugitive.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5527
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

Cmd. Cheyd wrote:
This is probably Easy-As-Dirt™, but how can I toggle a variable within one OXP's script from a second OXP's script?

Code: Select all

OXP_A
.....Script.js
..........Var Foo = False;

OXP_B
.....Script.js
..........Oxp_A.Script.Foo = True;
[/i]

Is it a simple issue of using:

Code: Select all

OXP_A
.....Script.js
..........This.Foo = False;

OXP_B
.....Script.js
..........This.Foo = True;
[/i]
worldScripts["<script name here>"].<variable> is your man, where the script name is what you define at the top of the script using this.name.

So if your script has this.name = "Black Hole OXP Script" containing a variable eventHorizon, then from a second worldScript you can test for and change the variable using worldScripts["Black Hole OXP Script"].eventHorizon.

You can also use this to check if the script exists in the first place, using if(worldScripts["<script name here>"]), that being true if the script is loaded...

Where I say variable above, it can be any parameter of the script, such as a timer or a function as well (the this. in many script commands can be thought of as a shortcut for a worldScript call to the script that the command is within).
User avatar
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Post by Svengali »

Is it possible for a script to determine if a machine has shader support and if the player has enabled it?
ovvldc
---- E L I T E ----
---- E L I T E ----
Posts: 344
Joined: Sat Apr 02, 2005 9:32 am
Location: Netherlands

Post by ovvldc »

Ahruman wrote:
It goes by the clever secret code name “Property List Editor”. It’s installed with Xcode.
And if you do not want to install Xcode, ask someone who has it installed Xcode to zip it and send it to you - Property List Editor doesn't depend on Xcode.
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

Svengali wrote:
Is it possible for a script to determine if a machine has shader support and if the player has enabled it?
No

We cannot access information in regard to a graphics card abilities from Oolite Java scripting

And

as far as I know, we cannot access player settings either...

I would suspect such a value to be found

in Oojsoolite.m

relevant section here...

Code: Select all

static JSPropertySpec sOoliteProperties[] =
{
	// JS name					ID							flags
	{ "version",				kOolite_version,			JSPROP_PERMANENT | JSPROP_ENUMERATE | JSPROP_READONLY },
	{ "versionString",			kOolite_versionString,		JSPROP_PERMANENT | JSPROP_ENUMERATE | JSPROP_READONLY },
	{ "jsVersion",				kOolite_jsVersion,			JSPROP_PERMANENT | JSPROP_ENUMERATE | JSPROP_READONLY },
	{ "jsVersionString",		kOolite_jsVersionString,	JSPROP_PERMANENT | JSPROP_ENUMERATE | JSPROP_READONLY },
	{ 0 }
};
However, Oolite should take care of all the shading specific things for you..
when enabled and when not.
Bounty Scanner
Number 935
zevans
---- E L I T E ----
---- E L I T E ----
Posts: 332
Joined: Mon Jul 06, 2009 11:12 pm
Location: Uncharted backwaters of the unfashionable end of the western spiral arm

Post by zevans »

But... you can make ships that fall back to different textures if shaders aren't available, if I remember a similar discussion correctly... would that fix whatever it is you're trying to do?
Post Reply