for (a in b)
syntax.But it seems obvious from the output that the way you've done it
oSys
turns out to be an integer number, not a systemInfo
object (as you would actually need), or else you wouldn't get
Code: Select all
21:45:08.912 [undefined]: oSys: 0
name
property.)So this is where you need to look.
EDIT: Yep, looking it up it appears that
oSys
in your syntax is only a counter, not the counted thing itself. Thus you need to make it point to the thing (the systemInfo
) itself, for instance like this:
Code: Select all
this.playerStartedJumpCountdown = function(type, seconds)
{
var aSysInRange = system.info.systemsInRange();
for ( counter in aSysInRange )
{
var oSys = aSysInRange[counter];
LogMsg( "========================================" );
LogMsg( "System in range # " + counter );
LogMsg( "oSys: " + oSys );
LogMsg( "System ID: " + oSys.systemID );
LogMsg( "System coords: " + oSys.coordinates );
LogMsg( "System government: " + oSys.government );
}
}
EDIT2: And it does. Here's the output from my current location (run and pasted from the JS-console, thus no time stamps):
Code: Select all
========================================
System in range # 0
oSys: [SystemInfo galaxy 7, system 73]
System ID: 73
System coords: (60.8, 28.2, 0)
System government: 5
========================================
System in range # 1
oSys: [SystemInfo galaxy 7, system 102]
System ID: 102
System coords: (63.6, 22.8, 0)
System government: 4
========================================
System in range # 2
oSys: [SystemInfo galaxy 7, system 110]
System ID: 110
System coords: (56, 24, 0)
System government: 6
========================================
System in range # 3
oSys: [SystemInfo galaxy 7, system 120]
System ID: 120
System coords: (63.2, 27, 0)
System government: 2
========================================
System in range # 4
oSys: [SystemInfo galaxy 7, system 127]
System ID: 127
System coords: (63.2, 24.4, 0)
System government: 4
========================================
System in range # 5
oSys: [SystemInfo galaxy 7, system 177]
System ID: 177
System coords: (56.4, 19, 0)
System government: 7
========================================
System in range # 6
oSys: [SystemInfo galaxy 7, system 184]
System ID: 184
System coords: (61.2, 20.2, 0)
System government: 2
========================================
System in range # 7
oSys: [SystemInfo galaxy 7, system 193]
System ID: 193
System coords: (62, 26.8, 0)
System government: 3
========================================
System in range # 8
oSys: [SystemInfo galaxy 7, system 201]
System ID: 201
System coords: (56.4, 26, 0)
System government: 5