Scripting requests

An area for discussing new ideas and additions to Oolite.

Moderators: another_commander, winston

User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Commander McLane wrote:
Ahruman, I love you!

I'm feeling like with Father Christmas here: You submit a request, and it gets fulfilled!!!

Joy! :D :D :D :D :D

(Sorry, you may as well delete this enthusiastic outburst of mine when you've read it. :oops:)
*enshrines outburst*

Keep in mind that for each quickly-answered bug report or feature request, there are at least twenty that are effectively ignored…
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:

Post by Commander McLane »

To get back to my original request and to show how important has_npc_traffic is going to be, let me tell you what happened yesterday:

As I said I want to dock the player with a Generation Ship, so I made that dockable. The (unwanted) result is that there are traders randomly launching from the Generation Ship. Yesterday it happened that one of those traders went a short while forward and ... jumped. Now as also the Generation Ship moves forward--painfully slowly, of course--eventually it got caught by the trader's wormhole and disappeared, leaving the most gigantic wormhole I've ever seen :shock:! Its blue dot was at the very edge of my scanner, but it filled the sky! And I got sucked in when I came closer than 20 kilometers! WOW!
User avatar
nijineko
---- E L I T E ----
---- E L I T E ----
Posts: 353
Joined: Wed Jul 04, 2007 3:37 pm
Location: two strange quarks short of a graviton....
Contact:

Post by nijineko »

sweet! where can i find that? hmmm, have you ever shot a wormhole? it has... interesting side effects.
arukibito ga michi wo erabu no ka, michi ga arukibito wo erabu no deshou ka?

Image
Play games. Win Amazon gift cards! Brag. Repeat.
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:

Post by Commander McLane »

You can't find it yet, because it's still in the making (and has still to go a long way). And again, the has_npc_traffic-key is meant to prevent something like this incident from happening, so you are not going to see it anyway, as far as I am concerned. :roll:
User avatar
nijineko
---- E L I T E ----
---- E L I T E ----
Posts: 353
Joined: Wed Jul 04, 2007 3:37 pm
Location: two strange quarks short of a graviton....
Contact:

Post by nijineko »

seriously, try shooting the wormhole on your way in. but you have to hit it dead center. with a wormhole that big, though, you might just crash the game instead of seeing the spectacular results. ^^
arukibito ga michi wo erabu no ka, michi ga arukibito wo erabu no deshou ka?

Image
Play games. Win Amazon gift cards! Brag. Repeat.
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1878
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post by Arexack_Heretic »

why are traders launching from it?
The behemoth only launches interceptors, I have yet to see any other ship dock with one.
Riding the Rocket!
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:

Post by Commander McLane »

Arexack_Heretic wrote:
why are traders launching from it?
The behemoth only launches interceptors, I have yet to see any other ship dock with one.
Well, just tested it. Made an entity-status-dump of a Behemoth. Looks basically the same as for my Generation Ship:

Code: Select all

[dumpState]: State for <StationEntity Behemoth - Titan 263>:
  [dumpState.entity]: Universal ID: 263
  [dumpState.entity]: Scan class: CLASS_POLICE
  [dumpState.entity]: Status: STATUS_IN_FLIGHT
  [dumpState.entity]: Position: (-9527.52, 7538.95, -8892.81)
  [dumpState.entity]: Orientation: (0.99058 - 0.053205i + 0.0735196j - 0.102541k)
  [dumpState.entity]: Distance travelled: 589.563
  [dumpState.entity]: Energy: 2500 of 2500
  [dumpState.entity]: Mass: 7.16395e+07
  [dumpState.entity]: Flags: isShip, isStation, hasMoved, hasRotated, isSunlit
  [dumpState.shipEntity]: Name: Behemoth - Titan
  [dumpState.shipEntity]: Roles: behemoth-titan
  [dumpState.shipEntity]: Subentity count: 35
  [dumpState.shipEntity]: Time since shot: 100007
  [dumpState.shipEntity]: Behaviour: BEHAVIOUR_ATTACK_FLY_TO_TARGET_TWELVE
  [dumpState.shipEntity]: Target: <ShipEntity Thargoid Warship 249>
  [dumpState.shipEntity]: Destination: (-1494.02, 6101.75, -5195.25)
  [dumpState.shipEntity]: Other destination: (0, 0, 0)
  [dumpState.shipEntity]: Waypoint count: 0
  [dumpState.shipEntity]: Desired speed: 125
  [dumpState.shipEntity]: Fuel: 0
  [dumpState.shipEntity]: Fuel accumulator: 1
  [dumpState.shipEntity]: Missile count: 0
  [dumpState.shipEntity.ai]: AI:
    [dumpState.ai]: State machine name: carrierPatrolAI.plist
    [dumpState.ai]: Current state: ATTACK_TARGET
    [dumpState.ai]: Next think time: 220.888
    [dumpState.ai]: Next think interval: 220.888
  [dumpState.shipEntity]: Frustration: 0
  [dumpState.shipEntity]: Success factor: 0
  [dumpState.shipEntity]: Shots fired: 0
  [dumpState.shipEntity]: Hull temperature: 60
  [dumpState.shipEntity]: Heat insulation: 1
  [dumpState.shipEntity]: Flags: has_ecm, escortsAreSetUp
  [dumpState.stationEntity]: Alert level: green
  [dumpState.stationEntity]: Max police: 8
  [dumpState.stationEntity]: Max defence ships: 3
  [dumpState.stationEntity]: Police launched: 1
  [dumpState.stationEntity]: Max scavengers: 3
  [dumpState.stationEntity]: Scavengers launched: 0
  [dumpState.stationEntity]: Docked shuttles: 3
  [dumpState.stationEntity]: Docked traders: 8
  [dumpState.stationEntity]: Equivalent tech level: 2147483647
  [dumpState.stationEntity]: Equipment price factor: 1
  [dumpState.stationEntity]: Flags: no_docking_while_launching
The last part is the relevant one. And it shows that there are the same numbers of docked ships as for any other station, including eight traders. Why you haven't seen them launching (and I don't recall it either), is a mystery to me.
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1878
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post by Arexack_Heretic »

I usually see them in WS, testing 'Thargorn'. No reason to launch there, no traders required in WS.


ok I dunno. :lol:
Riding the Rocket!
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:

Post by Commander McLane »

Well, it just seems to me that all stations (=dockable entities) are given a default number of police ships, defense ships, scavengers, traders and shuttles on being spawned, and there is nothing much we can currently do about it. (Apart from waiting for the version where has_npc_traffic and the like will be implemented.)

Actually even Thargoid Carriers should be able to launch traders. Although I've never seen that.
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1878
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post by Arexack_Heretic »

I'm having trouble myself with a hermit-lookalike, It won't set the techlevel to 1 and defenceships are either police or not at all.

Additional keys for Docking_allowed_roles (and also launching) etc would be helpfull in your case.
in the same line as max_scavengers, max_defenceShips, max_miners, etc.
Riding the Rocket!
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:

Post by Commander McLane »

Yes, equivalent_techlevel and some other shipdata-keys are broken in 1.69.1. Have a look at the bug reports.

But Ahruman has already fixed it on his harddisk. Not yet released, though.
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1878
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post by Arexack_Heretic »

I always forget whats in the changelogs.

Maybe I should revert to an older version to test/update OXP's. :/
Or just wait for the next patch. ;)

edit: I gots a request...may not be a new one, may even be already implemented.

Code: Select all

cargoCarried_number as a queriable state. 
The purpose is to compare the amount of cargo carried by a player before and after a visit to a smugglers' asteroid: a crude way to 'check the manifest'.

A way to use trading (SoldGoods/BoughtGoods) as a trigger for scripting is not really usefull outside the context of what I want to do, so too much effort for the possible benefits to the community.
Riding the Rocket!
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1878
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post by Arexack_Heretic »

Ahruman wrote:
Ahruman wrote:
Hopefully it will be possible for ship-attached JavaScript scripts to get a “who killed me” parameter to their didBecomeDead() handler.
Update on this: the world script event for player deaths now has two paramaters, “whodunnit” and “context”, as in:

Code: Select all

this.didBecomeDead = function(whodunnit, context)
{
    Log("Gadzooks! Player was killed by " + whodunnit + " through " + context + ".");
}
Context can (currently) be one of:
  • “energy damage” (whodunnit is a ship)
  • “scrape damage” (whodunnit is a ship)
  • “heat damage” (whodunnit is null)
  • “hit a planet” (whodunnit is a planet)
There will be a similar takeDamage() event for energy, scrape, and possibly heat damage.

My intention is (still) to have NPC scripts look similar to world scripts, so the same principle will apply.

Oh, it’ll also be possible for NPC scripts to suppress explosions in their death handlers.
will 'hit a planet' by police cause the planet to become fugitive?
Riding the Rocket!
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Arexack_Heretic wrote:
will 'hit a planet' by police cause the planet to become fugitive?
Heh. The bounty stuff isn’t handled by JavaScript, but even if it was, setting the bounty of a planet would have no effect (because bounty is a Ship property, not a Planet property).
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1878
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Annoying kamikazes

Post by Arexack_Heretic »

I feel performAttack(etc) should reset speed from 100%+ back to 100%, I'm getting tired of being rammed to death by speedaddled pirates.
Riding the Rocket!
Post Reply