[Help] AutoBattledomer Greasemonkey script.

Discussion in 'Code Snippets and Tutorials' started by Jubixion, Jun 15, 2009.

Thread Status:
Not open for further replies.
  1. Jubixion

    Jubixion Level II

    Joined:
    Jun 11, 2009
    Messages:
    205
    Likes Received:
    14
    Ok I've managed to get a script that auto selects your pet and choose an opponent. When it goes into the battling page, it selects the weapons and choose an ability (eg. Fierce Attack). Now the problem I'm facing is clicking the "Go!" button.

    The button contains an onClick='SubmitFightForm()'.

    I've tried different methods of clicking the buttons like:
    Code (Text):
    1. if((link=document.evaluate("//a[contains(@onclick,'SubmitFightForm()')]",document,null,9,null).singleNodeValue)) {
    2.         unsafeWindow.SubmitFightForm()(parseInt((link.getAttribute('onclick').match(/\((\d+)\)/)||'1')[1]));
    3.     }
    and

    Code (Text):
    1. for(var i=0; i<button.length; i++) {
    2.      if(button[i].value = 'Go!') {
    3.           button.click();
    4.      }
    5. }
    Sure the codes click the button, but it also deselects both weapons that the script has selected previously, resulting in my pet using only an ability without weapons.

    Just for extra info, this is how I selected my two weapons.
    Code (Text):
    1. for(var j=0; j<select_weapon.length; j++) {
    2.         if(select_weapon[j].type = 'checkbox') {
    3.             document.location.href="javascript:activate_equip(2);";
    4.             document.location.href="javascript:activate_equip(3);";
    5.         }
    6.     }
    Any help will be appreciated :)
     
  2. Phee

    Phee Moderator
    Staff Member

    Joined:
    Aug 18, 2007
    Messages:
    6,206
    Likes Received:
    101
    Moved to programming chat; This is more NF.net site related issues only :)
     
  3. Jubixion

    Jubixion Level II

    Joined:
    Jun 11, 2009
    Messages:
    205
    Likes Received:
    14
    You can lock/close this thread. It's been solved already.

    Solution:
    Code (Text):
    1. document.location.href="javascript:SubmitFightForm();";
     
Thread Status:
Not open for further replies.