Thread:Sylvandyr/@comment-5033427-20130317121214/@comment-4830404-20130317162446

Hi there,

Unfortunately the Tiny Castle breeding rules will be extremely different from the Dragon Story rules (so you wouldn't be able to just adapt my calculator - your needs will be completely different). If you don't have any programmers on your staff, you will be hard pressed to keep the rules updated in the code as they inevitably change. You have to have a perfect sense of the exact way that the breeding rules work for the game, all the way down to the edge cases. Otherwise, some of the combinations will come out wrong.

Another challenge with embedding the calculator directly is that MediaWiki is a big pain when it comes to javascript. You've got to do a lot of voodoo to coax it, and it caches javascript in an annoying way so if you update the code, you won't be able to see the changes until the cache is purged. This usually takes a day (whenever people's individual browsers clear themselves) or you can hard-purge your cache manually, but this won't be purged for everyone.

One way to reduce cache purging requirements is to separate your data from your code and then read those variables with eval. Data is something like creature elements, creature breeding times, etc... This sort of information will be changed often as new creatures, elements, etc. are released. You can update these fast if you separate your data into a separate MediaWiki file, having your .js file read it via eval to inject it onto the page, and then perform ?action=purge on the data page and the calculator page.

For example, let's say I was adding a new dragon with already existing colors (no new rules required, thus no code changes required). I could edit my data page, then once done, add ?action=purge to the end of the data page link and press Enter to perform the action. I would repeat this also on the page that the calculator is on. Once done, I would instantly be able to see the new dragon in the calculator. Now, let's take a new release of a completely new color dragon that doesn't perform according to any previously-known rules. This one would require an editing of the code .js file instead, and the changes would not be seen until the cache is purged, so you could clear your cache yourself to check that the changes are correct, but everyone else would have to manually clear theirs or wait until their browsers did the daily clearing.

There are a lot of steps that you're going to have to perform to get the code working on a Wikia page via MediaWiki. MediaWiki does things that breaks code that works perfectly on a normal page. I can help you with these because I struggled through learning the quirks myself, but if you do not have someone who can write the heart of the code for you, then this is moot. HTML is not coding, wiki editing is not coding - you need to find someone who knows fundamentally how to really program stuff. If you find such a programmer, he/she will be able to pick up javascript easily even if he/she had never used it before. (I actually learned javascript to make the Dragon Story calculator).

If you don't know a programmer yet, don't fret - it's not like people are born programmers. Every good programmer is a self-taught one, and as long as you put it in your mind to learn the logic, you can totally do it. You don't need a university degree - just determination, time, and the ability to learn from mistakes.

Please let me know if there's anything I can do to help.