System Redux
Moderators: winston, another_commander
System Redux
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.
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.
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?
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?
- JensAyton
- Grand Admiral Emeritus
- Posts: 6657
- Joined: Sat Apr 02, 2005 2:43 pm
- Location: Sweden
- Contact:
Instead of:BTW: How Do I do correct logging?
Code: Select all
LogWithClass("script.javaScript.warning.162","galaxyNumber " + galaxyNumber);
Code: Select all
log("galaxyNumber " + galaxyNumber);
// or
log("myTest.galaxyNumber", "galaxyNumber: " + galaxyNumber);
E-mail: [email protected]
- JensAyton
- Grand Admiral Emeritus
- Posts: 6657
- Joined: Sat Apr 02, 2005 2:43 pm
- Location: Sweden
- Contact:
I can’t recreate this under either Mac OS X or Linux. Exactly where are you calling your test function?
E-mail: [email protected]
Why did you change the AddMoon function?krombart wrote:I simply changed the addMoon function from script.js from SystemRedux.
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
- Commander McLane
- ---- 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:
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?):
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!
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');
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.
Thats interstellar space ^^.Commander McLane wrote:being executed if in interplanetary space.
interplanetary is between planets, further out between stars that is interstellar.
just so you dont confuse Krombart or CaptKev
Bounty Scanner
Number 935
Number 935
There's a strict mode?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?)
Regarding interstellar space, I'll add 1 to the planetNumber and an extra zero as the first element for each galaxy in the array.
It doesn't take muchFrame wrote:just so you dont confuse Krombart or CaptKev
Download Fighter HUD, Stingray and System Redux from the EliteWiki
- JensAyton
- Grand Admiral Emeritus
- Posts: 6657
- Joined: Sat Apr 02, 2005 2:43 pm
- Location: Sweden
- Contact:
That’s the JavaScript parser’s strict mode. Oolite always sets SpiderMonkey to strict mode because it catches more potential bugs.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?
In this case, it’s an out-of-range array index. Your diagnosis is correct.
E-mail: [email protected]
- Commander McLane
- ---- 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:
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 aCaptKev 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.
Code: Select all
conditions = (planet_number greaterthan -1);
do =(
{
Rest of your code
}
);
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');
}
Download Fighter HUD, Stingray and System Redux from the EliteWiki
Re: System Redux
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.
-> http://www.box.net/shared/bdzr8ornxmjcyhc8r65j (7.6 KB)
The zip contains only the new script, planetinfo.plist and readme for the update.
- Okti
- ---- 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
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;
}
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;
}