Battledome auto 1p Battler

Discussion in 'Code Snippets and Tutorials' started by Shawn, Jan 28, 2010.

  1. Shawn

    Shawn Level IV

    Joined:
    Jul 15, 2009
    Messages:
    1,989
    Likes Received:
    76
    Location:
    Somewhere, lah.
    NOT MY CODE


    Code (Text):
    1. // ==UserScript==
    2. // @name           Neopets: Battledome auto-fights
    3. // @namespace      Steinn
    4. // @description    Automatically fights on battledome
    5. // @include        http://www.neopets.com/battledome/*
    6. // ==/UserScript==
    7.  
    8. function random(from, to)
    9. {
    10.     return Math.floor(Math.random() * (to-from)) + from;
    11. }
    12.  
    13. if(!GM_getValue("petname")) //Ask for set pet name case doesn�t exist
    14. {
    15.     var askpet = prompt("past you pet name here.\n iTs CasE SenSiTivE", "pet_example")
    16.     GM_setValue("petname", askpet)
    17. }
    18.  
    19. if(GM_getValue("finished")==undefined) // set function finish case doesn�t exist
    20. {
    21.     GM_setValue("finished", false)
    22. }
    23.  
    24. if(!GM_getValue("itens")) // ask for itens case doesn�t exist
    25. {
    26.     var askitems = prompt("how much itens do you wann use? \nINSERT ONLY 1 OR 2", "1")
    27.     if((askitems.value>2) || (askitems.length>1))
    28.     {
    29.         alert("please select only 1 or 2 items");
    30.     }
    31.     GM_setValue("itens", askitems);
    32. }
    33. if(GM_getValue("itens")==1)
    34. {
    35.     var item1 = "activate_equip(1);";
    36.     var item2 = "";
    37. }
    38. else
    39. {
    40.     var item1 = "activate_equip(1);";
    41.     var item2 = "activate_equip(2);";
    42. }
    43.  
    44. if(GM_getValue("finished"))
    45. {
    46.     GM_setValue("finished", false)
    47.     setTimeout(function(){location.href="http://www.neopets.com/battledome/battledome.phtml?type=oneplayer&subtype=challenge"}, random(4200, 4800))
    48. }
    49.  
    50. var ids = ["3","3","3","3"];
    51. var ids2 = ids[random(0, 3)];
    52.  
    53. if(location.href.match("subtype=challenge")) //if is page to select fight
    54. {
    55.     setTimeout(function(){location.href="http://www.neopets.com/battledome/process_battledome.phtml?petselect=" + GM_getValue('petname') + "&type=oneplayerchallenge&opponent_id=" + ids2;}, random(2200, 4100))
    56. }
    57.  
    58. if(location.href.match("fightid")) // if is fight
    59. {
    60.     if(lol1=document.getElementsByTagName("textarea")[0])
    61.     {
    62.         document.getElementsByTagName("center")[0].getElementsByTagName("select")[0].selectedIndex = 1; //select the item to attack
    63.         setTimeout(function(){ location.href="javascript:" + item1 + item2 + "SubmitFightForm();"}, random(2200, 4100)) // para form battle
    64.     }
    65.     var gettext = document.getElementsByTagName("center")[0].getElementsByTagName("b")[0];
    66.     if(gettext.innerHTML.match("You have won this fight!"))
    67.     {
    68.         setTimeout(function(){location.href="javascript: document.forms[1].submit();"}, random(2200, 4100)) // para ambos os forms next and back
    69.     }
    70.  
    71. }
    72.  
    73. if(location.href.match("battledome_fightend")) // fight finished
    74. {
    75.     GM_setValue("finished", true);
    76.     setTimeout(function(){location.href="javascript: document.forms[1].submit();"}, random(2200, 4100))
    77. }
    78.  

    This post is not to share the battler, but I want to ask, how do I change my stance for this? It always fierce attacks, I want to defend
     
  2. Cacklenub

    Cacklenub Level IV

    Joined:
    May 10, 2008
    Messages:
    1,345
    Likes Received:
    58
    Code (Text):
    1.       document.getElementsByTagName("center")[0].getElementsByTagName("select")[0].selectedIndex = 1; //select the item to attack
    See if changing the selectedIndex to 2,3,4,5 would change the stance. It is kind of a guess, though - wouldn't put all your eggs in this basket (I could be very wrong and make TNT suspicious.)
     
  3. ilovevicky

    ilovevicky Level II

    Joined:
    May 26, 2009
    Messages:
    248
    Likes Received:
    7
    I used one and got iced be careful with it, I was iced for using a program and i had used nothing else on that account :(
     
  4. Shawn

    Shawn Level IV

    Joined:
    Jul 15, 2009
    Messages:
    1,989
    Likes Received:
    76
    Location:
    Somewhere, lah.
    ooh scary.
    Ok anyway the 1p battler doesnt work well now that I've got more than 100 wins on a 1p opponent and it would take strategy
     
  5. Kaito

    Kaito Level IV

    Joined:
    Jun 29, 2007
    Messages:
    2,692
    Likes Received:
    15
    anyone able to use this code and make one? ^^
     
  6. Shawn

    Shawn Level IV

    Joined:
    Jul 15, 2009
    Messages:
    1,989
    Likes Received:
    76
    Location:
    Somewhere, lah.
    A 1p battler with strategy?
    wow