Thread:Jens Ingels/@comment-24416108-20141128155015/@comment-3271569-20141129161104

No problem, but the script is far from finished. Their is still a lot todo. In order to help you understand javascript I give you this suggestion:
 * 1) Open you console (chrome it's CTR+SHIFT+I in windows and go to the console tab)
 * 2) Visit a page like w:c:age-of-wonders-3:Humans

You maybe noticed I edit your template. I wrapped some spans & a div arround it for this reason This code above calls the location of the health from the unit. So if you can call the location you can also save this location: Now you saved the location you can basicly do everything you want with it: So if you can change the value whe can also make calculations with it: This also allows us to return the value (note: for the calculation I used one of the build-in javascript functions to make sure the value wasn't converted to a string): If you still don't see it. Go to the Chrome console and type the code below in the console while your on the w:c:age-of-wonders-3:Template:Human_Cavalry

____________

"If so, how can I refer to the calculated values in the templates?" Like I said again, you can't refer to the calculations in that template since their located server side.

What you can do however is send a url request with: http://age-of-wonders-3.wikia.com/wiki/Template:HealthCalc?action=raw

But than you will have to use regex to collect all data from that template ones you saved the url request into a variable. It's just better to remake the calculation in a function like I did here. Also these commands are heavy restricted & even if you can collect the data. The time to request it is just massive. Slow loading is not the purpose of JavaScript add all. If you still want todo it. Here are some answers for it. But that's only the request. In order to get all values properly for it you need to use the regex language. Really man, just don't try it. It's just overkill. I tried todo it some time ago with requesting riot api. And even than I found the process overkill.