town selection error

Скрипт: Ikariam Automation
hello Danielv123 and thanks for your great script. it really helps

but for no reason started loosing the count of the cities.

i chose 8th city to send at 10 city. it sends from 8 to 9.
when i choose to send from 8 city to 11 , it sends from 8 to 10 etc ( one town before)

i did deleted reinstaled, cleared cache etc nothing worked!
hope you can find a solution!


  • Yes, unfortunately this is an issue which I am yet to solve. It will be offset by one if you are sending from a lower number to a higher, but fine if you are sending from a higher to a lower. I also believe there might be some problem with town number 12, but don't know about that.

    Unfortunately I don't think I have the time to fix it due to other projects and the fact that I no longer have an account for the game. If you do have a fix though, I would be happy to post it with proper attribution.

  • ok thanks
    i am not that good at coding, but i will give it a try.
    if i fix it even by luck i will leave a post here
  • отредактировано February 2018 Chrome

    Please check my second post here, which has the fix.

    I am able to fix this issue but I haven't done extensive testing yet. It's basically related to no. of towns listed in the dock gui. And it's less than the total no. of towns by 1 always.
    I just updated this condition in the script below the comment.

    // correct for the fact that the dock GUI does not show the currently selected town
                if(townNumber != 0){

    This seems to have fixed the issue. I have total 11 towns and I had issue with transporting stuff to 11th town. According to previous/original condition it wouldn't deduct the townNumber correctly for the 11th town. As the list item is clicked using array notation, where count starts from 0... It was looking for 10th list item instead of 9th. So, changing the condition townNumber > fromNumber to townNumber ! = 0 fixed the issue for me.

    Hope this helps. :smile:

  • Does this still work correctly for transporting between all the other towns? If you are able to confirm this, I will update the script :smiley:

  • Hi Daniel,
    I hope no one used the fix I posted above as it doesn't work properly.
    I noticed that the condition you had put is perfect but somehow it's doing string compare when it's more than single digit number.
    So, I used parseInt function to force integer compare and it appears to be working perfectly now :)

    // correct for the fact that the dock GUI does not show the currently selected town
                if(parseInt(townNumber) > parseInt(fromTownNumber)){
  • отредактировано February 2018 Chrome

    Didn't add the first thing as it seemed wrong to me, but this last piece of code makes perfect sense! Should also tell you that the normal way to convert to numbers in JS is with Number("11")

    I updated the script, see version 1.2.2

  • thank you WizKrafts for the fix/update
    works fine

Войдите или Зарегистрируйтесь чтобы комментировать.