Page 1 of 1

Cannot set property galacticHyperspaceFixedCoordsInLY?

Posted: Wed Nov 16, 2011 6:00 pm
by Wildeblood
This script is supposed to be stepping through an array of possible co-ordinates, but all it's doing is producing this error. The co-ordinates are formatted incorrectly?

Code: Select all

01:50:22.153 [script.javaScript.exception.ooliteDefinedError]: ***** JavaScript exception (Naval-GalDrive-Programmer 0.1): Error: Cannot set property galacticHyperspaceFixedCoordsInLY of instance of PlayerShip to invalid value "5.6, 3.4, 0".
01:50:22.153 [script.javaScript.exception.ooliteDefinedError]:       ../AddOns/Sensible GalDrives (WIP).oxp/Scripts/naval_galdrive_programmer.js, line 90.
01:50:22.891 [script.javaScript.exception.ooliteDefinedError]: ***** JavaScript exception (Naval-GalDrive-Programmer 0.1): Error: Cannot set property galacticHyperspaceFixedCoordsInLY of instance of PlayerShip to invalid value "5.6, 3.4, 0".
01:50:22.892 [script.javaScript.exception.ooliteDefinedError]:       ../AddOns/Sensible GalDrives (WIP).oxp/Scripts/naval_galdrive_programmer.js, line 90.
01:50:23.659 [script.javaScript.exception.ooliteDefinedError]: ***** JavaScript exception (Naval-GalDrive-Programmer 0.1): Error: Cannot set property galacticHyperspaceFixedCoordsInLY of instance of PlayerShip to invalid value "5.6, 3.4, 0".
01:50:23.659 [script.javaScript.exception.ooliteDefinedError]:       ../AddOns/Sensible GalDrives (WIP).oxp/Scripts/naval_galdrive_programmer.js, line 90.

Re: Cannot set property galacticHyperspaceFixedCoordsInLY?

Posted: Wed Nov 16, 2011 6:05 pm
by Thargoid
That would be my first guess. Can you post the script up that's throwing the error, or at least the bit of it where the vector is defined?

Re: Cannot set property galacticHyperspaceFixedCoordsInLY?

Posted: Wed Nov 16, 2011 6:08 pm
by Wildeblood
Thargoid wrote:
That would be my first guess. Can you post the script up that's throwing the error, or at least the bit of it where the vector is defined?

Code: Select all

this.galaxyNames[7] = new Array("Titiridi (SecCom 1)","Xeoresce (SecCom 2)","Leater (SecCom 3)","Atmabe (SecCom 4)","Inzaan (SecCom 5)","Esusale (SecCom 6)","Inisbi (SecCom 7)","Leesusen (SecCom 8)","Maarabi (SecCom 9)","Teteus (SecCom 10)","Belabia (SecCom 11)",	"Vebixe (SecCom 12)","Laorlaza (SecCom 13)","Getiusza (SecCom 14)");

this.galaxyCoords[7] = new Array("5.6, 3.4, 0","5.6, 20.8, 0","11.6, 42.2, 0","21.6, 13.4, 0","29.6, 9, 0","37.6, 19.2, 0","49.2, 42.6, 0","50, 2, 0","61.2, 20.2, 0","69.6, 3.4, 0","88, 26.4, 0","91.6, 15, 0","92, 44.2, 0","69.2, 39.6, 0");
Do I need to remove the spaces?

Re: Cannot set property galacticHyperspaceFixedCoordsInLY?

Posted: Wed Nov 16, 2011 6:27 pm
by Thargoid
I think you will need to define each as a vector3D, rather than as a string perhaps.

For example "5.6, 3.4, 0" would become Vector3D(5.6, 3.4, 0) and so on for the rest of the array.

That's based on the constructor example on the wiki, which is the format that galacticHyperspaceFixedCoordsInLY needs its input in. It does also say that it rounds the integers, which may impact on what you're trying to do?

Re: Cannot set property galacticHyperspaceFixedCoordsInLY?

Posted: Wed Nov 16, 2011 6:51 pm
by Kaks
You should be able to use the [] notation too:

Code: Select all

this.galaxyCoords[7] = new Array([5.6, 3.4, 0],[5.6, 20.8, 0],[11.6, 42.2, 0] ... );
or even 'better':

Code: Select all

this.galaxyCoords[7] = [[5.6, 3.4, 0],[5.6, 20.8, 0],[11.6, 42.2, 0] ... ];

Re: Cannot set property galacticHyperspaceFixedCoordsInLY?

Posted: Wed Nov 16, 2011 6:53 pm
by Wildeblood
Thargoid wrote:
I think you will need to define each as a vector3D, rather than as a string perhaps.

For example "5.6, 3.4, 0" would become Vector3D(5.6, 3.4, 0) and so on for the rest of the array.

That's based on the constructor example on the wiki, which is the format that galacticHyperspaceFixedCoordsInLY needs its input in. It does also say that it rounds the integers, which may impact on what you're trying to do?
I read that, but I got these numbers by making the game display its current settings for galacticHyperspaceFixedCoordsInLY in a console message (I didn't choose them arbitrarily), so I assume the numbers are correct. There are 96 SecCom systems, so I'll be a bit miffed if I've formatted this all wrongly.

Code: Select all

02:47:52.694 [script.javaScript.exception.ooliteDefinedError]: ***** JavaScript exception (Naval-GalDrive-Programmer 0.1): Error: Could not construct vector from parameters ("5.6, 3.4, 0") -- expected Vector, Entity or array of three numbers.
02:47:52.694 [script.javaScript.exception.ooliteDefinedError]:       ../AddOns/Sensible GalDrives (WIP).oxp/Scripts/naval_galdrive_programmer.js, line 88.
02:47:53.560 [script.javaScript.exception.ooliteDefinedError]: ***** JavaScript exception (Naval-GalDrive-Programmer 0.1): Error: Could not construct vector from parameters ("5.6, 3.4, 0") -- expected Vector, Entity or array of three numbers.
02:47:53.560 [script.javaScript.exception.ooliteDefinedError]:       ../AddOns/Sensible GalDrives (WIP).oxp/Scripts/naval_galdrive_programmer.js, line 88.
It's the " " that is wrong? They should be [ ]?

Re: Cannot set property galacticHyperspaceFixedCoordsInLY?

Posted: Wed Nov 16, 2011 6:56 pm
by Kaks
You either do
Vector3D(5.6, 3.4, 0)
or
[5.6, 3.4, 0]
you seem to have done
Vector3D("5.6, 3.4, 0")
you added extra - unneded - quotes with js vector3Ds

Re: Cannot set property galacticHyperspaceFixedCoordsInLY?

Posted: Wed Nov 16, 2011 7:02 pm
by Wildeblood
Thank you, Kaks. Thank you, Thargoid. It's working now.