 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Ado Guest
|
Posted: Sat Jun 10, 2006 8:11 am Post subject: Please help Text Extracting?? |
|
|
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
|
Posted: Sat Jun 10, 2006 8:11 am Post subject: Re: To Oliver |
|
|
Its Adrian again. Ye it would except you cant add custom units, buildings or technologies in the editor, you must edit the text file. |
|
| Back to top |
|
 |
Oliver Townshend Guest
|
Posted: Sat Jun 10, 2006 8:11 am Post subject: Re: Please help Text Extracting?? |
|
|
| 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
|
Posted: Sat Jun 10, 2006 8:11 am Post subject: Re: Please help Text Extracting?? |
|
|
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 |
|
 |
|
|
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
|
|