BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Please help Text Extracting??

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Non-Technical
View previous topic :: View next topic  
Author Message
Ado
Guest





PostPosted: Sat Jun 10, 2006 8:11 am    Post subject: Please help Text Extracting?? Reply with quote



Hi Im Adrian. I have a game called Civilization 3 and to modify
it you need to change a text file. But, it is really easy to put in wrong search paths in the text file, and the onlyway to
test if the modified version works is to start up thw whole
game. So, I was wondering if i could "extract" the
search/directory paths from the text file and place them all in
a list box. So, the text file looks like do:

#START LEADER/RACE ART
#RACE_ROMANS
art\leaderheads\CE.pcx
art\advisors\CE_all.pcx
#RACE_EGYPTIANS
art\leaderheads\CL.pcx
art\advisors\CL_all.pcx
...blah blah blah

For example I want to fill a list box with all the search
paths found, i.e: art\leaderheads\CL.pcx and
art\advisors\CL_all.pcx
I was thinking of getting every second or so line, but I cannot as the pattern changes further down the document. Maybe is it possible to "scan" each line and search for the words "pcx"
or "art\" and if BOTH are found, add them to a listbox with all the paths.

Thanks In Advanced, Adrian
Back to top
Ado
Guest





PostPosted: Sat Jun 10, 2006 8:11 am    Post subject: Re: To Oliver Reply with quote



Its Adrian again. Ye it would Smile except you cant add custom units, buildings or technologies in the editor, you must edit the text file.
Back to top
Oliver Townshend
Guest





PostPosted: Sat Jun 10, 2006 8:11 am    Post subject: Re: Please help Text Extracting?? Reply with quote



Quote:
Hi Im Adrian. I have a game called Civilization 3 and to modify
it you need to change a text file. But, it is really easy to put in wrong
search paths in the text file, and the onlyway to

Use the Civilization Scenario editor for god's sake and make your life much
simpler.

Oliver Townshend
Back to top
Ben Hochstrasser
Guest





PostPosted: Sat Jun 10, 2006 8:11 am    Post subject: Re: Please help Text Extracting?? Reply with quote

Ado wrote:

Quote:
So, I was wondering if i could "extract" the
search/directory paths from the text file and place them all in
a list box. So, the text file looks like do:

#START LEADER/RACE ART
#RACE_ROMANS
art\leaderheads\CE.pcx
art\advisors\CE_all.pcx
#RACE_EGYPTIANS
art\leaderheads\CL.pcx
art\advisors\CL_all.pcx
..blah blah blah


Why don't you simply delete every commented line and every line that does
not contain a backslash?

....
ListBox1.Items.LoadFromFile('c:\this.file.txt');
ListBox1.Sorted := False;
n := ListBox1.Items.Count;
for i := n-1 downto 0 do
begin
s := ListBox1.Items.Strings[i];
if ((s = '') or
(s[1]='#') or
(pos('\', s) = 0)) then
ListBox1.Items.Delete(i);
end;
....

--
Ben
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Non-Technical All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.