[Release] Market Observer

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

Moderators: winston, another_commander

User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2691
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: [Release] marketObserver 2.2.2

Post by spara »

laxori666 wrote:
A small bug report here: if I have hypercargo installed, and I hit F5-F5 and then F8 at the main station, I get taken to the trading screen but it is missing some info:
:shock: I'll check it out. Probably some problem with HC and commodity markets. Anything in the log?
laxori666
Competent
Competent
Posts: 37
Joined: Mon Sep 02, 2013 3:45 am

Re: [Release] marketObserver 2.2.2

Post by laxori666 »

spara wrote:
:shock: I'll check it out. Probably some problem with HC and commodity markets. Anything in the log?
Doesn't look like it, no. This is the tail end of me turning game on, loading, hitting F5-F5 F8, getting the bugged screen, then exiting:

Code: Select all

15:18:38.052 [startup.complete]: ========== Loading complete in 5.84 seconds. ==========
15:18:40.542 [dirty_hack]: Hacking WildShips
15:18:40.542 [dirty_hack]: Hacking Anarchies
15:18:40.542 [dirty_hack]: Hacking ConStores
15:18:40.542 [dirty_hack]: Hacking Tionisla Chronicle Array
15:18:40.542 [dirty_hack]: Hacking Space Bars
15:18:40.543 [dirty_hack]: Hacking Buoy Repair
15:18:43.535 [script.load.world.listAll]: Loaded 180 world scripts:
    [...]
15:18:46.204 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (Safe_Docking 1.0.1): TypeError: worldScripts[s] is undefined
15:18:46.204 [script.javaScript.exception.unexpectedType]:       ../AddOns/Safe_Docking.oxp/Scripts/SD_script.js, line 52.
15:18:47.242 [dirty_hack]: Hacking WildShips
15:18:47.242 [dirty_hack]: Hacking Anarchies
15:18:47.242 [dirty_hack]: Hacking ConStores
15:18:47.242 [dirty_hack]: Hacking Tionisla Chronicle Array
15:18:47.242 [dirty_hack]: Hacking Space Bars
15:18:47.243 [dirty_hack]: Hacking Buoy Repair
15:18:55.408 [exit.context]: Exiting: Exit Game selected on options screen.
15:18:55.411 [gameController.exitApp]: .GNUstepDefaults synchronized.

Closing log at 2013-09-03 15:18:55 -0400.
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2691
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: [Release] marketObserver 2.2.2

Post by spara »

Can't reproduce it :(. Oolite 1.77, HC 1.10, mO 2.2.2, mO-cm 1.1. To debug further, I need your oxp list so I can replicate your install. Please post the relevant part from your log here or pm me.
User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2577
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: [Release] marketObserver 2.2.2

Post by Norby »

laxori666 wrote:
I get taken to the trading screen but it is missing some info
My guess: try to reduce the refresh timer from 8 to 1 second in the 463. line near the end of script.js and the info maybe shown shortly.
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2691
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: [Release] marketObserver 2.2.3

Post by spara »

With the help of laxori666 and his excellent bug report I was able to hunt the bug down and squash it. And while I was out there I spotted and squashed another bugger too :D.

New version (2.2.3)

* fixed two rare bugs
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2691
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: [Release] marketObserver 2.2.3

Post by spara »

Laxori666 has tweaked the Commodity Markets OXP addon to preserve buy/sell prices over saves. Download an updated version (1.2) from the wiki.
realbrit
Mostly Harmless
Mostly Harmless
Posts: 2
Joined: Thu May 29, 2014 8:34 am

Re: [Release] marketObserver 2.2.3

Post by realbrit »

I believe I have found a bug. I'm seeing a problem with event dependency when I dock at a station. I'm running the latest Trunk build for 1.79. The playerBoughtCargo function in the mo_CommodityMarket oxz is firing and completing before the same function in marketObserver has had time to execute. The result is that the buy log is left showing double the quantity of goods bought as the sale and re-buy under moCommodityMarket is processed before the original buy.

When I dock at a station I then get a message that I lost X amount of cargo because the buy log quantity and the manifest quantity are different. This means that my trader rating is constantly moving in a negative direction.

EDIT:

I have resolved the issue by updating the playerBoughtCargo function in the script.js file in oolite.oxp.spara.mo_commodity_markets.oxz to the following:

Code: Select all

this.playerBoughtCargo = function(commodity, units, price) 
{
	 this.$eventTimer = new Timer(this, function() { this.$updateBoughtCargo(commodity, units, price); }, 1, -1);
}

this.$updateBoughtCargo = function(commodity, units, price)
{
   ... original playerBoughtCargo function
{
This gives a second for all other playerBoughtCargo events to process before processing the moCommodityMarket event.
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2691
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: [Release] marketObserver 2.2.3

Post by spara »

realbrit wrote:
I believe I have found a bug. I'm seeing a problem with event dependency when I dock at a station. I'm running the latest Trunk build for 1.79. The playerBoughtCargo function in the mo_CommodityMarket oxz is firing and completing before the same function in marketObserver has had time to execute. The result is that the buy log is left showing double the quantity of goods bought as the sale and re-buy under moCommodityMarket is processed before the original buy.

When I dock at a station I then get a message that I lost X amount of cargo because the buy log quantity and the manifest quantity are different. This means that my trader rating is constantly moving in a negative direction.

EDIT:

I have resolved the issue by updating the playerBoughtCargo function in the script.js file in oolite.oxp.spara.mo_commodity_markets.oxz to the following:

Code: Select all

this.playerBoughtCargo = function(commodity, units, price) 
{
	 this.$eventTimer = new Timer(this, function() { this.$updateBoughtCargo(commodity, units, price); }, 1, -1);
}

this.$updateBoughtCargo = function(commodity, units, price)
{
   ... original playerBoughtCargo function
{
This gives a second for all other playerBoughtCargo events to process before processing the moCommodityMarket event.
Nice fix :D . I wonder why this issue has not surfaced before. I'll be updating the oxp with the fix later. Thanks for reporting and for the fix.

Edit: Bugger :( . Something's still wrong after the fix. Try a fresh start and buy and sell something. I'll have to dig deeper. Don't have time at the moment though. I'll be back with it later or in a couple of days. It might be that Market Observer needs a stab rather than Commodity Markets.
realbrit
Mostly Harmless
Mostly Harmless
Posts: 2
Joined: Thu May 29, 2014 8:34 am

Re: [Release] marketObserver 2.2.3

Post by realbrit »

I'd seen the "Cargo Lost" messages on docking before but they did not seem to affect anything so I had ignored them. Now I have a trader rating to protect I started looking!

The fix works for me as far as reporting the correct profit/loss on a transaction. I started a new commander, bought food and textiles, launched, turned around and docked with Lave station. No cargo lost report, no change to the trader rating, correct calculation of profit/loss if I sell the cargo.

However the fix has now introduced an issue on the purchase screen where the quantity, price and player credits do not get updated accurately. I'll continue to look.
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2691
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: [Release] marketObserver 2.2.3

Post by spara »

realbrit wrote:
I'd seen the "Cargo Lost" messages on docking before but they did not seem to affect anything so I had ignored them. Now I have a trader rating to protect I started looking!

The fix works for me as far as reporting the correct profit/loss on a transaction. I started a new commander, bought food and textiles, launched, turned around and docked with Lave station. No cargo lost report, no change to the trader rating, correct calculation of profit/loss if I sell the cargo.

However the fix has now introduced an issue on the purchase screen where the quantity, price and player credits do not get updated accurately. I'll continue to look.
There seems to be a core bug in effect here. I'll report it and wait for a fix and then I'll look deeper. Meanwhile I suggest not using Commodity Markets oxp. Market Observer should work just fine.
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2691
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: [Release] marketObserver 2.2.3

Post by spara »

There was no bug in the core, but a feature I was not aware of. I'm wiser again, thanks to cim :D . I have fixed the issue realbrit reported and now there are new versions of both Market Observer (2.2.5) and Commodity Markets (1.2.2) available from the expansion manager. Both need to be updated for Commodity Markets to work properly.

Big thank you, realbrit, for a detailed bug report. That helped a lot :D .
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2691
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: [Release] marketObserver 2.2.3

Post by spara »

Another Oolite 1.79/1.80 glitch fixed. MFDs are meant to work so that if you dock and launch the game remembers what was shown. That breaks if someone uses hud switching and switches to a hud that does not have MFDs defined. Even though no MFDs are shown while docked, they must be defined. Market Observer did exactly that, it switched to it's own hud that had no MFDs defined in the market screen and the game forgot the MFD layout even though the correct HUD was restored.

This has now been fixed. Version 2.2.6 defines two bogus MFDs to the market screen and now the game remembers the layout. Get the new version from the expansion pack manager.

There are a few switching huds out there that should be checked for this behaviour, if they get converted to oxzs.
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: [Release] marketObserver 2.2.3

Post by cim »

spara wrote:
This has now been fixed. Version 2.2.6 defines two bogus MFDs to the market screen and now the game remembers the layout. Get the new version from the expansion pack manager.
Probably no hurry at this stage, but it might be worth defining more than two for this sort of thing, since there's no limit on the number of MFDs a HUD can define, and you want to have at least as many as any real HUD.
spara wrote:
There are a few switching huds out there that should be checked for this behaviour, if they get converted to oxzs.
...and a quick note on this, hopefully without derailing the whole thread: from 1.79 you can bind HUD elements to particular alert conditions, so some switching HUDs may be simplified to non-switching HUDs.
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2691
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: [Release] marketObserver 2.2.3

Post by spara »

No hurry of course, but since I have updated the Aad-hud to have 4 mfds, I had to update this one too. Now this one supports huds with up to 6 mfds.
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2691
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: [Release] marketObserver 2.2.8

Post by spara »

New version 2.2.8

* Fixed issue with Target Reticle oxp.
Post Reply