Last active
August 29, 2015 14:27
-
-
Save lifelike/3f7fa3cb2fdd361e5f1a to your computer and use it in GitHub Desktop.
Simple script I wrote a long, long time ago to quickly extract journal entries from the AD&D Goldbox games (provided as simple text-files plus PCX-images on the 1994 Goldbox CDROM).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl -w | |
| if (!$ARGV[0]) { | |
| print "usage: $0 [entry nr]\n"; | |
| exit 1; | |
| } | |
| my $nr = $ARGV[0]; | |
| # name of utility to use to display PCX files | |
| #my $pcx_viewer = "/usr/bin/xloadimage"; | |
| #my $pcx_viewer = "/usr/bin/display"; | |
| my $pcx_viewer = "/usr/local/bin/display"; | |
| # location of files from /wizworx dir on goldbox cdrom | |
| #my $dox_path = "/usr/local/share/doc/goldbox"; | |
| my $dox_path = "/Users/user/backup/goldbox/WIZWORKS"; | |
| #name of file with docs | |
| #$file_name = "$dox_path/por_adv.dox"; | |
| #$file_name = "$dox_path/cab_adv.dox"; | |
| #$file_name = "$dox_path/ssb_adv.dox"; | |
| $file_name = "$dox_path/pod_adv.dox"; | |
| #$file_name = "$dox_path/cok_adv.dox"; | |
| #$file_name = "$dox_path/dkk_adv.dox"; | |
| #$file_name = "$dox_path/dqk_adv.dox"; | |
| #$file_name = "$dox_path/gsf_adv.dox"; | |
| #$file_name = "$dox_path/tsf_adv.dox"; | |
| open FILE, "< $file_name" || die "unable to open dox file"; | |
| my $show = 0; | |
| while (<FILE>) { | |
| if (/Journal Entry $nr[^0-9]/i) { | |
| $show = 1; | |
| } elsif (/Journal Entry/i) { | |
| $show = 0; | |
| } | |
| if ($show) { | |
| print; | |
| if (/G:(.+.PCX):\"\[GRAPHIC:/) { | |
| my $image_name = $1; | |
| $image_name =~ tr/A-Z/a-z/; | |
| system "$pcx_viewer $dox_path/$image_name"; | |
| } | |
| } | |
| } | |
| close FILE; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment