Author Topic: CarPark - This tool does not exist  (Read 206 times)

dreadnaut

  • Corner Controller
  • ***
  • Posts: 1217
    • View Profile
    • chezDreadnaut
CarPark - This tool does not exist
« on: September 19, 2021, 09:10:09 PM »
I have been thinking about a new car swap / backup tool, probably DOS based, but I don't know if it'll ever rise near the top of my long list of projects. I shall dump my ideas here, in the hope that they will be useful to someone, one day.


Overview

The tool I imagine is called CarPark, because yes. When launched without parameters, it shows a text-based interface with a single scrollable list of cars, where each line contains the abbreviation and the full name of a car.

Cars come from both the Stunts directory and a second directory, which acts as backup area. Duplicates are removed, but remembered. If a car is stored in the Stunts directory, and therefore active, there's a symbol at the beginning of its line, for example an o.


Keys

Cursor keys and j/k can be to move a selection bar up and down the list.

Space acts as toggle to add and remove cars. Press it while the selection is on a car from the Stunts directory, and the o symbol becomes a -: the car is marked for removal. You can't mark the last car for removal. Press Space on a car that is only stored in the parking lot, and a + appears on its line: the car is marked for inclusion in the active set. No files have yet moved at this point!

You can also use a and d to always add or remove a car. They make it easier to add a bunch of cars without worrying about any already selected cars in the middle of the list: jajajajaja, in Hungarian style.

The bottom of the screen shows current numbers: active cars, to add, to remove. Next or below that is the list of available keys: [a] Add  [d] Remove  [Space] Toggle ....

If the number of cars that are active or to-be-added goes above the maximum allowed (32?), a  message appears next to the counters, and saving is disabled.

If the number is OK, pressing Enter applies the changes: cars with a + are copied from the parking lot directory to the Stunts directory; cars with a - that are *not yet* in the parking lot are moved there. The program could then close, leaving a success message on the prompt. s could be an alternative key to save without quitting.

Pressing Escape will close the program, no changes will be applied. There could be a confirmation prompt if the list includes any + or - rows, to avoid losing changes.


Command line options

It might be easier to start with these, to have all operations ready in a testable way.

  • /backup will copy all cars that are in the Stunts directory but not in the parking lot directory to the latter;
  • /backup-all will copy all cars to the parking lot, overwriting any already in there;
  • /add NAME [ NAME ...] will look for cars in the parking lot, and copy their files to the Stunts directory; the program will output one line for each car, something like + NAME OK or x NAME Unknown, or x NAME Too Many cars
  • /remove NAME [ NAME ... ] will look for car NAME in the Stunts directory, move their files to the parking lot, or moving them there if they don't exist
  • /import <directory> will look in the specified directory for full sets of car files, and copy them to the parking lot
  • /enable <filename> will read car abbreviations from the file, and copy their files from the parking lot to the Stunts directory; unless all the listed car are missing from the parking lot, it will delete/move all other active cars, leaving only the selected set.
Imagine running carpark /enable zak-2022.txt and having all cars ready!


Notes

There are operations on multiple files here, that should be handled in a safe and possibly atomic way. Moving car files should copy them, and only delete the original if all four files have been copied successfully.

There are some tricky situations when the two directories contain different versions of the same car, i.e., where some files are compressed in one but not in the other. Overwriting a car should ensure that all files belonging to the previous version are removed. When we check if a car already exists in a directory, we mean "exactly the same files", and might need to skip the car and show a warning.

The tool could include CAR_<abbreviation>.TXT as an optional file in the set that defines a car. It would be copied around with the rest if it exists. This would give us a vague standard for documentation. Code for an optional file might be a pain to implement though.


(By the way, I've discovered [ tt ] for monospaced text!)
« Last Edit: September 19, 2021, 09:47:09 PM by dreadnaut »

Daniel3D

  • Skid`s Nightmare
  • **
  • Posts: 789
    • View Profile
Re: CarPark - This tool does not exist
« Reply #1 on: September 19, 2021, 09:36:00 PM »
Well, you're not the only one thinking about it.
So maybe a co-op with CAS and KyLiE is possible?
Both have similar ideas (as far as I can tell)

And I would like to add the feature to setup (optional)
With all these cars (Ryoma alone has about 70 now)
There is need for it.
Ever tried, ever failed. Try again, fail better.

Currently running 19 separate instances of Stunts or 4D Sports Driving.
---------
Stunts resources.
https://mega.nz/folder/JM8HQI5a#mH5ZBNwXC0eEBmockWo50A

dreadnaut

  • Corner Controller
  • ***
  • Posts: 1217
    • View Profile
    • chezDreadnaut
Re: CarPark - This tool does not exist
« Reply #2 on: September 19, 2021, 09:43:39 PM »
Well, you're not the only one thinking about it.

Yep, your message pushed me to get all these thoughts out of my head and put them in words. But I don't see any excitement in writing all that file handling code for DOS right now.

And I would like to add the feature to setup (optional)

Each task to its own tool. Setup could store car lists, and call out to carpark /enable lancias.txt.

Daniel3D

  • Skid`s Nightmare
  • **
  • Posts: 789
    • View Profile
Re: CarPark - This tool does not exist
« Reply #3 on: September 19, 2021, 09:59:03 PM »
Each task to its own tool. Setup could store car lists, and call out to carpark /enable lancias.txt.
I see it as setting up the contents of the showroom.

But your idea is very nice, you can make configurations that you save and just call back.
I do want setup to be able to act as a portal to other programs as well though. So you don't have to remember all tools in command line.
Just run setup and launch them from there.

I am a visual minded person myself, so I would like a graphic of the car in it.
Maybe by storing a showcase picture with the same abbreviation so it can be shown.
I also thought about adding metadata to the cars for better sorting.
it can be added as a chunk to the car's res file. (the graphic to i think to keep it clean)
We would have to edit about 100 cars, but I'll happily do that. I that means we have the program.
Ever tried, ever failed. Try again, fail better.

Currently running 19 separate instances of Stunts or 4D Sports Driving.
---------
Stunts resources.
https://mega.nz/folder/JM8HQI5a#mH5ZBNwXC0eEBmockWo50A

dreadnaut

  • Corner Controller
  • ***
  • Posts: 1217
    • View Profile
    • chezDreadnaut
Re: CarPark - This tool does not exist
« Reply #4 on: September 19, 2021, 10:56:37 PM »
I am a visual minded person myself, so I would like a graphic of the car in it.

Then your tool, unfortunately, is not my tool.

I also thought about adding metadata to the cars for better sorting.
it can be added as a chunk to the car's res file. (the graphic to i think to keep it clean)
We would have to edit about 100 cars, but I'll happily do that. I that means we have the program.

As I have done with Cas before, I advise against adding extra data inside a file format that exists outside your control. Store the metadata next to the car, and handle the new file as part of the set.

But please let's keep this topic about CarPark. Other project can be discussed elsewhere.

Daniel3D

  • Skid`s Nightmare
  • **
  • Posts: 789
    • View Profile
Re: CarPark - This tool does not exist
« Reply #5 on: September 19, 2021, 11:49:08 PM »
I am a visual minded person myself, so I would like a graphic of the car in it.
Then your tool, unfortunately, is not my tool.
Vise versa as well, I'm afraid.
Ever tried, ever failed. Try again, fail better.

Currently running 19 separate instances of Stunts or 4D Sports Driving.
---------
Stunts resources.
https://mega.nz/folder/JM8HQI5a#mH5ZBNwXC0eEBmockWo50A

KyLiE

  • Bernie's Brother
  • **
  • Posts: 239
  • Italian Stallion
    • View Profile
Re: CarPark - This tool does not exist
« Reply #6 on: September 20, 2021, 04:30:15 AM »
I have been thinking about a new car swap / backup tool, probably DOS based, but I don't know if it'll ever rise near the top of my long list of projects.

I've been thinking about this as well and your idea sounds similar to what I had in mind.  However, I also don't know when or if I'll be able to start working on it.  I'll be sure to let you know if I make a start though. :)

alanrotoi

  • Lives on Stunts
  • ******
  • Posts: 4268
  • Suck my Indy!
    • View Profile
    • Maite Zaitut, La Vengadora Oscura
Re: CarPark - This tool does not exist
« Reply #7 on: September 20, 2021, 09:32:44 PM »
It seems a great idea! I can't help to build it but I toast for you! ;D