Skip to content

Instantly share code, notes, and snippets.

@droberin
Last active July 27, 2024 20:08
Show Gist options
  • Save droberin/a8dcbcb371e92e06477cd833fa81272d to your computer and use it in GitHub Desktop.
Save droberin/a8dcbcb371e92e06477cd833fa81272d to your computer and use it in GitHub Desktop.
StarCitizen ship order in terminal device (prefixes your favourite ships with numbers to show up first using alphabetical order)

StarCitizen Favourite Ships (Author callsign: DRoBeR)

To avoid having to scroll into a big ship list, one can add a Prefix into their ship names... so they would pop up first on machine lists!!

Configuration

add your favourite ships by key into fav_ships.txt at same dir as the ps1 script. Example:

vehicle_nameANVL_Carrack
vehicle_NameANVL_C8R_Pisces_Rescue

Execution

open a PowerShell in directory where script and config is and just run .\starcitizen_fav_ships.ps1.

This script would create a global.ini file that should be copied into your STARCITIZENMainDirectory\LIVE\data\Localization\english\global.ini. Also requires to have set, in STARCITIZENMainDirectory\LIVE\user.cfg the value:

g_language = english

Each time this script is executed, you must copy global.ini.

extra info

Open downloaded global.source.ini to check vehicle ids, look for vehicle_name (case insensitive, as there are variations).

vehicle_nameANVL_Carrack
vehicle_NameANVL_C8R_Pisces_Rescue
.\fav_ships.ps1
Downloading global.source.ini from https://sctranslator.danidomen.com/download?locale=&hash=global...
Download completed.
Reading favorite ships from fav_ships.txt...
Favorite ships loaded: vehicle_nameANVL_Carrack, vehicle_NameANVL_C8R_Pisces_Rescue, vehicle_NameDRAK_Cutlass_Red, vehicle_NameCRUS_Starlifter_C2, vehicle_NameARGO_Mole
Processing global.source.ini...
Modifying line: vehicle_NameANVL_C8R_Pisces_Rescue -> 1-Anvil C8R Pisces Rescue
Modifying line: vehicle_nameANVL_Carrack -> 0-Anvil Carrack
Modifying line: vehicle_NameARGO_Mole -> 4-Argo MOLE
Modifying line: vehicle_NameCRUS_Starlifter_C2 -> 3-Crusader C2 Hercules Starlifter
Modifying line: vehicle_NameDRAK_Cutlass_Red -> 2-Drake Cutlass Red
Processing completed.
Files closed.
Script completed.
# Author CallSign: DRoBeR (in-game donations are welcome but I probably won't get notified...)
# Define the URL and the destination file names
$url = "https://sctranslator.danidomen.com/download?locale=en&hash=global"
$sourceFile = "global.source.ini"
$destFile = "global.ini"
$configFile = "fav_ships.txt"
# Download the global.source.ini file
Write-Host "Downloading global.source.ini from $url..."
Invoke-WebRequest -Uri $url -OutFile $sourceFile
Write-Host "Download completed."
# Read the favorite ships from the config file
Write-Host "Reading favorite ships from $configFile..."
$favShips = Get-Content $configFile
Write-Host "Favorite ships loaded: $( $favShips -join ', ' )"
# Open the destination file for writing
$destFileStream = [System.IO.StreamWriter]::new($destFile)
try
{
# Process the global.source.ini file line by line
Write-Host "Processing $sourceFile..."
$sourceFileStream = [System.IO.StreamReader]::new($sourceFile)
while ($null -ne ($line = $sourceFileStream.ReadLine()))
{
# Split the line using the first '=' as the delimiter
$splitLine = $line -split '=', 2
if ($splitLine.Count -eq 2)
{
$key = $splitLine[0]
$value = $splitLine[1]
# Check if the key is in the favorite ships list
$index = [array]::IndexOf($favShips, $key)
if ($index -ge 0)
{
# Replace the value with the prefixed value
$value = "$index-$value"
Write-Host "Modifying line: $key -> $value"
}
# Construct the new line
$newLine = "$key=$value"
}
else
{
# Line does not match the "key=value" format, keep it unchanged
$newLine = $line
}
# Write the new line to the destination file
$destFileStream.WriteLine($newLine)
}
Write-Host "Processing completed."
}
finally
{
# Close the file streams
$sourceFileStream.Close()
$destFileStream.Close()
Write-Host "Files closed."
}
Write-Host "Script completed."
@droberin
Copy link
Author

Keep in mind must reload the whole game to see the new strings applied! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment