Jump to content


Photo

DOS Programming Problem


  • Please log in to reply
7 replies to this topic

#1 tomkaz

tomkaz
  • Member
  • 992 posts

Donator

Posted 11 November 2014 - 02:00 PM

I know this not a place for DOS questions, but I am desperate for help.  I have a problem and do not know where to get the answer.  But since the are many who have DOS programming experience (look at BiG World Project files) I thought I would ask this question here.
 
I have the following sequence in the middle of a program for tracking down an error.  I have used the PAUSE command several times before it reaches the sequence in this program and it always works.  In this sequence, when the program reached the PAUSE command, it closes.  That is why I added the "I am at this spot" statements to find oout what is going on.  The program does 'pause' and you get the 'Press any key to continue . . .' statement.  Then no matter what I do the program closes without finishing the code.  The program statements in the program that follow this PAUSE command are simple ECHO statements.  You never see them on the screen.
 
ECHO I am at this spot 1 (Prints on screen)
ECHO.
ECHO I am at this spot 2 (Prints on screen)
PAUSE (Point of failure.)
ECHO I am at this spot 3 (Never prints on screen)
ECHO.
ECHO.
ECHO I am at this spot 4 (Never prints on screen)
 
On the screen, you will see:
 I am at this spot 1
 I am at this spot 2
Press any key to continue . . .
 
The only other DOS commands in the program before this section are SET, IF EXIST, RD, MD, PAUSE,  {ECHO.}, and ECHO.
 
I have tried variations of the program sequences with out any success.  I have look at several DOS references but nothing indicates that a key stroke reply to the PAUSE statement would shut down the program.
 
If anyone knows a solution or suggestion, I would would appreciate the help.  My intent is to add this to BiG World Install.bat to track which mods get installed and to move my saved games to another folder for storage.
 
Thanks,
 
Tom
 


#2 dabus

dabus
  • Member
  • 1982 posts

Posted 11 November 2014 - 02:27 PM

BWP has the listing of mods builtin... why reinvent the wheel?

I'd advice to open a cmd-window, use the @echo on-switch in your script, run it from the opened window and see what's the last thing that's written. Or use a simple editor that supports running dos-batches and print the output in its own text-panel.

Sometimes those things are stupid stuff like comments in an if-clause or wrong syntax.


Edited by dabus, 11 November 2014 - 02:29 PM.

THINK! - It's not illegal.

#3 tomkaz

tomkaz
  • Member
  • 992 posts

Donator

Posted 11 November 2014 - 03:10 PM

Thanks dabus:

 

I am using V14.1 with the order from V14.2.  So it goes to the screen but not to a file.  I have managed to use List.bat to send it to a file, but just recently it quit working.  The other thing I do is send copies of the .log and .err files to another folder because BiG World Cleanup.bat deletes them.

 

I have looked through 12 sites so far and have not got a hint.  But I have learned lots of DOS secrets.  It is frustrating but fun.  And I have tried the the @Echo On trick.  It is just that there is nothing showing up for what is happening.  I did have some misspellings, but I assume I got all those and all the typos.  It just bugs me that I cannot fix this.

 

Thanks again for your advice,

 

Tom



#4 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5148 posts

Posted 11 November 2014 - 03:48 PM

Hmm, I am not entirely sure ... but have you tried to put another "PAUSE" without the quotes after the "ECHO I am at this spot 4" -line, cause the ECHO's might just flash for a 1/1000000th of a second, and so they won't be see-able, as the monitor can't even keep up. Let alone your eyes.

Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#5 tomkaz

tomkaz
  • Member
  • 992 posts

Donator

Posted 11 November 2014 - 05:00 PM

Thanks The Imp:

 

Between dabus and you you did trigger some more thoughts.  They led me to finding the problem.

 

Whenever I use GOTO statements, I check the labels.  I have 5 GOTOs in the file and I did check to see that the labels were correct when I first wrote them.  However, somehow I accidentally typed another character in one label.  Any time you have a GOTO statement where it cannot find its label, it will search until it reaches the last line in the file.  Then it closes the program.  I spent 5 hours chasing this down in a 30 line program.  It ain't fun getting old. 

 

I guess the old carpenter adage that you measure twice before you cut once is very good advice.  I should have check that a second time when the program did not work.

 

Thanks again for the comments,

 

Tom


Edited by tomkaz, 11 November 2014 - 05:01 PM.


#6 Yovaneth

Yovaneth

    The newly-appointed Master Builder of Baldur's Gate

  • Modder
  • 3058 posts

Posted 11 November 2014 - 05:31 PM

You're not the only one suffering from old-age code-blindness. I've wasted four hours today chasing an onscreen drawing failure (non-IE) in some C-language code, only to finally find that I'd mistyped the resource name and then (while troubleshooting) b*llixed up its resource number too.  TG I keep a proper rolling backup...!! :lol:


Edited by Yovaneth, 11 November 2014 - 05:32 PM.


#7 dabus

dabus
  • Member
  • 1982 posts

Posted 11 November 2014 - 06:12 PM

Yes, typos are bad stuff. And you tend to go :tease:  if you (are on the way to) find them.

 

Um, these are the calls.

 

CALL "BiG World Installpack\List.bat" IE

start notepad "BWP existing mods.txt"

-> list existing mods

 

CALL "BiG World Installpack\List.bat" INE

start notepad "BWP not existing mods.txt"

-> list not existing mods

 

CALL "BiG World Installpack\List.bat" INI

start notepad "BWP installed mods.txt"

-> list not installed mods

 

Open Command, go to your BG2-folder and use the calls. Creates some files, use some editor to view them.

I added the start-lines from the BiG World Install.bat, so you could copy those two lines in some other batch if you wanted to.

 

I guess you tried to run the List.bat from the directory where the files is in (BiG World Installpack). That does not work since the file is started from the main batch, which is located one path "below" the file. So the files that are needed do have a different path when you start from a different directory.

 

Call-from BG2-dir> file needs a list, here BiG World Installpack\List.txt -> runs fine

Call-from BiG World Installpack> file needs a list, here BiG World Installpack\List.txt -> not found + setups are not here -> fails
 


Edited by dabus, 11 November 2014 - 06:22 PM.

THINK! - It's not illegal.

#8 tomkaz

tomkaz
  • Member
  • 992 posts

Donator

Posted 11 November 2014 - 07:34 PM

Hi dabus:

 

Thank you for the information.  I will check it out tomorrow as it is now my bed time.  I am sure it will help others who want to get that information.

 

Tom