function main()
{
variable index:int Planets
variable iterator PlanetsIterator
variable iterator PlanetsByTypeIterator
variable collection:int PlanetsByType
variable int Counter = 1
; Using system Gulfonodi as test (Gulfonodi's ID is 30002384)
Universe[30002384]:GetPlanetIDs[Planets]
Planets:GetIterator[PlanetsIterator]
Universe[30002384]:GetNumPlanetsByType[PlanetsByType]
PlanetsByType:GetIterator[PlanetsByTypeIterator]
if ${PlanetsIterator:First(exists)}
{
echo "[PI] The Gulfonodi System has ${Planets.Used} planets:"
do
{
echo "[PI] - ${Counter}. ${PlanetsIterator.Value}: ${Universe[${PlanetsIterator.Value}].Name}"
Counter:Inc
}
while ${PlanetsIterator:Next(exists)}
}
Counter:Set[1]
if ${PlanetsByTypeIterator:First(exists)}
{
echo "[PI] The breakdown of planet types in the Gulfondi System are as follows:"
do
{
echo "[PI] - ${Counter}. ${PlanetsByTypeIterator.Key}: ${PlanetsByTypeIterator.Value}"
Counter:Inc
}
while ${PlanetsByTypeIterator:Next(exists)}
;;;
; Note: To get quantities by type, use ${PlanetsByType.Element["Barren"]}, for example.
;;;
}
Counter:Set[1]
return
}
Home » Script Examples (Snippets)
Also available in: PDF
Accessing Planet Information from solarsystem datatype
Article version: 4 -
Added by Amadeus over 1 year ago
| Updated by Amadeus over 1 year ago.
| Viewed 313 times