Announcement

Collapse
No announcement yet.

Batch Files

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Batch Files

    I left a post at the end of another of my threads asking for help in the creation and usage of batch files (maybe a text manual or previous thread). I guess most folks just thought that thread was through. Oh well. Anyway, does anyone have a guide to creating and using batch files in a scenario? I've heard they can make miracles happen (well maybe not quite), and I would like to get acquainted with using them in my scenarios, especially since I downloaded CivSwap. Some please help me.

  • #2
    Have you read the CivSwap readme?

    In addition to that, see these links. They're far more general, though. You probably won't need to use much of it, but it'll give an idea of what batch files can do at least:
    Batch files help and information including a full list of questions and answers that help answer how to make, run, and edit batch files.



    Then have a look at some of the existing scenarios with batch files. If you still have questions, fire away!
    Civilization II: maps, guides, links, scenarios, patches and utilities (+ Civ2Tech and CivEngineer)

    Comment


    • #3
      From MU's 2nd link.

      Debugging
      Testing a batch-file for correctness, and removing 'bugs' if necessary.

      Several approaches -:
      • Print statements. putting echo statements in the file will allow you to see at which point the program took a nose-dive.
      • Stepping through the code. COMMAND.COM /Y /C batch_file_name.BAT
      I didn't know about that /Y trick!

      Have you read the CivSwap readme?
      Where have I heard that before!
      El Aurens v2 Beta!

      Comment


      • #4
        What I really want to know is, which I couldn't find simply or easily in those links, is how to use a batch file to rename files. With CivSwap, this should give me my intended purpose. How is this function done now that I've got the DOS basics.

        Comment


        • #5
          Usually, you use the copy command (e.g. COPY EVENTS1.TXT EVENTS.TXT, then later on COPY EVENTS2.TXT EVENTS.TXT). That way you avoid any chance of overwriting the original.

          Then have a look at some of the existing scenarios with batch files.
          This is really the best way to learn, once you have a reference at hand. Techumseh uses a thorough one written by Gothmog for his scenarios. Makes an excellent template. Oops, that's for ToT. Allard uses one in River War (FW?). I'm sure someone will cite a good MGE example.
          El Aurens v2 Beta!

          Comment


          • #6
            I wrote this SETUPSND prototype for a Scenario Creation Handbook that never was released. You may find it useful (The sentences between * are comments, you have to delete them):

            ---------------------------------------------------------------------

            @echo off *This hides the messages; user will only see the ECHOS*
            REM This is a prototype batch file to copy sound files *REM indicates a comment*
            REM of any Civ2 Scenario (v2.60 or higher).
            REM Created by Javier Arriaga, 11-IV-2003.
            if exist SCENARIO.scn goto YES
            *If the file is in the correct folder, jump to YES point*
            echo ERROR: I can't find file "SCENARIO.scn". Make sure
            echo you are running from the correct directory.
            *Error message*
            goto END *Jumps to END*
            :YES *This is YES point*
            md sound *Creates SOUND folder*
            move NAME1.wav sound *moves the original file to the SOUND folder; copy this line if you have more files*
            cd sound
            copy NAME1.wav NAME2.wav
            copy NAME1.wav NAME3.wav
            copy NAME1.wav NAME4.wav
            copy NAME1.wav NAME5.wav
            copy NAME1.wav NAME6.wav
            *Creates the copies; copy this lines if you need more*
            cd..
            cls *Clear Screen*
            echo Sound files installed. Pleased verify a "sound" sub-directory
            echo has been created in your "SCENARIO" directory. *Success message*
            :END *END point*
            rem End of program

            ----------------------------------------------------------------

            To rename a file, the order is:
            rename NAME1.EXT NAME2.EXT
            Last edited by jasev; May 15, 2004, 10:15.
            "Son españoles... los que no pueden ser otra cosa" (Cánovas del Castillo)
            "España es un problema, Europa su solución" (Ortega y Gasset)
            The Spanish Civilization Site
            "Déjate llevar por la complejidad y cabalga sobre ella" - Niessuh, sabio cívico

            Comment


            • #7
              Sorry in taking so long to get back to you all. A great thanks for your help on this matter. I should be able to take it from here (I hope).

              Comment

              Working...
              X