Page 1 of 3

[Release] marketAide

Posted: Fri Aug 31, 2012 5:50 pm
by spara
Hello.

I just can't remember min, avg and max prices of commodities and a I have to check them all the time so I created a very simple oxp that overlays the market screen with the data from the reference sheet.

Hope you find it useful.

Version 1.2

https://www.box.com/s/ixblm3pudvztqzkq8eqn

Re: marketAide oxp

Posted: Fri Aug 31, 2012 5:59 pm
by Smivs
Lots of people will find this useful. Nice one! :)
If I have one request, it is could the overlay also be available without an image?

Re: marketAide oxp

Posted: Fri Aug 31, 2012 8:17 pm
by Captain Beatnik
A good idea resulting in a very useful oxp. Good work, commander spara! :)

Re: marketAide oxp

Posted: Fri Aug 31, 2012 9:31 pm
by spara
Glad you like it.

I have updated the file to a new version. In the first version I accidentally merged the bgs market background with the commodities prices, so it really wasn't an overlay :?. I was using the backround to line up things. The new version is a true overlay. And a lot smaller in size :D.

Re: marketAide oxp

Posted: Sat Sep 01, 2012 2:09 am
by Rese249er
Awesome idea, waited till the fixes to download... Will be back with a review.

EDIT: Back with a review: simple, clean, and brilliant. I'm calling it a must-have.

Re: marketAide oxp

Posted: Sat Sep 01, 2012 2:57 am
by Wildeblood
It works, but not the way you think it does. :wink:
09:56:36.595 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (market_Aide 1.0): TypeError: this.$marketOverlay is undefined
09:56:36.595 [script.javaScript.exception.unexpectedType]: ../AddOns/marketAide.oxp/Scripts/aide.js, line 11.
Overlays are reset when you change screens, so this should be all you need in the script:-

Code: Select all

this.guiScreenChanged = function(to, from) {
	if (to == "GUI_SCREEN_MARKET" && guiScreen == "GUI_SCREEN_MARKET") {
	setScreenOverlay('aide_market_overlay.png');
	}
}

Re: marketAide oxp

Posted: Sat Sep 01, 2012 7:06 am
by spara
Wildeblood wrote:
It works, but not the way you think it does. :wink:
09:56:36.595 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (market_Aide 1.0): TypeError: this.$marketOverlay is undefined
09:56:36.595 [script.javaScript.exception.unexpectedType]: ../AddOns/marketAide.oxp/Scripts/aide.js, line 11.
Overlays are reset when you change screens, so this should be all you need in the script:-

Code: Select all

this.guiScreenChanged = function(to, from) {
	if (to == "GUI_SCREEN_MARKET" && guiScreen == "GUI_SCREEN_MARKET") {
	setScreenOverlay('aide_market_overlay.png');
	}
}
Thanks for spotting. I thought that the script was so simple that I didn't even bother to look at the log :lol: . I did it the way you suggest at first, but it made the overlay disappear when pressing pause key (p). Framecallback seems to be a solution, but the example I was using destroyed this.$marketOverlay too early causing the error. No more destroying and now it seems to work.

Had to start versioning. Link to version 1.1 updated in the first post.

Re: marketAide oxp

Posted: Sat Sep 01, 2012 7:34 am
by Wildeblood
spara wrote:
Had to start versioning. Link to version 1.1 updated in the first post.
Still wrong. Still the same mistake. You're trying to remove the actual function, not the frame callback.

Code: Select all

this.guiScreenChanged = function(to, from) {
	if (to == "GUI_SCREEN_MARKET") {
		this.$myFrameCallback = addFrameCallback(this.$marketOverlay.bind(this));
	}
}

this.$marketOverlay = function(delta) {
	if (guiScreen != "GUI_SCREEN_MARKET") {
		removeFrameCallback(this.$marketOverlay);    <--------------
		return;
	}
	setScreenOverlay('aide_market_overlay.png');
}
See this post for a correct example. :wink:

Re: marketAide oxp

Posted: Sat Sep 01, 2012 7:43 am
by Rese249er
Downloaded v1.1, though as a pilot and not a coder, probably won't make a difference to me.

Re: marketAide oxp

Posted: Sat Sep 01, 2012 7:58 am
by spara
Wildeblood wrote:
spara wrote:
Had to start versioning. Link to version 1.1 updated in the first post.
Still wrong. Still the same mistake. You're trying to remove the actual function, not the frame callback.

Code: Select all

this.guiScreenChanged = function(to, from) {
	if (to == "GUI_SCREEN_MARKET") {
		this.$myFrameCallback = addFrameCallback(this.$marketOverlay.bind(this));
	}
}

this.$marketOverlay = function(delta) {
	if (guiScreen != "GUI_SCREEN_MARKET") {
		removeFrameCallback(this.$marketOverlay);    <--------------
		return;
	}
	setScreenOverlay('aide_market_overlay.png');
}
See this post for a correct example. :wink:
I have to be blind :x . That was exactly the example I was using. I stand corrected, thank you very much. And the oxp is updated. Again.

Re: [Release] marketAide

Posted: Sun Sep 02, 2012 8:17 pm
by spara
I have gone through the "OXP Distribution" page on wiki (which I should have done a lot earlier :)) and have repackaged the oxp accordingly (included the license and such). If I would like my oxp to be added to the oxp list in the wiki, what should I do?

Re: [Release] marketAide

Posted: Sun Sep 02, 2012 8:37 pm
by Smivs
spara wrote:
... my oxp to be added to the oxp list in the wiki, what should I do?
Just ask here! There's usually a wiki-er around who will help.
It's done for you :)
Or if you wish to have a wiki account of your own, again, just ask, although I can't help with that I'm afraid.

Re: [Release] marketAide

Posted: Mon Sep 03, 2012 6:19 pm
by Shipbuilder
Spara - If you want a Wiki account Maik set out up for me so he is probably the best person to contact.

Good work with the oxp by the way.

Re: [Release] marketAide

Posted: Mon Jan 14, 2013 3:34 pm
by barge411
Out of curiosity is it possible to include the price you have bought the commodity at ? as part of the overlay.

Re: [Release] marketAide

Posted: Mon Jan 14, 2013 4:09 pm
by spara
barge411 wrote:
Out of curiosity is it possible to include the price you have bought the commodity at ? as part of the overlay.
Not possible as overlay. Overlay is simply a png image. At the moment Wildebloods AI Trading Assistant does that. My Troomp also does that, but there are issues with Oolite 1.77, so it can't be recommended.

Price of the bought goods is actually more complicated than it looks. First of all it has to be an average. Then you'll have to cope with goods that are dumped or destroyed or scooped. New Cargoes and Hypercargo also add their quirks in to the mix. And let's not forget handling of cargo contracts and their premiums.