[RELz] tes3cmd, a small tool for modifying TES3 plugins

Post » Mon Aug 23, 2010 4:12 am

I tried Strawberry 5.10.0.3. and could not get it to work. It was giving me a "Can't open perl script "tes3cmd": No such file or directory." when I enter C:\strawberry\perl\bin\perl tes3cmd help

Where did you put tes3cmd? If you are in the directory where the script exists, then perl should find it. If you are not in the same directory as the script, you'll have to give it a complete path name like:

C:\strawberry\perl\bin\perl C:\morrowind\tes3cmd\tes3cmd

This command line is basically saying to run the perl.exe and give it the script file tes3cmd to load and run.
User avatar
victoria johnstone
 
Posts: 3424
Joined: Sat Oct 14, 2006 9:56 am

Post » Mon Aug 23, 2010 3:44 am

Any thought on a GUI? ;)

Something I had thought would be really neat (if possible!) would a gui option that would have check boxes next to each type of record in an esp. Then you could check more than one type to have the rename search look through, or limit the file dump, etc. :goodjob:
User avatar
Mizz.Jayy
 
Posts: 3483
Joined: Sat Mar 03, 2007 5:56 pm

Post » Mon Aug 23, 2010 3:00 pm

Any thought on a GUI? ;)

Something I had thought would be really neat (if possible!) would a gui option that would have check boxes next to each type of record in an esp. Then you could check more than one type to have the rename search look through, or limit the file dump, etc. :goodjob:


Maybe at some point I can do a GUI. It would certainly make it easier to use. However, GUIs are not really my area of expertise, so it probably won't get done any time real soon.
User avatar
ZANEY82
 
Posts: 3314
Joined: Mon Dec 18, 2006 3:10 am

Post » Mon Aug 23, 2010 4:36 pm

I managed to get strawberry perl working, though I can't seem to change the drive letter in the command prompt (looked up possible reasons and solutions, too much work). Long story short, I found a workaround and its works nicely. Granted I've only tried listing NPC_.name of one of my mods.

I did notice a few things I wish I could do.

Any chance a function could be made to change all the skills of all NPCs (or NPCs matching/containing a string) to a list of numbers? And perhaps another for stats?

Just chucking out a few things. Thanks for the handy tool. :) I'll have to try it out some more.
User avatar
Charles Mckinna
 
Posts: 3511
Joined: Mon Nov 12, 2007 6:51 am

Post » Mon Aug 23, 2010 12:12 pm

Any chance a function could be made to change all the skills of all NPCs (or NPCs matching/containing a string) to a list of numbers? And perhaps another for stats?

I could do that, but it's the kind of thing that right now I'd have to do a new function for every request like this, and I'd rather come up with a general solution that would work for any subrecord. I will have to think on it. Hmm, a general solution would be a bit of an undertaking, but I'll see if I can come up with something.
User avatar
Emily Rose
 
Posts: 3482
Joined: Sat Feb 17, 2007 5:56 pm

Post » Mon Aug 23, 2010 1:43 pm

I want to say that I am so incredibly glad I have this right now. I have undertaken *yet* another project that this has simplified. I am working on a mod that requires somewhere around 1400 unique spells (I know, it's a HUGE amount of spells, but it will be worth it! :hehe: ) Most of the are just slight variations of others; so between tes3cmd and the ability to export/import text files, it's actually a piece of cake. Maybe an hour of work as opposed to the dozens I had originally anticipated. Thanks again! :goodjob:
User avatar
Alexxxxxx
 
Posts: 3417
Joined: Mon Jul 31, 2006 10:55 am

Post » Mon Aug 23, 2010 8:08 am

I want to say that I am so incredibly glad I have this right now. I have undertaken *yet* another project that this has simplified. I am working on a mod that requires somewhere around 1400 unique spells (I know, it's a HUGE amount of spells, but it will be worth it! :hehe: ) Most of the are just slight variations of others; so between tes3cmd and the ability to export/import text files, it's actually a piece of cake. Maybe an hour of work as opposed to the dozens I had originally anticipated. Thanks again! :goodjob:

Thank you :)

And if you find any more inefficient things that could be automated, let me know and I'll take a look at them.
User avatar
Siobhan Thompson
 
Posts: 3443
Joined: Sun Nov 12, 2006 10:40 am

Post » Mon Aug 23, 2010 7:26 am

I'm working on getting MGE to animate the kelp (and other things) in my game. In order to do this, I need to remove all of the default kelp references from the game. MGE will take care of rendering the kelp for me. However, MGE doesn't render in interior cells, so I need to create a patch for the interior cells that have kelp and place a new kelp reference in them. I figured I could use TES3CMD to show me which cells had kelp references in them.

In order to make my life easier, I made a modification to TES3CMD to make it output its records all on one line. I can then redirect the output to a file and use sed, swk, grep, etc to process the records and get what I need.

When I ran TES3CMD, I didn't see anything in the output that specifically said "this is an interior". However, I did a little test and I placed a kelp in an interior cell and an exterior cell. When I ran TES3CMD against both ESPs, the exterior one had "CELL.DATA: Coordinates: (x, x)" in its output, and the interior one didn't. Is that enough for me to assume that all exterior cells will have that output and interiors wont?

My process looks something like this:

perl mytes3cmd -t CELL Morrowind.esm > foo1
grep -i "kelp" < foo1 > foo2
grep -m "CELL.DATA: Coord" < foo2 > foo3

If my assumptions are right, foo3 should now contain all of the cells that are interiors (-m says to output the lines that don't match). When I did this, I only came up with two cells:

Hla Oad, Fatleg's Drop Off
Zainsipilu

Does that sound right, or do I need to do some more work to make TES3CMD useful for what I'm trying to do?
User avatar
Melis Hristina
 
Posts: 3509
Joined: Sat Jun 17, 2006 10:36 pm

Post » Mon Aug 23, 2010 3:24 pm

Check interior-as-exterior cells, I think these have coordinates too. (But I'm not 100% sure and can't test it at the moment.)

Determining whether a cell is interior (including int-as-ext) or exterior based on the CELL record is tricky - Lightwave tested several different methods while developing TESFaith and all had their problems. In the latest alpha, he relied on one bit in the cell flags, and that worked better than the previous approaches. Search for Lightwave's posts in this forum and you should find the thread quickly.
User avatar
Nathan Barker
 
Posts: 3554
Joined: Sun Jun 10, 2007 5:55 am

Post » Mon Aug 23, 2010 10:32 am

@Silverglade: Yes, tes3cmd only prints "Coordinates" for a CELL if the bit-flag that Psyringe mentioned is set for an exterior cell, so I believe what you are trying to do should work.

I'll see if I can come up with a decent one record per line output mode for the dump command. Someone else might find that useful too.

If you have any more suggestions I'll be happy to consider them for a future release of tes3cmd to make it more useful.
User avatar
Laura Cartwright
 
Posts: 3483
Joined: Mon Sep 25, 2006 6:12 pm

Post » Mon Aug 23, 2010 1:11 pm

Ah, tes3cmd is even smarter than I thought already. ;) In that case - Silverglade, disregard the problem I mentioned, it seems that tes3cmd already deals with it. :)

John, now I'm curious - is this flag documented somewhere (in this case Lightwave would probably be glad to hear that his asumption was correct and that the new algorithm is sound), did you reverse-engineer it yourself, or was Lightwave's post the basis of your implementation?
User avatar
Flesh Tunnel
 
Posts: 3409
Joined: Mon Sep 18, 2006 7:43 pm

Post » Mon Aug 23, 2010 6:38 pm

Thanks guys. You might be happy to know that I disassembled the CS and they are doing a similar test (ANDing with 0x01) to determine if something is an interior or exterior. I haven't verified if you guys are doing it on the same byte or not, but you probably are.

Off Topic:
What does your unpack command "Lx[L]f" do? I don't recognize the "[L]" syntax in there. I can't seem to find it documented.
User avatar
Ridhwan Hemsome
 
Posts: 3501
Joined: Sun May 06, 2007 2:13 pm

Post » Mon Aug 23, 2010 1:52 pm

@Psyringe: I have been using this description of the TES3 file format:
http://www.uesp.net/text.shtml?morrow/tech/mw_esm.txt
and under CELL.DATA, it lists these flags:
	DATA = http://forums.bethsoft.com/index.php?/topic/934107-relz-tes3cmd-a-small-tool-for-modifying-tes3-plugins/Cell Data		long Flags			0x01 = Interior?			0x02 = Has Water			0x04 = Illegal to Sleep here			0x80 = Behave like exterior (Tribunal)


@Silverglade: The documentation for perl's pack/unpack are in the "perlfunc" man page:
One can replace the numeric repeat count by a template enclosed in brackets; then the
packed length of this template in bytes is used as a count. For example, "x[L]" skips a
long (it skips the number of bytes in a long); the template "$t X[$t] $t" unpack()s twice
what $t unpacks. If the template in brackets contains alignment commands (such as
"x![d]"), its packed length is calculated as if the start of the template has the maximal
possible alignment.

User avatar
El Khatiri
 
Posts: 3568
Joined: Sat Sep 01, 2007 2:43 am

Post » Mon Aug 23, 2010 10:53 am

@Psyringe: I have been using this description of the TES3 file format:
http://www.uesp.net/text.shtml?morrow/tech/mw_esm.txt

Thanks. :) I'll relay that to Lightwave, he'll be pleased to hear that the assumptions he based the new algorithm on were based on were verified by other people's independent research (including Silverglade's disassembling of the CS, thanks to you too :) ).
User avatar
GPMG
 
Posts: 3507
Joined: Sat Sep 15, 2007 10:55 am

Post » Mon Aug 23, 2010 1:22 pm

Um, why not just use the info function in the CS to find what cells the object has references for the esms/esps loaded? :blink:

In the CS:
* Right-click the object in question and select 'Info'.
* The 'Use Report:' window opens - the bottom section lists what cells the object is used in by 'Cell Name', 'Grid', and 'Ref Count'.
* The 'Grid' column will list 'Interior' for interiors and coordinates for exteriors.
* Double-clicking an entry will open the cell location in the Render window with the object reference selected and zoomed in.

You'll want to do this for each object.

The 'Use Report:' columns can be sorted - click on the column header to sort between ascending / descending order.


And to confirm... kelp is only located in those two stock Bethesda interior cells (MW, TB, BM esms loaded):
Hla Oad, Fatleg's Drop Off
Zainsipilu


Using tes3cmd to locate references is still a good thing, especially for lots and lots of references.
A bit overkill in this case for kelp tho. :P
User avatar
lydia nekongo
 
Posts: 3403
Joined: Wed Jul 19, 2006 1:04 pm

Post » Mon Aug 23, 2010 4:35 pm

I'm not sure how useful it would be, but if you are going to work on a single-line-per-record output, then an option to request a specific record might be nice too. For example, after I dumped all of the records and used grep to narrow down the ones I was interested in, it would have been nice to request those records in the nice ouput format. Something like:

Give me record 1057 in the multi-line format
-r 1057

Give me record 1057 and 8703 in the multi-line format
-r 1057,8703

Give me records 1057 through 1200 in the multi-line format
-r 1057-1200
User avatar
Gavin Roberts
 
Posts: 3335
Joined: Fri Jun 08, 2007 8:14 pm

Post » Mon Aug 23, 2010 7:31 am

I'm not sure how useful it would be, but if you are going to work on a single-line-per-record output, then an option to request a specific record might be nice too. For example, after I dumped all of the records and used grep to narrow down the ones I was interested in,


Not sure if this is what you are looking for, but the dump command already has 2 options that allow you to narrow down the records you want dumped. You can either say "tes3cmd dump -t cell,npc_" and all the CELL and NPC_ records are dumped, or you can match on a perl regexp, like this: "tes3cmd dump -t npc_ -m tarhiel" and only the NPC_ record that contains the pattern "tarhiel" will be dumped. If this gives you what you want, that looks like it might be a better solution than requesting specific record numbers.

Edit: I've checked in a change to svn so that "tes3cmd dump" now has a "-s separator_string" command line option, which, if specified, prints out records in single-line format, using the given separator_string to separate the fields.
User avatar
No Name
 
Posts: 3456
Joined: Mon Dec 03, 2007 2:30 am

Post » Mon Aug 23, 2010 2:50 pm

Not sure if this is what you are looking for, but the dump command already has 2 options that allow you to narrow down the records you want dumped.

I was familiar with those commands already. However, they seemed to return much more than what I was looking for. Like I said, I'm not sure how useful the feature would be also I didn't realize that you changed the record number based on what you output. I thought the record numbers you output were specific to the record's place in the file you queried against.
User avatar
Quick Draw III
 
Posts: 3372
Joined: Sat Oct 20, 2007 6:27 am

Post » Mon Aug 23, 2010 8:50 am

I was familiar with those commands already. However, they seemed to return much more than what I was looking for.

If you feel like giving an example of the kinds of things you'd like to query or how you'd narrow down a query, I could try implementing something to make this feature more useful.
User avatar
yessenia hermosillo
 
Posts: 3545
Joined: Sat Aug 18, 2007 1:31 pm

Post » Mon Aug 23, 2010 6:10 pm

Well once again this tool has saved me an incredible amount of time. I was able to turn 22 spells into 2082 spells in about an hour and a half. :hehe:

Of course now I need to go dump them all to text and edit the effects..... :huh:
User avatar
Krista Belle Davis
 
Posts: 3405
Joined: Tue Aug 22, 2006 3:00 am

Post » Mon Aug 23, 2010 1:10 pm

Well once again this tool has saved me an incredible amount of time. I was able to turn 22 spells into 2082 spells in about an hour and a half.

That's a lot of spells! What are you up to? (If it's ok to ask).
User avatar
Nicole M
 
Posts: 3501
Joined: Thu Jun 15, 2006 6:31 am

Post » Mon Aug 23, 2010 5:44 am

I'm making it so you can use a potion and make poison out of it to apply to your weapon. It uses a curse effect for the actual spell. I had to account for all of the effects that could be used as well as all of the possible magnitude combinations.

Blast it....once again I have overestimated the CS. I was hoping to export all of these spells to a text file and change the effects there. But of course that isn't some of the data included in the dump. :thumbsdown:
User avatar
tannis
 
Posts: 3446
Joined: Sat Dec 09, 2006 11:21 pm

Post » Mon Aug 23, 2010 4:16 pm

Blast it....once again I have overestimated the CS. I was hoping to export all of these spells to a text file and change the effects there. But of course that isn't some of the data included in the dump. :thumbsdown:

Yeah, it would be great if the CS could completely dump all objects as text, and then import them back. Another idea for a future project ...
User avatar
Andres Lechuga
 
Posts: 3406
Joined: Sun Aug 12, 2007 8:47 pm

Post » Mon Aug 23, 2010 6:42 am

Bump for New Release: tes3cmd Version 0.34 is now available:
http://code.google.com/p/mlox/downloads/list

The "dump" command has been updated quite a bit, and more records can now be printed as text.

New commands: delete, diff, fogpatch, see the http://code.google.com/p/mlox/wiki/Tes3cmd for details.

If you suffer from the graphics card glitch that causes some interior CELLs to be blacked out, then the command "tes3cmd fogpatch" will create a patch .esp that fixes all the affected cells in your current plugins.
User avatar
Lisha Boo
 
Posts: 3378
Joined: Fri Aug 18, 2006 2:56 pm

Post » Mon Aug 23, 2010 2:00 pm

Since the topic of fixing fogbugs in a plugin came up in another thread, I thought I'd reply here:

To try to remain more in-thread, as a mod author, I'd like more to directly be able to fix the original mod(s)... I think this could still be a suggestion for a possible new tool option

Well, the http://mlox.googlecode.com/svn/trunk/util/tes3cmd allows you to run arbitrary perl code on a plugin, so it can do this too:
tes3cmd modify -t cell -e 'my $mod = 0; foreach my $subrec (@$r) { if (exists $subrec->[1]->{Fog_Density} and $subrec->[1]->{Fog_Density} == 0) { $subrec->[1]->{Fog_Density} = 0.01; warn "Fogbug fixed for $subrec->[0]\n"; $mod = 1; } }; $mod;' dh_thriftshop.esp


I wouldn't expect that to be obvious :)
But these little bits of code could easily be put into a small file, and executed with the -p switch. So someone could cobble something up and pass it around and then it would be like:

tes3cmd modify -t cell -p fix_fogbugs.pl dh_thriftshop.esp


and fix_fogbugs.pl would basically contain the perl code to modify the appropriate fields.

The "modify" subcommand is an "alpha" feature of tes3cmd. I need to rewrite the interface, and maybe wrap the code that accesses records in an Object Oriented interface. But I've already used it a bit to wreck major damage on Arktwend, and it really was extremely useful for me.
User avatar
Amy Melissa
 
Posts: 3390
Joined: Fri Jun 23, 2006 2:35 pm

PreviousNext

Return to III - Morrowind