Page 1 of 4

[release] Newt's Mining IFF Scanner Upgrade

Posted: Fri Sep 01, 2017 3:18 am
by NewtSoup
Hi there,

This is my first OXZ. I started this afternoon after getting annoyed at losing splinters on the scanner so I got bored and decided to jump into my first mod.

Basically It's a purchasable ( and saleable ) upgrade to the IFF scanner. Once installed it colours the lollipops for asteroids in white/brown, boulders in white/orange and splinters in white/green colours for easier tracking.

I use [EliteWiki] Ore processor and so I wanted it to work alongside but be independent of it.

This is a direct download link for the OXP. It is also available in the in game OXP Manager

Mining IFF Scanner Upgrade

this is temporary for people to have a go with until I've got around to releasing it properly.

BTW it is heavily influenced by Capt. Murphy's [EliteWiki] Police IFF Scanner Upgrade. This has been a great learning experience and first foray into a bit of Oolite Coding.

Current Version 1.1.1

****************************************
NewtSoup Mining IFF Scanner Upgrade Changelog

06/09/2017 - 1.1.1
Minor bug fix - Metal fragments now show correctly in the same colour as splinters.

05/09/2017 -1.1.0
Added Scavenger Hack - identifies cargo containers and escape pods.

02/09/2017 -1.0.2
Minor bug fixes
Included "Metal fragment" to be compatible with Staer9's Icesteroids

01/09/2017 -1.0.1
Tech level increased to 11 to match that of the mining laser
Price increased to 800 credits to match that of the mining laser
Asteroid colour changed to white/gray to better distinguish from boulders

01/09/2017 -1.0.0
Released

Re: [release?] (tentative) Newts Mining Scanner Upgrade

Posted: Sat Sep 02, 2017 4:13 am
by cag
Congrats on your first publishing! Now comes the fun part: user feedback :)
I like to mine too and think this is a great idea. But...

- you've got at line 113

Code: Select all

for ( idx = 0; i<numRocks; idx++){
which JSHint reports "'i' is not defined." Luckily, if fails to execute, rather than loop infinitely!

- you need to also test for

Code: Select all

else if (rocks[idx].name === "Splinter" || rocks[idx].name === 'Metal fragment'){
 
in your 'identifyRocks' & 'equipmentDamaged' functions, if you want to be compatible w/ Staer9's "icesteroids" oxp. Its boulders spawn more boulders which then spawn metal fragments, which are harder to spot than splinters!

One last thing, it's an agreed convention that oxp function and variable names start with either a '$' or '_'. You've only got one function, 'identifyRocks' and one variable, 'MiningScannerTimer' to worry about. So they can be renamed '_identifyRocks' or '$identifyRocks', '_MiningScannerTimer' or '$MiningScannerTimer'. It's up to you - pick a 'style' and be consistent. The reason for this (however unlikely it may seem), is if oolite ever produces a 'MiningScannerTimer' or 'identifyRocks' in the future, your oxp may stop working or behave strangely.

Good work - keep chipping away at it! (sorry, couldn't resist)

Re: [release?] (tentative) Newts Mining Scanner Upgrade

Posted: Sat Sep 02, 2017 6:05 am
by Astrobe
That's one of those ideas that seem obvious once done. Thanks for implementing it!

Re: [release?] (tentative) Newts Mining Scanner Upgrade

Posted: Sat Sep 02, 2017 12:03 pm
by NewtSoup
cag wrote: Sat Sep 02, 2017 4:13 am
Congrats on your first publishing! Now comes the fun part: user feedback :)
I like to mine too and think this is a great idea. But...

- you've got at line 113

Code: Select all

for ( idx = 0; i<numRocks; idx++){
which JSHint reports "'i' is not defined." Luckily, if fails to execute, rather than loop infinitely!

- you need to also test for

Code: Select all

else if (rocks[idx].name === "Splinter" || rocks[idx].name === 'Metal fragment'){
 
in your 'identifyRocks' & 'equipmentDamaged' functions, if you want to be compatible w/ Staer9's "icesteroids" oxp. Its boulders spawn more boulders which then spawn metal fragments, which are harder to spot than splinters!

One last thing, it's an agreed convention that oxp function and variable names start with either a '$' or '_'. You've only got one function, 'identifyRocks' and one variable, 'MiningScannerTimer' to worry about. So they can be renamed '_identifyRocks' or '$identifyRocks', '_MiningScannerTimer' or '$MiningScannerTimer'. It's up to you - pick a 'style' and be consistent. The reason for this (however unlikely it may seem), is if oolite ever produces a 'MiningScannerTimer' or 'identifyRocks' in the future, your oxp may stop working or behave strangely.

Good work - keep chipping away at it! (sorry, couldn't resist)
That's very weird because it works. I will fix the bad loop. And amend the name checking promptly. As soon as I've had my coffee. I've literally just woke. ( And yes the first thing I did was check the forums ).

I tried using the oolite checker but I get a really annoying message about "extra data after parsed string, line 1 character 13" or similar which is odd because line one is "use strict;"

I've also not worked out how to get the debugger working yet so my debugging is constantly restarting oolite

Re: [release?] (tentative) Newts Mining Scanner Upgrade

Posted: Sat Sep 02, 2017 12:20 pm
by Cody
NewtSoup wrote: Sat Sep 02, 2017 12:03 pm
As soon as I've had my coffee. I've literally just woke. ( And yes the first thing I did was check the forums ).
<sniggers> You've got it bad. <sips coffee>
NewtSoup wrote: Sat Sep 02, 2017 12:03 pm
... "extra data after parsed string, line 1 character 13" or similar which is odd because line one is "use strict;"
Should that be "use strict";?

Re: [release?] (tentative) Newts Mining Scanner Upgrade

Posted: Sat Sep 02, 2017 12:58 pm
by NewtSoup
Cody wrote: Sat Sep 02, 2017 12:20 pm
NewtSoup wrote: Sat Sep 02, 2017 12:03 pm
As soon as I've had my coffee. I've literally just woke. ( And yes the first thing I did was check the forums ).
<sniggers> You've got it bad. <sips coffee>
NewtSoup wrote: Sat Sep 02, 2017 12:03 pm
... "extra data after parsed string, line 1 character 13" or similar which is odd because line one is "use strict;"
Should that be "use strict";?
You're quite correct. And the code is "use strict"; my bad

this is the output from the oxp verifier

Code: Select all

13:55:13.349 Running OXP verifier for ./AddOns/NewtSoup_Mining_Scanner_Upgrade.oxp
13:55:13.349 Scanning files
13:55:13.350 Checking plist well-formedness
  13:55:13.350 Checking equipment.plist
  13:55:13.350 Checking script.js
  13:55:13.350 Could not interpret property list Config/script.js.
    13:55:13.350 Parse failed at line 3 (char 237) - extra data after parsed string
13:55:13.351 Checking equipment.plist
13:55:13.351 Checking for unused files
  13:55:13.351 TODO: implement unused files check.
13:55:13.351 OXP verification complete.
and this is the first 4 lines of my code ( which works )

Code: Select all

//This oxp was created mainly as a learning experience.  But also to give me better tracking on splinters when mining.  Works Great with  OreProcessor
//It was heavily influenced by Capt. Murphy's IFF Police Scanner Upgrade
"use strict";
this.name		="Mining_Scanner_Upgrade";
It seems the verifier can't get past the end of "use strict";

Re: [release?] (tentative) Newts Mining Scanner Upgrade

Posted: Sat Sep 02, 2017 12:58 pm
by NewtSoup
OXP Updated to 1.0.2

Re: [release?] (tentative) Newts Mining Scanner Upgrade

Posted: Sat Sep 02, 2017 7:39 pm
by cag
NewtSoup wrote: Sat Sep 02, 2017 12:03 pm
I've also not worked out how to get the debugger working yet so my debugging is constantly restarting oolite
It will make life so much easier; I usually only restart 2-3 times a session.
The first thing is to decide if you want a completely seperate folder for dev, so it won't keep you grounded when you break things (recommended).

On the oolite download page, http://www.oolite.org/download/, under 'OXP Developer releases', you'll see 3 links in the first list item. You can ignore the link for Debug.oxp (it's broken), as it's now included in the development releases. You only need to download 2 things: OoDebugConsole1.5.zip and a 'development' version, your best bet being the latest 'Nightly builds' at
https://github.com/OoliteProject/nightlies/releases

If you're on Windows, OoDebugConsole1.5.zip has a .exe file which you run before running oolite. If you're on Linux or Mac OS, it has the python source (I'm on Windows, so I can't help you there.)

Re: [release?] (tentative) Newt's Mining Scanner Upgrade

Posted: Sat Sep 02, 2017 9:04 pm
by cag
I was thinking, since you're almost there, why not add cargo, with a special colour (w/ maybe an alert sound) for escape pods/black boxes.
Then you could prioritize what you go after when other ships are around, scooping up stuff too.

Re: [release?] (tentative) Newt's Mining Scanner Upgrade

Posted: Sat Sep 02, 2017 10:41 pm
by NewtSoup
cag wrote: Sat Sep 02, 2017 9:04 pm
I was thinking, since you're almost there, why not add cargo, with a special colour (w/ maybe an alert sound) for escape pods/black boxes.
Then you could prioritize what you go after when other ships are around, scooping up stuff too.
Hi Cag, thanks for the info on getting the debugger working. Most appreciated. I will do that in a bit, just got home from work and winding down with a couple of beers and some pizza.

I suppose I could add cargo and escape pods etc. It wouldn't really be a mining upgrade then , perhaps more of a Scavenger upgrade. I could also add some flavour by making it only purchasable from rock hermits. Does the tech level still count on stuff bought from hermits?

Re: [release?] (tentative) Newt's Mining Scanner Upgrade

Posted: Sat Sep 02, 2017 10:57 pm
by Cody
NewtSoup wrote: Sat Sep 02, 2017 10:41 pm
I could also add some flavour by making it only purchasable from rock hermits.
Excellent idea!

Re: [release?] (tentative) Newt's Mining Scanner Upgrade

Posted: Sun Sep 03, 2017 11:33 am
by NewtSoup
This post is just a link test to see if I can get a direct download from microsoft one drive.

Also if someone's feeling kind can they tell me if they get a direct download from the google link in the first post or if they get taken to the google drive page first and then presented with a link?

I'm trying to sort out an acceptable direct download for the OXP page on oolite.org

https://1drv.ms/u/s!AuH_cIWCRVRphDZjMR_V4yMJLQiF

*** Never mind :) I've just noticed that expansion packs are uploaded to the wiki. I will wait on my wiki UN/PW ***

Re: [release?] (tentative) Newt's Mining Scanner Upgrade

Posted: Sun Sep 03, 2017 2:59 pm
by NewtSoup
Is it possible, using the debug console, to make an OXP reload while the game is running?

If I change some of the script for instance. Can I get the game to use the new script without restarting or does it pick it up automatically?

Re: [release?] (tentative) Newt's Mining Scanner Upgrade

Posted: Sun Sep 03, 2017 7:39 pm
by Norby
NewtSoup wrote: Sun Sep 03, 2017 2:59 pm
Is it possible, using the debug console, to make an OXP reload while the game is running?
The whole oxp is not, nor anything in .plist files, just the content of js variables and function codes.

Re: [release?] (tentative) Newt's Mining Scanner Upgrade

Posted: Sun Sep 03, 2017 7:51 pm
by NewtSoup
Norby wrote: Sun Sep 03, 2017 7:39 pm
NewtSoup wrote: Sun Sep 03, 2017 2:59 pm
Is it possible, using the debug console, to make an OXP reload while the game is running?
The whole oxp is not, nor anything in .plist files, just the content of js variables and function codes.
Thank you Norby.