Cannot set property galacticHyperspaceFixedCoordsInLY?

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

Moderators: winston, another_commander

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

Cannot set property galacticHyperspaceFixedCoordsInLY?

Post 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.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Re: Cannot set property galacticHyperspaceFixedCoordsInLY?

Post 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?
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2407
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia

Re: Cannot set property galacticHyperspaceFixedCoordsInLY?

Post 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?
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Re: Cannot set property galacticHyperspaceFixedCoordsInLY?

Post 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?
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Re: Cannot set property galacticHyperspaceFixedCoordsInLY?

Post 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] ... ];
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2407
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia

Re: Cannot set property galacticHyperspaceFixedCoordsInLY?

Post 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 [ ]?
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Re: Cannot set property galacticHyperspaceFixedCoordsInLY?

Post 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
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2407
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia

Re: Cannot set property galacticHyperspaceFixedCoordsInLY?

Post by Wildeblood »

Thank you, Kaks. Thank you, Thargoid. It's working now.
Post Reply