Page 1 of 1

Finding the Name of a Star System

Posted: Sun May 31, 2009 4:42 pm
by Nemoricus
I have a set of arrays with the numbers of certain systems in them and need to match them with the name of the system they correspond to. I cannot figure out a way to do so.

My first thought was to make a look-up table containing the names of all of the systems in a given galaxy, but I cannot find any OXP that does anything similar. Since I can't figure out how to do it on my own, I can't use this method.

My second method would be to query Oolite for the name that a given system number in a given galaxy has, but I cannot find any documentation that suggests that something like this exists.

Does anyone have any suggestions as to how to match a system number with the name of that system?

Posted: Sun May 31, 2009 5:57 pm
by Rxke
You mean The Oolite/Elite planet list?

http://wiki.alioth.net/index.php/Oolite_planet_list

or do you want to do it in-game?

Posted: Sun May 31, 2009 5:59 pm
by Nemoricus
That's the second time I brought up something related to matching system numbers and names and that's the second time that someone's first thought was to direct me to that page. I really should mention that that's not what I need.

I need a method in script to do that matching. I already have the lists. They're just not usable in an OXP as is.

Yes, what I need is a method to do so while the game's running.

Posted: Sun May 31, 2009 6:17 pm
by DaddyHoggy
You can query what system you're in - you could use that number to look up a position in an array - the array holding all the system names in numerical order.

http://wiki.alioth.net/index.php/Oolite ... ce:_System

However, this is from somebody who has never written an OXP (so you may wish to take your own condiment)

Posted: Sun May 31, 2009 6:20 pm
by Thargoid
system.systemIDForName and system.systemNameForID will do it in Javascript.

They take in the system's number and throw out the system's name (or vice-versa respectively). So for your purposes you'd want the latter one.

Posted: Sun May 31, 2009 6:26 pm
by Nemoricus
Thank you, Thargoid.

Posted: Sun May 31, 2009 7:00 pm
by DaddyHoggy
Knew if I said something dumb then somebody would immediately come along and say something sensible! Fortunately, I am a bird of very little ego.

Posted: Sun May 31, 2009 7:03 pm
by Thargoid
Nothing dumb about it at all. Those two commands are detailed on the page you linked to.

So when can we expect the first DH Javascript OXP? ;)

Posted: Mon Jun 01, 2009 1:23 am
by Nemoricus
I'm surprised I didn't spot those before. I was looking on that very page for something like that.

Again, thank you, Thargoid, for your help.