I am a big fan of Command and Conquer Generals and Zero Hour. I love modifying those games for fun.

Report RSS Generals Code Cleanup Strategy

Posted by on

I went back to my favorite hobby of programming and testing code for PC games. I also wrote a strategy guide on how to delete comments in files to make them look better (and hopefully make the game run faster). This is a big tutorial I made, so I recommend saving it in a text file before you begin.

This programming strategy guide is used to delete lines of comments found in the INI text files of Command & Conquer Generals and Generals Zero Hour. By deleting comments marked with semi-colons ( ; ), the programmer will have cleaner-looking files that may improve the game's running speed.

NOTE: Always copy the INI files found in the larger BIG files into the game's folders before modifying them. Use the Final BIG Editor to do this.

Credit for Final BIG Editor goes to the German programmer Matthias "Matze" Wagner. I take no credit for the application.

I have to mention something here. Steps 6 and 7 did not translate well into this blog. You are supposed to replace a space-space-equals-space with a space-equals-space. Then replace a space-equals-space-space with a space-equals-space. I know it doesn't look like that in the blog, but that is how I wrote the guide originally.

I may have written too many steps and given myself more work than I needed to. It is better for me to be safe than sorry.

The guide is easier to read at my project page.

Step 1:
Copy INI file contents to temporary file named temp.txt.
Example of INI file used: FactionUnit.ini

IMPORTANT: Save the temp.txt file every time you make changes to avoid losing your work.

Step 2: Use Control+H shortcut to open Replace box.

Step 3: Enter the following:
In Find what: |//|
In Replace with: |;//|

Note: the | line characters are not part of the text boxes. Enter only what is between the lines.

Click Replace All button once.

Step 4: Enter the following:
In Find what: |; |
In Replace with: |;|
Click Replace All button until no changes are made.

Step 5: Enter the following:
In Find what: | ;|
In Replace with: |;|
Click Replace All button until no changes are made.

Step 6: Enter the following:
In Find what: | = | (space-space-equals-space)
In Replace with: | = | (space-equals-space)
Click Replace All button until no changes are made.

Step 7: Enter the following:
In Find what: | = | (space-equals-space-space)
In Replace with: | = | (space-equals-space)
Click Replace All button until no changes are made.

Step 8: Transfer file contents to Microsoft Word.

Step 9: Use Control+H shortcut to open Find and Replace box.

Step 10: Enter the following:
In Find what: |;|
In Replace with: |^p;|
Click Replace All button once.

Step 11: Enter the following:
In Find what: |;*^13|
In Replace with: |;^13|

IMPORTANT: Under Search Options (click More button to reveal), check Use wildcards box.

Click Replace All button once.

Step 12: Transfer file contents back to temp.txt. When you transfer, replace the older text with the newer text: Control+A, Delete, and then Control+V.

Step 13: Use Control+H shortcut to open Replace box.

Step 14: Enter the following:
In Find what: |; |
In Replace with: |;|
Click Replace All button once.

Step 15: Transfer file contents back to Microsoft Word.

Step 16: Enter the following:
In Find what: |;|
In Replace with: |;^p|

IMPORTANT: Under Search Options, clear Use wildcards box.

Click Replace All button once.

Step 17: Transfer file contents back to temp.txt.

Step 18: Use Control+H shortcut to open Replace box.

Step 19: Enter the following:
In Find what: |;|
In Replace with: || (delete any text from this line)
Click Replace All button once.

Step 20: Transfer file contents back to Microsoft Word.

Step 21: Enter the following:
In Find what: |^p^w^p|
In Replace with: |^p^p|
Click Replace All button until no changes are made.

Step 22: Enter the following:
In Find what: |^p^p|
In Replace with: |^p|
Click Replace All button until no changes are made.

Step 23: Enter the following:
In Find what: |End^pObject|
In Replace with: |End^p^pObject|
Click Replace All button once.

Step 24: Enter the following:
In Find what: | ^p|
In Replace with: |^p|
Click Replace All button until no changes are made.

Step 25: Transfer file contents back to temp.txt.

Step 26: Transfer temp.txt contents to INI file. Run both game and WorldBuilder to check for errors.

Step 27a: If errors exist, undo changes to INI file and start over from Step 1.

Step 27b: If errors do not exist, save changes to INI file. Congratulate yourself. :)


Post comment Comments
IvanderLim
IvanderLim - - 1,181 comments

for now i'm lazy to do some programming because if i do this thing i kinda didn't enjoy where i am free from school.

But the problem is i never know when i will back where i like to mod some YR and Generals.
At this time i always playing megaman because the game is my favourite since i'm 5 years old.

If i had some programming skills i'm planning to fix some issues from Rockman X6 such as level design itself, armor,etc

Reply Good karma Bad karma+1 vote
ankitp
ankitp - - 24 comments

I am really excited to learn programming language like the Java. But for this I have to pass the my full time in learning Java and that's not possible due to my other Job. But I'll try to learn in the future definitely.

Reply Good karma Bad karma+1 vote
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: