[CF-Devel] Map lore redux

crossfire-devel-admin at archives.real-time.com crossfire-devel-admin at archives.real-time.com
Wed Apr 23 21:02:26 CDT 2003


Ok one more try:

How about this:  An arch called maplore

Object maplore
name <key word?>
type 98(?)
face lore.111 -->sample png attached
lore
@yadda yadda.
endlore
invisible 1
no_pick 1
editable 128
end

Pop these in you maps while designing when you think of some tidbits 
you'd like to have show up in the general lore population, such as:
@The banks of the river Frontinac are said to be the home of a fierce 
tribe of lizardmen.
@The river Frontinac is only passable near the Plains of Azzar or in the 
northern jungles.
or
@The city of Scorn is said to be as vile a cesspool as can be found west 
of Navar.


Every so often, run a tidied up version of this script (or perhaps a 
PERL version mhhh?) to collect the map lore so you can do something with 
it.  With some modifications you could also probably run this against 
the arches too generating a single lore file to play with.

#!/usr/bin/python
#lorecollect.py
#To collect 'lore object' lore - endlore contents from Crossfire maps
# Python 2.1 or so
import sys
import os
import string
import fileinput

def lorecollect(lfile, dir, files):
    for file in files:
        file = os.path.join(dir,file)
        try:
            f = open(file,'r')
            contents = f.read().split('\n')
            match = 0
            for line in contents:
                if line == 'arch maplore':
                    print 'Found one'
                    lfile.write(file)
                    match = 1
                elif match == 1 and line[:3] == 'name':
                    lfile.write('%s\n' %(line))
                elif match == 1 and line == 'lore':
                    match = 2
                elif match == 2 and line == 'endlore':
                    match = 0
                elif match == 2:
                    lfile.write('%s\n' %(line))
                else:
                    pass
            f.close()
        except (OSError, IOError):
            pass
if __name__ == '__main__':
    import sys
    if len(sys.argv) < 3:
        sys.stderr.write ('Collects lore from maps into a single 
file\nUsage: lorecollect.py <mapdirectoryroot> <targetfilename>')
        sys.exit()
    else:
        lfile = open(sys.argv[2],'w')
        os.path.walk(sys.argv[1],lorecollect,lfile)
        lfile.close()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: lore1.png
Type: image/png
Size: 398 bytes
Desc: not available
Url : 
     
     http://shadowknight.real-time.com/pipermail/crossfire/attachments/20030423/20d4a30d/lore1.png
     
     
    


More information about the crossfire mailing list