.com.unity Forums
  The Official e-Store of Shrapnel Games

This Month's Specials

Raging Tiger- Save $9.00
winSPMBT: Main Battle Tank- Save $6.00

   







Go Back   .com.unity Forums > Shrapnel Community > Space Empires: IV & V

Reply
 
Thread Tools Display Modes
  #1  
Old April 29th, 2004, 04:44 AM
Will's Avatar

Will Will is offline
Lieutenant Colonel
 
Join Date: Mar 2001
Location: Emeryville, CA
Posts: 1,412
Thanks: 0
Thanked 0 Times in 0 Posts
Will is on a distinguished road
Default AI Utility

At the request of Imperator Fyron, I have created a batch file script that takes all files in a directory, then creates copies of it in all subdirectories, while prefixing the file with the name of the directory and an underscore (_).

Apparently, this would be quite useful to create generic copies of AI files in several subdirectories

linky link

As I don't really have SEIV installed on my computer here, I don't know if this works perfectly. As I remember the AI files, it *should* work. Pretty much, like I said, it just takes the subdirectory (race) name, tacks it on front of the file name with an underscore, and copies the file to the subdirectory. So if you have a set of generic AI template files (sans the race name and underscore) in a directory, you can create one or two or fifty subdirectories, place this script in the directory, double click, and it should automagically do the copying/renaming for you.

I made it on a Windows 2k box, so it should work on 2k, NT, and XP. I have no idea if it will work on 9x. If someone could test it out, that would be grand. If it doesn't work, and someone else doesn't create a 9x Version by the time I get home (mid-May), I'll (hopefully) post a 9x Version then.

Free (as in speech, and as in beer) for everyone. Download, copy, distribute to your heart's content. It's only one line of code, anyway It would be appreciated if people did too, I'll probably take it down in a week or so... actually...

... since it *is* just one line of code...

code:
 
for /D %%d in (*) do @for %%f in (*.txt) do @copy %%f .\%%d\%%d_%%f

... copy that into a file, give it a .bat extension, and run to your heart's content. I'll leave the link for a while for the more lazy among us. After I take the link down, the code will still be here. Ha!

(Now Fyron, aren't you glad you didn't go about writing a C program to do this? )
__________________
GEEK CODE V.3.12: GCS/E d-- s: a-- C++ US+ P+ L++ E--- W+++ N+ !o? K- w-- !O M++ V? PS+ PE Y+ PGP t- 5++ X R !tv-- b+++ DI++ D+ G+ e+++ h !r*-- y?
SE4 CODE: A-- Se+++* GdY $?/++ Fr! C++* Css Sf Ai Au- M+ MpN S Ss- RV Pw- Fq-- Nd Rp+ G- Mm++ Bb@ Tcp- L+
Reply With Quote
  #2  
Old April 29th, 2004, 07:06 AM
Fyron's Avatar

Fyron Fyron is offline
Shrapnel Fanatic
 
Join Date: Jul 2001
Location: Southern CA, USA
Posts: 18,394
Thanks: 0
Thanked 12 Times in 10 Posts
Fyron is an unknown quantity at this point
Default Re: AI Utility

Yay! Thanks Will! And yes, I am glad I didn't go about writing a c++ program for this.

Well... I could not get it to work on this crappy Dell lab computer running XP, probably Home... but that means nothing.

What I was thinking was making it only affect .txt files that have "AI_" In their names, and cut off anything before "AI". Would it be too much trouble to alter it to do this?

[ April 29, 2004, 06:12: Message edited by: Imperator Fyron ]
__________________
It's not whether you win or lose that counts: it's how much pain you inflict along the way.
--- SpaceEmpires.net --- RSS --- SEnet ModWorks --- SEIV Modding 101 Tutorial
--- Join us in the #SpaceEmpires IRC channel on the Freenode IRC network.
--- Due to restrictively low sig limits, you must visit this link to view the rest of my signature.
Reply With Quote
  #3  
Old April 29th, 2004, 11:22 AM
Will's Avatar

Will Will is offline
Lieutenant Colonel
 
Join Date: Mar 2001
Location: Emeryville, CA
Posts: 1,412
Thanks: 0
Thanked 0 Times in 0 Posts
Will is on a distinguished road
Default Re: AI Utility

Well, I could have the script only grab text files that begin with 'AI_' (AI_*.txt), but the problem is I'm not sure how I could chop off the 'AI_' part and replace it with '%dirname%_'.

I could make a perl script to do this pretty easily, it's just I'm not sure about the extent that Win NT/2k/XP natively support perl. A quick google search hasn't got me much...

I'll take a look into it more tomorrow, but right now I have to sleep, then wake up in the morning, go over a proof of the Completeness and Compactness Theorems of First-Order Languages, then write up a quick enumeration scheme for formulae of a First-Order Language a la the scheme used by G�del. Something like prime(n) = nth prime number, an (a name in the language) = prime(n), (kth function of i parameters)�ik = prime(1)^k * prime(2)^i, (mth relational symbol between j terms) Pjm = prime(3)^m * prime(4)^j, then combining them all together is a huge long product... bleh. What I just typed isn't right, but it's somewhere in the ballpark, I'm too tired...
__________________
GEEK CODE V.3.12: GCS/E d-- s: a-- C++ US+ P+ L++ E--- W+++ N+ !o? K- w-- !O M++ V? PS+ PE Y+ PGP t- 5++ X R !tv-- b+++ DI++ D+ G+ e+++ h !r*-- y?
SE4 CODE: A-- Se+++* GdY $?/++ Fr! C++* Css Sf Ai Au- M+ MpN S Ss- RV Pw- Fq-- Nd Rp+ G- Mm++ Bb@ Tcp- L+
Reply With Quote
  #4  
Old May 1st, 2004, 11:32 PM
Will's Avatar

Will Will is offline
Lieutenant Colonel
 
Join Date: Mar 2001
Location: Emeryville, CA
Posts: 1,412
Thanks: 0
Thanked 0 Times in 0 Posts
Will is on a distinguished road
Default Re: AI Utility

Ok, figured out a sort-of kludge... turns out I don't really need perl, I can work around it in other ways

code:
 
@for /D %%d in (*) do @for %%f in (AI_*.txt) do @for /F "usebackq tokens=2* delims=_" %%g in ('%%f') do @copy %%f .\%%d\%%d_%%g_%%h
@for /D %%D in (*) do @for %%F in (.\%%D\*.txt_) do @rename .\%%D\%%~nF.txt_ %%~nF.txt

Same procedure as before, takes all files matching AI_*.txt in a directory, and copies it to all subdirectories, taking off the 'AI_' and replacing it with '{subdirname}_'.

Link in first post has been updated.
__________________
GEEK CODE V.3.12: GCS/E d-- s: a-- C++ US+ P+ L++ E--- W+++ N+ !o? K- w-- !O M++ V? PS+ PE Y+ PGP t- 5++ X R !tv-- b+++ DI++ D+ G+ e+++ h !r*-- y?
SE4 CODE: A-- Se+++* GdY $?/++ Fr! C++* Css Sf Ai Au- M+ MpN S Ss- RV Pw- Fq-- Nd Rp+ G- Mm++ Bb@ Tcp- L+
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 03:50 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2024, Shrapnel Games, Inc. - All Rights Reserved.