[Release] Navigation MFD

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

Moderators: winston, another_commander

User avatar
Nite Owl
---- E L I T E ----
---- E L I T E ----
Posts: 531
Joined: Sat Jan 20, 2018 4:08 pm
Location: In The Dark

Re: [Release] Navigation MFD

Post by Nite Owl »

Been getting a bunch of these lately.

Code: Select all

[script.javaScript.exception.unexpectedType]: ***** JavaScript exception (navi_mfd 1.9.2): TypeError: whom.target is null
Which has been traced back to this bit of code (line 388 in notepad++) from the script.js file (config folder) in this OXZ.

Code: Select all

// Tracker OXP
		else if (this.$targetName === "Tracker") {
			if (whom.target.displayName)
				this.$targetName = whom.target.displayName;
			else this.$targetName = whom.target.name;
			this.$targetName += " (Tracked)";
		}
The only TWEAKS made to this file are changing the km and kilometer references to Kiloometers at the very beginning of the file. This is a standard practice of mine and has caused no other similar problems. Why the error is being generated is beyond me. Any and all help would be deeply appreciated.
Humor is the second most subjective thing on the planet

Brevity is the soul of wit and vulgarity is wit's downfall

Good Night and Good Luck - Read You Soon
User avatar
hiran
Theorethicist
Posts: 2259
Joined: Fri Mar 26, 2021 1:39 pm
Location: a parallel world I created for myself. Some call it a singularity...

Re: [Release] Navigation MFD

Post by hiran »

Looking at your error

Code: Select all

[script.javaScript.exception.unexpectedType]: ***** JavaScript exception (navi_mfd 1.9.2): TypeError: whom.target is null
and the code line

Code: Select all

			if (whom.target.displayName)
what would you expect as a result if whom.target is null?
Or in other words: What would

Code: Select all

			if (null.displayName)
give as result?
Sunshine - Moonlight - Good Times - Oolite
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4772
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: [Release] Navigation MFD

Post by phkb »

I’ll investigate why “whom” is null tonight sometime.
User avatar
hiran
Theorethicist
Posts: 2259
Joined: Fri Mar 26, 2021 1:39 pm
Location: a parallel world I created for myself. Some call it a singularity...

Re: [Release] Navigation MFD

Post by hiran »

phkb wrote: Thu Jun 27, 2024 10:23 pm
I’ll investigate why “whom” is null tonight sometime.
I guess whom is not null but whom.target is.
So better check borh.
Sunshine - Moonlight - Good Times - Oolite
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4772
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: [Release] Navigation MFD

Post by phkb »

After some investigation, it appears that "whom.target" is the thing that is null. In this instance, "whom" is a tracker entity from the Tracker OXP, and if everything is working how Tracker expected it to, then the tracker ship entity would always have a "target" property populated with the target it's supposed to be tracking. But obviously, in this example, it has returned null. Based on my reading of the Tracker OXP, that situation shouldn't happen, although there might exist a chance between frames where a tracker is being spawned but the target hasn't been assigned.

But that's just from my reading of the code. I haven't tested this yet, and I don't normally play with Tracker OXP, so I'll need to set it up. More updates to follow.
Post Reply