IFF add on OXP.. Bounty Information

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

Moderators: another_commander, winston

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 »

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
}
Bounty Scanner
Number 935
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 »

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.
User avatar
Cmdr James
Commodore
Commodore
Posts: 1357
Joined: Tue Jun 05, 2007 10:43 pm
Location: Berlin

Post 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 ;)
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 »

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? :-)
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 »

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 ?
Bounty Scanner
Number 935
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 »

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.
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 »

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.
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 »

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.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5525
Joined: Thu Jun 12, 2008 6:55 pm

Post 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?
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 »

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...
Bounty Scanner
Number 935
User avatar
Lestradae
---- E L I T E ----
---- E L I T E ----
Posts: 3095
Joined: Tue Apr 17, 2007 10:30 pm
Location: Vienna, Austria

Post by Lestradae »

Frame wrote:
... show the correct bounty awarded, which will be maximum 100 cr... in version 1.04...
Why the 100Cr maximum?
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 »

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...
Bounty Scanner
Number 935
User avatar
dalek501
Deadly
Deadly
Posts: 185
Joined: Sat May 17, 2008 10:47 am
Contact:

Post 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.
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 »

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..
Bounty Scanner
Number 935
User avatar
dalek501
Deadly
Deadly
Posts: 185
Joined: Sat May 17, 2008 10:47 am
Contact:

Post by dalek501 »

I see. :)
Post Reply