Khanwars script

By booraz Last update Jun 29, 2010 — Installed 3,909 times.

Wonderfull script

in
Subscribe to Wonderfull script 4 posts, 2 voices



Minh Truong User
FirefoxWindows

Thanks author for the script.

I'm looking for the script for this game long long time ago and today I found your script.

I installed, tried it and I have some questions + suggestions for improvement this script:

Questions:
1. v.1.1b: Doesn't build 3rd building, if the player have VIP account => I don't know how to use this feature or it didn't work in my language as I can build 3rd building (Vietnamese game at http://deche.vn)
2. v.1.1
* Additional map table => I don't know how to use this feature
* Marches enlarger => I don't know how to use this feature
3. How can I use the feature which was descible in "script options" page?

Suggestions:
1. In the market page, we should have seperate "max" button for 4 kinds of goods. And if you can, please add more buttons: -1k, -2k, -4k, 1k, 2k, +4k for every goods.
Those buttons will round up/down to 1, 2 or 4k if the current goods in text field is not divisible/multible for 1, 2 or 4k (depend on the button will be clicked).
Ex: with the number 16123, if user click on
-1k, that number will be 16000
+1k, that number will be 17000
-2k, that number will be 16000
+2k, that number will be 18000
-4k, that number will be 16000
+4k, that number will be 20000
but if the number is 16000:
-2k, that number will be 14000
+2k, that number will be 18000
-4k, that number will be 12000
+4k, that number will be 20000
and so on.

2. Beside of the half of army user can select (ex: Max (140) Min (0) / (70)), I think we should have the carry weight for every army unit and total carry weight for all selected units according with the number of units has been selected. Ex: a light cavalry has carry weight 90, a quickwalker has carry weight 2. User select 1 quickwalker and 50 light cavalry so the total carry weight for them are 4502. At that time, the screen look like:

Quickwalker: Total (10) Selected (1) Max (10) Min (0) / (5) / Carry weight (2)
Light cavalry: Total (140) Selected (50) Max (140) Min (0) / (70) / Carry weight (4500)

Popular: 202 Carry weight: 4502

The reason for this request is we can know the total carry weight when we select the army units immediately instead of we must go to the next confirm page.

3. In the market page and the 2nd page of march page (/pohod.php), can we have a favorite castle list beside the "target coordinate" drop down field? User can enter that two lists in the "script options" popup look like (following this parttern: "Name x:y"):

Castle A 100:20
Enemy castle Z 110:23
....

4.Support multi languages (define string constants in the top of the source so users can edit the string values following their language).

We can discuss more if you need some clarifications.

Thanks in advance. Have a nice weekend.

 
booraz Script's Author
FirefoxWindows

Answers:
1. If you have VIP account, and in script option you selected to build auto building, then script build only two building, but you can with mouse click make third building.
2. When you go to map.php, there is additional button (lithuanian language only now) left bottom. In the image you can view this link: http://www.ipix.lt/images/90808205.jpg When you click on this button, you will see after the map additional actual map information.
3. I don't understand what are you talking about. Maybe you can explain more?

About suggestions:
1. It's possible, if I will have time i can try to make it. In the old script version for Khanwars 1.0, there was something like you wrote.
2. It's good idea. Perfect.
3. Also good idea.
4. It's necessary.

Thank you for your post.

 
Minh Truong User
FirefoxWindows

Hi there,

I made small modify in your script for showing marches info as below:

  function marchesInfo() {
    var n = document.getElementsByTagName('a');
    if (n.length>0) {
      for (var i=0;i<n>-1) {
          var m = n[i].href.split('%20');
          var str = 'Population: ' + m[11];
          var hasRes = (m[1] != 0 || m[3] != 0 || m[5] != 0 || m[8] != 0);
          if (hasRes)
             str = ' G: ' + m[1] + ', I: ' + m[3] + ', W: ' + m[5]+ ', M: ' + m[8];
          
          var brr = document.createTextNode(str);
          n[i].parentNode.appendChild(brr);
          
          if (!hasRes)
            n[i].parentNode.removeChild(n[i]);
        }
      }
    }

You will see new variable "str" for containing the text string. If the current actions are on the way going to (attackings) or on the way back to (transportings), we just only show the population "P: xxx" instead of showing 0, 0, 0, 0, xxx as you did; otherwise, we show the information button and the text "G: xxx, I: yyy, W: zzz, M: www"

About "3. How can I use the feature which was descible in "script options" page?", could you please show me (by using images) how to use "Auto build Building" feature? How can we determine the building number? And what we can do with the text area in the script options popup?

About "Additional map table", can you give me a picture for that table's content? In my page, I also saw that link as the same with your link in image but when I click mouse on it, it didn't work.

New question for you: why and what are the meanings for colors in market page?

Regards,
Minh Truong

 
Minh Truong User
FirefoxWindows

Hi author,

I updated your source for adding new feature: save and restore last march action for more conveniences. Please get my codes and update to your origin source. And if you can, please let users decide that they want to use this feature or not in the script options page.

  function optionEnlarger() {
    var obj = document.getElementsByTagName("select")[3];
    if (obj.id=='type') {
      obj.setAttribute("size",obj.getElementsByTagName("option").length);
      
      //restore last march action
      var lastMarchAction = getCookie('lastMarchAction');
      if (lastMarchAction) {
        obj.options[lastMarchAction].selected = true;
      }
      
      obj.setAttribute('onchange','setLastMarchAction();');
      embedFunction(setLastMarchAction);
    }
  }
  
  function setLastMarchAction() {
    var obj = document.getElementsByTagName("select")[3];
    if (obj.id=='type') {
      var i = 0;
      for(i = obj.options.length - 1; i >= 0; i--) {
        if(obj.options[i].selected)
          setCookie('lastMarchAction', i);
      } 
    }
  }

I found a small bug: when we don't have any transporter for transporting the goods, your script will throw an error to the browser (gold is null). Please check the variable gold is null or not before you continue to add new action scripts setResLikeGold and setResColor into gold, iron, wood and food object.

Thanks,
Minh Truong

PS: I formatted the source codes (a tab to 02 spaces) for easy reading. Sorry for this action.

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel