Thanks. Manifest gives the quantities of all items in the hold; it doesn't seem to indicate the prices they were bought at (That's what I need to calculate profit) - is there any way to get at those? I mean, is it a question of setting global variables (if that's even possible)?
Yep. In my simple - and still hypothetical - 'Elite Trader' OXP I'd prefer to avoid saving or logging anything... just have a conditional statement to decide whether the trade was good or not, and update (or not) the player's Elite score accordingly.
For a player and NPC ship, how to definitively restrict the availability of, for example, military lasers and military shield enhancers? I'm forced to ask because I have already, in FE Ships and FE Ships Player, removed those options from the "optional_equipment" in shipyard.plist, with the forbidden items still turning up for purchase at the shipyards of certain stations.
Edit: This is just for a few of the lighter craft, not all ships. I know there's "available_to_NPCs" in equipment.plist, but I think that's for all ships?
Edit: The Wiki suggests that allowAwardEquipment() might work if I include it in a condition script. It also says that the ship parameter can be an array... so how would I code that in practice?
In the JS Wiki: serviceLevel : Number (read/write, positive integer in range 75-100)
The level of servicing the player's ship has. Renovation will be offered in shipyards at 85 or below, and malfunctions are more likely at lower values. This affects the sales price of the ship.
Would setting this to 100 effectively bring the ship into good repair (including all equipment)?
No, they are different properties. The equivalent of max_energy is maxEnergy. Generally the convention is underscores for the plist stuff and camelCase for the JS stuff.
maxSpeed
maxSpeed : Number (read-only, read/write from 1.81)
The ship’s maximum speed under normal power.
Problem incrementing maxSpeed, then thought it should it be maxFlightSpeed, as in the plist, but that gave me undefined. Can anyone enlighten me on how to modify a ship's max speed?
Two possibilities:
1. The condition is not satisfied, therefore PS.maxSpeed++ is never exectued.
2. You have not tried PS.maxSpeed++ more than once. The first time you execute it, it will return its value and then increment it. You may want to try ++PS.speed instead so that it increments first, then it returns its value.
If it resets, then there must be something else that is resetting it. Another OXP script maybe?
Here, have a look at this screenshot of the console checking maxSpeed:
We start at 350. Then do a maxSpeed++. It still shows 350, but it has incremented it already to 351. Then we do another ++ and it shows 351, but it has incremented it already to 352. And so on until it displays 354 and has incremented it to 355. At this point we just do a PS.maxSpeed and get back 355, as expected. I don't see a problem here.