addShipsToRoute not working in interstellar space (trunk)

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

Moderators: winston, another_commander, Getafix

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

addShipsToRoute not working in interstellar space (trunk)

Post by Commander McLane »

Apparently addShipsToRoute doesn't work in interstellar space. It returns null.

This could be deliberately, because there are no routes in interstellar space. A warning/reminder in the Wiki would be nice, though.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: addShipsToRoute not working in interstellar space (trunk

Post by Switeck »

It possibly could be "made to work" but only if distance along the route is set to 0. :lol:
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: addShipsToRoute not working in interstellar space (trunk

Post by Commander McLane »

That's what I did when it didn't work.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: addShipsToRoute not working in interstellar space (trunk

Post by Eric Walch »

Commander McLane wrote:
Apparently addShipsToRoute doesn't work in interstellar space. It returns null.

This could be deliberately, because there are no routes in interstellar space. A warning/reminder in the Wiki would be nice, though.
It is better to have it return null than populate all ships near the zero coordinate, because its clearly an oxp error when that code is used in places without any possible route :)
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Re: addShipsToRoute not working in interstellar space (trunk

Post by JensAyton »

Documentation updated.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: addShipsToRoute not working in interstellar space (trunk

Post by Switeck »

I guess I need to re-read how to place ships at absolute coordinates using the new methods. :(
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: addShipsToRoute not working in interstellar space (trunk

Post by Commander McLane »

Switeck wrote:
I guess I need to re-read how to place ships at absolute coordinates using the new methods. :(
It's not so difficult, especially for interstellar space. The player is always spawned in the vicinity of the origin [0, 0, 0] (vectors are given in square brackets). So, if you want to spawn a ship there as well, you only need to use

Code: Select all

system.addShips("role", 1, [0, 0, 0]);
If you want more than one ship, you change the 1 to another value.

There is a fourth optional parameter for specifying the radius around the coordinates in which the ships may be spawned. If you don't use it, one scanner radius (25600m) will be used. Therefore the above example is identical to

Code: Select all

system.addShips("role", 1, [0, 0, 0], 25600);
Obviously you can play with the radius parameter as well.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: addShipsToRoute not working in interstellar space (trunk

Post by Eric Walch »

Commander McLane wrote:
It's not so difficult, especially for interstellar space. The player is always spawned in the vicinity of the origin [0, 0, 0] (vectors are given in square brackets). So, if you want to spawn a ship there as well, you only need to use

Code: Select all

system.addShips("role", 1, [0, 0, 0]);
If you want more than one ship, you change the 1 to another value.
You can do it even shorter by using

Code: Select all

system.addShips("role", 1);
[0, 0, 0] is default position when you skip it. That way is does the same as the old

Code: Select all

system.legacy_addShips("role", 1);
:P
Post Reply