0

スクリプト自体は問題なく動作します。エラーなしです。しかし、7,500 回実行したうち、成功したのは 35 回だけでした。正規表現の成功率を改善するにはどうすればよいですか? 今のところ、それは仕事をしていないからです。

var IDs = [136758649, 116770724, 136171998]//A lot more IDS than this
var PriceWanting = 60
var scanneditems = 0
var itemerror = 0
document.write('<p id = "title">Total number bought: 0 items for a total of 0</p>')
document.write('<p id = "scanned">Items scanned: 0</p>')
document.write('<p id = "itemerrors">Items scanned: 0</p>')
var buys = 0
var totalrobuxspent = 0
console.log("Bot started")
var loop = setInterval(function()
{
  for (var i = 0;i<IDs.length;i++) {
  $.get(" http://m.roblox.com/items/" + IDs[i] + "/privatesales",function(data) {
      var Regex = /\<span class="currency-robux">([\d,]+)\<\/span\>/;
      var PriceSelling = data.match(Regex);
      scanneditems = scanneditems + 1
      document.getElementById("scanned").innerHTML = "Scanned items: " + scanneditems
      PriceSelling = PriceSelling ? PriceSelling[1] : '';
      if (PriceSelling.length < 1) {
        itemerrors = itemerrors + 1
        document.getElementById(''itemserror'').innerHTML = ''Total errors: '' + itemerrors
        return
      }
      PriceSelling = Number(PriceSelling.replace(",",""))
      PriceSelling = PriceSelling * 1
      totalrobuxspent = totalrobuxspent + PriceSelling
      var remaining = PriceWanting - PriceSelling
      if (remaining >= -0.1) 
      {
        buys = buys + 1
        document.getElementById("title").innerHTML = "Total number of items bought: " + buys + " for a total of " + totalrobuxspent + " "
var Regex2 = /<a href="\/Catalog\/VerifyTransfer\DuserAssetOptionId=([\d,]+)\Damp;expectedPrice=([\d,]+)">/
                                var HatBuyId = data.match(Regex2)[1]
                                var HatBuyLink = "http://m.roblox.com/Catalog/VerifyPurchase?assetid=" + HatBuyId + " &type=robux&expectedPrice=" + PriceSelling
var Explorer = document.createElement('iframe');
                                function Buy(){
       Explorer.contentDocument.forms[0].submit();
       console.log("Item purchase complete, scanning again.")
       var inf = document.createElement('div');
       inf.style.fontSize = "18px";
       inf.style.background = "rgba(0,0,5,0)";
       inf.style.position = "absolute";
       inf.style.width = "100%";
       inf.style.height = "18pt";
       inf.innerText = "Bot currently running. Purchases: "+answer;
       document.body.appendChild(inf);
                                };
                                Explorer.onload = Buy;
                                Explorer.width = "100%";
                                Explorer.height = "85%";
                                Explorer.src = HatBuyLink;
                                document.body.innerHTML = "";
                                document.body.appendChild(Explorer);
    }
  })
}
},500)
4

2 に答える 2

0

コードではセミコロンを使用してください。

continue;

関数ではなく、ループに適用できます。使用

return;

関数のコンテキストから抜け出すためのキーワード。

于 2014-02-23T00:57:47.460 に答える