systemIDForName What about duplicate names?

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

Post Reply
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

systemIDForName What about duplicate names?

Post by Okti »

According to Wiki=
systemIDForName

function systemIDForName(systemName : String) : Integer
Returns the ID number of a system in the current galaxy based on the system name)
What happens if you pass the name of a system like "Inzaan", which there a two planets with the same name in G8 :?:
My OXP's
And Latest Mission Coyote's Run
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:

Re: systemIDForName What about duplicate names?

Post by Commander McLane »

Okti wrote:
According to Wiki=
systemIDForName

function systemIDForName(systemName : String) : Integer
Returns the ID number of a system in the current galaxy based on the system name)
What happens if you pass the name of a system like "Inzaan", which there a two planets with the same name in G8 :?:
Why don't you just try it in the console:

Code: Select all

> System.systemIDForName("Inzaan")
22
Either it has returned one of them randomly, or the smaller number (the other Inzaan has ID 156).

Note that Inzaan is the only case of two planets with the same name in the same galaxy. So scripters should be aware of the exception.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Re: systemIDForName What about duplicate names?

Post by JensAyton »

It searches through the planet IDs from 0 to 255 and returns the first match. (It’s also laughably inefficient.) Docs updated.
Post Reply