[Release] marketAide

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: 2550
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

[Release] marketAide

Post by spara » Fri Aug 31, 2012 5:50 pm

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
Last edited by spara on Sun Sep 02, 2012 8:12 pm, edited 3 times in total.

User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Disunited Kingdom
Contact:

Re: marketAide oxp

Post by Smivs » Fri Aug 31, 2012 5:59 pm

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?
Commander Smivs, the friendliest Gourd this side of Riedquat.

User avatar
Captain Beatnik
Deadly
Deadly
Posts: 143
Joined: Sun Feb 27, 2011 10:15 pm
Location: Eastern Bavaria (Average Agricultural Confederacy)

Re: marketAide oxp

Post by Captain Beatnik » Fri Aug 31, 2012 8:17 pm

A good idea resulting in a very useful oxp. Good work, commander spara! :)
I love deadlines. I like the whooshing sound they make as they fly by.
(Douglas Adams, 1952 - 2001)

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

Re: marketAide oxp

Post by spara » Fri Aug 31, 2012 9:31 pm

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.

User avatar
Rese249er
---- E L I T E ----
---- E L I T E ----
Posts: 647
Joined: Thu Jun 07, 2012 2:19 pm
Location: Well, I WAS in G3...

Re: marketAide oxp

Post by Rese249er » Sat Sep 01, 2012 2:09 am

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.
Last edited by Rese249er on Sat Sep 01, 2012 2:57 am, edited 1 time in total.
Got all turned around, lost my nav connection... Where am I now?

User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2161
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia
Contact:

Re: marketAide oxp

Post by Wildeblood » Sat Sep 01, 2012 2:57 am

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');
	}
}

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

Re: marketAide oxp

Post by spara » Sat Sep 01, 2012 7:06 am

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.

User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2161
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia
Contact:

Re: marketAide oxp

Post by Wildeblood » Sat Sep 01, 2012 7:34 am

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:

User avatar
Rese249er
---- E L I T E ----
---- E L I T E ----
Posts: 647
Joined: Thu Jun 07, 2012 2:19 pm
Location: Well, I WAS in G3...

Re: marketAide oxp

Post by Rese249er » Sat Sep 01, 2012 7:43 am

Downloaded v1.1, though as a pilot and not a coder, probably won't make a difference to me.
Got all turned around, lost my nav connection... Where am I now?

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

Re: marketAide oxp

Post by spara » Sat Sep 01, 2012 7:58 am

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.

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

Re: [Release] marketAide

Post by spara » Sun Sep 02, 2012 8:17 pm

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?

User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Disunited Kingdom
Contact:

Re: [Release] marketAide

Post by Smivs » Sun Sep 02, 2012 8:37 pm

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.
Commander Smivs, the friendliest Gourd this side of Riedquat.

User avatar
Shipbuilder
---- E L I T E ----
---- E L I T E ----
Posts: 877
Joined: Thu May 10, 2012 9:41 pm
Location: Derby

Re: [Release] marketAide

Post by Shipbuilder » Mon Sep 03, 2012 6:19 pm

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.
The GalTech Industries Corporation - Building ships to populate the galaxies.

Increase the variety of ships within your Ooniverse by downloading my OXPs

Flying the [wiki]Serpent_Class_Cruiser[/wiki] "Thargoid's Bane"

barge411
Average
Average
Posts: 10
Joined: Fri Dec 09, 2011 11:50 am

Re: [Release] marketAide

Post by barge411 » Mon Jan 14, 2013 3:34 pm

Out of curiosity is it possible to include the price you have bought the commodity at ? as part of the overlay.

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

Re: [Release] marketAide

Post by spara » Mon Jan 14, 2013 4:09 pm

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.

Post Reply