[WIP]Miner Pod OXP (v0.1 Released)

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

Moderators: winston, another_commander

User avatar
Okti
---- E L I T E ----
---- E L I T E ----
Posts: 700
Joined: Sun Sep 26, 2010 1:51 pm
Location: A GH shop, near witchpoint to Oresrati in Galaxy 8

Re: [WIP]Miner Pod OXP (v0.1 Released)

Post by Okti »

lave wrote:
I just tested it again (my work can wait lol).

I am still getting the same problem.
I have 1 pod fitted, no breaker and only 1 asteriod within range.

The pod scoops the first splinter then just flys off. I waited for about 10 mins but it never returned.
I am not too good with coding but I had a look and can't seem to see anything wrong.

With the first release of this (when it used to launch 10+ pods) it did actually work for me.

In that case I did edit the 10 to just 1 so that there was just one pod and it worked fine.
I am Playing with this for 6 hours now, with only one miner. I could not reproduce the bug you mentioned. After scooping it always returns to be collected. The version you mentioned was a lot bugier than that because target lost events were handled as cargo_sccoped, which did not match the visual number of splinters sccoped.

I don't think it will make much difference but, What is your operating system?
My OXP's
And Latest Mission Coyote's Run
User avatar
lave
Deadly
Deadly
Posts: 141
Joined: Thu Sep 09, 2010 12:21 am
Location: Deep in Leesti space mining asteroids for a living.
Contact:

Re: [WIP]Miner Pod OXP (v0.1 Released)

Post by lave »

I'm on Windows Vista.

The first version you made seemed to work fine. The pod/s scooped all spliters then returned.

Now the pod flys off even though there are other splinters floating around.

Oh well, it's not a problem. I will continue to mine the old fashioned way lol.

Thanks.
User avatar
Okti
---- E L I T E ----
---- E L I T E ----
Posts: 700
Joined: Sun Sep 26, 2010 1:51 pm
Location: A GH shop, near witchpoint to Oresrati in Galaxy 8

Re: [WIP]Miner Pod OXP (v0.1 Released)

Post by Okti »

I will PM you a link for the old version.

Thanks.
My OXP's
And Latest Mission Coyote's Run
User avatar
Disembodied
Jedi Spam Assassin
Jedi Spam Assassin
Posts: 6885
Joined: Thu Jul 12, 2007 10:54 pm
Location: Carter's Snort

Re: [WIP]Miner Pod OXP (v0.1 Released)

Post by Disembodied »

I'm no use at the programming side but I can spot a typo ... should be "1 ton of Minerals collected"! :)
User avatar
lave
Deadly
Deadly
Posts: 141
Joined: Thu Sep 09, 2010 12:21 am
Location: Deep in Leesti space mining asteroids for a living.
Contact:

Re: [WIP]Miner Pod OXP (v0.1 Released)

Post by lave »

Okti wrote:
I will PM you a link for the old version.

Thanks.

Cheers.

At least I can edit the code to only have 1 pod (which I prefer anyway).
User avatar
maik
Wiki Wizard
Wiki Wizard
Posts: 2028
Joined: Wed Mar 10, 2010 12:30 pm
Location: Ljubljana, Slovenia (mainly industrial, feudal, TL12)

Re: [WIP]Miner Pod OXP (v0.1 Released)

Post by maik »

Added to the WIP section of the [wiki]OXP List[/wiki].
User avatar
SandJ
---- E L I T E ----
---- E L I T E ----
Posts: 1048
Joined: Fri Nov 26, 2010 9:08 pm
Location: Help! I'm stranded down here on Earth!

Re: [WIP]Miner Pod OXP (v0.1 Released)

Post by SandJ »

Okti, some suggestions which may or may not be helpful.

1. Some files say this.author = "Okti" and some say this.author = "Oktay"

2. As Disembodied said, in minerPodAutoMiner.js and minerPodAutoMinerHelpers.js, "1 Tone" should be either "1 tonne" or "1 ton".

3. On the Wiki page Scripting Oolite with JavaScript it says:
Ensure you change at least the Name value. Every script must have a unique name. If multiple scripts with the same name are encountered, Oolite will arbitrary select one and discard the others.
but

Code: Select all

minerPodAutoMiner.js        says  this.name = "minerPodAutoMiner";
minerPodAutoMinerHelpers.js says  this.name = "minerPodAutoMiner";    <--- wrong
minerPodForCollection.js    says  this.name = "minerPodForCollection";
minerPodRockBreaker.js      says  this.name = "minerPodAutoMiner";    <--- wrong
4. The script minerPodAutoMiner.js is more recent than and contains more functionality than minerPodAutoMinerHelpers.js e.g. this.locatePlayer() and thisShipWasScooped () - is that intentional?

5. In minerPodAutoMiner.js all the code in this.shipSpawned() is commented out - is this intentional? Ditto for minerPodRockBreaker.js

6. Does it matter that minerPodForCollection.js does not refer to gem stones or alloys whilst the other js files do?

7. Should this code:

Code: Select all

this.quant = Math.round(Math.random() * 15 + 0.5);
missionVariables.MinerPod_gold +=quant;
this.comod = this.quant + " kgrms of Gold Collected";
be saying "+= this.quant" on the 2nd line? (I expect it makes no difference, it just looks odd.)

8. Every time Math.random() is called, it returns a different number. Remember that when constructing if / else statements. The following does work but will not do quite what you expect.

Code: Select all

        if (Math.random() < .3)
        {
            this.quant = Math.round(Math.random() * 15 + 0.5);
            missionVariables.MinerPod_gold +=quant;
            this.comod = this.quant + " kgrms of Gold Collected";
        }
        else if (Math.random() <.5)
        {
            this.quant = Math.round(Math.random() * 15 + 0.5);
            missionVariables.MinerPod_platinum +=quant;
            this.comod = this.quant + " kgrms of Platinum Collected";
        }
        else
        {
            this.quant = Math.round(Math.random() * 15 + 0.5);
            missionVariables.MinerPod_gems +=quant;
            this.comod = this.quant + " grms of Gem Stones Collected";
        }
Instead you are better off assigning Math.random() to a variable, then referring to the variable since it will not change with every if / else.

9. Random number generation is an inefficient algorithm; the less it is used, the better for performance. That is another reason to assign Math.random() to a variable before doing something. Instead you could do something like this (this is pseudocode, just convert it to JavaScript):

Code: Select all

this.CargoType = Math.random()
if (this.CargoType < 0.21)
    cargo += 1 tonne Minerals
elseif (this.CargoType < 0.455)
    cargo += 1 tonne Radioactives
elseif (this.CargoType < 0.7)
    cargo += 1 tonne Alloys
else // will be one of the expensive items, need to know how much
    this.CargoQuantity = Math.ceil(Math.random() * 15 )  // Math.ceil always rounds UP so no "+.5" is needed
    if (this.CargoType < 0.79)
        cargo += this.CargoQuantity Gold
    elseif (this.CargoType < .895)
        cargo += this.CargoQuantity Platinum
    else
        cargo += this.CargoQuantity Gem Stones
Probably better still would be to use switch() / case

10. As Gimi said, please always change the version number when you upload it. The experience mentioned above of you getting different behaviour from someone else combined with not changing version numbers is a classic problem in software change control. Uploading code that has been commented out is another. It becomes possible you are not uploading what you think you are. No offence is meant, it's 25 years of software development experience talking. It is also a good idea to have a comment in every source file saying what date (even time) you last edited it, and why, for your own benefit. It is tedious, but saves you time in the long run, especially if you get interrupted while working on a change.
Flying a Cobra Mk I Cobbie 3 with nothing but Explorers Club.OXP and a beam laser 4 proper lasers for company :D
Dropbox referral link 2GB of free space online + 500 Mb for the referral: good for securing work-in-progress.
User avatar
Micha
Commodore
Commodore
Posts: 815
Joined: Tue Sep 02, 2008 2:01 pm
Location: London, UK
Contact:

Re: [WIP]Miner Pod OXP (v0.1 Released)

Post by Micha »

SandJ wrote:
10. As Gimi said, please always change the version number when you upload it. The experience mentioned above of you getting different behaviour from someone else combined with not changing version numbers is a classic problem in software change control. Uploading code that has been commented out is another. It becomes possible you are not uploading what you think you are. No offence is meant, it's 25 years of software development experience talking. It is also a good idea to have a comment in every source file saying what date (even time) you last edited it, and why, for your own benefit. It is tedious, but saves you time in the long run, especially if you get interrupted while working on a change.
Something which can help here is version control software. These are getting very easy to use and can easily be integrated with the desktop. Check out TortoiseGIT for Windows, for example, no need for a server or anything else.
Also allows you to very easily compare past versions so you can see what you changed - especially useful if you're just trying something out.
The glass is twice as big as it needs to be.
User avatar
SandJ
---- E L I T E ----
---- E L I T E ----
Posts: 1048
Joined: Fri Nov 26, 2010 9:08 pm
Location: Help! I'm stranded down here on Earth!

Re: [WIP]Miner Pod OXP (v0.1 Released)

Post by SandJ »

In latest.Log on my case-sensitive Linux box:

Code: Select all

[script.load.notFound]: ***** Could not find a script file named MinerPod.js.
In [size=120]MinerPod v0.1.oxp\Config\shipdata.plist[/size] there is:

Code: Select all

      script = "MinerPod.js"
which I think needs to be:

Code: Select all

      script = "minerPod.js"
Edit: There's more:
Latest.log wrote:
18:36:49.903 [ai.load.failed.unknownAI]: Can't switch AI for <ShipEntity 0x7f6cb4036820>{"MinerPodRockBreaker"} to "MinerPodRockBreakerAI.plist" - could not load file.
18:36:49.904 [script.load.notFound]: ***** Could not find a script file named MinerPodRockBreaker.js.
In [size=120]MinerPod v0.1.oxp\Config\shipdata.plist[/size]

Code: Select all

      ai_type = "MinerPodRockBreakerAI.plist";
...
      script = "MinerPodRockBreaker.js";
to:

Code: Select all

      ai_type = "minerPodRockBreakerAI.plist";
...
      script = "minerPodRockBreaker.js";
Flying a Cobra Mk I Cobbie 3 with nothing but Explorers Club.OXP and a beam laser 4 proper lasers for company :D
Dropbox referral link 2GB of free space online + 500 Mb for the referral: good for securing work-in-progress.
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: [WIP]Miner Pod OXP (v0.1 Released)

Post by Norby »

Due to Okti is missing since April, I uploaded Miner Pod 0.11 which contain SandJ's error fixing suggestions.

Edit: removed until Okti agree it to satisfy the license.
Last edited by Norby on Sat Nov 09, 2013 12:35 pm, edited 2 times in total.
User avatar
Fatleaf
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 1988
Joined: Tue Jun 08, 2010 5:11 am
Location: In analysis mode on Phaelon
Contact:

Re: [WIP]Miner Pod OXP (v0.1 Released)

Post by Fatleaf »

Norby wrote:
Due to Okti is missing since April, I uploaded Miner Pod 0.11 which contain SandJ's error fixing suggestions.
Ermm...... Have you tried to contact Okti first before changing his work?
Find out about the early influences of Fatleaf here. Also his OXP's!
Holds the Ooniversal record for "Thread Necromancy"
User avatar
JazHaz
---- E L I T E ----
---- E L I T E ----
Posts: 2991
Joined: Tue Sep 22, 2009 11:07 am
Location: Enfield, Middlesex
Contact:

Re: [WIP]Miner Pod OXP (v0.1 Released)

Post by JazHaz »

Fatleaf wrote:
Norby wrote:
Due to Okti is missing since April, I uploaded Miner Pod 0.11 which contain SandJ's error fixing suggestions.
Ermm...... Have you tried to contact Okti first before changing his work?
Par for the course with Norby. He keeps stepping on people's toes.

Norby, you are allowed to alter anyone's work FOR YOUR OWN USE. However YOU ARE NOT ALLOWED TO RELEASE IT WITHOUT PERMISSION.

Sorry everyone for caps, but Norby doesn't seem to get it.

This is the licence for the Miner Pod OXP. Norby, you have broken the terms in the licence.
License:

This OXP is released under the Creative Commons Attribution - Non-Commercial - Share Alike 3.0 license with the following clauses:

* Whilst you are free (and encouraged) to re-use any of the scripting, models or texturing in this OXP, the usage must be distinct from that within this OXP. Unique identifiers such as (but not limited to) unique shipdata.plist entity keys, mission variables, script names (this.name), equipment identity strings (EQ_), description list arrays and entity roles must not be re-used without prior agreement. Basically if it's unique or would identify or overwrite anything in the original OXP, then you may not re-use it (for obvious compatibility reasons).
* rebundling of this OXP within another distribution is permitted as long as it is unchanged. The following derivates however are permitted and except from the above:
* the conversion of files between XML and openStep.
* the merging of files with other files of the same type from other OXPs.
* The license information (either as this file or merged into a larger one) must be included in the OXP.
* Even though it is not compulsory, if you are re-using any sizable or recognisable piece of this OXP, please let me know :)
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: [WIP]Miner Pod OXP (v0.1 Released)

Post by Norby »

I really missed it, sorry. Licensing seems to be a minefield to me. Download removed until Okti send a reply although there is a big chance to my PM will be in my outbox forever.

Thank you JazHaz and Fatleaf for the proofreading!
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: [WIP]Miner Pod OXP (v0.1 Released)

Post by Smivs »

Norby wrote:
there is a big chance to my PM will be in my outbox forever.
Hopefully not. Okti is very busy with RL(TM) at the moment, but I did speak to him in the chatroom a while ago, so he is still with us in spirit, if not in body right now.
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: [WIP]Miner Pod OXP (v0.1 Released)

Post by Cody »

Norby wrote:
... there is a big chance to my PM will be in my outbox forever.
I'll email Okti tonight and nudge him, Norby... but he doesn't always respond to emails.
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
Post Reply