var today = new Date(); var pathtobe = "logs/" +"_"+ me.name +"_chickenlog.xml"; //print("ÿc1agor chickenlogger loaded"); // Creating of the chickenlog.xml file whenever a Character joins a game function CheckLog() { // Check if file already exists if(!FileTools.exists(pathtobe)) FileTools.writeText(pathtobe, '\n\n\n' ); } // Writes chickens to chickenlog.xml via E4X // http://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Processing_XML_with_E4X // chicken = chicken Object function writeLog( me) { if(!chicken || !NT_logchickens) return true; var templine = ""; var content = ""; var time_now = new Date(); var timestring = time_now.toLocaleFormat("%a %m/%d/%y %H:%M"); //+++++++ start replace() +++++++++ // Replaces new lines with spaces var chickenname = chicken.fname.replace(/\n/g, " "); chickenname = chickenname.replace('\02/g', ""); // Adds a unique identifier to each chicken var chickenid = time_now.getTime(); var chickendesc = chicken.description.replace(/ÿc(.)/g, ""); chickendesc = chickendesc.replace(/\n/g, '|'); WriteSqlchickenlog(chicken,_mode,"file "+obj.file+" line "+obj.lineno) //chickendesc = ""; // Adds the tag into XML content =''+chickendesc+''; // //chickenlog.chicken +={chickendesc}; var filehandle = File.open(pathtobe, 2); // Skips XML header lines because they cause errors when creating the E4X object var linecount = 0; while(!filehandle.eof) { templine = filehandle.readLine(); if(!(templine == "" || templine == "" || templine == "" || templine == "")) { linecount++ if (linecount == NT_LoggingMaxLines) break; content += templine; } } filehandle.close(); content=''+content+''; var chickenlog = new XML(content); // Creates a Time String // Format: http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html // Creation of the file output, headers first and then the chickenlog content FileTools.writeText(pathtobe, '\n\n' + chickenlog.toXMLString()); return true; } function WriteSqlchickenlog(chicken,mode,nipline){ var db = new SQLite('inventories.sqlite') try{ db.execute('CREATE TABLE IF NOT EXISTS "main"."chickenlog" (' + '"KeyOwner" TEXT,' + '"TimeStamp" TEXT,' +'"FoundIn" TEXT,' +'"Kept" TEXT,' +'"NipLine" TEXT,' +'"name" TEXT,' +'"x" TEXT,' +'"y" TEXT,' + '"type" TEXT,' +'"classId" TEXT,' + '"mode" TEXT,' +'"act" TEXT,' + '"gid" TEXT,' + '"area" TEXT,' + '"hp" TEXT,' +'"mp" TEXT,' +'"hpMax" TEXT,' +'"mpMax" TEXT,' +'"stamina" TEXT,' + '"staminamax" TEXT,' +'"charlvl" TEXT,' +'"chickencount" TEXT,' +'"owner" TEXT,' + '"ownertype" TEXT,' +'"spectype" TEXT,' +'"direction" TEXT,' +'"uniqueid" TEXT,' + '"code" TEXT,' +'"prefix" TEXT,' +'"suffix" TEXT,' +'"prefixnum" TEXT,' +'"suffixnum" TEXT,' + '"fname" TEXT,' +'"quality" TEXT,' +'"node" TEXT,' +'"location" TEXT,' +'"sizex" TEXT,' +'"sizey" TEXT,' + '"chickenType" TEXT,' +'"description" TEXT,' + '"descrip" TEXT,' + '"bodylocation" TEXT,' +'"ilvl" TEXT,' +'"lvlreq" TEXT,' + '"runwalk" TEXT,' +'"weaponswitch" TEXT,' + '"objtype" TEXT,' + '"islocked" TEXT,' +'"screenX" TEXT,' +'"screenY" TEXT );'); } catch(error){ } var dis2 ="" var classid =""; var dmg ="" var soc ="" var def =""; var eth ="" var screenPT = [0,0]; var key = me.name +"@"+me.account; var area = "" for(var j = 0; j