System Redux

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

Moderators: another_commander, winston

krombart
Competent
Competent
Posts: 52
Joined: Tue May 20, 2008 9:25 am

System Redux

Post by krombart »

Running System Redux I get those error messages (I works anyway) Would be cool if that could be fixed.

2008-05-25 10:37:03.670 oolite[5402] [script.javaScript.warning.162]: ----- JavaScript warning: reference to undefined property system_info[galaxyNumber * 256 + system.ID]
2008-05-25 10:37:03.670 oolite[5402] [script.javaScript.warning.162]: /home/ebw/.Oolite/AddOns/System_Redux.oxp/Config/script.js, line 53.
2008-05-25 10:37:03.670 oolite[5402] [script.javaScript.warning.162]: ----- JavaScript warning: reference to undefined property system_info[galaxyNumber * 256 + system.ID]
2008-05-25 10:37:03.671 oolite[5402] [script.javaScript.warning.162]: /home/ebw/.Oolite/AddOns/System_Redux.oxp/Config/script.js, line 71.
2008-05-25 10:37:03.671 oolite[5402] [script.javaScript.warning.162]: ----- JavaScript warning: reference to undefined property system_info[galaxyNumber * 256 + system.ID]
2008-05-25 10:37:03.671 oolite[5402] [script.javaScript.warning.162]: /home/ebw/.Oolite/AddOns/System_Redux.oxp/Config/script.js, line 89.
2008-05-25 10:37:22.835 oolite[5402] [script.javaScript.warning.162]: ----- JavaScript warning: reference to undefined property system_info[galaxyNumber * 256 + system.ID]
2008-05-25 10:37:22.836 oolite[5402] [script.javaScript.warning.162]: /home/ebw/.Oolite/AddOns/System_Redux.oxp/Config/script.js, line 53.
2008-05-25 10:37:22.836 oolite[5402] [script.javaScript.warning.162]: ----- JavaScript warning: reference to undefined property system_info[galaxyNumber * 256 + system.ID]
2008-05-25 10:37:22.836 oolite[5402] [script.javaScript.warning.162]: /home/ebw/.Oolite/AddOns/System_Redux.oxp/Config/script.js, line 71.
2008-05-25 10:37:22.836 oolite[5402] [script.javaScript.warning.162]: ----- JavaScript warning: reference to undefined property system_info[galaxyNumber * 256 + system.ID]
2008-05-25 10:37:22.837 oolite[5402] [script.javaScript.warning.162]: /home/ebw/.Oolite/AddOns/System_Redux.oxp/Config/script.js, line 89.
krombart
Competent
Competent
Posts: 52
Joined: Tue May 20, 2008 9:25 am

Post by krombart »

I played a little bit and found that the code

this.addMoons = function()
{
LogWithClass("script.javaScript.warning.162","Trying to access system_info " + galaxyNumber * 256 + system.ID);
LogWithClass("script.javaScript.warning.162","system.ID " + system.ID);
LogWithClass("script.javaScript.warning.162","galaxyNumber " + galaxyNumber);
}

produced the output

2008-05-25 12:20:58.852 oolite[6050] [script.javaScript.warning.206]: ----- JavaScript warning: LogWithClass() is deprecated, use log() instead.
2008-05-25 12:20:58.853 oolite[6050] [script.javaScript.warning.162]: Trying to access system_info 593927
2008-05-25 12:20:58.853 oolite[6050] [script.javaScript.warning.206]: ----- JavaScript warning: LogWithClass() is deprecated, use log() instead.
2008-05-25 12:20:58.853 oolite[6050] [script.javaScript.warning.162]: system.ID 7
2008-05-25 12:20:58.853 oolite[6050] [script.javaScript.warning.206]: ----- JavaScript warning: LogWithClass() is deprecated, use log() instead.
2008-05-25 12:20:58.854 oolite[6050] [script.javaScript.warning.162]: galaxyNumber 232

which seems a little bit absurd. galaxyNumber is definitely buggy.

BTW: How Do I do correct logging?
krombart
Competent
Competent
Posts: 52
Joined: Tue May 20, 2008 9:25 am

Post by krombart »

This occurred on oolite 1.72
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

BTW: How Do I do correct logging?
Instead of:

Code: Select all

LogWithClass("script.javaScript.warning.162","galaxyNumber " + galaxyNumber);
write:

Code: Select all

log("galaxyNumber " + galaxyNumber);
// or
log("myTest.galaxyNumber", "galaxyNumber: " + galaxyNumber);
I can’t do anything about the bad galaxyNumber values at the moment since I’m not at home.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

I can’t recreate this under either Mac OS X or Linux. Exactly where are you calling your test function?
krombart
Competent
Competent
Posts: 52
Joined: Tue May 20, 2008 9:25 am

Post by krombart »

I simply changed the addMoon function from script.js from SystemRedux.
User avatar
CaptKev
---- E L I T E ----
---- E L I T E ----
Posts: 519
Joined: Fri Jan 26, 2007 3:21 pm
Location: Shropshire, UK

Post by CaptKev »

krombart wrote:
I simply changed the addMoon function from script.js from SystemRedux.
Why did you change the AddMoon function?

I've been using System Redux beta ever since JavaScript was added and have never experienced the galaxyNumber problem. :?
Download Fighter HUD, Stingray and System Redux from the EliteWiki
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

I've come across something else: If I misjump with System_Redux installed, the JS-console shows the following entries (I don't understand the reference to strict mode, I don't play in strict mode; System_Redux wouldn't do anything in strict mode, would it?):

Code: Select all

Warning (strict mode): reference to undefined property system_info[galaxyNumber * 256 + system.ID]
    Active script: "System Redux 1.1 beta" 1.1
    script.js, line 63:
    	var sys_info = system_info[galaxyNumber * 256 + system.ID] & (0x0F >> (4 - this.max_moons));
Warning (strict mode): reference to undefined property system_info[galaxyNumber * 256 + system.ID]
    Active script: "System Redux 1.1 beta" 1.1
    script.js, line 81:
    	var sys_info = system_info[galaxyNumber * 256 + system.ID] & (0xF0 >> (4 - this.max_planets));
Exception: TypeError: system.mainPlanet has no properties
    Active script: "System Redux 1.1 beta" 1.1
    script.js, line 101:
    		system.mainPlanet.setTexture('home_planet' + (((system_info[galaxyNumber * 256 + system.ID] & 0xF000) >> 12) + 1) + '.png');
I think it basically comes down to the fact that System_Redux isn't meant for planetNumber -1. So perhaps you should add another condition that prevents the script from being executed if in interstellar space.

EDIT: corrected "interplanetary" to "interstellar". What was I thinking when I wrote this??? Thanks, Frame!
Last edited by Commander McLane on Mon May 26, 2008 1:47 pm, edited 1 time in total.
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

Commander McLane wrote:
being executed if in interplanetary space.
Thats interstellar space ^^.

interplanetary is between planets, further out between stars that is interstellar.

just so you dont confuse Krombart or CaptKev
Bounty Scanner
Number 935
User avatar
CaptKev
---- E L I T E ----
---- E L I T E ----
Posts: 519
Joined: Fri Jan 26, 2007 3:21 pm
Location: Shropshire, UK

Post by CaptKev »

Commander McLane wrote:
I've come across something else: If I misjump with System_Redux installed, the JS-console shows the following entries (I don't understand the reference to strict mode, I don't play in strict mode; System_Redux wouldn't do anything in strict mode, would it?)
There's a strict mode? :roll:

Regarding interstellar space, I'll add 1 to the planetNumber and an extra zero as the first element for each galaxy in the array.
Frame wrote:
just so you dont confuse Krombart or CaptKev
It doesn't take much :wink:
Download Fighter HUD, Stingray and System Redux from the EliteWiki
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Commander McLane wrote:
I've come across something else: If I misjump with System_Redux installed, the JS-console shows the following entries (I don't understand the reference to strict mode, I don't play in strict mode; System_Redux wouldn't do anything in strict mode, would it?
That’s the JavaScript parser’s strict mode. Oolite always sets SpiderMonkey to strict mode because it catches more potential bugs.

In this case, it’s an out-of-range array index. Your diagnosis is correct.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

CaptKev wrote:
Regarding interstellar space, I'll add 1 to the planetNumber and an extra zero as the first element for each galaxy in the array.
Wouldn't it be cleaner just to add an extra condition that prevents System_Redux from doing anything in interstellar space? In legacy scripting that would be a

Code: Select all

conditions = (planet_number greaterthan -1);
do =(
     {
      Rest of your code
     }
);
as the outer function. Don't know the JS-syntax.
User avatar
CaptKev
---- E L I T E ----
---- E L I T E ----
Posts: 519
Joined: Fri Jan 26, 2007 3:21 pm
Location: Shropshire, UK

Post by CaptKev »

Code: Select all

/*    001     002     003     004     005     006     007     008     009     010
this.system_info = new Array(
	0, 0x21A5, 0x2100, 0x1118, 0x8181, 0x3168, 0xD110, 0x2105, 0x0735, 0xC103, 0x7110...
	0, 0xC1A0, 0x2138, 0x0148, 0x1108, 0x1102, 0x6108, 0x11A0, 0xA1A0, 0x71F3, 0x4101...
	0, 0x2100, 0x7161, 0x7144, 0x6109, 0x0194, 0x81A2, 0x2144, 0xB180, 0x2199, 0x2153...
	0, 0x5180, 0x5103, 0x2142, 0x4122, 0x2116, 0x31C0, 0x3102, 0xC193, 0x0108, 0x1120...
	0, 0x0161, 0x212D, 0x8120, 0xA108, 0xC144, 0xA181, 0x4105, 0xD140, 0x2124, 0x9100...
	0, 0x1130, 0xF108, 0x5100, 0x0142, 0x31C0, 0x1104, 0x5104, 0xE100, 0x8141, 0x5102...
	0, 0xE173, 0x3150, 0x2148, 0x91B8, 0x1102, 0x0111, 0x6180, 0xF108, 0x9108, 0x1113...
	0, 0x4116, 0xD102, 0xA125, 0x5180, 0x0111, 0x6180, 0xF108, 0x1120, 0xA100, 0x1101...
);

this.homePlanet = function()
{
	if (!this.system_info[galaxyNumber * 256 + system.ID+1]) return;

	system.mainPlanet.setTexture('home_planet' + (((this.system_info[galaxyNumber * 256 + system.ID+1] & 0xF000) >> 12) + 1) + '.png');
}
This way allows for the planet texture to be turned off for particular system, which might be useful in the future.
Download Fighter HUD, Stingray and System Redux from the EliteWiki
User avatar
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Re: System Redux

Post by Svengali »

With CaptKevs permission a update to v1.2.1 is available.

-> http://www.box.net/shared/bdzr8ornxmjcyhc8r65j (7.6 KB)

The zip contains only the new script, planetinfo.plist and readme for the update.
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: System Redux

Post by Okti »

Code: Select all

this.changeSystems = function(ar)
{
	if(ar){
		for(var i=0;i<ar.length;i++){
			for(var j=0;j<ar[i].length;j++){
				system_info[(i*256)+1+ar[i][j]] = 0;
			}
		}
	} else this.system_info = this.org_system_info;
	return;
}
I think there must be a this. before system_info otherwise it does not seem to work.

The code must be as follows

Code: Select all

this.changeSystems = function(ar)
{
	if(ar){
		for(var i=0;i<ar.length;i++){
			for(var j=0;j<ar[i].length;j++){
				this.system_info[(i*256)+1+ar[i][j]] = 0;
			}
		}
	} else this.system_info = this.org_system_info;
	return;
}
My OXP's
And Latest Mission Coyote's Run
Post Reply