Author Topic: How to Mass Edit and Data Mine your Module  (Read 1440 times)

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
How to Mass Edit and Data Mine your Module
« Reply #30 on: April 02, 2014, 08:14:33 am »


               I verified that behaviour. Existing scripts fail with this message:

[Warning] Deprecated use of %ERF['resource']; use instead 'resource' in %ERF at c_add_var.ls line 9 pos 6.

So, I'm even more persuaded to stay on the old release. All the same, it would be really helpful if you could publish the documentation in a legible format, with the caveat that some things have changed. It's full of helpful gems!

As one illustration, in Funky's example #1, there's no way of telling which area each placeable count is for, because the area name isn't in any .git file field. However, using the new documentation to discover the "silver bullet" variable $_,


for (%mod['*.git'])
  {
    $area = $_;
    $count = 0;
    for (/{'Placeable List'}) {$count++;}
    print $area, $count, "\\n";
}

               
               

               
            

Legacy_MrZork

  • Hero Member
  • *****
  • Posts: 1643
  • Karma: +0/-0
How to Mass Edit and Data Mine your Module
« Reply #31 on: April 02, 2014, 09:22:16 am »


               

It is also possible to give the loop variable an explicit name. The example below does that in both loops.


 


FWIW, the example is a placeable counter, as above, but also prints the more human-readable name of each area, along with its resref and placeable count. To do that, the first loop populates a hash with the area names, using the resrefs as keys, then the second loop grabs the name. Both loops take advantage of the fact that the resrefs are the ARE and GIT filenames stripped of their extensions, something ls scripts can also take advantage of when looping through creatures, items, etc.



@AreaNames = ();
for $AreaARE (%mod['*.are']) {
    $AreaNames[substr($AreaARE,0,-4)] = /Name;
    }

for $AreaGIT (%mod['*.git'])
    {
    $AreaRR = substr($AreaGIT,0,-4);
    $AreaName = $AreaNames[$AreaRR];
    $count = 0;
    for (/{'Placeable List'}) {$count++;}
    print "$AreaName [$AreaRR] has $count placeables\n";
    }

               
               

               
            

Legacy_dunahan_schwerterkueste_de

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
How to Mass Edit and Data Mine your Module
« Reply #32 on: April 02, 2014, 06:03:25 pm »


               

Sry, for that delay '<img'> Got the doc ready enough for the first public release. Hope it will help, even a littlebit '<img'>


 


Here's the link


https://www.dropbox....your Module.pdf


 


The code for the first example of Funky will work, if you do it that way:



   Spoiler
   


MrZork explains the definition of subroutines, as I guess. It's described in the helpsys also in the pdf-doc.



               
               

               
            

Legacy_dunahan_schwerterkueste_de

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
How to Mass Edit and Data Mine your Module
« Reply #33 on: April 07, 2014, 07:59:09 pm »


               

As you can see in this very early version, I'm trying to build a lexicon like the nwscript-lex '<img'> got some of the functions of rc3 and some of Funky's/Acaos provided scripts working in the new version of moneo.


*working on these files to get them right* '<img'>



               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
How to Mass Edit and Data Mine your Module
« Reply #34 on: April 09, 2014, 08:12:47 am »


               

Very cool, and nice work. Watching this thread with interest, though I don't have time to do much experimentation myself, these days. Let me know if there's anything you think should be included in the original posts.


 


Thanks!


Funky



               
               

               
            

Legacy_dunahan_schwerterkueste_de

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
How to Mass Edit and Data Mine your Module
« Reply #35 on: April 09, 2014, 01:52:32 pm »


               *blushes*

Thanks you too! Got 70% of those provided scripts by you and Acaos already working. Now I'm trying to get the doc filled with the info I got of this 'learning by doing' sessions  '<img'>

Besides, I'm going to comment those scripts, so that even newbies, like me (got no education on languages to write such scripts, learned only from tests and faults) can read them and have a idea of what they do, or even what help moneo can be!

*going back to this script, that eventually copies a whole area from one map to another map, or I hope so*
               
               

               
            

Legacy_dunahan_schwerterkueste_de

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
How to Mass Edit and Data Mine your Module
« Reply #36 on: April 13, 2014, 05:50:58 pm »


               

Something I found out and would add to the doc in time:



   Spoiler
   



   Spoiler
   



   Spoiler
   



   Spoiler
   



               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
How to Mass Edit and Data Mine your Module
« Reply #37 on: April 15, 2014, 09:23:05 pm »


               

Sounds good. Do you have a script sample for those functions?


 


Thanks,


Funky



               
               

               
            

Legacy_dunahan_schwerterkueste_de

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
How to Mass Edit and Data Mine your Module
« Reply #38 on: April 16, 2014, 10:48:52 am »


               

Got them here, but had to correct some descriptions due newer experiences...


 


addac.ls



   Spoiler
   


 


dumpcritter.ls:



   Spoiler
   


 


dumpdoors.ls:



   Spoiler
   


 


*grumbles 'cause of the formatting of the post due inserting from mobile phone*



               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
How to Mass Edit and Data Mine your Module
« Reply #39 on: April 17, 2014, 12:29:53 am »


               

Actually, I get the same formatting issues when I post from my PC. I haven't fussed with trying to work around them yet, as I've been using pastebin. I may do that as well, for these samples. I'll get them added to the followup post as soon as I'm able.


 


Thanks!


Geoff



               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
How to Mass Edit and Data Mine your Module
« Reply #40 on: April 17, 2014, 06:05:05 pm »


               On the subject of formatting on this site, you can use the "spoiler" BBCode to reduce long scripts to a button - that way, folk can browse the thread without having to page through the detail every time.
               
               

               
            

Legacy_dunahan_schwerterkueste_de

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
How to Mass Edit and Data Mine your Module
« Reply #41 on: April 19, 2014, 07:38:46 am »


               

Didn't saw this spoiler thingie, so I didn't thought it was active. Now I re-edited the post and put them into spoilers '<img'>



               
               

               
            

Legacy_dunahan_schwerterkueste_de

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
How to Mass Edit and Data Mine your Module
« Reply #42 on: May 05, 2014, 06:59:25 pm »


               

Sry, got some serios probs with akamaihd.net '<img'> Since I did some backups, my work isn't destroyed, but it would take some time to get back to it...



               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
How to Mass Edit and Data Mine your Module
« Reply #43 on: May 05, 2014, 07:47:08 pm »


               

Thanks - I'll try to reformat the original post, when I go back through it, using spoiler tags. Here's to hoping this forum holds on to color codes better than the last one. '<img'>


 


Funky



               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
How to Mass Edit and Data Mine your Module
« Reply #44 on: February 22, 2015, 02:14:08 pm »


               

I just discovered how to merge area information from the .are and .git files. I'll cross-post the solution here, for future reference. In this example, we make a list of area placeables from the .git file, but add the area name from the .are file.


 



   Spoiler