Naja, Namen sind nur Schall und Rauch
ascii2fig liest zB die Eckkoordinaten der Walkingboxes aus und erzeugt daraus ein file fuer Xfig, welches ebenfalls das passende Hintergrundbild als bitmap enthaelt.
Das ist also sehr wenig code, aber extrem hilfreich:
Python
- import sysboxids="0123456789abcdef"
- scripts=open('scriptlist.txt','r')for room in scripts: room=room[:-1] figfile=open('figure_%s.fig' % room,'wb') boxfile=open('script_%s.boxes' % room,'rb')
- figfile.write("""#FIG 3.2 Produced by xfig version 3.2.5cLandscapeCenterMetricA4 100.00Single-21200 2""")
- figfile.write("2 5 0 1 0 -1 51 -1 -1 0.000 0 0 -1 0 0 5\n") figfile.write("\t0 %s_frames/f_%s_room_full.png\n" % (room,room)) figfile.write("\t-17 -31 18270 -31 18270 7740 -17 7740 -17 -31\n")
- scale=57.09 boxes=[] for line in boxfile: if line[:4]==".box": x1,y1,x2,y2 =line[5:-1].split(",") x1=int(int(x1)*scale) x2=int(int(x2)*scale) y1=int(int(y1)*scale) y2=int(int(y2)*scale) figfile.write("2 2 0 1 7 7 50 -1 -1 0.000 0 0 -1 0 0 5\n") figfile.write("\t%d %d %d %d %d %d %d %d %d %d\n" % (x1,y1,x2,y1,x2,y2,x1,y2,x1,y1))
Damit sieht sowas hier:
.box 0,81,17,87
.box 4,87,21,103
.box 9,102,39,114
.box 16,114,55,128
.box 20,128,76,134
.box 46,104,62,109
.box 62,106,76,110
.box 76,107,150,134
.box 104,102,136,107
.box 150,113,189,134
.box 189,129,203,134
.box 203,129,216,134
.box 216,123,301,134
.box 242,113,265,123
Dann so aus wie das Bild unten im uralten Vektor-Editor Xfig (unter linux)