Page 2 of 5

Posted: Tue Aug 19, 2008 8:53 pm
by Frame
Cmdr James wrote:
Just a quick note that in the latest trunk version, I think you need to change the script to player.ship.target.bounty as player.target.bounty does not seem to work.
Thanks...

does player.ship work in 1.71.2 ? In that case I will make the corrections right away...

Edit

Answering that one myself.. and that is a negative... player.ship.target.bounty does not work in 1.71
Oolite 1.71.2 sdterr.txt wrote:

Code: Select all

----- JavaScript warning: reference to undefined property player.ship
2008-08-19 20:58:18.928 oolite.exe[3796] [script.javaScript.warning.162]:       AddOns/BountyScanner.oxp/Scripts/BountyScanner.js, line 43.
Edit

added Version detection... instead

Code: Select all

this.startUp = function()
{
	//log("BountyScanner.js","Oolite version "+oolite.version)
	if(oolite.version == "1,71" || oolite.version == "1,71,2")
	{
		//log("BountyScanner.js","detected 1.71 or1.71.2")
		this.Theplayership = player
	}	
	else
	this.Theplayership = player.ship
}

Posted: Wed Aug 20, 2008 9:35 am
by Eric Walch
Cmdr James wrote:
Just a quick note that in the latest trunk version, I think you need to change the script to player.ship.target.bounty as player.target.bounty does not seem to work.
This change will affect more that 50% of the oxp's with JS. e.g. all mission oxp's won't work proper anymore. Most check for "player.docked" which becomes "player.ship.docked".

I already started changing things in some of my oxp's to let them work with both Oolite versions, I a similar way as Frame showed above.

Posted: Wed Aug 20, 2008 6:16 pm
by Cmdr James
Most JS methods should still work in trunk, but may give warnings. For some reason a few of them dont work properly. I think player.target is one of them. But it could be that I have broken it in my copy ;)

Posted: Fri Aug 22, 2008 9:15 pm
by JensAyton
Frame wrote:

Code: Select all

this.startUp = function()
{
	//log("BountyScanner.js","Oolite version "+oolite.version)
	if(oolite.version == "1,71" || oolite.version == "1,71,2")
	{
		//log("BountyScanner.js","detected 1.71 or1.71.2")
		this.Theplayership = player
	}	
	else
	this.Theplayership = player.ship
}
You spelled the version numbers wrong, and missed 1.71.1. The correct way to do this is:

Code: Select all

if (0 < oolite.compareVersion("1.72"))
{
    // 1.71.x or earlier
    this.thePlayerShip = player;
}
else
{
    // 1.72 or later
    this.thePlayerShip = player.ship;
}
Cmdr James wrote:
Just a quick note that in the latest trunk version, I think you need to change the script to player.ship.target.bounty as player.target.bounty does not seem to work.
Weird, player.target.bounty works here (with a warning). Have you rebuilt the cache since I last changed the prefix script? :-)

Posted: Sat Aug 23, 2008 6:26 am
by Frame
Ahruman wrote:
Frame wrote:

Code: Select all

this.startUp = function()
{
	//log("BountyScanner.js","Oolite version "+oolite.version)
	if(oolite.version == "1,71" || oolite.version == "1,71,2")
	{
		//log("BountyScanner.js","detected 1.71 or1.71.2")
		this.Theplayership = player
	}	
	else
	this.Theplayership = player.ship
}
You spelled the version numbers wrong, and missed 1.71.1. The correct way to do this is:

Code: Select all

if (0 < oolite.compareVersion("1.72"))
{
    // 1.71.x or earlier
    this.thePlayerShip = player;
}
else
{
    // 1.72 or later
    this.thePlayerShip = player.ship;
}
yeah missed 1.71.1, but when i print out to tthe debug console, i get "1,71,2" not "1.71.2".. so does this mean we got different outputs for mac and windows, or can this might be keyboard langauge related ?

Posted: Sat Aug 23, 2008 2:45 pm
by JensAyton
I’m rather surprised that it happens in that context, but this is down to a bug in the C standard library implementation in Windows – in violation of the spec, it applies locale settings in certain contexts by default. Anyway, you’ll get commas or points depending on system language settings, but only under Windows, and your test won’t work at all on English-language installations. It’s entirely possible that this means oolite.compareVersion() and requires.plist don’t work properly in non-English versions of Windows, though.

Posted: Sat Aug 23, 2008 5:22 pm
by Eric Walch
Ahruman wrote:
I’m rather surprised that it happens in that context,
The same with me on a Mac. When I type "oolite.version" in the console I get the version comma separated. But compare version works for me. There I use points however.

Posted: Sat Aug 23, 2008 11:23 pm
by JensAyton
Hey look, it happens here too. :-p

The reason is simple: oolite.version is not a string but an array. oolite.versionString is a string. The idea that [1, 72] == "1,72" hadn’t occurred to me.

Posted: Tue Aug 26, 2008 8:52 am
by Thargoid
V1.03 still seems to be reporting a spawned Thargoid Warship (role "oolite-thargoid") as a bounty of 460c, even though on nuking it yields 100c?

Posted: Tue Aug 26, 2008 2:33 pm
by Frame
Thargoid wrote:
V1.03 still seems to be reporting a spawned Thargoid Warship (role "oolite-thargoid") as a bounty of 460c, even though on nuking it yields 100c?
i´ll make a special check for thargoids with bounty more than 100 cr... and show the correct bounty awarded, which will be maximum 100 cr... in version 1.04...

Posted: Tue Aug 26, 2008 5:21 pm
by Lestradae
Frame wrote:
... show the correct bounty awarded, which will be maximum 100 cr... in version 1.04...
Why the 100Cr maximum?

Posted: Tue Aug 26, 2008 8:18 pm
by Frame
Lestradae wrote:
Frame wrote:
... show the correct bounty awarded, which will be maximum 100 cr... in version 1.04...
Why the 100Cr maximum?
dunno, just is so... Thargoid bounty is max 100, not sure for the robot fighters though... i known theire bounty goes up if they hit a police ship... wheter or not it maxs out at 100, i dont know.

in case anyone wonders. this has nothing to do with this OXP, it is a hard-coded max bounty for Thargoids...

Posted: Tue Aug 26, 2008 8:48 pm
by dalek501
Is that for all Thargoids or just standard original ones? I'm sure I destroyed a battle cruiser type and got far more than 100cr.

Posted: Tue Aug 26, 2008 10:28 pm
by Frame
dalek501 wrote:
Is that for all Thargoids or just standard original ones? I'm sure I destroyed a battle cruiser type and got far more than 100cr.
Can´t speak for OXP ships... but i think it only counts for the build in ones... or those OXP ships that mimics them..

Posted: Wed Aug 27, 2008 8:16 am
by dalek501
I see. :)