this is a java scripts (.js) i'm planning to make .xpi extension for firefox to autohaggle right now, i'm having problem with MATHS~! lol...the extension work, but it haggled at higher price, you see if the item cost 1200, it will 1292 or something like that. Is there a way for me, to use the %feature, like 95% of the X (shop keeper's offer)? Spoiler // ==UserScript== // @name AutoHaggle // @description Auto Haggles On Neopets // @include http://*.neopets.*/haggle.phtml* // @include http://neopets.*/haggle.phtml* // ==/UserScript== function GetBetween(zStr, zStart, zEnd){ var zStr = zStr; var zStart = zStart; var zEnd = zEnd; var z1 = zStr.indexOf(zStart); var z2 = zStr.indexOf(zEnd, z1); if(z2 > z1 && z1 > -1){ return zStr.substring(z1 + zStart.length,z2); }else{ return ""; } } function SmartHaggle(priceth){ var pricelength = priceth.length; var returnval = priceth.charAt(0) + priceth.charAt(1); for (i = 2; i < pricelength; i++) { returnval = returnval + priceth.charAt( Math.round(Math.random()) ); } return returnval; } var URL = window.location.href; URL = URL.toLowerCase(); if(URL.indexOf("neopets.") > 0){ var DOMAIN = "neopets"; } if(DOMAIN == "neopets"){ var strHTML = document.body.innerHTML; if(strHTML.indexOf("I want at least ") > 1){ var haggle = GetBetween(strHTML,"<b>The Shopkeeper says 'I want at least "," Neopoints for this great item.'"); document.getElementsByName("current_offer")[0].value = SmartHaggle(haggle.replace(",","")); }else if(strHTML.indexOf("I wont take less than ") > 1){ var haggle = GetBetween(strHTML,"<b>The Shopkeeper says 'I wont take less than "," Neopoints for it.'"); document.getElementsByName("current_offer")[0].value = SmartHaggle(haggle.replace(",","")); }
Don't make legit RSing even harder. But, use the first two numbers repeated, (NO idea how to code but ill give some examples) Stocks 5000 = Haggles 5050 Stocks 10000 = Haggles 10101 Stocks 154323 = Haggles 151515 ALSO looks a MILLION times more legit, as thats what us legit people use
Code (Text): function autoHaggle(original_price) { var new_price = ''; var alternate = false; while (new_price.length < original_price.toString().length) { new_price+= original_price.toString().charAt(alternate ? 1 : 0); } return new_price; } Exactly what SoC said. If you have any question just ask
thanks alot... i managed to make it. hehe... now i'm just have to test it out... its not greasemonkey script i'm making. its FF extension... i believe it would be faster in recognising the page and so on
I don't get how this works.. alternate is always false so isn't it always going to be the chartAt(0) ? :s maybe I'm just missing something obvious :lol:
Whoops, forgot a line. Code (Text): function autoHaggle(original_price) { var new_price = ''; var alternate = false; while (new_price.length < original_price.toString().length) { new_price+= original_price.toString().charAt(alternate ? 1 : 0); alternate = !alternate; } return new_price; }
i got, this firefox extension. which auto hanggle for you. it seem to work... should i contribute it to the site?
I don't think so, unless you get permission from the author. I think its technically copyrighted. So unless its explicitly released under the GPL or some other copyleft license, you shouldn't re-distribute it w/o permission.
well, what i meant, was i made it myself, with a bunch of friends. i compressed as .xpi files so it can be install as firefox add-on
let me know how it goes. Would u like me to help. Can I import the above script onto greasmonkey to test?
well, i changed a bit on the script. that's just a part of the calculation, using the first 2 number to haggle. 1299 NPs, would haggle 1212 or 1222 or 1211
I tried to load the original script that you posted on here onto greasmonkey but it didnt work.. if you want you can message me the script to test for you. If not I hope your script makes it on to the download section soon. especially for the magic shop