Page 21 of 29

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Posted: Mon Nov 09, 2020 1:04 pm
by Reval
True. The old hands (Braben/Bell) really squeezed a world of bytes into that 32k!

But I never really went on to 80386/486 etc with the PC: moved straight on up to higher level langs. Never looked back :)

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Posted: Mon Nov 09, 2020 2:51 pm
by dybal
Reval wrote: Mon Nov 09, 2020 11:12 am
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)?
Market Observer keeps a buy log

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Posted: Mon Nov 09, 2020 2:55 pm
by Reval
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.

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Posted: Wed Nov 11, 2020 10:34 am
by Reval
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?

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Posted: Mon Nov 16, 2020 6:44 am
by Reval
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)?

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Posted: Mon Nov 16, 2020 7:00 am
by another_commander
Yes. You can easily verify that in the debug console if you are at a high tech level system and execute:

Code: Select all

player.ship.serviceLevel = 80
Now if you go to the F3 screen you get the Maintenance Overhaul option. Next execute

Code: Select all

player.ship.serviceLevel = 100
and now the Maintenance Overhaul option is gone from the F3 screeen.

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Posted: Mon Nov 16, 2020 10:59 am
by Reval
Indeed it does - thanks.

player.ship.maxforwardShield yields "undefined" when attempting to print the value. What is the range and is it really possible to increment it?

Is it the same property as max_energy in shipdata.plist?

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Posted: Mon Nov 16, 2020 11:02 am
by another_commander
Try maxForwardShield (with a capital F). All these properties are case sensitive.

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Posted: Mon Nov 16, 2020 11:03 am
by Reval
Oops. And is it equivalent to max_ energy?

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Posted: Mon Nov 16, 2020 11:04 am
by another_commander
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.

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Posted: Mon Nov 16, 2020 6:30 pm
by Reval
That makes sense.

Now, the Wiki has

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?

Edit: this is what I'm doing -

Code: Select all

if (this.$etLastSpeed<this.$etLimitSpeed) player.ship.maxSpeed++;
but it stays constant, refusing to increment.

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Posted: Mon Nov 16, 2020 8:17 pm
by another_commander
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.

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Posted: Tue Nov 17, 2020 5:25 am
by Reval
Well, the odd thing is, all the other properties I'm incrementing with the same logic increase just fine...

Code: Select all

this.shipWillDockWithStation = function(station) {
		// incremental protective enhancements for the ship
		if (this.$etLastSpeed<this.$etLimitSpeed) {
			player.ship.maxSpeed++;
		}
		if (this.$etLastThrust<this.$etLimitThrust) {
			player.ship.maxThrust++;
		}
		if (this.$etLastShields<this.$etLimitShields) {
			player.ship.maxForwardShield++;
			player.ship.maxAftShield++;
		}
		if (this.$etLastEnergy<this.$etLimitEnergy) {
			player.ship.maxEnergy++;
		}
		if (this.$etLastRecharge<this.$etLimitRecharge) {
			player.ship.forwardShieldRechargeRate++;
			player.ship.aftShieldRechargeRate++;
		}
		// update last specs
		this.$etLastSpeed=player.ship.maxSpeed;
		this.$etLastThrust=player.ship.maxThrust;
		this.$etLastShields=player.ship.maxForwardShield;
		this.$etLastEnergy=player.ship.maxEnergy;
		this.$etLastRecharge=player.ship.forwardShieldRechargeRate;
	}
}
It's only maxSpeed that isn't. Well, it does appear to increase once, but then resets itself.

BTW, testing on 1.82 atm, the min version specified in my manifest.plist... also on 1.90 - same result. :?

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Posted: Tue Nov 17, 2020 6:37 am
by another_commander
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:
Image
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.

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Posted: Tue Nov 17, 2020 6:42 am
by Reval
No arguing with that :)

I'll try on a completly barebones install then...

I do have various oxps that play with speed - Torus to Sun Drive, injector cruise control etc.

Many thanks.