TES3CMD - Perl Scripting Help Needed

Questions specific to OpenMW-CS can be asked, and content development related topics can be discussed here
Post Reply
User avatar
FiftyTifty
Posts: 63
Joined: 15 Oct 2014, 21:02

TES3CMD - Perl Scripting Help Needed

Post by FiftyTifty »

Now that TES3MP is due an update any day now, I've turned to modding Morrowind, with plenty of experience with the newer Elder Scrolls and Fallout games. Cut my teeth on making TES5Edit scripts in Delphi to automate inhumane amounts of work. But there is a problem; there's no real documentation nor any meaningful amount of well-commented example Perl scripts.

But there is a problem. There's no documentation for the Perl scripting features. I've only found a couple of other scripts that use it, and they don't have documentation either. What I'm aiming to do, is raise the level of all NPCs to 20, adjusting their stats depending on their class, and have some classes give an even higher level boost also dependent on their class. But, sadly, no documentation. This is what I've got so far:

Code: Select all

use strict;


sub main {

    my($npcToChange) = @_;
    my $iCurrentLevel = 0;
    my $iNewLevel = 20;
    my $strElementSignature = '';

    if ($npcToChange->rectype eq 'NPC_'){

        foreach my $Element (@{$npcToChange->{SL}}) {

            $strElementSignature = $Element->subtype;

            if ($strElementSignature eq 'NPDT' && ($Element->{level} + 0 ) < 20 {

                $element->{level} = $iNewLevel

            }

        }

    }

}
Yeah it's not much, since I'm already at a roadblock; it might as well be psuedocode since I've no idea how to actually work with the data. Here's the snippet of code I was using as a reference:

Code: Select all

sub main {
   my($tr) = @_; # tr = the record
   my $ok = 0;
   my $angle = 0;
   my $delta = 0;
   my $newangle = 0;
   my $subtype = '';
   my $name = '';
   if ($tr->rectype eq 'CELL') { # only interested in CELL records
      if (!$tr->is_interior) {  # that are not interiors
         $ok = 0;
         foreach my $tsr (@{$tr->{SL}}) { # tsr = the sub-record
            $subtype = $tsr->subtype;
            if ( $ok == 0 ) {
               if ($subtype eq 'FRMR') { 
                  $ok = 1; 
               }
            }
How do I figure out the names of the flags, the data, and how to work with them? I've tried looking at the source .pl file of TES3CMD, but it's extremely terse with no explanations.
User avatar
halbe
Posts: 65
Joined: 14 Feb 2017, 03:55

Re: TES3CMD - Perl Scripting Help Needed

Post by halbe »

First ye must venture to the MMC Discord of ancient yore. There ye shalt find a wizened wizard known as "Greatness7", he is a master scripter of all things Morrowind be it TES3CMD Perl, MWSE-lua, using python to edit .NIFs, or even the accursed mwscript of certain death. To seek the wisdom of this wizened wizard, you need only speak the words of power with conviction and meaning: "help pls"

Then ye shall be enlightened and shall join the council of TES3CMD. There are like 5 of us and G7 is our leader.
User avatar
FiftyTifty
Posts: 63
Joined: 15 Oct 2014, 21:02

Re: TES3CMD - Perl Scripting Help Needed

Post by FiftyTifty »

halbe wrote: 10 Jul 2020, 00:37 First ye must venture to the MMC Discord of ancient yore. There ye shalt find a wizened wizard known as "Greatness7", he is a master scripter of all things Morrowind be it TES3CMD Perl, MWSE-lua, using python to edit .NIFs, or even the accursed mwscript of certain death. To seek the wisdom of this wizened wizard, you need only speak the words of power with conviction and meaning: "help pls"

Then ye shall be enlightened and shall join the council of TES3CMD. There are like 5 of us and G7 is our leader.
What, there's someone that actually knows how to work with TES3CMD's scripting? Right, am hopping on over.
Post Reply