Question Nuke script trouble

Discussion in 'Scripts & Independent Tools' started by Sventevith, Nov 29, 2017.

Share This Page

  1. Sventevith

    Sventevith New Member

    Joined:
    May 29, 2017
    Messages:
    4
    Likes Received:
    0
    Anyone else have this issue. I'm in the process of turning this nuke script into a support script. The script seems to fail at inserting total number of heavy cav into the rally point and gives you 1000000 units instead of all.

    javascript:var Tsalkapone_coords='PUT CO ORDS HERE';var snob=0;var spy=0; var ram=0;var catapult=0; var light=0; var heavy=1e6; var marcher=0;var axe=0;var spear=1e6; var archer=0; var sword=0; var Tsalkapone_script_title='Support';var Tsalkapone_cookieID='Support1';$.getScript('https://dl.dropboxusercontent.com/s/uqon51aliz193wm/Tsalkapone.Nuke_Support_script_ek.js');void 0;
     

    Attached Files:

  2. Ibra Gonza II

    Ibra Gonza II Non-stop Poster

    Joined:
    Dec 12, 2015
    Messages:
    171
    Likes Received:
    56
    Of course it does, you are entering var heavy = 1e6 which equals one million.

    If you want to insert all units (of HC) you can use this:
    Code:
    $("#unit_input_heavy").attr('data-all-count');
    Which will find the input of the heavy cav, get it's all-count attribute (an attribute that contains the maximum troops you can insert for this field). You can then just insert the value this returns into that box.
     
  3. Sventevith

    Sventevith New Member

    Joined:
    May 29, 2017
    Messages:
    4
    Likes Received:
    0
    Gave it a try. No luck. What i don't understand is why var " " = 1e6 works with all the other units except heavy cav.
     
  4. Ibra Gonza II

    Ibra Gonza II Non-stop Poster

    Joined:
    Dec 12, 2015
    Messages:
    171
    Likes Received:
    56
    That's weird indeed, but still bad practice :p
    Just replace it with
    var heavy=$("#unit_input_heavy").attr('data-all-count');

    And that should work
     
    Sventevith likes this.
  5. Sventevith

    Sventevith New Member

    Joined:
    May 29, 2017
    Messages:
    4
    Likes Received:
    0
    Thank you very much. :D
    Im not much into scripting. but i tinker here and there to learn how things work.
     
  6. Ibra Gonza II

    Ibra Gonza II Non-stop Poster

    Joined:
    Dec 12, 2015
    Messages:
    171
    Likes Received:
    56
    You're welcome. That's the best way to learn it :)