Ok for everyone who likes to edit their own pickit files(aka nip files) here is a handy nip checker by Gumshield. It checks for alias errors and alot of syntax errors and as far as I'm concerned is very necessary for editing and writing your own pickits.Anyway there will be a couple of instructions to follow to get it to work,first thing is make a copy of one of your bot files ( found in D2NT31_NTBot42\D2NT\scripts\NTBot\bots) and rename it nipchecker, make sure you keep the .ntj extension and do not make it .txt file.Then delete everything in your new nipchecker.ntj and paste this text in
var _TLAliases = new Array();
var NTConfig_CheckCodes = true;
function NTMain()
{
Include("libs/common/NTCommon.ntl");
NTC_IncludeLibs();
NTC_IncludeConfig("NTBot/char_configs");
NT_LoadConfig();
Print("ÿc3[Toothless NIP Checker 2.0.0] - Load");
if (NTConfig_NIPFilePath && NTConfig_NIPFilePath.length > 0)
{
var msg;
msg = NTConfig_NIPFilePath.length +
" nip file" +
(NTConfig_NIPFilePath.length==1?"":"s") +
" found."
Print(msg);
var woops;
var item;
try { item = me.GetItems()[0]; woops = false;}
catch (error) { Print("Please have at least one item on this character"); woops = true;}
if (!woops) TLNC_DoIt(item);
}
else
Print("No nip files found - check your character config file.");
while(1)
NTC_Delay(500);
NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");
}
function TLNC_ParseLine(f, clean, line)
{
var input;
var sections;
var keywords;
var keyword;
var keywordErrors = '';
var keywordValue;
var keywordValueErrors = '';
var keywordAliasCodes = '';
var skipList;
var working;
var aliases;
var aliasesKey;
var ret = 0;
const KEYWORDS = "ftncqlps";
sections = clean.split("#");
if (sections[0] && sections[0].length > 4)
{
working = sections[0];
keywords = sections[0].match(/\[((\s*?.*?)*?)\]/gi);
if (keywords && keywords.length > 0)
{
skipList = new Array();
for (var i = 0; i < keywords.length; i++)
{
keyword = keywords[i].substring(1, keywords[i].length - 1);
working = working.slice(keywords[i].length);
if (i + 1 < keywords.length)
{
keywordValue = working.slice(0, working.indexOf(keywords[i + 1]) - 1);
working = working.slice(keywordValue.length + 1);
keywordValue = keywordValue.replace(/[^\'a-zA-Z 0-9]+/g, '');
}
else
{
keywordValue = working.replace(/[^\'a-zA-Z 0-9]+/g, '');
}
aliasesKey = keyword.substring(0, 1);
switch (aliasesKey)
{
case "l" :
case "p" :
case "s" :
if (isNaN(keywordValue))
{
keywordValueErrors += keywordValue + " ";
ret = -1;
}
break;
case "t" :
case "n" :
case "c" :
case "q" :
case "f" :
if (isNaN(keywordValue))
{
aliases = _TLAliases[aliasesKey];
if (!aliases)
{
keywordErrors += keyword + " ";
ret = -1;
}
else
{
if (aliases.indexOf(keywordValue) < 0)
{
keywordValueErrors += keywordValue + " ";
ret = -1;
}
}
}
else
{
if (skipList.indexOf(keyword + keywordValue) < 0)
{
aliases = _TLAliases[aliasesKey + "1"];
if (aliases["c" + keywordValue] != null)
{
keywordAliasCodes += keywordValue + "=[" + aliases["c" + keywordValue] + "] ";
ret = 1;
}
else
{
keywordValueErrors += keywordValue;
ret = -1;
}
}
skipList.push(keyword + keywordValue);
}
break;
default :
keywordErrors += keyword + " ";
ret = -1;
break;
}
}
}
else
{
keywordErrors += "No keywords found before # ";
ret = -1;
}
}
if (sections[1] && sections[1].length > 4)
{
working = sections[1];
keywords = sections[1].match(/\[((\s*?.*?)*?)\]/gi);
if (keywords && keywords.length > 0)
{
skipList = new Array();
for (var i = 0; i < keywords.length; i++)
{
keyword = keywords[i].substring(1, keywords[i].length - 1);
working = working.slice(keywords[i].length);
if (isNaN(keyword))
{
aliases = _TLAliases["s"];
if (aliases.indexOf(keyword) < 0)
{
keywordValueErrors += keyword + " ";
ret = -1;
}
}
else
{
if (skipList.indexOf(keyword) < 0)
{
aliases = _TLAliases["s1"];
if (aliases["c" + keyword] != null)
{
keywordAliasCodes += keyword + "=[" + aliases["c" + keyword] + "] ";
ret = 1;
}
else
{
keywordValueErrors += keyword;
ret = -1;
}
}
skipList.push(keyword);
}
}
}
else
{
keywordErrors += "No keywords found after # ";
ret = -1;
}
}
if (ret != 0)
{
if ((keywordErrors.length > 0) || (keywordValueErrors.length > 0) || (NTConfig_CheckCodes && keywordAliasCodes.length > 0))
f.WriteLine(line);
if (keywordErrors.length > 0)
f.WriteLine("\tKeyword Errors\t\t:\t" + keywordErrors);
if (keywordValueErrors.length > 0)
f.WriteLine("\tAlias Errors\t\t:\t" + keywordValueErrors);
if (NTConfig_CheckCodes && keywordAliasCodes.length > 0)
f.WriteLine("\tCode Sanity Check\t:\t" + keywordAliasCodes);
f.WriteLine("");
}
return ret;
}
function TLNC_DoIt(item)
{
var passRT = 0;
var failRT = 0;
var nipsRT = 0;
var pass = 0;
var fail = 0;
var nips = 0;
var input;
var line;
var nip;
var evals;
var output;
var fileNameNip;
var fileNameOutput;
var woops;
var msg;
var parseResult = 0;
for (var nipfile = 0 ; nipfile < NTConfig_NIPFilePath.length ; nipfile++)
{
fileNameNip = "NTBot/item_configs/" + NTConfig_NIPFilePath[nipfile];
nip = FileOpen(fileNameNip, 0);
if (nip)
{
TLNC_LoadItemAliases();
pass = 0;
fail = 0;
nips = 0;
fileNameOutput = "NTBot/item_configs/TLNipCheck_" + NTConfig_NIPFilePath[nipfile].replace("/", "_") + ".txt";
output = FileOpen(fileNameOutput, 1);
if (output)
{
while (!nip.eof)
{
input = nip.ReadLine();
input = input.replace(/^\s+/, '');
var i = input.indexOf("//");
line = i >= 0 ? input.slice(0, i) : input;
line = line.replace(/ |;|\t|\v|\f|\r|\n/g, '').toLowerCase();
if (line.length == 0)
continue;
nips++;
woops = false;
parseResult = TLNC_ParseLine(output, line, input);
if (parseResult < 0)
{
fail++;
continue;
}
evals = NTIPParseLineInt_Fooed(line);
if (evals && evals.length > 0)
{
if (evals[0].length > 0)
{
try
{
eval(evals[0]);
if (evals[1].length > 0)
{
try { eval(evals[1]); woops = false; }
catch (error)
{
TLNC_WriteIt(output, input, "\tEval error\t\t:\tAfter #");
woops = true;
}
}
}
catch (error)
{
TLNC_WriteIt(output, input, "\tEval error\t\t:\tBefore #");
woops = true;
}
woops == true ? fail++ : pass++;
}
else
{
if (evals[1].length > 0)
{
try { eval(evals[1]); woops = false; }
catch (error)
{
TLNC_WriteIt(output, input, "\tEval error\t\t:\tAfter #");
woops = true;
}
}
woops == true ? fail++ : pass++;
}
}
}
msg = "File (" + eval(nipfile+1) + "/" + NTConfig_NIPFilePath.length + ") " + NTConfig_NIPFilePath[nipfile];
msg += fail > 0 ? " ÿc1FAIL" : " ÿc2OK";
msg += fail > 0 ? "ÿc0" : "ÿc2";
msg += " (" + pass + "/" + nips + ")";
msg += fail > 0 ? "ÿc1" : "ÿc0";
msg += " (" + fail + "/" + nips + ")";
Print(msg);
TLNC_WriteIt(output, "PASS : " + pass, "FAIL : " + fail);
output.Close();
}
else
Print("ÿc1Error creating output file : " + fileNameOutput);
nip.Close();
passRT += pass;
failRT += fail;
nipsRT += nips;
}
else
Print("ÿc1Error opening nip file : " + fileNameNip);
}
Print("TOTALS : " + nipsRT + " total, ÿc2" + passRT + " pass, ÿc1" + failRT + " fail");
if ((failRT > 0) || (parseResult != 0))
Print("ÿc1Check output files in /NTBot/item_configs/ directory");
}
function TLNC_WriteIt(f, l1, l2)
{
f.WriteLine(l1);
f.WriteLine(l2);
f.WriteLine(" ");
}
function TLNC_LoadItemAliases()
{
var arr, arr1;
arr = new Array();
arr1 = new Array();
for (k in _NTIPAliasType)
{
arr.push(k);
arr1["c" + _NTIPAliasType[k]] = k;
}
_TLAliases["t"] = arr;
_TLAliases["t1"] = arr1;
arr = new Array();
arr1 = new Array();
for (k in _NTIPAliasClassID)
{
arr.push(k);
arr1["c" + _NTIPAliasClassID[k]] = k;
}
_TLAliases["n"] = arr;
_TLAliases["n1"] = arr1;
arr = new Array();
arr1 = new Array();
for (k in _NTIPAliasClass)
{
arr.push(k);
arr1["c" + _NTIPAliasClass[k]] = k;
}
_TLAliases["c"] = arr;
_TLAliases["c1"] = arr1;
arr = new Array();
arr1 = new Array();
for (k in _NTIPAliasQuality)
{
arr.push(k);
arr1["c" + _NTIPAliasQuality[k]] = k;
}
_TLAliases["q"] = arr;
_TLAliases["q1"] = arr1;
arr = new Array();
arr1 = new Array();
for (k in _NTIPAliasFlag)
{
arr.push(k);
arr1["c" + _NTIPAliasFlag[k]] = k;
}
_TLAliases["f"] = arr;
_TLAliases["f1"] = arr1;
// #
arr = new Array();
arr1 = new Array();
for (k in _NTIPAliasStat)
{
arr.push(k);
arr1["c" + _NTIPAliasStat[k]] = k;
}
_TLAliases["s"] = arr;
_TLAliases["s1"] = arr1;
}
function NTIPParseLineInt_Fooed(input)
{
var i;
var _start, _end;
var _section, _keyword;
var _result;
const OPERATORS = "+-/*%&|^~";
_end = input.indexOf("//");
if(_end != -1)
input = input.substring(0, _end);
input = input.replace(/ |;/g, "").toLowerCase();
// dirty hack
input = input.replace(/\|{2}|\+|\-|\/{1}|\*|\%/g, "&&");
if(input.length < 5)
return null;
_result = input.split("#");
if(_result[0] && _result[0].length > 4)
{
_section = _result[0].split("[");
_result[0] = _section[0];
for(i = 1 ; i < _section.length ; i++)
{
_end = _section[i].indexOf("]") + 1;
switch(_section[i][0])
{
case 'f':
_result[0] += "(1";
_end += 2;
break;
case 't':
case 'n':
case 'c':
case 'q':
case 'l':
case 'p':
case 's':
_result[0] += "1";
break;
default:
break;
}
for(_start = _end ; _end < _section[i].length ; _end++)
if(!NTIPIsSyntaxInt(_section[i][_end]))
break;
_result[0] += "==";
for(_start = _end ; _end < _section[i].length ; _end++)
if(NTIPIsSyntaxInt(_section[i][_end]))
break;
_keyword = _section[i].substring(_start, _end);
if(isNaN(_keyword))
{
switch(_section[i][0])
{
case 'f':
_result[0] += "1)";
break;
case 't':
case 'n':
case 'c':
case 'q':
case 'l':
case 'p':
case 's':
_result[0] += "1";
break;
}
}
else
{
if(_section[i][0] == 'f')
_result[0] += "1)";
else
_result[0] += "1";
}
_result[0] += _section[i].substring(_end);
}
}
else
_result[0] = "";
if(_result[1] && _result[1].length > 4)
{
_section = _result[1].split("[");
_result[1] = _section[0];
for(i = 1 ; i < _section.length ; i++)
{
_end = _section[i].indexOf("]") + 1;
// dirty hack
if (_result[1].length > 0)
{
switch (_result[1].slice(_result[1].length - 1))
{
case "&":
case "(":
break;
default :
_result[1] += "&&";
break;
}
}
_result[1] += "1==1";
for(_start = _end ; _end < _section[i].length ; _end++)
if(!NTIPIsSyntaxInt(_section[i][_end]))
break;
for(_start = _end ; _end < _section[i].length ; _end++)
if(NTIPIsSyntaxInt(_section[i][_end]))
break;
_keyword = _section[i].substring(_start, _end);
_result[1] += _section[i].substring(_end);
}
}
else
_result[1] = "";
return _result;
}
/*
* Version History
* Last update 12-MAY-2010
*
* 2.0.0 FIX MAJOR - logical operations
* (all previous versions serisouly flawed)
*
* 1.0.3 FIX omitted keywords : p and s
* 1.0.2 FIX allow for either aliases or codes
* FIX Level keyword
* ADD sanity checks codes (if used) and logs the alias equivalent
* 1.0.1 ADD checks aliases are valid against libs/common/NTItemAlias.ntl file
* 1.0.0 initial release
*
* [email protected]
*/
Now after you have filled up your nipchecker.ntj file make sure you save it.Next go to your characterconfig file located D2NT31_NTBot42\D2NT\scripts\NTBot\char_configs\you r characters name and right before the rest of the boss files paste this line
NTConfig_Script.push("TLNipChecker.ntj"); NTConfig_CheckCodes = true;
Now whenever you want to run this nipchecker just make sure its uncommented and make sure all the other bosses are commented out (you want to run this one by itself) The output text files for this appear in your snagit directory and obviously you only want to run this initially and whenever you make modifications to the nip files.If anyone has any questions please post here and I can help you out to the best of my abilities.
Bookmarks