Page 7 of 13

Re: Email System (Release)

Posted: Tue Mar 31, 2015 3:58 pm
by QCS
The "Small fix on good service level" item in the shop seems to create emails (shown in F4 as unread) but when opening the Email system, no mail is there.

Log (excerpt):

JavaScript warning (GalCopAdminServices 1.4.4): Unknown expansion key [maint_itemname_EQ_SERVICE_LEVEL_SMALL_FIX_4] in string.
oolite.oxp.phkb.EmailSystem.oxz/Scripts/galcopadmin.js, line 409.

---
Edit:
When my escorts (EscortDeck/EscortPack OXP) kill a fugitive with a bounty, the email states (no bounty).

Re: Email System (Release)

Posted: Tue Mar 31, 2015 10:38 pm
by phkb
Vincentz wrote:
How about sending an email when getting Cargo, Passenger Parcel contracts?
Wildeblood wrote:
The contracts should already be creating emails for Oolite 1.81
Wildeblood is correct, you'll get emails about contracts (and scooped escape pods) in 1.81.
Vincentz wrote:
Sends email to archive
I'm not sure about the archive function. The problem is not technical (it's not that hard to do), but practical. Archived emails have to be stored and retrieved. All that storage is in your save game file, and when the save game is loaded all that data has to go into memory somewhere. Having thousands, or even hundreds, of archived email is a massive resource drain, both in memory allocation and save game size.

The reason I made most of the automated emails expire automatically is to keep the size of the mailbox down. Regular playing should mean only 1 or 2 pages of emails are being stored and retrieved.

I'm not necessarily against the idea, but I'm not sure of the best way to implement it that ensures a reasonable memory footprint.

What do others think? Would an archive system be valuable? Should it have a hard limit of, say, 100 emails? That way, if you want to archive more, you have to delete some archived emails. Or if you archive more than 100, the oldest archived emails are dropped? Other ideas?
QCS wrote:
The "Small fix on good service level" item
What OXP is that from?
QCS wrote:
When my escorts (EscortDeck/EscortPack OXP) kill a fugitive with a bounty, the email states (no bounty).
Interesting. That would mean the shipKilledOther function is getting called when your escorts kill a ship, but it's not providing details of the ship that was killed (the whom parameter). I'll have to look into the Export Pack OXP and see what it's doing.

Re: Email System (Release)

Posted: Tue Mar 31, 2015 10:54 pm
by Wildeblood
phkb wrote:
QCS wrote:
The "Small fix on good service level" item
What OXP is that from?
One of Norby's, Hardships possibly.

Re: Email System (Release)

Posted: Tue Mar 31, 2015 11:28 pm
by Norby
phkb wrote:
QCS wrote:
The "Small fix on good service level" item
What OXP is that from?
ShipVersion

Re: Email System (Release)

Posted: Wed Apr 01, 2015 2:02 am
by phkb
Thanks Wildeblood and Norby. I'll check it out.

Re: Email System (Release)

Posted: Wed Apr 08, 2015 4:47 am
by phkb
Version 1.4.5 has been released. In this version:
  • Added some more equipment key exclusions for the maintenance email (ShipVersion OXP items)
  • Added some special cases for ShipVersion repair equipment items.
  • Switched from shipKilledOther to shipTargetDestroyed to better monitor for ships destroyed by the player
  • Small bug fixes and tweaks.
Hopefully this will play nicely with ShipVersion now - let me know if you discover a problem.

Re: Email System (Release)

Posted: Wed Apr 08, 2015 6:05 am
by CdrC64
phkb wrote:
Version 1.4.5 has been released. In this version:
Hi phkb,

I'm having some issues downloading this from inside the game. I believe the version number in manifest.plist is still set to 1.4.4

Regards,

Glenn

Re: Email System (Release)

Posted: Thu Apr 09, 2015 7:53 am
by phkb
Thanks for the report, Glenn. I'll get an update posted later this evening.

Edit: OK, Version 1.4.6 is released, which fixes the manifest version number issue, and another small issue with the "maint_itemname" errors in the log file.

Re: Email System (Release)

Posted: Thu Apr 09, 2015 11:15 am
by Wildeblood
You're some kind of workaholic, phkb.

Re: Email System (Release)

Posted: Fri Apr 10, 2015 5:58 am
by phkb
I like to code. And Oolite is part of my pain management strategy.

Re: Email System (Release)

Posted: Sun Apr 12, 2015 3:40 pm
by phkb
Version 1.4.7 has just been release and is available via the download manager or via links in the first post. This version fixes an issue with the Combat Simulator OXP, where invalid emails were being sent after destroying simulator ships.

Re: Email System (Release)

Posted: Thu May 14, 2015 4:26 pm
by Norby
Here is a fix for a timelimit problem in galcopadmin.js. When I bought a ship with 30 equipment:

Code: Select all

17:33:40.427 [script.javaScript.timeLimit] OperationCallback (OOJSEngineTimeManagement.m:229): ***** ERROR: Script "GalCopAdminServices" ran for 1.80469 seconds and has been terminated.
17:33:40.427 [script.javaScript.stackTrace] OOJSDumpStack (OOJavaScriptEngine.m:811):  0 (galcopadmin.js:924) <anonymous function>
I measured the running time of the important part in debug console:

Code: Select all

var a=console.getProfile(function(){
var equip,ship=player.ship;for (var i = 0; i < ship.equipment.length; i++) {
	if ("EQ_HULL_REPAIR".indexOf(ship.equipment[i].equipmentKey) == -1) {
		if (ship.equipment[i].isPortableBetweenShips == false) {
			equip += "- " + ship.equipment[i].name + "\n";
			added = true
		}
	}
}});log(this.name,a.javaScriptTime+" : "+a.totalTime);

0.003686000000003631 : 3.788045  
Almost 4 seconds due to the access of the equipment array is very slow.

You can fix it like this:

Code: Select all

var a=console.getProfile(function(){
var equip,e=player.ship.equipment,i;for (i = 0; i < e.length; i++) {
	var q = e[i];
	if ("EQ_HULL_REPAIR".indexOf(q.equipmentKey) == -1) {
		if (q.isPortableBetweenShips == false) {
			equip += "- " + q.name + "\n";
			added = true
		}
	}
}log(this.name,"i="+i);});
log(this.name,a.javaScriptTime+" : "+a.totalTime);

i=30

0.0004270000000001165 : 0.013895
270 times faster. :)

Re: Email System (Release)

Posted: Thu May 14, 2015 10:21 pm
by phkb
Norby wrote:
270 times faster
:shock: :shock:

Wow. OK, well, new version will be out soon. Thanks for taking the time to find and debug the issue Norby.

Re: Email System (Release)

Posted: Fri May 15, 2015 2:05 am
by Wildeblood
phkb wrote:
Norby wrote:
270 times faster
:shock: :shock:

Wow.
I think if you go back to the first page of this thread, I was harping on about avoiding player.ship.equipment as much as possible. :D

Re: Email System (Release)

Posted: Fri May 15, 2015 2:24 am
by phkb
Version 1.4.11 is now up which incorporates the changes Norby supplied to improve performance.
Wildeblood wrote:
I think if you go back to the first page of this thread, I was harping on about avoiding player.ship.equipment as much as possible
My apologies for not taking your advice sooner. Got there in the end, though.