Stunts Forum

Stunts - the Game => Stunts Related Programs => Topic started by: dreadnaut on September 19, 2021, 09:10:09 PM

Title: CarPark - This tool does not exist
Post by: dreadnaut 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.

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!)
Title: Re: CarPark - This tool does not exist
Post by: Daniel3D 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.
Title: Re: CarPark - This tool does not exist
Post by: dreadnaut on September 19, 2021, 09:43:39 PM
Quote from: Daniel3D on September 19, 2021, 09:36:00 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.

Quote from: Daniel3D on September 19, 2021, 09:36:00 PM
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.
Title: Re: CarPark - This tool does not exist
Post by: Daniel3D on September 19, 2021, 09:59:03 PM
Quote from: dreadnaut on September 19, 2021, 09:43:39 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.
Title: Re: CarPark - This tool does not exist
Post by: dreadnaut on September 19, 2021, 10:56:37 PM
Quote from: Daniel3D on September 19, 2021, 09:59:03 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.

Quote from: Daniel3D on September 19, 2021, 09:59:03 PM
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.
Title: Re: CarPark - This tool does not exist
Post by: Daniel3D on September 19, 2021, 11:49:08 PM
Quote from: dreadnaut on September 19, 2021, 10:56:37 PM
Quote from: Daniel3D on September 19, 2021, 09:59:03 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.
Title: Re: CarPark - This tool does not exist
Post by: KyLiE on September 20, 2021, 04:30:15 AM
Quote from: dreadnaut 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'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. :)
Title: Re: CarPark - This tool does not exist
Post by: alanrotoi 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