VOGONS


First post, by Rekrul

User metadata
Rank Member
Rank
Member

In Windows batch scripts, you can perform arithmetic operations with SET /A x=x+1, but that dosn't work in MS-DOS.

Is there any third-party utility that can be used to perform basic arithmetic operations in an MS-DOS script?

So far all the programs I've found haven't worked with variables. I did find one, eval100.zip;

https://www.sac.sk/files.php?d=16&p=28

That claims it can modify variables, but naturally it gives absolutely no examples of its usage and I'll be damned if I can figure out how to make it work.

I tried Googling, but that's greatly complicated by the fact that the entire world seems to think that the command prompt in Windows is MS-DOS. 😠

I could accomplish the same thing with a ton of IF statements, but I was hoping to find something more elegant.

Reply 3 of 6, by BinaryDemon

User metadata
Rank Oldbie
Rank
Oldbie

From what I read 'xset' would work, but I've never tried it. I've also used a ton of IF statements on occasion but it usually gets the the point where you ask yourself, why am I doing this in BATCH when I could be using QBASIC or an even more complex language.

Check out DOSBox Distro:

https://sites.google.com/site/dosboxdistro/ [*]

a lightweight Linux distro (tinycore) which boots off a usb flash drive and goes straight to DOSBox.

Make your dos retrogaming experience portable!

Reply 5 of 6, by Rekrul

User metadata
Rank Member
Rank
Member
Errius wrote:

What exactly are you trying to do? How are you planning to use variables in your script?

At the moment I'm only planning to use one variable and it's going to be in the autoexec portion of the DOSBox configuration files.

I like to make up custom config files for each game that have a menu allowing you to boot the game, run the game's setup and change various options. For example, my menu for the Redneck Rampage games allows you to boot any of the three games (the original, Rides Again and Route 66), run the setup (settings are then copied to all three games), enable/disable the CD music and enable/disable the Cusspack.

Something I've wanted to do for a while now is add an option to adjust the volume of the CD music, since the in-game volume options don't work. Recent testing shows that the DOSBox Mixer command will accept a variable, so I just needed a way to increase or decrease the value of that variable. If xset works the way it says, I can just add a small routine to increase or decrease the variable when the proper menu key is pressed (with a min/max check so that it rolls over at each extreme). This way I don't need to edit the config file if I want to change the volume setting.

BinaryDemon wrote:

From what I read 'xset' would work, but I've never tried it.

Thanks, from reading the docs, xset looks like exactly what I was looking for!

BinaryDemon wrote:

I've also used a ton of IF statements on occasion but it usually gets the the point where you ask yourself, why am I doing this in BATCH when I could be using QBASIC or an even more complex language.

As above I need to put it in the DOSBox config file. It runs all other DOS commands and external programs, so I'm hoping that it will also work with a program like xset. If it doesn't, then nothing will and I'll have to do it the long way.

Thanks again. 😀

Reply 6 of 6, by Rekrul

User metadata
Rank Member
Rank
Member

I'm happy to report that xset works perfectly and does exactly what I wanted. It even allows setting the contents of a variable from a file (xset variable < file.txt), so I can have my configuration store the volume setting to a file and have it persist between sessions.

Thanks again! 😀