User:Qazmlpok/nhtohtml
After discovering this tool on the net, I decided to modify it for use in generating wiki pages using the templates. Instead of generating html files, it now generates wiki markup code that can be pasted into an article on this wiki. Running the script will require Perl, a copy of the Nethack/SLASH'EM source code (other variants won't necessarily work, but it could certainly be modified). It is necessary to modify the script to point to the source installation; search for "$nethome" and asjust the directory; be sure to use forward slashes even on windows. The output also includes the encyclopedia entry and a stub message stating that the article was automatically generated. I modified the output to match the existing standards as closely as I could. Since there are a large number of missing SLASH'EM monster articles, this should be useful to fill in the missing pages, or the Vanilla articles with missing conveyance chances, source references, and attributes.
Some deficiencies:
- Experience and Difficulty are not available from the source code. The values are available for the vanilla monsters, but I don't know how to calculate them for the missing SLASH'EM monsters.
- The encyclopedia entry is not formatted very well. I wrapped it in the new template, but I believe manual formatting is still necessary. I don't know of a good way to automatically format it.
And some additions:
- After discovering how magic resistance works, natural magic resistance is mentioned on the resistances section. I'm surprised it was never mentioned before; I had no idea angels were magic resistant AND are the right size to wear DSM.
- Similarly, level drain resistance is mentioned. Death magic is mention if the monster specifically is immune to death magic (in SLASH'EM), e.g. the higher angelic beings.
- Resistance chance is calculated. This is something that was missing from the original nhtohtml (and a good number of articles on this wiki). Telepathy, Teleportitis, and teleport control are also mentioned on the conveyances table, as are several hard-coded specials, like a mind flayer corpse giving +1 intelligence or a chameleon causing polymorph. If the monster never leaves a corpse the conveyances table is blanked, as there is no way to get the intrinsics even if the monster "conveys" them (swallowing attacks do NOT work for this; I've tried)
If anyone has any suggestions on way to improve the output, they'd be appreciated. Here's the full source. Perl is far from my best language, so I'm sure the script contains inefficiencies or unusual code.
(5/4) Alright, just updated the code. I believe it is properly calculating the difficulty and base experience, with help from Ion Frigate's code analysis. Random sampling on the data seems to confirm the results; difficulty matches up everywhere I checked, experience matches up in most places as well. Experience seems to include incorrect values on the wiki though; the killer bee article states 19 base experience, Monsters (by difficulty) says 21, while wizard mode and my program give me 31. I'm assuming the bug in experience() line 76 is the cause of at least some of the discrepancy; thanks to whoever annotated the source as I definitely would have overlooked that myself. Other minor changes are including "appears in (small/large/very large) groups" in the frequency, and better article support; it no longer says "A Demogorgon" on the attributes list.
I'll probably start using this to fill in some SLASH'EM articles over next week if no one else has any suggestions for improving the output.
(11/30) Updated to account for G_NOCORPSE (Thanks, Ion frigate). Shelob's monster definition also incorrectly used SIZ instead of LVL, the script will account for that now.
(2018/11/19) Updated to handle NetHack 3.6.0 and 3.6.1. I haven't exhaustively checked all of the output, but it appears to be working without issue. Other fixes:
- Added strength gain from giants, including the new 3.6.0 rules
- 3.6.0 fixes exp gain (see the 5/4 update above). Added a check against the version to only use the bugged exp on 3.4.3.
- Used 'strict' mode for Perl. Changed a lot of the formatting.
https://github.com/qazmlpok/nhtowikihtml
And sample output:
S asphynx | |
---|---|
Difficulty | 11 |
Attacks | |
Base level | 8 |
Base experience | 200 |
Speed | 15 |
Base AC | 3 |
Base MR | 0 |
Alignment | 0 (neutral) |
Frequency (by normal means) | Very rare, appears only outside of Gehennom |
Genocidable | Yes |
Weight | 100 |
Nutritional value | 80 |
Size | Small |
Resistances | poison, petrification |
Resistances conveyed | poison (53%) |
A asphynx:
| |
Reference | SLASH'EM_0.0.7E7F2/monst.c#line3119 |
Encyclopedia Entry
This small, inoffensive-looking snake shares the feared power
of petrification with its distant relatives the cockatrice and
basilisk. Just one touch from its blunt snout can render one
motionless for all eternity.
[ The New Bestiary, Wizard Endlebrook ]
{{stub|This page was automatically generated by a modified version of nhtohtml version 1.9w}}