PDA

View Full Version : Combat Record Sheet



nlubofsky
Mar 6th, '03, 07:05 AM
One of the most useful things in Hero Creator was the ability to load up all the characters that were going to be in a combat and print out a Combat Summary sheet (one of those in which the characters are ordered top to bottom by DEX and their Phases are indicated left to right so it is easy to see who has the next turn).

Has anybody written a script or something to implement this with the Hero Designer character files?

Thanks!
Nick

Monolith
Mar 6th, '03, 07:08 AM
I think it is more complicated than just a script. You first need a way to "group" all the desired sheets together. Then you need something that will extract all the needed data and put it into the format you want. That feels like a 2 or 3 step process. Not being a progammer, I could be wrong, but it seems that way to me.

It would make a nice addition for version 2 though. :)

EvilGM
Mar 6th, '03, 07:26 AM
All you really need is an export filter that will put out the info you need, then you can copy and paste into a single file yourself. :)

lemming
Mar 6th, '03, 01:26 PM
That wouldn't be that difficult of a script to write. You just need to pull the DEX & SPD Values from the *.hdc files. (One does need to do the calculation, but that's not hard.)

As soon as I finish up this UPS bug for a paying project I'll whip up a quick perl script. For now, I'll just output a tab delimited file.
Or would comma's be better?
So the output would look like this
----
Name,Dex,1,2,3,4,5,6,7,8,9,10,11,12
Calico,38/8,,X,X,,X,X,,X,X,,X,X
Apex,20/5,,,X,,X,,,X,,X,,X
----
Hope I got the right number of commas in there.:)

That could be ported into any of a number of programs. I'll put the link to Active State for you Windows folks to get Perl.

Derek Hiemforth
Mar 6th, '03, 01:31 PM
Originally posted by lemming
For now, I'll just output a tab delimited file.
Or would comma's be better?Why not both? (Derek said, volunteering Mark for more work. ;)

Could you have a switch that specifies whether you want commas or tabs? That way, folks who want to import it into spreadsheets could use the comma-separated format, and people who want to import in into a word processor can use the tab-separated format.

lemming
Mar 6th, '03, 01:54 PM
Originally posted by Derek Hiemforth
Why not both? (Derek said, volunteering Mark for more work. ;)

Could you have a switch that specifies whether you want commas or tabs? That way, folks who want to import it into spreadsheets could use the comma-separated format, and people who want to import in into a word processor can use the tab-separated format.

Oh sure, update the spec while it's being worked on. Damn marketing people. :D

Yea, that shouldn't be a problem. I'm not anticapating this script to take too much time to make for the first try.

lemming
Mar 6th, '03, 06:24 PM
Ok, here's the perl script, zipped.
I'm using XML::Twig to do the parsing, so hopefully it's already installed. If not, get it from CPAN (html://www.cpan.org).

For you people stuck in the Windows world:
ActiveState (http://aspn.activestate.com/ASPN/Downloads/ActivePerl/) has a nice Perl for your platforms.

YAU (Yet another update)

Call it 0.03

TechnoViking
Mar 6th, '03, 07:47 PM
Works great, other than you can not use * wildcards with it in Windows.

Get the following error

Invalid argument at mkspdchrt.pl line 44

Mike

lemming
Mar 6th, '03, 09:08 PM
Originally posted by Mike Basinger
Works great, other than you can not use * wildcards with it in Windows.

Get the following error

Invalid argument at mkspdchrt.pl line 44


Hmm. That might be due to white space in the file name. I replaced the zip with an updated version, but if that isn't the case you might have non-valid XML in there.
I'll have to put some logic to skip invalid characters.

Oh, I forgot to mention, the characters are arranged in Dex order, ties broken by speed, then random.

Derek Hiemforth
Mar 6th, '03, 09:18 PM
The new one's not working for me either, Mark (although now the error is on line 48). None of the .hdc files have whitespace in the names. It works fine if you type out all the filenames individually, but not if you use the wildcard.

(Also, shouldn't the DEX/SPD "column" have a header? :) )

By the way, BIG THANKS for doing this! It's gonna be most useful! :D

Derek Hiemforth
Mar 6th, '03, 09:35 PM
FWIW, it's not long filenames that are the culprit either. I tried using only filenames that fit the 8.3 format. It's also not a problem with whitespace in the full pathname; I tried putting the files in just "C:\SPDCHART" and it got the same error in line 48.

lemming
Mar 6th, '03, 09:49 PM
Originally posted by Derek Hiemforth
FWIW, it's not long filenames that are the culprit either. I tried using only filenames that fit the 8.3 format. It's also not a problem with whitespace in the full pathname; I tried putting the files in just "C:\SPDCHART" and it got the same error in line 48.

Looks like I'm going to have to throw perl on the windows box then. (Old Win98SE, PII-200) Thanks for doing those tests. I think it's trying to treat the *.hdc as a file instead of doing a glob.

Nato
Mar 6th, '03, 09:50 PM
Well, I think it is very cool that you've made a script to do this.

Now, can anyone help a Perl virgin use this script. I downloaded the script and then the ActiveShare program (downloaded the MSI one). Not when I click on the mkspdchrt.pl file, a black screen opens and closes REALLY fast - can't even see what it says.

Now that I've downloaded it, would anyone be so kind as to instruct me on the steps to use it to make a combat record sheet. Do I open HeroDesigner first and then a couple characters? If you could even give me a step by step guide that even an idiot would understand, I would be eternally grateful. Thanks!

lemming
Mar 6th, '03, 10:05 PM
Originally posted by Nato
Well, I think it is very cool that you've made a script to do this.

Now, can anyone help a Perl virgin use this script. I downloaded the script and then the ActiveShare program (downloaded the MSI one). Not when I click on the mkspdchrt.pl file, a black screen opens and closes REALLY fast - can't even see what it says.

Yea, that generally happens if you just click on the file.

If you can open a command line window, you might be able to run it as:


perl path\to\mkspdchrt.pl character1.hdc character2.hdc > speedchart.txt

That will take the speed & dex from those two characters and make a speed chart.

Have I mentioned how I suck at UI? Or explaining how to run stuff under Windows?

Why no SPD/DEX header? Decided that I didn't want to clutter the header too much.

Derek Hiemforth
Mar 6th, '03, 10:05 PM
Nate -

Try these steps...

First, you'll need to get the Twig parser. To get it...
1. Find the stuff that the perl installer just put in your Start Menu tree. (Mine is at Start...Programs...Active State ActivePerl 5.8.)
2. Launch Perl Package Manager.
3. Make sure you're online.
4. Type:
install XML-Twig

Once it finishes installing that, you'll be ready to go.

1. For easiness sake, I suggest creating a folder where you'll plan on making these sheets. I put mine simply at c:\spdchart. Copy the mkspdchrt.pl file there, and whatever .hdc files you want to make a chart from.
2. Launch an MS-DOS prompt.
3. Navigate until you're in your folder described above.
4a. To see the chart on screen with the fields separated by tabs, type:
perl -w mkspdchrt.pl foo.hdc foo1.hdc foo2.hdc
4b. To use, say, commas instead of tabs, modify the command to:
perl -w mkspdchrt.pl -s , foo.hdc foo1.hdc foo2.hdc
4c. To capture this in a file instead of just dumping it to the screen, type:
perl -w mkspdchrt.pl -s , foo.hdc foo1.hdc foo2.hdc > spdchart.csv (That filename at the end can be whatever... spdchart.txt, etc.)

Try that and lemme know how it goes. :)

(D'oh! Mark beat me to it! Hope this is useful too.)

lemming
Mar 6th, '03, 10:10 PM
Originally posted by Derek Hiemforth
Nate -

Try these steps...

Much better steps.

Nato
Mar 6th, '03, 10:50 PM
Oh, you guys just rock. Thanks. Now I'm intrigued with Perl scripting. So theoretically, this Perl script could be edited to include whatever information one wanted? Such as OCV/DCV and all the standards right? Coolness. This rocks.

Are you planning on making a 2nd version and if so what will you add or whatnot?

Thanks again Lemming! And Darren for the great explanation.

lemming
Mar 6th, '03, 11:33 PM
Originally posted by Nato
Oh, you guys just rock. Thanks. Now I'm intrigued with Perl scripting. So theoretically, this Perl script could be edited to include whatever information one wanted? Such as OCV/DCV and all the standards right? Coolness. This rocks.

Are you planning on making a 2nd version and if so what will you add or whatnot?

Thanks again Lemming! And Darren for the great explanation.

You're welcome. It was just something banged out in 1/2 hour. (And then cleanup. :rolleyes: )

Hmm, 2nd version. Not sure. Might jump into Java and make something with a graphical input. Of course, maybe I'll just wait for Perl 6 which can use Java modules! MWA HA HA!

Perl is a great language. First developed to parse text, it can now used for practically anything.
If you know programming: Learning Perl (http://www.oreilly.com/catalog/lperl3) is probably the best book.

Some links to start with:

PerlMonks (http://www.perlmonks.org)
Perl (http://www.perl.com)
CPAN (http://www.cpan.org)

nblade
Mar 6th, '03, 11:48 PM
Yes perl is our friend, not matter what many people will tell you. While JAVA claims to be portable, 90% of all perl scripts I've used are portable. Only those that make calles to either platform specific binaries or OS system call, are not usually portable. And I don't think there is platform I've found that doesn't have a version for it.

Actually I'm sure someone could write code that didn't use the XML code. Althougth I'm sure it would be easier in the long run.

lemming
Mar 7th, '03, 12:21 AM
Originally posted by nblade
Actually I'm sure someone could write code that didn't use the XML code. Althougth I'm sure it would be easier in the long run.

If I wanted to do it without dealing with the XML parsing modules, I could of done it with a regex. (well, maybe not quite that)

I like the XML in that it's readable and can be parsed by outside programs. I'm thinking of trying out some other programs on the hdc files using Java. Not because I'm a fan of Java, just that I know people with Hero Designer will have Java running on their system. :)
(Plus I'm unemployed right now, learning another language is always a good thing. Though everyone I know who's gone from Perl to Java just says it makes them appreciate Perl more. :cool: )

I could do all the graphics with Perl/Tk which would be just as portable though... Just be one more step for the user...

TechnoViking
Mar 7th, '03, 05:54 AM
Now I get
Invalid arguement at mkspdchrt.pl line 51

Mike

lemming
Mar 7th, '03, 06:41 AM
Originally posted by Mike Basinger Now I get
Invalid arguement at mkspdchrt.pl line 51


Hmm, wierdness. I doubt I'll have much time to look at it today. I'll be dealing with cats, rather than computers today.

Derek Hiemforth
Mar 7th, '03, 06:53 AM
I found a fix for it. :D

1. Run the Perl Package Manager.
2. Install the "Win32-Autoglob" module.
3. Edit the mkspdchrt.pl file so that it loads the new module. To do that, find this part:
use XML::Twig;
use Getopt::Long;and add this on the next line:
use Win32::Autoglob;
4. Save the file.
5. Enjoy! :)
C:\spdchart>perl -w mkspdchrt.pl -s , *.hdc
Name,,1,2,3,4,5,6,7,8,9,10,11,12
The Flash,35/8,,X,X,,X,X,,X,X,,X,X
Superman,33/7,,X,,X,,X,X,,X,,X,X
Batman,26/6,,X,,X,,X,,X,,X,,X
Hawkman,24/5,,,X,,X,,,X,,X,,X
Aquaman,23/5,,,X,,X,,,X,,X,,X
Samurai,21/5,,,X,,X,,,X,,X,,X

Thag13
Mar 7th, '03, 08:52 AM
Now I know how Charlie Brown Feels in school


all of these posts that the BLAH BLAH BLAH BLAH effect.

I didnt understand a word of it...

kinda cool though

so when will some one have a sheet I can down load>>??

TechnoViking
Mar 7th, '03, 09:37 AM
Originally posted by Derek Hiemforth
I found a fix for it. :D

Thanks Derek, works great. PERL RULEZ:D.

Mike

Derek Hiemforth
Mar 7th, '03, 10:58 AM
Hey Mark, I just realized that the speed chart is listing characters based on their base DEX and SPD rather than their totals. So if Billy Batson has a DEX of 11 and a SPD of 2 normally, and has a DEX of 23 and a SPD of 5 when he's Captain Marvel (with the additional DEX and SPD bought Only In Heroic Identity), then the speed chart will show him as DEX 11, SPD 2 instead of DEX 23, SPD 5...

Kaeto
Mar 7th, '03, 12:58 PM
Originally posted by Thag13
Now I know how Charlie Brown Feels in school


all of these posts that the BLAH BLAH BLAH BLAH effect.

I didnt understand a word of it...

kinda cool though

so when will some one have a sheet I can down load>>??


I have to agree. I'm not a programmer.:(

Derek Hiemforth
Mar 7th, '03, 02:39 PM
Originally posted by Kaeto
I have to agree. I'm not a programmer.:( Guys, you don't have to be a programmer to use this. Okay, it's not a pretty little point-and-click app, but it's not like you have to crunch a bunch of code to use it.

Here's all you have to do to use this (assuming you're on a Windows machine):

1. Login to the ActiveState web site (http://www.activestate.com/Products/ActivePerl) and click on Download, then click on Next.
2. Check the Minimum System Requirements link, and download and run the MSI installer if needed for your system.
3. Download the Perl installer and run it to install perl.
4. Once it's installed, go to Start...Programs...ActiveState ActivePerl 5.8...Perl Package Manager.
5. Type "install XML-Twig" and hit Enter.
6. Type "install Win32-Autoglob" and hit Enter.
7. Type "exit" and hit Enter.
8. Make a folder on your hard drive where you'll make speed charts. Mine is at C:\spdchart.
9. Download the "mkspdchrt.zip" file that Mark posted earlier in this thread, and unzip the "mkspdchrt.pl" file to the folder you just created in step 8.
10. Edit the "mkspdchrt.pl" with a text editor, and add the line "use Win32::Autoglob;" below the two other lines you'll see near the top of the file that look similar. Save the change. (I'm sure Mark will post an updated file so this step becomes unnecessary.)
11. Copy whatever Hero Designer character files (.hdc files) you want to make a speed chart with into your spdchart folder.
12. Launch an MS-DOS prompt. (There should be a shortcut for this in your Start Menu tree somewhere, perhaps under Accessories. If you can't find it, just go to Start...Run and type in "command".)
13. Type in "cd c:\spdchart" and hit enter
14. Type in "perl -w mkspdchrt.pl *.hdc > spdchart.txt" and hit Enter.

You now have a speed chart (spdchart.txt) with the "fields" spearated by tabs, suitable for opening in Word or Excel or whatever to make a pretty printout. Of course, you will only have to do steps 1 through 10 once... after that, you only need to do steps 11-14.

Hope this helps. :)

lemming
Mar 7th, '03, 07:29 PM
Originally posted by Derek Hiemforth
Hey Mark, I just realized that the speed chart is listing characters based on their base DEX and SPD rather than their totals. So if Billy Batson has a DEX of 11 and a SPD of 2 normally, and has a DEX of 23 and a SPD of 5 when he's Captain Marvel (with the additional DEX and SPD bought Only In Heroic Identity), then the speed chart will show him as DEX 11, SPD 2 instead of DEX 23, SPD 5...

Hmm, that shouldn't be hard to implement. Of course, what to do with +3 SPD only for Mental might be a hassle. Maybe I'll have a note at the end for SPD bought outside of Char.

Qelan
Mar 7th, '03, 09:57 PM
Here is a spreadsheet I was working on. Extra special thanks to Fuzzy Gnome for his help with the formulas. Only thing is you can't use duplicate DEX values but you should decied who you want to act before another character with the same dex and add a decimal to their value (ex. 23 and 23.1)

Thag13
Mar 8th, '03, 12:19 PM
Thanks Derek,

Its still Klingon to me..but I think I can figure it out.

Thanks for helping us non programers.(well I can program, but amiga Basic and old stuff like that)

:p

Night
Mar 13th, '03, 06:52 PM
Hi-

I submitted an XML export template way back during the BETA period that might help you guys with this a little bit (I wrote it for just this sort of thing).

If you ran your perl script against that rather than the .hdc file you will get the values after HD has applied the rules and computed them, instead of the raw data which is in the .hdc.

It's called GenericXml and it's on the export template page under Free Stuff.

YMMV-
Butler