#! /usr/bin/tclsh # # $Id: elite-describe,v 1.4 2003/03/10 23:38:18 mdw Exp $ package require "elite" "1.0.1" proc describe n { global economy government elite-worldinfo p $n puts "Name: $p(name)" puts "Seed: $p(seed)" puts "Position: $p(x), $p(y) LY" puts "Economy: $economy($p(economy))" puts "Government: $government($p(government))" puts "Tech. level: $p(techlevel)" puts [format "Population: %s billion (%s)" \ [expr {$p(population)/10.0}] $p(inhabitants)] puts "Gross productivity: $p(productivity) M Cr" puts "Radius: $p(radius) km" puts "" set ll {} set l 0 foreach w $p(description) { incr l incr l [string length $w] if {$l > 72} { puts $ll; set ll {}; set l 0 } lappend ll $w } puts $ll } if {[llength $argv] < 1} { puts stderr "usage: $argv0 \[-g GALAXY\] PLANET ..." exit 1 } set g $galaxy1 for {set i 0} {$i < [llength $argv]} {incr i} { set a [lindex $argv $i] switch -- $a { "-g" { incr i set a [lindex $argv $i] set g [parse-galaxy-spec $a] if {[string equal $g ""]} { puts stderr "$argv0: bad galaxy string `$a'" exit 1 } destructure {. g} $g } default { set n [parse-planet-spec $g $a] if {[string equal $n ""]} { puts stderr "$argv0: unknown planet `$a'" continue } describe $n puts "" } } }