Conversion to Cavezzi

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

Post Reply
User avatar
Cholmondely
Archivist
Archivist
Posts: 5251
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Conversion to Cavezzi

Post 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?
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
LittleBear
---- E L I T E ----
---- E L I T E ----
Posts: 2876
Joined: Tue Apr 04, 2006 7:02 pm
Location: On a survey mission for GalCop. Ship: Cobra Corvette: Hidden Dragon Rated: Deadly.

Re: Conversion to Cavezzi

Post 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.
Last edited by LittleBear on Fri May 13, 2022 5:25 pm, edited 1 time in total.
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
User avatar
Cholmondely
Archivist
Archivist
Posts: 5251
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Conversion to Cavezzi

Post 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!
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
Slartibartfast
Deadly
Deadly
Posts: 175
Joined: Mon Jan 21, 2008 3:54 pm

Re: Conversion to Cavezzi

Post by Slartibartfast »

Hi

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

Slartibartfast :wink:
Oolite 1.91 / Imp. Trader ( slighly modified :wink: ) on Lubuntu 22.04 LTS on AMD64 2x 3800+ ,
ATI Radeon R7240 XFS / Samsung TV 40" 1080p
C-Media CMI8738 / Yamaha RX-V575 / DIY-Speaker
Logitech Attack3 & standard german keyboard
User avatar
LittleBear
---- E L I T E ----
---- E L I T E ----
Posts: 2876
Joined: Tue Apr 04, 2006 7:02 pm
Location: On a survey mission for GalCop. Ship: Cobra Corvette: Hidden Dragon Rated: Deadly.

Re: Conversion to Cavezzi

Post by LittleBear »

Unfortunately, the Galactic Banks refuse to deal with fiddling small change. :wink:
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
User avatar
Cholmondely
Archivist
Archivist
Posts: 5251
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Conversion to Cavezzi

Post 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
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
hiran
Theorethicist
Posts: 2315
Joined: Fri Mar 26, 2021 1:39 pm
Location: a parallel world I created for myself. Some call it a singularity...

Re: Conversion to Cavezzi

Post 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.
Sunshine - Moonlight - Good Times - Oolite
Post Reply