Announcement

Collapse
No announcement yet.

Batchfiles of TERROR!!!

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

  • Batchfiles of TERROR!!!

    Ok, I have all these damned scenarios that look really great.

    I don't play them, however.

    They have these things called "batchfiles" in them.

    I fear batchfiles.

    Somebody explain them to me. They must be harmless critters, really, or they wouldn't be so widely used.

    Can someone explain to me how they are used and how to make (read; copy) one myself?

    Thanx in advance.
    Lost in America.
    "a freaking mastermind." --Stefu
    "or a very good liar." --Stefu
    "Jesus" avatars created by Mercator and Laszlo.

  • #2
    they are small programs that run a series of dos commands, often just copying a file from one location to another. To run the batch file just double click on it and follow the instrustions; it will usually open a dos box with prompts for you to respond to.

    If you want to edit one, right click on the file and select edit to open it in Notepad. They are dead handy if you want to change events, rules or units files mid-scenario
    http://sleague.apolyton.net/index.ph...ory:Civ2_Units

    Comment


    • #3
      When people using Win2k or XP they´ll probably not work
      Blah

      Comment


      • #4
        Can running the batchfile screw things up with the scenario? With the overall Civ2 program? What if I do it wrong? (cuz I always seem to, the first time). Are different, individual batch files needed for each scenario? Do they have to be customized to function properly? If I wanted to use one, it sounds as if just looking for one that works in somebody else's scenario and copying it wouldn't work--it'd be a different batchfile w/different functions--is that right? So, to make one myself, I'd have to learn how to read the "batchfile" programs?

        There needs to be a "Batchfiles for Dummies" paper somewhere. Like on the Scenario League, for example.

        I'm toying w/a scenario idea now. It's in the works--I can feel it. Too many ideas growing to let this field go fallow. But I want to see if this batchfile stuff is workable first. Tentative name; The Imperial Centuries. More later. Maybe.
        Lost in America.
        "a freaking mastermind." --Stefu
        "or a very good liar." --Stefu
        "Jesus" avatars created by Mercator and Laszlo.

        Comment


        • #5
          Originally posted by Exile
          Can running the batchfile screw things up with the scenario? With the overall Civ2 program?
          Well, if your batch files are not done correctly, you could screw up the scenario, eg. when you overwrite scn files (gfx, events) during the execution of a batch file, but you should find this out before the release, while testing your scn (so, if you use batchfiles, backup all scn files that are effected by the commands within your batch files before making test runs )

          If you´re totally unsure how your files will work, post a preview here

          And as long the batch file is placed in the subfolder of your scn, and NOT in Civ2´s main folder, it cannot damage the main civ2 game files

          What if I do it wrong? (cuz I always seem to, the first time).
          Depends what the modifications are that are done by the batch files. Most designers use them for implementing multiple events, so they will not work correctly if the batch files have errors. Others also use multiple rules and multiple gfx (eg. units) files which are swapped by batch files, then you have to be even more cautious while programming them.

          Are different, individual batch files needed for each scenario? Do they have to be customized to function properly? If I wanted to use one, it sounds as if just looking for one that works in somebody else's scenario and copying it wouldn't work--it'd be a different batchfile w/different functions--is that right? So, to make one myself, I'd have to learn how to read the "batchfile" programs?
          This depends too - you probably cannot find batch files in other scns that do exactly the same you wish for your scn - so you can look into other scns to learn more about their batch files, but you can hardly use the same files. I used Nemo´s files as "templates", but of course I had to modify them for my purposes.
          Blah

          Comment


          • #6
            Lets see if I can help at all.

            Greetings Exile.

            Fear not the mighty batch files. For they are to be used for the glory of Civ!


            Basically, a batch file is used to copy existing files within your scenario directory. When these files are copied, it is customary that their name be switched.

            Example: You have a seasonal change comming in a scenario. For examples' sake you'll only be changing the terrain1.gif and terrain2.gif files. This means that you would ship your scenario out with 2 sets (4 files) of terrains. Lets call them Summerterrain1 & 2.gif, and Winterterrain 1 & 2.gif. At the start of the scenario you would have the player run (by double-clicking) the batch file itself to open the menu.


            Aside: Menued batchfiles are the best because you can have them perform all the functions you need with one file. Early batched scenarios (RF1.0) had separate batch files for each file-switch, totally unneeded as the coding can be squeezed into 1 batch file easily.


            Now you've got the menu up, and for your purposes you want the player to have the batch file make the starting set of terrain files. Lets say your scenario starts in summer. So when you prompt the player with a question as to what phase of the scenario he is about to play (summer) his selection [whatever you have it be] will make the batch file go into your scenario folder, copy the SummerTerrain 1 & 2.gifs, paste them back into the scenario folder but with the name that Civ will recognize= terrain1.gif and terrain2.gif.

            Your original SummerTerrain 1 &2.gifs will still be there untouched, you are simply creating the proper filename for civ to recognize for that phase of the game.

            I am going to make several posts here, so let me now attatch a pic so you can see whats going on....
            Attached Files

            Comment


            • #7
              Now that is the batch file opening menu for Stalingrad.


              What I am prompting the player to do (even it they are just starting) is to make sure he/she sets the scenario up with all the correct files for the phase being played. There are all kinds of switches made for each phase in this scenario.




              Now this not only goes for your terrain.gifs, but basically ANY file in your civ folder. You can have the batch file copy .gifs, .bmp's, .wav's, .txts. et al.

              So for example the unit in Extra1 slot within the units file....
              This unit uses Extra1.wav sound within the sound folder. At a time where this needs to be changed you'll actually have to have the batch file change several files--> the units file itself if the gfx for the unit will change, the corresponding Extra1.wav if the unitsound is changed, and also the rules.txt entry for it if the name and stats are changed.

              All 3 of those actions can be done by the batch file if you so choose. They can all be done after the player selects simply the season that he/she wants to play. You as the designer know what things need to be switched, and the batch file merely takes the process of manually changing things away from the player (as they probably will mess it up doing it manually). This is why they are so tasty.

              Here is a shot as if I were to have selected phase 1 from my batch program. Note all the files which the program has reported it successfully copied:
              Attached Files

              Comment


              • #8
                All of those files copied are being done simply to ensure that the player hasnt started a new game while still having the files for phase 4 or 5 cued up.

                I program alot of redundancy into the batchfile, but so what? It is all done in a matter of a second (your pc doing the file copying), and if it ensures that no foul-ups occur, all the better.

                So, I hope you are following up to here.


                When I click phase 2 for instance, it will copy and paste all the files civ needs to read in order to function over again: terrain1&2.gif, rules.txt, game.txt, etc.

                However, this time it wil not look for SummerTerrain 1&2, to be copied and renamed terrain1&2.gif, but rather it will look for WinterTerrain1&2, copy those and overwrite whatever standard-named civ files are there currently. If I have any phase2 specific unit switches, sound changed or the like, I can set it to look for them and copy them in, overwriting any changes made for phase 1.

                Here you will see that I have selected phase 2, and all the appropriate files have been copied. Also note the error messaage displayed: 'Events header not found'. I'll get to this in a minute. The important thing is that you see what is going on. Your pc is simply looking for files you've told it are in existance in your scenario's folder, copying them, and then pasting them in that same scenario folder with a new name for Civ to recognize. You arent touching your civII install or in anyway threatening the functioning of your machine.
                Attached Files

                Comment


                • #9
                  Okay, so if you are with me, we shall go to that events header thing. You might notice that most of your hip scenarios with batch files will include another program in the final packaging zip: DELEVENT.exe

                  This miniprogram was included in your civII install in the main directory, and it serves to wipe a save file* of it's event information. When a game is saved, the file records all of the events that have triggered (so JUSTONCE events wont repeat) and possibly the events that have not been triggered, I am not sure. When you change seasons or something, the ability to use another 20 odd kb for more events is a godsend, so this is almost always used.

                  * Marko discovered that if you change the coding slightly in the batch language you can get it to delete the events info in .NET files as well (perfect for MP or PBEM scenarios.


                  What you see in that screenshot is the fact that I didnt actually load the game in civ after selecting the phase 1 option of the batch program. Therefore no events info was recorded into the savefile. When I went to switch to phase 2, it attempted to run DELEVENT to delete the events info which was not present, resulting in the message :events header not found.

                  In the olden days, one had to manually drag the save file (in explorer) over the DELEVENT program to remove the events header. Letting windows do it is absolutely a help.


                  This should cover what a batch file does in case the others' responses weren't clear, and why they are all kinds of helpful. Next we shall move on to the deep dark chasams of actually writing one up! Wooohooo!

                  Comment


                  • #10
                    So when can we expect Stalingrad?

                    Comment


                    • #11
                      Hush up there Darth.

                      Sorry for the delay, I had to step out for a minute or several.


                      Now for the last of it we'll discuss the writing of it. Its pretty simple, and if one can understand the civII events language, one can easily understand this. Here I will post the entirety of the Stalingrad batch:

                      @echo off
                      cls
                      echo.
                      echo Stalingrad Playtest File Manager Version 1.0
                      echo.
                      echo Choose the phase which you want to play.
                      echo You have the following options:
                      echo.
                      echo 1. Load Phase 1 "Outskirts"
                      echo 2. Load Phase 2 "City in Flames"
                      echo 3. Load Phase 3 "General Winter"
                      echo 4. Load Phase 4 "Operation Uranus"
                      echo 5. Load Phase 5 "Operation Winterstorm"
                      echo 6. Load Phase 6 "Liquidation"
                      echo X. Exit without Loading
                      echo.
                      choice /c:123456X Enter your selection please:

                      if errorlevel 7 goto done
                      if errorlevel 6 goto Opt6
                      if errorlevel 5 goto Opt5
                      if errorlevel 4 goto Opt4
                      if errorlevel 3 goto Opt3
                      if errorlevel 2 goto Opt2
                      if errorlevel 1 goto Opt1

                      :Opt1
                      echo.
                      echo Phase 1 "Outskirts" loading...
                      copy rules1.txt rules.txt
                      copy units1.gif units.gif
                      copy events1.txt events.txt
                      copy Sterrain1.gif terrain1.gif
                      copy Sterrain2.gif terrain2.gif
                      copy cities1.gif cities.gif
                      copy Game1.txt Game.txt
                      copy sound\Missile1.wav sound\Missile.wav
                      echo.
                      echo Welcome to Stalingrad, Herr Paulus!
                      goto done

                      :Opt2
                      echo.
                      echo Phase 2 "City in Flames" loading...
                      copy rules2.txt rules.txt
                      copy units2.gif units.gif
                      copy events2.txt events.txt
                      copy Sterrain1.gif terrain1.gif
                      copy Sterrain2.gif terrain2.gif
                      copy cities1.gif cities.gif
                      copy Game2.txt Game.txt
                      copy sound\Missile2.wav sound\Missile.wav
                      DELEVENT SG.sav
                      echo.
                      echo We must take the banks of the Volga, Herr Paulus!
                      goto done

                      :Opt3
                      echo.
                      echo Phase 3 "General Winter" loading...
                      copy rules3.txt rules.txt
                      copy units3.gif units.gif
                      copy events3.txt events.txt
                      copy Wterrain1.gif terrain1.gif
                      copy Wterrain2.gif terrain2.gif
                      copy cities2.gif cities.gif
                      copy Game2.txt Game.txt
                      copy sound\Missile2.wav sound\Missile.wav

                      DELEVENT SG.sav
                      echo.
                      echo Another winter campaigning in Russia...
                      goto done

                      :Opt4
                      echo.
                      echo Phase 4 "Operation Uranus" loading...
                      copy rules4.txt rules.txt
                      copy units3.gif units.gif
                      copy events4.txt events.txt
                      copy Wterrain1.gif terrain1.gif
                      copy Wterrain2.gif terrain2.gif
                      copy cities2.gif cities.gif
                      copy Game2.txt Game.txt
                      copy sound\Missile2.wav sound\Missile.wav
                      DELEVENT SG.sav
                      echo.
                      echo There's been word of a Soviet breakthrough!
                      goto done

                      :Opt5
                      echo.
                      echo Phase 5
                      copy rules5.txt rules.txt
                      copy units3.gif units.gif
                      copy events5.txt events.txt
                      copy Wterrain1.gif terrain1.gif
                      copy Wterrain2.gif terrain2.gif
                      copy cities2.gif cities.gif
                      copy Game2.txt Game.txt
                      copy sound\Missile2.wav sound\Missile.wav
                      DELEVENT SG.sav
                      echo.
                      echo Hoth is on his way! Theres still hope!
                      goto done

                      :Opt6
                      echo.
                      echo Phase 6
                      copy rules6.txt rules.txt
                      copy units3.gif units.gif
                      copy events6.txt events.txt
                      copy Wterrain1.gif terrain1.gif
                      copy Wterrain2.gif terrain2.gif
                      copy cities2.gif cities.gif
                      copy Game2.txt Game.txt
                      copy sound\Missile2.wav sound\Missile.wav
                      DELEVENT SG.sav
                      echo.
                      echo Holdfast Feldmarschall, there will be no retreat!
                      goto done

                      :done
                      echo.
                      exit
                      quit

                      The best thing to do is to alter an existing batch file as mentioned by others. Right clicking them reveals an edit option, then it is simply working within notepad. However, there are some things you should know, which you can probably just see from the example, but I'll explain anyway.

                      A '.' is used after an echo when you want there to be a space in what is displayed. Refer to screenshots.
                      echo followed by a space then text, will display that text.

                      choice /c: is used for making selections. They are then refered to as Options later. See that if you press 2 when prompted by the menu, then it refers farther down to :Opt 2

                      The errorlevels part just says that if there is a problem to go to the previous option. I dont really undewrstand this part, as most likely going to the previous option would mess things up. But hey, nemo had it in his.

                      The copy feature is the bread and butter. This is where you make the batch program do all the needed filechanging for you. Simply stick to the format as posted, spaces and all

                      copy_ rules1.txt_ rules.txt (where underscores are spaces)

                      Here you are first specifying the file you want copied, then what you want the new name of the copy to be. The 2nd name here should be of the type that Civ will recognize. Also note that this works with the sound folder too, because it will always be one directory deeper than the scenario folder. This is where the 'sound\' (strange that the slash won't show up in the text here, should be sound-slash) part comes in. This is just you having the .wav files changed in the proper folder.

                      'goto done' is pretty much your ENDIF. Place it at the end of the list of commands you want performed by the selection, this finishes the program and allows you to close the actual window that the batch operates in.

                      Note the DELEVENT part as mentioned before. Writing it as posted will run the DELEVENT.exe on the (in this case) save file. You'll need to specify this to your players. You cannot have them saving their game with their own name (mygame.sav) because you cannot anticipate their name, and command the batch to look for said file in order to delete the events from it. Usually, you have a text event on the turn before the fileswitching is needed, prompting the player to save the game at the end of his/her turn with the specific savegame name you suggest (Imperial Centuries= IC.sav to me), run the batch selecting the new season/phase, and reload the game.....*poof* all changes made!

                      I think this should cover it Exile. If you still dont follow, get to me, and I'll assist or just whip one up for you when the time is needed.

                      And hey, does this mean you've never fought on the Red or Second Fronts? Yikes!

                      -FMK.
                      Last edited by klesh; November 30, 2002, 23:14.

                      Comment


                      • #12
                        And lastly, here is a screenie of what happens when you have the batch attempt to copy files that aren't present. It nicely displays what went wrong, so its easy to iron out problems.

                        -FMK.
                        Attached Files

                        Comment


                        • #13
                          I used to be afraid of batchfiles as well, but I've since learned to love them. Basically, if you're familiar with DOS [ie if you're older then 20] then they're easy to cope with.
                          'Arguing with anonymous strangers on the internet is a sucker's game because they almost always turn out to be - or to be indistinguishable from - self-righteous sixteen year olds possessing infinite amounts of free time.'
                          - Neal Stephenson, Cryptonomicon

                          Comment


                          • #14
                            Originally posted by BeBro
                            When people using Win2k or XP they´ll probably not work
                            Can't run Batch files in Windows 2000 or XP? The solution is remarkably simple. Simply download "choice.com" and place it in your Windows System32 subdirectory. Problem solved! (The file is inside the attached zip - Apolyton forbids the upload of .com files)

                            Actually, all "Batch File Required" Scenarios should include choice.com in the zip and have instructions for installing it in the readme.
                            Attached Files
                            To La Fayette, as fine a gentleman as ever trod the Halls of Apolyton

                            From what I understand of that Civ game of yours, it's all about launching one's own spaceship before the others do. So this is no big news after all: my father just beat you all to the stars once more. - Philippe Baise

                            Comment


                            • #15
                              Originally posted by BeBro
                              When people use Win2k or XP they´ll probably not work
                              Yes, I recently started using WinXP, and none of the batchfiles work! The box closes as soon as I open it, saying something about not understanding the command "choice".

                              Does anyone know how to fix this? It's keeping me from using the majority of scenarios out now.
                              The strategically impaired,
                              -Cal

                              Comment

                              Working...
                              X