Author Topic: [D2NT] .nip checker  (Read 2050 times)

noob_patrol

  • Guest
[D2NT] .nip checker
« on: June 17, 2010, 03:59:19 AM »
LAST UPDATE - 12th May 2010
(Issues/Bugs/Wish List updated 25th May 2010)
CREDITS
~Toothless
~gumshield

Fiddle with your nips with peace of mind.
No longer will your bot stand idle over an item you wrongly configured in a nip file 

SCREENIE


OUTPUT
This will be generated by the script and stored in a text file in your item_configs directory.
There will be one file for each nip file you are using.
Only the lines with errors will be logged.

Example output #1Code:
   [Name] == Hunter'sGuise && [Quality]==set && [ColdResist]==50 // Aldur's Stony Gaze
   Keyword Errors   :   
   Alias Errors      :   50

[Mame] == BattleBoots && [Quality] == set && [FireResist] == 50   // Aldur's Advance
   Keyword Errors   :   mame
   Alias Errors      :   50

[Name] == ShadowPlate && [Quality] == set # [LightResst] == 50 // Aldur's Deception
   Keyword Errors   :   
   Alias Errors      :   lightresst

[Name] == JaggedStar [Quality] == set # [Sockets] == 3 // Aldur's Rhythm
   Eval error      :   Before #
 
PASS : 0
FAIL : 4
Example input #2Code:
[Name] == 649   // (guess)
[Name] == SmallCharm && [Quality] == magic # [80] == 7 // dunno wot 80 means
[Type] == jewel && [Quality] == 7 # ([331]+[335] == 10 || [330]+[334] == 10 || [332]+[336] == 10 || [329]+[333] == 10) // wtf is this :)
[Name] == SmallCharm && [Level] <= 18
Example output #2Code:
[Name] == 649   // (guess)
   Keyword Errors      :   
   Alias Errors      :   
   Code Sanity Check   :   649=[keyofdestruction]

[Name] == SmallCharm && [Quality] == magic # [80] == 7 // dunno wot 80 means
   Keyword Errors      :   
   Alias Errors      :   
   Code Sanity Check   :   80=[itemmagicbonus]

[Type] == jewel && [Quality] == 7 # ([331]+[335] == 10 || [330]+[334] == 10 || [332]+[336] == 10 || [329]+[333] == 10) // wtf is this :)
   Keyword Errors      :   
   Alias Errors      :   
   Code Sanity Check   :   7=[unique] 331=[passivecoldmastery] 335=[passivecoldpierce] 330=[passiveltngmastery] 334=[passiveltngpierce] 332=[passivepoismastery] 336=[passivepoispierce] 329=[passivefiremastery] 333=[passivefirepierce]

PASS : 4
FAIL : 0

CODE
Latest (updated 12th May 2010)

2.0.0
http://pastebin.com/raw.php?i=rzAhs91H
FIX : eval() and logical operations
ADD : NTConfig_CheckCodes - true=write sanity code check to output file
Previous
DO NOT USE

Paste contents into a new file with a .ntj extension, and save in NTBot/bots/ directory.
eg. NTBot/bots/TLNipCheck.ntj
make sure it does NOT have a .txt extension (see p7)


USAGE
Just add the script in your character file.
Make sure the filename matches to the file you just created and saved.Code:
NTConfig_Script.push("TLNipCheck.ntj"); NTConfig_CheckCodes = true;

Obviously its best to run this only after nip file modifications.
So comment out all those boss runs and just run this script, and then vice versa once you happy.


ISSUES/BUGS/WISH LIST

Always use the latest version


FIX : Error creating output file (happens with nip files in multiple nested directories)
Find the line that starts "fileNameOutput =" (line 250'ish)
Change the replace("/", "_") to replace(/\//g, "_")


FIX : p5 - NTItemAlias arrays with values as arrays
These linesCode:
arr1["c" + _NTIPAliasType[k]] = k;
arr1["c" + _NTIPAliasClassID[k]] = k;
arr1["c" + _NTIPAliasClass[k]] = k;
arr1["c" + _NTIPAliasQuality[k]] = k;
arr1["c" + _NTIPAliasFlag[k]] = k;
arr1["c" + _NTIPAliasStat[k]] = k;

need to be changed to, respectivelyCode:
arr1["c" + _NTIPAliasType[k].toString().split(",")[0]] = k;
arr1["c" + _NTIPAliasClassID[k].toString().split(",")[0]] = k;
arr1["c" + _NTIPAliasClass[k].toString().split(",")[0]] = k;
arr1["c" + _NTIPAliasQuality[k].toString().split(",")[0]] = k;
arr1["c" + _NTIPAliasFlag[k].toString().split(",")[0]] = k;
arr1["c" + _NTIPAliasStat[k].toString().split(",")[0]] = k;



ISSUE : p8 - if keywords are blank then it counts as a fail but will not be reported in output file



This script will not catch all syntax errors.
I did not want to write a query parser, so have just followed the same logic that NTItemParser.ntl uses.
ie. a pass with nip check does not guarantee your syntax is correct


Just remember, this script just checks aliases matches and then tries to emulate a runtime eval call.


I'll release an udpated script when this list gets too long, lol !



Hope you guys find it useful - thought I'd give a little something back, ahem.
I for one am tired of myself screwing it up, as well as reading (all too often) about other people's woes.

Enjoy!