Page 8 of 56

Posted: Tue Apr 29, 2008 9:29 am
by Commander McLane
Alternative: use Ship.remove(). – Ahruman

A method to empty a system completely without traces, so that a script can then populate it according to its needs.

sendAllShipsAway isn't really meant for this purpose (I suppose it was invented specifically for the Nova mission.), because the ships leave wormholes. This doesn't give the impression that the system was empty in the first place.

So the method I am asking for here would simply remove all existing entities (probably with the exeption of the main station). In legacy scripting I would suggest removeAllEntities as a method name.

I guess in JavaScript it could get a parameter which determines whether the main station is to be removed as well, or not, or perhaps to be replaced with what. (In interstellar space it would of course make no difference.)

Posted: Tue Apr 29, 2008 3:14 pm
by JensAyton
Alternative: use Ship.remove(). – Ahruman

Commander McLane wrote:
A method to empty a system completely without traces, so that a script can then populate it according to its needs.

sendAllShipsAway isn't really meant for this purpose (I suppose it was invented specifically for the Nova mission.), because the ships leave wormholes. This doesn't give the impression that the system was empty in the first place.

So the method I am asking for here would simply remove all existing entities (probably with the exeption of the main station). In legacy scripting I would suggest removeAllEntities as a method name.

I guess in JavaScript it could get a parameter which determines whether the main station is to be removed as well, or not, or perhaps to be replaced with what. (In interstellar space it would of course make no difference.)
Removing the main station willy-nilly isn’t really an option. Oolite makes lots of internal assumptions, which are special-cased for novaed systems.

I’ll look into adding a parameter to the sendAllShipsAway to suppress wormholes. Don’t expect a legacy version.

Posted: Mon May 12, 2008 10:54 am
by Eric Walch
Working on buoyRepair I encountered several AI commands that would be easier implemented when available in JS.

A lot can also be invoked by sending the AI a message but some are better to be used directly.

1)
I would like to have a JS equivalent of launchShipWithRole:. When the role is: trader, pirate, defenseShip, police etc. it should use the specific AI commands launchTrader, launchPirateShip, launchDefenseShip etc otherwise the plain launchShipWithRole:

Special launching defense ships with an AI sometimes leads to sending to much or many I noticed with working on the Leviathan AI.

2)
switching lights on/off could be useful when done directly in JS. Since 1.71 subentities can have their own flashers. This makes it possible to also selectively turn them on/off. e.g. It gives possibilities to have certain flashers always on and put additional ones on when a station or ship goes into alert mode.

3)
A script should be able to access the destination variable for read/write. Now I gave the buoyrepair station a fixed location that is hard-coded in the Amadillo ship and shuttle AI's. I would like to give the station a random location and the ships asking for this location at the worldScript. For that the script must be able to write a ships destination.
Also can I exactly calculate where the Amadillo with buoy should end for its placement, but I see no way to transmit these values to the ship. They now just go straight ahead for a fixed distance when launched. This only works well when no other ships interfere. Occasionally they hit other ships on their way and deviate their course a little because of this. But by using a gotoWaypoint.plist I would completely loose my endpoint.

4)
With version 1.47 Giles introduced user friendly coordinate systems for the various addShip commands. Working with vectors I noticed that this all happens with the internal coordinate system. |t is easy to get a station position, read in its orientation and calculate a point exactly in line with the docking bay and 9000 meters away. But when you want to add a buoy (or any other ship) at that place, I need the user friendly coordinates. Kaks suggested a new transformation function for this. Probably useful, but it is kind a stupid when already having internal coordinates. (At the end they have to be translated back to internal coordinates again).

I would suggest in adding an additional three character code: "INT" to the various coordinate systems. Whenever INT is uses the coordinates are treated as internal coordinates and are not transformed. (Or NAT for Native or any other sensible three letter code that does not interfere with the current ones)

5)
I think that the script can access the real location of a cloaked ship. To prevent misuse of that information it should also be "hidden" for a script. The most realistic way for implementation would we to add a new internal variable "cloakedPosition" to the ship entity. Whenever cloaking is activated the current location is stored in that variable. Now, when a script accesses the position of a ship it should get this value instead when cloaked.

Posted: Mon May 12, 2008 11:40 am
by Commander McLane
Eric Walch wrote:
4)
With version 1.47 Giles introduced user friendly coordinate systems for the various addShip commands. Working with vectors I noticed that this all happens with the internal coordinate system. |t is easy to get a station position, read in its orientation and calculate a point exactly in line with the docking bay and 9000 meters away. But when you want to add a buoy (or any other ship) at that place, I need the user friendly coordinates. Kaks suggested a new transformation function for this. Probably useful, but it is kind a stupid when already having internal coordinates. (At the end they have to be translated back to internal coordinates again).

I would suggest in adding an additional three character code: "INT" to the various coordinate systems. Whenever INT is uses the coordinates are treated as internal coordinates and are not transformed. (Or NAT for Native or any other sensible three letter code that does not interfere with the current ones)
Done. This is already available in 1.71.
1.71 release notes wrote:
...
Added support for “abs” co-ordinate system.
...
Haven't tried it out, but I would guess the character code is "abs", like in "abs 102243 -46376 895002".

Posted: Mon May 12, 2008 6:35 pm
by Eric Walch
Commander McLane wrote:
Done. This is already available in 1.71.
1.71 release notes wrote:
...
Added support for “abs” co-ordinate system.
...
Haven't tried it out, but I would guess the character code is "abs", like in "abs 102243 -46376 895002".
I had read this in the release notes and I should have realised what is mend. You are right, I tried it and it works as advertised.

I put the next lines in a station script.

Code: Select all

this.shipSpawned = function()
{
    system.legacy_addShipsAtPrecisely("my-buoy", 1, "abs", this.ship.position.add(this.ship.heading.multiply(9000)))
}
And the buoy is at 9000 meters in line with the bay. It now takes just one line that other scripters just can copy in their own script if they want.

Posted: Fri May 23, 2008 7:44 am
by JensAyton
Req: method to force next jump to misjump.

Posted: Fri May 23, 2008 7:53 am
by Commander McLane
Ahruman wrote:
Req: method to force next jump to misjump.
Thanks! :)

I take it this also means it doesn't yet exist. :(

Posted: Wed Jun 04, 2008 12:01 pm
by Amen Brick
Is there a simple script using an algorithm (one assumes) to make all the planets in a galaxy convert to corporate status randomly over a period of time?

Posted: Wed Jun 04, 2008 1:20 pm
by Disembodied
There are, I believe, some OXPs which do change the political status of one or two planets, so it might be possible already to do something like this. How you'd go about it though I have no idea. But I'm struggling to understand why anyone would want to... apart from filling the ooniverse with cops and losing almost all the pirates, it would seem to me to reflect a terribly old-fashioned, not to say Marxist, view of social development! :wink:

Posted: Wed Jun 04, 2008 1:26 pm
by Amen Brick
Disembodied wrote:
There are, I believe, some OXPs which do change the political status of one or two planets, so it might be possible already to do something like this. How you'd go about it though I have no idea. But I'm struggling to understand why anyone would want to... apart from filling the ooniverse with cops and losing almost all the pirates, it would seem to me to reflect a terribly old-fashioned, not to say Marxist, view of social development! :wink:
It's to do with consequences of failure of a mission (or success if you take the other intended mission path).

Posted: Wed Jun 04, 2008 1:36 pm
by LittleBear
It should be faily easy to do with Java Script. Set the current date as a variable. Then every seven days (or whatever) set the govenment number to 7 of a system randomly chosen with planetnumber [d256]. A 'news flash" should also be displayed with the mission screen every time a system switched (if you like).

Posted: Wed Jun 04, 2008 4:17 pm
by Disembodied
Amen Brick wrote:
It's to do with consequences of failure of a mission (or success if you take the other intended mission path).
Sounds interesting! A Borg-esque corporate juggernaut... now who does that remind me of...

Posted: Mon Jun 09, 2008 11:31 am
by Commander McLane
A method to set weapon_energy from a script.

According to the wiki-documentation weaponEnergy isn't even a ship-property under JS. I want that, and I want it to be read/write.

Reason: weapon_energy has two uses: it determines the power of the ship's lasers (or plasma turrets) and it calculates the power of dealEnergyDamageWithinDesiredRange for that ship. But you might want to have a ship which does both: Have lasers with a reasonable punch, and dealEnergyDamageWithinDesiredRange when it is killed. As it is now, in order to keep weapon_energy in a reasonable range for lasers (something in the range of 15-20) you would have to set the desired_range for the dealEnergyDamageWithinDesiredRange to something ridiculously high (see the example in this post). A better solution would be to reset the value of weapon_energy in the ship's AI, just before the dealEnergyDamageWithinDesiredRange, together with the setDesiredRangeTo:. If no new AI-method is intended, it could be made doable via JS in the ship's ship-script.

...

Posted: Tue Jun 10, 2008 7:09 am
by Lestradae
Many people would want the passenger transports to become a viable career path:

https://bb.oolite.space/viewtopic.ph ... c&start=15

I hereby make this a scripting request. It really would enhance the game. Thanks in advance 8)

Posted: Tue Jun 10, 2008 1:30 pm
by Commander McLane
Ahruman will tell you that this has nothing to do with scripting, therefore it isn't a scripting request.

What the interested parties have to do is to persuade one of the code-monkeys to change some internal calculations.