Log in

View Full Version : Help with BASIC


Doubble Dutch
Aug 11, 2008, 02:51 AM
Hey there;

I've recently made some basic er... BASIC programs for fiddling around with the Jazz Jackrabbit 1 graphics The only problem seems to be that well, they're a bit hard to use if you're not totally DOS immersed like I am. They're all command line interfaces, and a bit picky at that.

So what I was wondering was, is there anyone here who knows more BASIC than me (That's not hard) that knows how to make opening or accessing files a little more easy than having to type out the whole name? (People really don't like doing this)

Or, if you have any tips for making my programs easier to use, they can be got here: http://www.jazz2online.com/J2Ov2/downloads/info.php?levelID=5147

HorvatM
Aug 11, 2008, 04:26 AM
I am an experienced BASIC programmer. The problem is, that I've never really found any other solution to opening files easier than typing the path and file name. However, one suggestion is (albeit not really elegant):

Tell the user that the files he/she wants to work with must be in the directory of the program. Then, you can make him/her write his/her files in a file with a listing of all the files, which is read by the program when choosing a file. In Microsoft QBasic, reading that file would be like this:


OPEN "Filelist.txt" FOR INPUT AS #1
DO WHILE NOT EOF(1)
Counter = Counter + 1
INPUT #1, FileName$(Counter)
PRINT FileName$(Counter)
LOOP
CLOSE #1


Of course this only works if the files are one per line, and they are written with double quotes before and after their names (such as "MyFile.txt"). To save disk space by two bytes for each file and to simplify the process for the user not having to enter each file in quotes, use LINE INPUT in place of INPUT.

You can also sort the files by name, but I'm not going to deal with this at the moment.

Note that I have only tested these techniques on Microsoft QBasic. Your BASIC interpreter/compiler may use different commands for dealing with files.

Hope this helps!

Cpp
Aug 11, 2008, 12:04 PM
I used to program in Quick Basic on Commodore64, but later on I've done numerous programs in Visual Basic 6. Recently I've stopped VB6 altogether to focus on x86 assembly, C++ and linux scripting.

Doubble Dutch
Aug 16, 2008, 10:59 PM
I see. Well, that is a pity then. I can only hope that someone who knows better language than me will work up the gumption to make replacements for my rudimentary programs. (Go go OpenJazz)

Torkell
Aug 17, 2008, 08:12 AM
Which BASIC variant are you using?

In Visual Basic 6, you can either use the Common Dialogs Control (needs a Form) or the dlgobjs.dll that I think is in the Package and Deployment Wizard folder (you may need to register it with regsvr32.exe) to display the standard Windows file open dialog. Obviously you'll have to include whichever one you use with your program, and either an installer or instructions on registering it.

If you're using QuickBASIC/QB, then you'll have to write your own console-based file browser. You could also read the filename in from the COMMAND$ function as part of the command-line arguments - this will let the user drag and drop the file on to your program.

I've not downloaded and tried your programs yet, as I don't have a JJ1 variant to hand (got the Xmas versions somewhere), so do say if I'm barking up the wrong tree here.