Page 8 of 14

Re: [UPDATED RELEASE] Superhub V1.4.oxp

Posted: Mon Dec 24, 2012 5:03 pm
by Thargoid
As noted when you reported this before - this one can be ignored. The new way of doing docks (to allow multiple ones) needs to have at least one dock defined for a dockable. Hence "proximity docks" like are used here (and in Lave Academy and Planetfall, amongst others) which don't have such a defined dock need one to be added.

The message is just a notification that the trunk code is doing that (adding a virtual dock), but aside from the notification everything else should continue to work fine. It's not too difficult to add real docks, but it needs new sub-entities hidden within the main model.

Re: [UPDATED RELEASE] Superhub V1.4.oxp

Posted: Wed Jan 15, 2014 5:57 pm
by pagroove
A question to the script experts. :D :

I want to make the Superhub appear NOT random anymore. I want to spawn it via the code used to spawn the Lave Academy.
Lave Academy uses a following script:

Code: Select all

this.setUpArrays = function()
	{
	this.academyList = [0, 1, 2, 3, 4, 5, 6, 7]; // galaxies 0-7
	this.academyList[0] = [7, 173, 168, 133, 4]; // Lave, Esteonbi, Enonla, Esanbe, Xequerin
	this.academyList[1] = [24, 92, 210, 55, 194]; // Maesaron, Erenanri, Reveabe, Legeara, Tigebere
	this.academyList[2] = [58, 165, 106, 198, 164]; // Radiqu, Edxeri, Ceedleon, Atius,Rerebi
	this.academyList[3] = [13, 47, 130, 18, 122]; // Mavelege, Bemate, Cebitiza,  Mausra, Ensoor
	this.academyList[4] = [16, 193, 231, 92, 9]; // Zaaner, Vebi, Inenares, Azaenbi, Dioris
	this.academyList[5] = [151, 6, 85, 146, 240]; // Teesso, Oresmaa, Celaan, Ariqu, Inesbe
	this.academyList[6] = [189, 146, 130, 118, 37]; // Isdilaon, Aenbi, Ataer, Orreedon, Qutegequ
	this.academyList[7] = [177, 31, 211, 157, 20]; // Ceenza, Aarzari, Biatzate, Inbein, Oredrier
	this.singleList = [7, 24, 58, 13, 16, 151, 189, 177]; // array for when 1 academy per galaxy selected
	}
The Current spawn script for the Superhub is:

Code: Select all

this.name           = "PAGroove_superhubPopulator";
this.author         = "Thargoid";
this.copyright      = "This script is hereby placed in the public domain.";
this.version        = "1.1";
this.description    = "Script to add a single superhub near the system main station";


this.shipWillLaunchFromStation = function(station)
   {
   if(station.isMainStation)
      {
      this.spawnHub();
      }
   }

this.shipWillExitWitchspace = function()
   {
   this.spawnHub();
   }

this.spawnHub = function()
   {
   if(Math.random() < 0.5 || system.techLevel < 11 || system.government < 4 || system.countShipsWithRole("pagroove_superhub") > 0 || this.superHubBlock)   
      {
      this.superHubBlock = true;
      return;
      }
   else
      {
      this.xOffset = (Math.random() * 10000) + 10000; // x offset between 10 and 20km
      this.yOffset = (Math.random() * 10000) + 10000; // y offset between 10 and 20km

      if(Math.random() > 0.5) // 50:50 chance of offsetting in the other direction
         {
         this.xOffset = -this.xOffset;
         }
      if(Math.random() > 0.5) // 50:50 chance of offsetting in the other direction
         {
         this.yOffset = -this.yOffset;
         }

      system.legacy_addShipsAtPrecisely("pagroove_superhub", 1, "abs", system.mainStation.position.add([this.xOffset, this.yOffset, 0]));
      }
   }

this.shipWillEnterWitchspace = function()
   {
   this.superHubBlock = null;
   }
How can the spawn script be adapted so I can handcode the Superhubs per galaxy? I want to do this in such a way that Superhubs appear in Tech 14/14 systems? I made a custom docking tunnel but I can't find super hubs currently because it doesn't spawn very often when visiting a high tech system.

Re: [UPDATED RELEASE] Superhub V1.4.oxp

Posted: Wed Jan 15, 2014 6:08 pm
by cim
pagroove wrote:
How can the spawn script be adapted so I can handcode the Superhubs per galaxy? I want to do this in such a way that Superhubs appear in Tech 14/14 systems? I made a custom docking tunnel but I can't find super hubs currently because it doesn't spawn very often when visiting a high tech system.
To just add them always to all TL 14/15 systems, and never to any others, replace

Code: Select all

   if(Math.random() < 0.5 || system.techLevel < 11 || system.government < 4 || system.countShipsWithRole("pagroove_superhub") > 0 || this.superHubBlock)   
with

Code: Select all

   if(system.techLevel < 13 || system.countShipsWithRole("pagroove_superhub") > 0 || this.superHubBlock)   
On the rest of the script, 1.79 will include two changes of relevance:
1) The ability to save at non-main stations. This will cause potential problems with that script unless you change

Code: Select all

   if(station.isMainStation)
      {
      this.spawnHub();
      }
to

Code: Select all

      this.spawnHub();
Making that change will not break the script in current Oolite versions.

2) A new way of running the system populator. There is no hurry to switch to this, and it wouldn't work with older versions if you did, but certain ways of using it will mean that the SuperHub could become a non-main station you could save at, and it could also make the script simpler.

Re: [UPDATED RELEASE] Superhub V1.4.oxp

Posted: Wed Jan 15, 2014 6:15 pm
by pagroove
Thanks CIM. I have changed the script and I will now start testing.
:D

Re: [UPDATED RELEASE] Superhub V1.4.oxp

Posted: Wed Jan 15, 2014 6:44 pm
by pagroove
Mmm it doesn't spawn. Flew a few times into Maraus and nothing:

This is the current script. Any faults?

Code: Select all

this.name           = "PAGroove_superhubPopulator";
this.author         = "Thargoid";
this.copyright      = "This script is hereby placed in the public domain.";
this.version        = "1.1";
this.description    = "Script to add a single superhub near the system main station";


this.shipWillLaunchFromStation = function(station)
   {
    this.spawnHub();
   }

this.shipWillExitWitchspace = function()
   {
   this.spawnHub();
   }

this.spawnHub = function()
   {
   if(system.techLevel < 13 || system.countShipsWithRole("pagroove_superhub") > 0 || this.superHubBlock)     
      {
      this.superHubBlock = true;
      return;
      }
   else
      {
      this.xOffset = (Math.random() * 10000) + 10000; // x offset between 10 and 20km
      this.yOffset = (Math.random() * 10000) + 10000; // y offset between 10 and 20km

      if(Math.random() > 0.5) // 50:50 chance of offsetting in the other direction
         {
         this.xOffset = -this.xOffset;
         }
      if(Math.random() > 0.5) // 50:50 chance of offsetting in the other direction
         {
         this.yOffset = -this.yOffset;
         }

      system.legacy_addShipsAtPrecisely("pagroove_superhub", 1, "abs", system.mainStation.position.add([this.xOffset, this.yOffset, 0]));
      }
   }

this.shipWillEnterWitchspace = function()
   {
   this.superHubBlock = null;
   }

Re: [UPDATED RELEASE] Superhub V1.4.oxp

Posted: Wed Jan 15, 2014 7:37 pm
by pagroove
The log says this a syntax error on line 25

Code: Select all

    ~/Games/Oolite Trunk 1.79-10jan2014/AddOns/Superhubv1.5t.oxp
    ~/Games/Oolite Trunk 1.79-10jan2014/AddOns/superico.oxp
20:24:18.881 [plist.parse.failed]: Failed to parse /Users/pagroove/Games/Oolite Trunk 1.79-10jan2014/AddOns/Superhubv1.5t.oxp/Config/shipdata.plist as a property list.
20:24:36.623 [script.javaScript.exception.syntaxError]: ***** JavaScript exception (Superhubv1.5t.anon-script): SyntaxError: syntax error
20:24:36.623 [script.javaScript.exception.syntaxError]:       /Users/pagroove/Games/Oolite Trunk 1.79-10jan2014/AddOns/Superhubv1.5t.oxp/Config/script.js, line 25:    else
20:24:36.623 [script.javaScript.load.failed]: ***** Error loading JavaScript script /Users/pagroove/Games/Oolite Trunk 1.79-10jan2014/AddOns/Superhubv1.5t.oxp/Config/script.js -- compilation failed
    CargoTypeExtension-Station-SuperHub 1.2.3
20:25:36.050 [script.javaScript.exception.syntaxError]: ***** JavaScript exception (Superhubv1.5t.anon-script): SyntaxError: syntax error
20:25:36.050 [script.javaScript.exception.syntaxError]:       /Users/pagroove/Games/Oolite Trunk 1.79-10jan2014/AddOns/Superhubv1.5t.oxp/Config/script.js, line 25:    else
20:25:36.051 [script.javaScript.load.failed]: ***** Error loading JavaScript script /Users/pagroove/Games/Oolite Trunk 1.79-10jan2014/AddOns/Superhubv1.5t.oxp/Config/script.js -- compilation failed
    CargoTypeExtension-Station-SuperHub 1.2.3
What goes wrong here?

Re: [UPDATED RELEASE] Superhub V1.4.oxp

Posted: Wed Jan 15, 2014 8:04 pm
by cim

Code: Select all

20:24:18.881 [plist.parse.failed]: Failed to parse /Users/pagroove/Games/Oolite Trunk 1.79-10jan2014/AddOns/Superhubv1.5t.oxp/Config/shipdata.plist as a property list.
This may be why you never saw one before.

Code: Select all

20:24:36.623 [script.javaScript.exception.syntaxError]: ***** JavaScript exception (Superhubv1.5t.anon-script): SyntaxError: syntax error
Line 25 of the script as pasted above looks fine to me, as do the ones around it. Indeed, copying and pasting into a JS file here, Oolite loads it just fine.

I've thought of another change that might be useful, though it won't fix the error.

Code: Select all

if(system.techLevel < 13 || system.countShipsWithRole("pagroove_superhub") > 0 || this.superHubBlock) 
should really be

Code: Select all

if(this.superHubBlock || system.techLevel < 13 || system.countShipsWithRole("pagroove_superhub") > 0)
The reason is that the conditions are checked from left to right, so the efficiency of checking this.superHubBlock only does any good if it's the first thing checked.

Re: [UPDATED RELEASE] Superhub V1.4.oxp

Posted: Wed Jan 15, 2014 11:12 pm
by pagroove
I solved it. It was a problem in the .plist. I tried to add a docking tunnel but introduced new errors. I now have it working and have beautiful tunnel now too. Screenshots soon.

Re: [UPDATED RELEASE] Superhub V1.4.oxp

Posted: Wed Jan 15, 2014 11:18 pm
by pagroove
Here it is (The new SuperHub launch tunnel)
Coming soon in the new version.

Image

Is it possible to generate different cargo contracts and carrier markets than the main station on a dockable?

Re: [UPDATED RELEASE] Superhub V1.4.oxp

Posted: Wed Jan 15, 2014 11:38 pm
by Cody
Oooh... shiny!

Re: [UPDATED RELEASE 16-01-2014] Superhub V1.5.oxp

Posted: Thu Jan 16, 2014 12:45 am
by pagroove
Updated the OXP:

v 1.5
-SuperHubs now appear at all Tech 14 and Tech 15 planets. (no more Random)
-Added a BGS Launch tunnel
-Added a License (See wiki page and in read me for details)

Download Link:

https://app.box.com/s/cd4ontw41gody7ckctu8

Re: [UPDATED RELEASE 16-01-2014] Superhub V1.5.oxp

Posted: Thu Jan 16, 2014 12:50 am
by Cody
Maraus is gonna be a little crowded, what with a Torus Station, a Zieman Habitat, and now a Superhub - cool.

Re: [UPDATED RELEASE 16-01-2014] Superhub V1.5.oxp

Posted: Thu Jan 16, 2014 12:52 am
by pagroove
Cody wrote:
Maraus is gonna be a little crowded, what with a Torus Station, a Zieman Habitat, and now a Superhub - cool.
Well it is a HUB region. :)
The Maraus Hub (Should be on the Vector Maps IMO.

Re: [UPDATED RELEASE 16-01-2014] Superhub V1.5.oxp

Posted: Thu Jan 16, 2014 12:55 am
by Cody
pagroove wrote:
The Maraus Hub (Should be on the Vector Maps IMO.
I've been operating in and around the Maraus Hub for quite a while now - it's the sweet spot in G7.

Re: [UPDATED RELEASE 16-01-2014] Superhub V1.5.oxp

Posted: Thu Jan 16, 2014 1:00 am
by pagroove
Cody wrote:
pagroove wrote:
The Maraus Hub (Should be on the Vector Maps IMO.
I've been operating in and around the Maraus Hub for quite a while now - it's the sweet spot in G7.
Also my current base of operations. And don't forget the RSS Galactic HQ that is also stationed in the Maraus System.