Page 1 of 1

Conversion to Cavezzi

Posted: Fri May 13, 2022 11:17 am
by Cholmondely
LittleBear wrote: Fri Jul 09, 2021 7:44 pm
Other units are easy to add.

Oolite always gives the number in meters, so its just one line in script to convert that to any units eg:-

if (missionVariables.random_station_names_units == "Kilometres") var unitBase = 1000;

So I just need to know how many meters there are in your units to add that as a line.
I'd rather like to convert my relevant oxp's to display distances in La Serenissima's (old Venetian) Cavezzi

(Telescope, Market Inquirer (F4 In-system distances screen), Compass on the Vimana HUD, etc.).

(1 cavezzo = 6 piedi = 2.08641 French metric units)

1) What do I need to insert into the oxp's?
2) Does it matter where in the .js file I bung it?
Speculative - just yes/no wanted at this stage of the game:
3) Is it possible to create an override .oxp doing it for everything? And maybe include LittleBear's full range of units (Miles, OU's, Torans etc.)
4) Is it possible to forcibly change units for a player to miles in the Digebiti system and to cavezzi at Tibecea?

Re: Conversion to Cavezzi

Posted: Fri May 13, 2022 5:16 pm
by LittleBear
The game's code always returns distances in game meters. So you just need to know how many meters are in the unit you want to convert the number returned in meters into. There are 2.08641 meters in 1 Cavezzi, 1609.34 meters in a mile and (obviously) 1,000 meters in a KM.

As the Almanac uses user-selectable units, the denominator number used is stored as a variable (depending on which units are selected).

var distranceinUnits = (player.ship.position.distanceTo(target) - target.collisionRadius)/missionVariables.random_station_names_mfd_unitBase;

If you look at Telescope's code and search for a /1000 and change that to /2.08641 then it will convert to Cavezzi instead of KM. You'd probabley also need to search for a " km" and replace that text with a " CV" so the CV appears after the number instead of a km.

Re: Conversion to Cavezzi

Posted: Fri May 13, 2022 5:22 pm
by Cholmondely
LittleBear wrote: Fri May 13, 2022 5:16 pm
The game's code always returns distances in game meters. So you just need to know how many meters are in the unit you want to convert the number returned in meters into. There are 2.08641 meters in 1 Cavezzi, 1609.34 meters in a mile and (obviously) 1,000 meters in a KM.

As the Almanac uses user-selectable units, the denominator used is stored as a variable (depending on which units are selected).

var distranceinUnits = (player.ship.position.distanceTo(target) - target.collisionRadius)/missionVariables.random_station_names_mfd_unitBase;

If you look at Telescope's code and search for a /1000 and change that to /2.08641 then it will convert to Cavezzi instead of KM. You'd probabley also need to search for a " km" and replace that text with a " CV" so the CV appears after the number instead of a km.
Thanks! Have a super weekend!

Re: Conversion to Cavezzi

Posted: Sat May 14, 2022 3:39 pm
by Slartibartfast
Hi

...and i wanna have "Ningi" as monetary unit

Slartibartfast :wink:

Re: Conversion to Cavezzi

Posted: Sat May 14, 2022 7:02 pm
by LittleBear
Unfortunately, the Galactic Banks refuse to deal with fiddling small change. :wink:

Re: Conversion to Cavezzi

Posted: Wed Aug 17, 2022 3:51 am
by Cholmondely
So I've faffed about with the ideas above. As usual, dismal failure! All I've managed so far is to transmogrify my altitude on the Vimana HUD altimeter.

How do I cavezzificate the STE distances?

How do I cavezzify Telescope's MFDs and STE target distance labels?

How do I cavezzalise the Compass, Speed & Target Module in the Vimana HUD?

(1 cavezzo = 2 bracchia = 6 piedi = 72 diti = 864 punti = 10,368 atomi = 2.08641 French revolutionary metric units)

Evidence: STE's stubborn resistance to cavezzification:
Image

Re: Conversion to Cavezzi

Posted: Tue Aug 23, 2022 7:50 pm
by hiran
Cholmondely wrote: Fri May 13, 2022 11:17 am
I'd rather like to convert my relevant oxp's to display distances in La Serenissima's (old Venetian) Cavezzi
(Telescope, Market Inquirer (F4 In-system distances screen), Compass on the Vimana HUD, etc.).

(1 cavezzo = 6 piedi = 2.08641 French metric units)
Why would you ever want to leave the metric system?
Only those who exited a brexit can think along such lines. :lol:

But it has context.