GuildWiki has been locked down: anonymous editing and account creation are disabled. Current registered users are unaffected. Leave any comments on the Community Portal.

Hello there! We are conducting a survey to better understand the user experience in making a first edit. If you have ever made an edit on Gamepedia, please fill out the survey. Thank you!

Forum:Coding

From GuildWiki
Jump to: navigation, search

Welcome to the Coding forum[edit source]

This forum is dedicated to discussing matters of template and bot coding. These matters are now distributed across various talk pages, and it is hard to later find these gems of information. So how should we use this forum?

  • put it on the watchlist (duh)
  • post questions
  • post answers
  • post links to questions and answers elsewhere, new or old
  • post announcements and links to these
  • post requests for help with (debugging) templates or bots
  • anything else related to templates and bots

Watchlist[edit source]

This forum won't fly if people aren't watching it. Please sign here (using three tildes, ~~~ ) to indicate you do.

Useful links[edit source]

MediaWiki features[edit source]

AutoWikiBrowser[edit source]

Perlwikipedia[edit source]

You need a C (?) compiler and the utility make to get Perliwikipedia to run. These come free with MinGW or cygwin (see below).

pywikipedia[edit source]

User:Dantman has a fork of it, and some adapations linked on the userpage.

GNU tools for Windows[edit source]

The GNU tools are a suite of powerful tools used by programmers around the world for decades. They have originally been written for a Unix-like operating system, but most of them have been "translated" to windows, usually from the same sources.

  • MinGW, a collection of tools for compiling C/C++ programs, including `make`, `gcc`, etc.
  • CygWin, a huge collection of GNU tools (the closest you can come to running GNU/Linux on Windows); includes Perl.
  • GnuWin32, a collection of useful tools that can be used separately. GnuWin32 doesn't include the gcc compiler, so you need to find a port of that elsewhere (e.g. in MingW).
  • gawk, a port of `awk`, is the tool mendel likes to use for quick automated text processing tasks.

Feel free to add more useful links.

Interwiki Transclusion[edit source]

See User:KyleH. Since when is that possible? --mendel 01:39, 12 June 2008 (UTC)

Been a while, obviously. See w:Shared_templates. --mendel 12:36, 12 June 2008 (UTC)

Skill Bar and other stuff[edit source]

  1. There is a workaround for #ifexist. Let's say article "redlink" doesn't exist. Then {{redlink}} is #ifeq to [[:Template:redlink]]. Of course this costs a lot when "redlink" does in fact exist. However, it ought to work well on images as they typically have short articles if any. So {{#ifeq {{Image:someimage.jpg}}|[[:Image:someimage.jpg]]|it does not exist|it exists}}.
  2. In finding that out, it helped that one can add action=raw&templates=expand&ctype=text/css to an URL to see the un-htmlized version of a page after template expansion. Are Mediawiki URL additions and options (liek action=raw and ctype) documented anywhere?
  3. Why did PanSola make Template:Skill_bar/doc when there is, in fact, no documentation on that page? Can anyone propose a simple way to find those templates that have no docs? including those that have a /doc with nothing on it? not even a stub tag or something? Hmm, probably comes down to parsing pages_current again.
  4. Is {{Skill bar}} used for user skills at all, or is it only supposed to be used for existing skills? #ifexist:Image:{{{1}}}.jpg is not likely to work for any parameter outside mainspace, and in fact there is no article that starts with Image:User: . So the technique to get the correct image that I used in {{Skill list item}} could be ported to {{Skill bar box}}, and that would avoid the #ifexist entirely.
  5. We could then have skill bars for monsters and totally, like, not use {{Skillset}}.

--◄mendel► 14:35, 25 June 2008 (UTC)

  1. Two errors in the code example you posted (that you are probably aware of anyway): first, you have to have a colon after #ifeq (#ifeq:); second, the first word of the image name will be titlecased by MediaWiki, so the second part of the comparison needs to reflect that ([[:Image:Someimage.jpg]]). So: {{#ifeq: {{Image:someimage.jpg}}|[[:Image:Someimage.jpg]]|it does not exist|it exists}}.
  2. mediawikiwiki:Manual:Parameters_to_index.php
  3. Maybe he was planning on documenting it later, and "later" never came? I don't know how to easily find undocumented templates.
  4. I'm pretty sure Skill bar is only used for existing skills, and removing the #ifexist: from Skill bar box would completely empty Category:Pages with too many expensive parser function calls.
  5. I'd be for that, although we'd still need a separate template because monsters rarely need a full 8-skill bar, while the userpages that use it do expect a full 8-skill bar (a lot of them have "Optional"s in the middle of the bar). This "Monster skill bar" would only need a simple modification: each line that calls a Skill bar box would be wrapped with an #if:, like {{#if: {{{1|}}} | {{Skill bar box|{{{1|optional}}}}} }}. —Dr Ishmael Diablo the chicken.gif 04:23, 27 June 2008 (UTC)
1. Hah! That's how you know I didn't copy and paste that code snippet!
4. Let's just remove the #ifexist then!
5. We could call that Template:Skillbar (and it wouldn't have |optional in it) (Yay for 7 closing braces!).It might be necessary to put a single {{trim}} around all the #ifexist so that a stack of nonexistant boxes at the end doesn't add too many spaces to the last table cell. You can then express Template:Skill bar as {{Skillbar|{{{1|optional}}}|{{{2|optional}}}|...|{{{8|optional}}} }} if it ever becomes necessary.
Actually, see User:M.mendel/Templates/Skillbar, User:M.mendel/Templates/Skillbar2 and User:M.mendel/Templates/Skill bar box.
I could write short articles on "Optional" (possibly redirect to "optional skill" and write that) and "generic resurrect". The cheapest fix to the missing monster skill icons is to do image redirects for them, going from Monster skill.
To fix the way Skillbar2 looks now, there are two options: a) undelete Template:Optional and write Template:empty and Template:Generic resurrect, or revert my Skill bar box to what it was before and use the image redirects for the monster skills. --◄mendel► 10:32, 27 June 2008 (UTC)

Color[edit source]

There is a template called {{Color}}. It is deprecated. Instead we have now W-color, R-color etc. LordBiro once advocated doing that with CSS (and apparently that still works) - I would advocate that for pretty much the same reason. It causes no extra server headaches, and needs just a browser that can cope.

For template colors it seems to make sense to me to use templates without parameters, i.e. {{Color light warrior}}, {{light color warrior}} or even {{light warrior color}}. The first version sorts better, the last reads better. These templates would just return the color code, i.e. they'd be extremely short and contain no parser function at all. We have 11 colors, in light, dark, possibly "border" and "background", and the new pale. The professions exist abbreviated and written out. (Whoever thought up these abbreviations ought to be stoned, why can't I just substring the first 2 letters? Argh!)

I am bringing this up because I want to experiment with a set of "pale" background colors, and I need to make templates for them. Unless we change site CSS. (Well, I guess I could experiment with personal CSS and change site CSS later...) And of course I need to use the long versions for input... :-( --◄mendel► 01:22, 30 June 2008 (UTC)

Skill box damage output Template[edit source]

Ok, I need your advice here. I'm currently trying to clean up the Area of effect skills quick reference page. In this page the Template:Skill box damage output is used. However, the 'damage' column isn't needed here and all mentioned skill (-templates) don't have 'damage' filled in, so it will result in a list full of {{{damage}}} tags. My take on this is that there will be 3 options:

  1. Drop use of this template, write your own table
  2. Copy existing template to new template, take damage column out (and maybe alter notes column too)
  3. Adjust existing template and insert clever trick to 'hide' damage column if needed

What would you think ? What is common here, in such situations ? -- Merty sign.gif-- ( talk ) 11:59, 3 July 2008 (UTC)

As a quick fix, I made the tags disappear when there is no damage. Is there anything that should be listed for these skills instead? --◄mendel► 12:43, 3 July 2008 (UTC)
Hey thanks Mendel, thats quick ! As far as I can see, I cannot think of anything that should be listed instead. Now we have an empty 'damage' column and 'note'. Ah well, at least its a start..ty :) -- Merty sign.gif-- ( talk ) 09:37, 7 July 2008 (UTC)

Dialogue CSS[edit source]

I would like to propose some CSS for Mediawiki:Common.css to easier format cutscene and other dialogues.

 div.dialogue p { text-indent:-4em; margin-left:4em; font-weight:bold; }
 div.dialogue p i { font-weight:normal; }

See User_talk:Quizzical#Cutscene_formatting for the intended effect.

Quotation marks could be added with these two lines (if there's no bug):

 div.dialogue p i:before { content:"\201C" }
 div.dialogue p i:after { content:"\201D" }

--◄mendel► 21:37, 7 July 2008 (UTC)

I tested these lines on my global.css and they work (the quotes, too). --◄mendel► 13:22, 8 July 2008 (UTC)

Why does this work?[edit source]

Q: Hey, I'm sort of teaching myself the different coding languages (got hung up on javascripting, bleh), and I was wondering why the code for the div class dialogue works. The code is, as follows:

div.dialogue p { text-indent:-4em; margin-left:4em; font-weight:bold; }
div.dialogue p i { font-weight:normal; }

The answer I got to was that because of the javascript that already exists, each page is written in a way that the javascript sees the apostrophe and decides to write a paragraph style, either "p", "p i", or some other third "p" type for normal text. As I said before, I don't know how to code so I can't check the javascript file and see if I'm right or not. If you could enlighten me, it'd be greatly appreciated but, by all means, don't feel obligated. Powersurge360 18:47, 13 August 2008 (UTC)

A: This has absolutely nothing to do with Javascript; it should work just as well when you turn Javascript off. (Well, on NN4.7 turning JS off also disabled CSS, but that was years ago in a galaxy far, far away). The CSS comes into effect after the wiki has converted the wikicode to HTML. The wiki converts regular text to paragraphs (<p>this is a paragraph</p>) and apostrophes to italics tags (<i>this is italic text</i>). You can see this if you view the page source with your browser (provided you can find the text, you might want to use action=render to get rid of the wiki skin code ; see above on how to use that).

Wikicode HTML appearance
<div class=dialogue>
Speaker: ''I am talking.''
</div>
<div class=dialogue>
<p>Speaker: <i>I am talking.</i></p>
</div>

Speaker: I am talking.

Now stylesheets (CSS) work by selecting a type of tag and specifying how content in that tag should be formatted. You can either put the format in the style="" attribute in the tag itself; or you can put it at the top of the HTML file; or you can import it at the top of the page file from another file. If you put

p { color: red; }

at the top of your HTML page or in a .css (like [[w:Special:MyPage/global.css]]), all <p> text (all paragraphs) in the HTML that includes this style will be red. Headings won't be affected, because they aren't inside <p> tags, they use <h1>, <h2> etc.

We need to select more specific paragraphs, though.

div.dialogue p { text-indent:-4em; margin-left:4em; font-weight:bold; }

means we select all <p> tags that are directly inside a <div> tag; and not just any <div> tag, but it has to have class=dialogue. This means any paragraph text inside the <div class=dialogue> is indented and bold.

Now one final adjustment is necessary: the text in italics should not be bold. Therefore, we use

div.dialogue p i { font-weight:normal; }

to select text that is inside <i> tags inside <p> tags inside a <div> with class=dialogue, and only that text is made to be not bold, but normal.

All this is being done by your CSS-compatible browser without any Javascript at all. --◄mendel► 19:18, 13 August 2008 (UTC)

Ok, so I didn't do too badly, I understood most of why it worked, but didn't quite get how the wikicode became HTML mark-up (assuming it was javascript as opposed to whatever it actually is). Thanks for moving/explaining it. Powersurge360 19:21, 13 August 2008 (UTC)
Javascript can put additional HTML text on a page after the wiki has sent it to your browser (the nav boxes that show/hide work that way), but that's not the case here. --◄mendel► 19:28, 13 August 2008 (UTC)

Naming Convention for Templates[edit source]

Do we have one? "BeastInfo", "QuestItem", "Skill box", "Effext box", "Shield begin info", "Quest-stub", "Unique-item-stub", "Location info", "CollectableCategory", "ElonianMissionProgression", "MonumentsNavBox". Guess we don't. --◄mendel► 05:35, 8 July 2008 (UTC)

Category list for AWB[edit source]

As long as making a category list from within AWB doesn't work, you can use Special:Export to create a category list. Enter the category name into the top box, click "Add", copy the contents of the big edit box to a text file, and let AWb make a list from that.

For deprecated methods of generating a category list by scripting, see here in the page history.

AWB is now able to create lists from categories. Not sure if it was the new release of AWB 4.4.0.0 or Wikia's upgrade to MediaWiki 1.13, but at least it works. —Dr Ishmael Diablo the chicken.gif 02:06, 20 September 2008 (UTC)

Mini Database Dump[edit source]

The Database dumps are quite big - editing a 250MB with a text editor is a daunting task. You can make a miniature database dump that contains just one page with Special:Export. Just enter the page name into the big box and click "Export". ("Save as file" doesn't work for me, though.) The XML file you get has exactly the same structure as our big database dumps. ◄mendel►

{{#expr:2^2}}[edit source]

...makes four. Right? Well, it should. Apparently our version of MediaWiki doesn't have support to do exponentials. Is there perhaps some alternative workaround I could use in the meantime? Calculating a power manually is quite messy...

If a^(b(x)):

  1. I evaluate b(x) (=c)
  2. Truncate the value (=d)
  3. Multiply a by itself d times
  4. Take the remainder after truncation by subtracting d from c (=e)
  5. Output to the user that they must manually multiply a by itself e times to finish the calculation

...and I'm trying to make a damage calculation template, so after that the user would then need to multiply by the Raw Damage. That is too much work for the user, I think.

Maybe I should just go bug Kyle instead. Entropy Sig.jpg (T/C) 06:56, 8 September 2008 (UTC)

Ok, I've done some digging. Meta documents powers (and logarithms and whatnot) since May 10th, albeit not on the m:Help:ParserFunctions page. They seem to be running ParserFunctions (Version 1.1.1), same as we. Ofcourse they're running MW 1.14a , and it seems that the calculations are somewhat dependent on the server OS as well. I'd wait until we get MW1.13 and file it as bug report then. ;-) (But since the database has just been locked, who knows? we may already have that.)
2^7=128
--◄mendel► 11:32, 8 September 2008 (UTC)
So close to achieving the ultimate dream of GuildWiki coders... :\ Other than this obstacle, I think User:Entropy/dcal should be ready for deployment soon. I wonder why it seemed so difficult before, it's really quite a simple thing to do if you put the data-gathering as the user's duty. To make it really really cool I would need to put in a whole listing of every damage source at the same, and a way to query its raw damage at a specified rank...etc. Lots of possible automation that I could add but it would make the template grow exponentially. (Pune.)
Random idea...I wonder if we could use an outside site to do the math? I know there is some template somewhere which puts out calls to an outside site for...timezone differences or something. Entropy Sig.jpg (T/C) 14:42, 8 September 2008 (UTC)
Yeah, Template:TZ. <- Check it out. Then we would do http://WEBSITE_THAT_DOES_MATH_BASED_ON_URL_IMPUT.com?math=2^{{{expression}}} or such.
Actually, if someone had their own website, it would probably be a lot easier to make a template that calls out everything to there and then the website returns the data to the template for display. I am sure it would be easier to code this without the restrictions of MediaWiki. Less drain on system resources also. Entropy Sig.jpg (T/C) 14:50, 8 September 2008 (UTC)
The way that would work is to make it site Javascript and link to it from the sidebar. I envision someone clicking on a "damage calculator" sidebar link, then a small window pops up that lets you do the calculations.
Good default values are "12" for attributes, "60" for armor, and "20" for a level. That makes casters do 60 damage with no mods, (hope that's right - I am too lazy to check), so that'd be a good damage default for average weapons as well. --◄mendel► 17:06, 8 September 2008 (UTC)
Well I don't know how to write .JS unfortunately. I could do it in Visual :P Those are good default values, I was tired. Entropy Sig.jpg (T/C) 23:49, 8 September 2008 (UTC)
Yay, it works now! Entropy gogogo! --◄mendel► 15:09, 10 September 2008 (UTC)
Cheers \o/\o/\o/ Once I'm done you can help me make it into a sidebar link or Monaco widget through .JS ! Entropy Sig.jpg (T/C) 21:23, 10 September 2008 (UTC)
Damage template is done now. Moving to mainspace at Template:Damage. If someone can convert it into a cool .JS thing that would be awesome...maybe we can have our own damage calculator page. Entropy Sig.jpg (T/C) 23:02, 10 September 2008 (UTC)

PAGESIZE not working[edit source]

(Reset indent) The thing that does not yet work is 0, which works everywhere but our wiki (I tried central wikia and wowwiki), and the cause may be that I had created a template of that name - it's been deleted today, so I hope the server script run that gives us the wantedpages etc. fixes that. If not, somebody's got to totally wipe the page from the database. --◄mendel► 21:26, 10 September 2008 (UTC)

I don't see how that is totally relevant but ok. sizeof() is a fun and useful function, but what would you do with it on Wikis? Entropy Sig.jpg (T/C) 21:34, 10 September 2008 (UTC)
Well, sizeof() does soemthing totally different in C, but anyhow.... what I want to do is tally up the size of Warwick's talkpage archives, and maybe automate that so we can compute some editcount/talkpage ratio for other users as well. More of a pastime, really. --◄mendel► 23:08, 10 September 2008 (UTC)
Right, so the talkpage is X Kb, you use sizeof() to find the size in bytes of each talkpage, which is part of the Warwick's archives array. foreach(archive in warwick_archives){ sizeof(archive) } ... Anyway can't you just take the contents of the archive, stick it to MSWord, and use Word Count? I understand that you want to do it automated, but...meh. I think it's strange how there isn't already a MediaWiki function for this, since obviously the software has the capability to count page size. Else it couldn't give those messages at 32kb about archiving. Entropy Sig.jpg (T/C) 23:24, 10 September 2008 (UTC)
Entropy, the MediaWiki Parserfunction that does this is called PAGESIZE, it is new with version 1.13, and it works on all Wikia wikis I've tested except ours. Do you want to copy & paste 49 pages, some quite huge, into a MSWORD document? I tried two approaches doing Wikitemplates, but ran into the processing limits imposed by the server because WarWick's archives are just too darn huge - and from those attempts stems the template that blocks the MediaWiki PAGESIZE from working, if my guess is right. Once it works, the oldest revision of User:Warwick/Archive size‎ just needs to have an #expr added that sums it all up. --◄mendel► 23:39, 10 September 2008 (UTC)
"I think it's strange how there isn't already a MediaWiki function for this" before MediaWiki 1.13. I understand that you may be frustrated but why take it out on the ignorant? :\ Entropy Sig.jpg (T/C) 23:41, 10 September 2008 (UTC)
I've reported the issue, seems today I find a lot of wikis with the problem when yesterday there wasn't one. --◄mendel► 10:33, 11 September 2008 (UTC)

JS for redirect=no[edit source]

I'd find a piece of JS useful that adds "?redirect=no" to all URLs on a page that don't have a question mark in them, and mayve "&redirect=no" to the URLs that do. It could be called via an extra tab. This would enable me to go to skill icon page from a skill page without triggering the redirect and attendant page load first. --◄mendel► 10:35, 13 September 2008 (UTC)

Minorly related question, but what is the difference between a "?function" and a "&function" call? I am also wondering if it would be more practical to instead make a piece of .JS that simply disables all redirects for you while it is on (so that you don't need to append URLs). Entropy Sig.jpg (T/C) 18:41, 13 September 2008 (UTC)
In a URL, the "?" signifies the beginning of parameters that are not part of the actual URL. The "&" is used between parameters if you have more than one. What Mendel's saying here is that for links that don't have parameters yet, the function would need to add "?redirect=no", and for those that do have parameters (that already have a "?" in the URL string), it needs to append this parameter to the existing set of parameters, as "&redirect=no" (so the full parameter list would be something like "?action=edit&redirect=no"). —Dr Ishmael Diablo the chicken.gif 18:57, 13 September 2008 (UTC)
Thank you, doctor. Remains for me to clarify that the redirects are done by the server without knowledge of the browser, so you cannot actually use JavaScript to control the server directly. What you can control is the page URL for the next page, because that is sent by the browser software and can be rewritten by the Javascript before it is sent (i.e. before you click on that link). What I take you to mean is to make it a toggle, so you would not have to click it for each page, but you'd turn them off once, and they'd stay off until you turned them on again. Clever! --◄mendel► 21:35, 13 September 2008 (UTC)

the following was copied from Entropy's user talk


The {{PAGENAME}} magic word (no need for template) is part of the new MediaWiki parser engine - it was released alongside the old engine in 1.12. Wikia hasn't forced anyone to switch to the new engine yet, although individual wikis can request it if they want it, but they are going to roll it out to everyone in the near future. There's a page Special:ParserDiffTest where you can compare the way a page is rendered with the old and new engines (the biggest difference I've seen is that the new engine adds a "class='mw-redirect'" attribute to all links that link to redirect pages, could be useful if we ever wanted to trim our use of internal redirects). —Dr Ishmael Diablo the chicken.gif 22:52, 24 September 2008 (UTC)
Hey, could that be used for Forum:Coding#JS for redirect=no?? Also, we have 1.13 now iirc, and I was talking about the magic word/template thing which gives a page's size in bytes, not return the URL or whatever. Entropy Sig.jpg (T/C) 22:59, 24 September 2008 (UTC)
Right, Wikia is now on 1.13, I was saying that the new engine was first released in 1.12. And I meant {{PAGESIZE}}, dunno why I typed "NAME". >.>
{{PAGENAME}} only refers to the name of the current page, so it wouldn't be of any use in creating "?redirect=no" links from a page. —Dr Ishmael Diablo the chicken.gif 23:05, 24 September 2008 (UTC)
I was talking of the class='mw-redirect' . Entropy Sig.jpg (T/C) 23:08, 24 September 2008 (UTC)
Ohhhhh... I see. Yes, that would work. There's a JS function getElementsByClassName whereby you could get all links that had class='mw-redirect' and rewrite them to include [?&]redirect=no. Brilliant! —Dr Ishmael Diablo the chicken.gif 23:25, 24 September 2008 (UTC)

Solution found? Entropy Sig.jpg (T/C) 03:49, 25 September 2008 (UTC)

Sort keys for pages in categories[edit source]

Sometimes you want a page to placed somewhere else in a category (a common case is when the pages have a common prefix and all get sorted under the same initial - you'd want them to sort by the part of the name that really matters). The way to do it is to add the sort key after the category, like so: [[Category:Forums|Coding]] would sort this page in Category:Forums, it would be listed as "Forum:Coding" but display under C (not F), sorted after "Cobbling" and before "Cooking".

Articles that use several categories, or that get autosorted by templates, can use another way to set their sort key: {{DEFAULTSORT:Coding}} sets a default category sort key for the whole current page; it acts as if |Coding was appended to every category anywhere on the page, including those put there by templates. --◄mendel► 21:48, 18 September 2008 (UTC)

Ugly hacks[edit source]

Category:Ugly hacks is for code that does the job, but less than elegant - it may be hard to read, perform badly, or I may remain uncertain that it works correctly under all conditions. Putting a page in that category remains invisible on the page itself once we upgrade to the new parser. I strive to use a <!-- comment --> on the page to indicate the ugliness so that others can have a go at beautifying. --◄mendel► 05:50, 23 September 2008 (UTC)

rearranging the RC box[edit source]

fieldset.rcoptions { border-style: none; margin: 0; padding: 0; }
fieldset.rcoptions form table tr+tr { position:absolute; top:235px; left:330px; }

See User_talk:JonTheMon/monobook.css. --◄mendel► 17:28, 29 October 2008 (UTC)

Recentchanges for WhatLinksHere ?[edit source]

Try Special:RecentChangesLinked/Category:GuildWiki or Special:RecentChangesLinked/Image:Diablo_the_chicken.gif (wtf?) or Special:RecentChangesLinked/User:M.mendel. --◄mendel► 18:05, 29 October 2008 (UTC)

mass edits outside RC[edit source]

This procedure needs admin powers for the "import" step.

  1. Special:Export the articles that are to be edited
  2. strip Wikia's copyright message from them
  3. edit the articles
  4. make the date current
  5. change the summary
  6. change the author to yourself
  7. I am unsure what happens to the revision numbers
  8. Special:Import the bunch

I haven't tested it yet, though, so proceed at your own risk. --◄mendel► 23:19, 7 November 2008 (UTC)

Dubious. Why not use a bot? Entropy Sig.jpg (T/C) 01:26, 8 November 2008 (UTC)
Ah. Better post a list of pages affected, so people can review.
With a bot, you're at the mercy of the varnishing gurus. For extensive edits, your own machine needs to run for a long time if you respect the idea of not doing more than 6 edits per minute. The server load is higher because the bot also reads the pages, checks for edit conflicts etc. With the export/import, if it is a complicated change, you can preview the result on all the pages before going live.
For the upcoming language/interwiki link feature, the challenge is to use the existing translation lists to auto-link a lot of pages. If I want to do that with AWB, I need to write a template that I can subst: on a page and let the wiki do the lookup (it's a bit involved). Or I could code my own bot (with all the possible bugs this entails). Or I can write a script that converts the exported pages and debug that to perfection, wait for a quiet morning with <2 wiki edits/hour and, in one fell swoop, turn the feature on. What would you prefer? --◄mendel► 09:21, 8 November 2008 (UTC) & 10:58, 8 November 2008 (UTC)
Because my technical understanding is far inferior to yours, I'll assume that you've forseen that it takes less "work" for all parties and machines involved, so you can go ahead and do it this way. But yes, do list what pages will be changed :) Entropy Sig.jpg (T/C) 10:14, 8 November 2008 (UTC)
Bah! I haven't foreseen anything; it was your comment that made me think (thank you). And "being too lazy to explain things properly" doesn't equal "far superior tech". At any rate, there's going to be testing, reported here, before anything big goes down. --◄mendel► 10:58, 8 November 2008 (UTC)
The non-technical summary of the above technical argument goes thus:
  • code my own bot: I'm too lazy to learn how to do that
  • use AWBot + templates: doable, but boring
  • Special:Export/Import: shiny new toy, lemme play with that!
Of course, the dis-/advantages listed above are true, but they're not the real motivation. :-P --◄mendel► 11:49, 8 November 2008 (UTC)
What happens if someone else edits one or more of the affected pages between exporting and reimporting? Would their edits be overwritten? ¬ Wizårdbõÿ777(talk) 19:21, 8 November 2008 (UTC)
That depends on the date of the imported revision; if it is older, the revision shows up in the history, but won't be current. That's why I suggest using a time of few edits because then you can look at RC, see what edits have been made in the interim, and manually deal with them. --◄mendel► 21:59, 8 November 2008 (UTC)

px vs. em[edit source]

moved from User talk:M.mendel

What's the difference? I always thought they were just different units to measure the same thing, like feet vs. meters. —Dr Ishmael Diablo the chicken.gif 17:02, 8 December 2008 (UTC)

1 px is one pixel, whereas 1 em is equivalent to the size of the font in the element. So if your div has a font-size of 12px, 2em is 24px. ¬ Wizårdbõÿ777(talk) 18:30, 8 December 2008 (UTC)
Oh, and "em" comes from typesetting, where one "em" was the width of the letter M (the widest letter). ¬ Wizårdbõÿ777(talk) 18:33, 8 December 2008 (UTC)
Yes, that is correct. So if a user has set the browser to enlarged fonts, or uses another dpi setting for the display so that the letters take up more pixels, the box will adapt to the size. That is assuming the font size is given in pt, not in pixels; if the font size is set in pixels, there is no difference. --◄mendel► 21:55, 8 December 2008 (UTC)

date displays[edit source]

I'm keeping the hacks I tried for Template:User birthday here in case anyone needs them. --◄mendel► 11:39, 10 January 2009 (UTC)

Display Wikicode

Sat Aug 17

{{#sub:{{CURRENTDAYNAME}}|0|3}} {{CURRENTMONTHABBREV}} {{CURRENTDAY}}

Saturday, 17th of August

{{CURRENTDAYNAME}}, 
{{CURRENTDAY}}{{#switch:{{CURRENTDAY}}|1=st|2=nd|3=rd|th}} 
of {{CURRENTMONTHNAME}}
<div style="position:relative;">[[Image:Birthday_Cupcake_(effect).jpg|45px]]
<div style="position:absolute; top:0px; left:6px; color:white; font-size:11px;">
[{{fullurl:{{FULLPAGENAME}}|action=purge}} {{#sub:{{CURRENTDAYNAME}}|0|3}}]
</div>
<div style="position:absolute; bottom:0px; left:6px; color:white; font-size:11px;">
[{{fullurl:{{FULLPAGENAME}}|action=purge}} {{CURRENTMONTHABBREV}} {{CURRENTDAY}}]
</div>
</div>

Link color change[edit source]

Hyperlinks are blue and change color when you have visited the page in question. Do we have CSS in place that we can attach to always make a link black? --◄mendel► 12:15, 12 January 2009 (UTC)

I seem to recall changing the font color will override the automatic "clicked" color. Btw, the color only changes in IE, not Firefox (not sure about any other browsers.) --Macros 12:37, 12 January 2009 (UTC)
Yes, the color changes by default in Firefox - it's set in the site CSS, unvisited is #002bb8, visited is #5a3696. You can easily override it with a span tag inside the wikilink, [[User:Dr ishmael|<span style="color:black">Dr ishmael</span>]] => Dr ishmael. A lot of people do this in their signatures. —Dr Ishmael Diablo the chicken.gif 15:32, 12 January 2009 (UTC)
Thank you. --◄mendel► 22:36, 12 January 2009 (UTC)

Transcludable Special Pages[edit source]

The pages listed there can be transcluded onto wiki pages. As an example, for RecentChanges, it could look like this: {{Special:RecentChanges/namespace=10,days=30,limit=10,hideminor=0}}.

As of this writing, for RecentChanges, the filtering by namespace and category do not work, but you can put the parameters on the URL of the page you are transcluding it on and then it does. See Forum:Coding/RC transclude demo and https://guildwiki.gamepedia.com/index.php?title=Forum:Coding/RC_transclude_demo&namespace=10, and the latter link is most simply and portably coded {{fullurl:Forum:Coding/RC transclude demo|namespace=10}}. --◄mendel► 10:55, 13 January 2009 (UTC)

nowiki with templates[edit source]

{{#tag:nowiki|{{{1|test}}}{{me}}[{{fullurl:{{PAGENAME}}|action=raw&ctype=text/css&templates=expand raw}}]}}

test<span style="white-space:nowrap;">[[Image:Mesmer-icon-small.png|Mesmer]]</span>[https://guildwiki.gamepedia.com/index.php?title=Coding&action=raw&ctype=text/css&templates=expand raw]

Cool, eh? Use it if you want to show what the wikicode output of a template looks like. --◄mendel► 12:32, 29 January 2009 (UTC)

Update: this works even better with pre instead of nowiki:

{{#tag:pre|{{{1|test}}}{{me}}[{{fullurl:{{PAGENAME}}|action=raw&ctype=text/css&templates=expand raw}}]}}

results in:

test<span style="white-space:nowrap;">[[Image:Mesmer-icon-small.png|Mesmer]]</span>[https://guildwiki.gamepedia.com/index.php?title=Coding&action=raw&ctype=text/css&templates=expand raw]

Thanks to gww:User:Poke for the tip! --◄mendel► 15:56, 9 April 2009 (UTC)

Nested <choose>[edit source]

It works using #tag: on the choose tag. See here for a demo. --◄mendel► 17:24, 16 February 2009 (UTC)

Section depth limit for TOCs[edit source]

Is there any controllable way to make Wikia limit the section depth it will include in the autogenerated/user-placed TOCs? eg all section headings with, say, more than three === are ignored, in the manner of the Wikipedia TOClimit template.

So for example if there's a page with 5 levels of subheading (and thus the TOC is somewhere near 3 kilometres long), one could go {{TOCleft|limit=3}} and the TOC would show only down to level 3 subheadings. It would help for cleaning up some QR pages, etc. where the TOC becomes an unwieldy burden visually and is often just forced off with __NOTOC__ instead.

Anyway so yeah... is there any way to do that here? :D -- AudreyChandler 18:01, 4 April 2009 (UTC)

We have CSS that works like that (except TOC works in mysterious ways, the indent doesn't always correspond to the number of =). See GuildWiki:CSS classes#Limit TOC display depth. --◄mendel► 18:17, 4 April 2009 (UTC)
omg perfect! Thank you. Effect on removal skills quick reference is shiny and pretty now! :D -- AudreyChandler 18:42, 4 April 2009 (UTC)


Titles for user spaces[edit source]

I tried, but it didn't work, so...

Is it possible to use < title > < /title > tags to retitle user space pages? When multiple tabs are open they all look exactly the same because the title is lifted from the page address (which all ofc start with something like User:CaptainCorellisMandolin/... etc.), which takes up the whole tab and pushes any distinctive identifying text off the edge. And that just... bugs me! x] -- AudreyChandler 17:17, 21 April 2009 (UTC)

Whilst meant from hiding surfing habits from peaking eyes, I find that the firefox extention TabReanimizer is a handy tab renaming tool that overwrites the tab name with a custom one. I use it for RC and other wiki pages, and it saves me work when I browse through my tabs (which is normally about 30) RandomTime 19:53, 21 April 2009 (UTC)
There is a hack to do that, but it's not installed on this wiki. --◄mendel► 21:17, 21 April 2009 (UTC)
On wiki is preferable, but TabReanimizer is a good way to go as a workaround RandomTime 21:32, 21 April 2009 (UTC)
MW 1.14 can do it hack-less if it is enabled, so maybe we could ask Wikia to have that done for us when we have 1.14? It's been discussed here on the central forums, too. For general guidance, we should make some kind of policy though to limit its use to non-confusing ways (only in userspace?). --◄mendel► 22:24, 21 April 2009 (UTC)
Well, I would suggest disabling it in places where the title is already automatically properly generated (article pages) or where the browser-identified title is about as good as necessary (for example, Image pages), for the sake of end-user consistency between page types. But I also don't really know enough about the various seedy crevasses this Wiki has to contribute properly to this discussion.
I just like it when the smart people let me make things pretty. :[ -- AudreyChandler 23:43, 21 April 2009 (UTC)
You can't selectively "disable" that feature, it's either on everywhere or off. What you can do when it's on is use a keyword on a page to set the title to be what you want it to be, and the only way to limit its use is socially, i.e. by making a community rule about it and enforcing it through telling people. --◄mendel► 09:07, 22 April 2009 (UTC)
Oh, I see. I don't think it would be too much of a problem (since I doubt the vast majority of users would even pay attention), unless there's a seething horde of vandals eagerly waiting to rename GuildWiki pages in horrible and creative ways. OTOH it's not that big a deal, I was just double-checking if there was a way to make it work currently. Not that I wouldn't use it liberally if it did appear in the featureset someday. :] -- AudreyChandler 18:07, 22 April 2009 (UTC)
Well, if for "currently" you'd accept "in two weeks", I'll see what can be done. --◄mendel► 18:14, 22 April 2009 (UTC)
lol, I'd accept "in 6-18 months". Thanks Mendel, let me know if I can help with ... whatever it is you're up to. I can... uh... cheerlead. Maybe. :P -- AudreyChandler 18:24, 22 April 2009 (UTC)
Mendel's chearleaders - new fanclub for Gwiki RandomTime 20:57, 22 April 2009 (UTC)
I wouldn't worry too much about vandalism. Move vandalism is much worse, and can already be done, yet it's not a big problem. --Macros 23:43, 22 April 2009 (UTC)

smaller polls[edit source]

Polls are resizable on GuildWiki. To get a smaller poll (it can get pretty wide for widescreen browsers), wrap it in a table. That will make it smaller, but at least as wide as the widest text in it. Example:

{|
|
<poll>
Question:
Yes
No
</poll>
|}

<poll> Question: Yes No </poll>

--◄mendel► 21:53, 1 May 2009 (UTC)

Monaco for Monobook[edit source]

There are a few ways for someone who prefers another skin to see wiki pages in Monaco:

  1. change your preferences (ugh)
  2. append ?useskin=monaco&usetheme=custom to a page URL
  3. place {{monaco}} on a page and click on it (it is invisible to monaco users): Template:Monaco
  4. use the "Monaco View" link in the "support" section of the sidebar
  5. add this as bookmark to your browser and use it on any Wikia page: javascript:document.location=document.location+'?useskin=monaco&usetheme=custom';

--◄mendel► 08:35, 13 May 2009 (UTC)

*Pagename problem[edit source]

{{PAGENAME}} (and related magic words) insert a line break at the front if the pagename starts with an asterisk. Various workarounds have been deployed at MediaWiki:Noarticletext. Watch {{urlencode:{{#tag:nowiki|{{PAGENAMEE}}}}}} get expanded to for a good "wtf?" :) --◄mendel► 20:14, 25 May 2009 (UTC)

Autorefresh for RC, Watchlist and logs[edit source]

.. is here. Does it work in personal .js ? Do we want this site-wide? (Remember to find and ask the author before copying, the license is incompatible.) --◄mendel► 10:10, 26 June 2009 (UTC)

Or we could steal it from GWW peeps without saying anything. It works in personal .js on *that* wiki, I've not tried it here. Entropy Entropy Sig 2.jpg (C) 04:41, 3 July 2009 (UTC)
Look here I stole it from some WoWWiki person (he allowed it), i have it across all Wikia sites. — Balistic

Cache issues[edit source]

Cache issues of any kind could become better by ?action=purge (or refresh tab): Images will resize themselves to all needed sizes, and .css or .js files will get passed to the cache servers who might have been unwilling to recognize the new version. If it doesn't seem to help, wait 5-15 minutes and try that again. We have the refresh tab because we have SMW. --◄mendel► 19:45, 2 July 2009 (UTC)

New JS for show/hide ?[edit source]

See w:c:dev:ShowHide. --◄mendel► 15:40, 12 July 2009 (UTC)

Linking to diffs[edit source]

Does anyone know if there is a way to link to a comparison between the most recent version of a page and the previous version? Basically, what I have a list of links on another wiki, and I want to put direct links to the most recent diff beside them (and have them automatically update when those pages are edited). Nwash User-Nwash-Eyes.png 09:42, January 15, 2010 (UTC)

Answering own question: Wikipedia:Template:Diff.
The answer is ?diff=cur, no revision number. --◄mendel► 22:32, January 15, 2010 (UTC)

Tabber extension[edit source]

I've been looking into the tabber extension; it currently (version 1.01) still has some issues, and I've posted workarounds to the talkpage there. If there's anything else, ask me on my talkpage. --M.mendel 16:49, July 15, 2010 (UTC)

Verbatim vs. int[edit source]

Read w:Forum:Verbatim. The upshot is that <verbatim> can be used to insert raw HTML on wiki pages that the parser would otherwise prevent. --◄mendel► 07:12, August 17, 2010 (UTC)

The obvious downside is that it could be used to insert malicious javascript from external sites: the iframe for RT's job queue graph runs a script from webnumbr.com. Of course, this is instantly mitigated by the fact that only admins can edit the MediaWiki: namespace, but it's still a risk that should be acknowledged.
So what sort of uses could this have besides embedding external content? —Dr Ishmael Diablo the chicken.gif 12:47, August 17, 2010 (UTC)
Not really anything extra, as sysops can already edit MediaWiki:common.js or, indeed - any user's custom javascript. This, far more than just Deletion and Protection, is one of the tools that the wiki is trusting Sysops with. -- RandomTime 20:16, August 17, 2010 (UTC)
Well, we're trusting anyone who plonks down the money to run ads on Wikia.
Verbatim can be used to get the img tag or the background style attribute past the parser. We could add a twitter feed, iframe a web-based irc client, place page-specific javascript on a page that needs it instead of having it in common.js, embed flash applets, make amazon associate links, embed any web counter to track statistics for specific pages, use the google maps API for that guildwars map, make pages that load and play music automatically (I'm saying we could, not that we should!), have popups on hovering (like PvXwiki builds), maybe make a skin mod with a 50% sidebar that opens gww:{{FULLPAGENAME}} in an iframe (well, that might not actually work), basically many things we could do if we controlled the skin or the extensions that run on the server. In short, break out of Wikicode limits. --◄mendel► 21:53, August 17, 2010 (UTC)
NB: I'm not trusting any advertisers. Ever. ---- RandomTime 22:05, August 17, 2010 (UTC)
Cool, that's exactly what I was looking for, mendel - I'm not much of a brainstormer. Sounds pretty spiffy. Unfortunately, like you mentioned on the Wikia forum page, there doesn't seem to be much documentation on it. Is there any way to pass parameters to the included code? Maybe set up some div's with specific id's that the JS could getElementById on?Dr Ishmael Diablo the chicken.gif 22:50, August 17, 2010 (UTC)
There's no way to pass parameters, but templates and magic words (such as {{PAGENAME}}) still work. In some cases, it might be possible to break up the html and insert a parameter in the wikitext (there's a type of amazon associate link that would work well with that). The safety of this is exactly the same as parameter passing, i.e. very unsafe, use with utmost care to avoid insertion of arbitrary code on pages. Are you thinking of anything specific? --◄mendel► 23:25, August 17, 2010 (UTC)
Since MediaWiki is written in php (AFAIK), it might be possible to insert php into the page with "verbatim". Could someone suggest a snippet of php to test if that is true? --◄mendel► 08:31, August 19, 2010 (UTC)
This should produce "Hello world!" --> #<verbatim>VerbatimPHPtest</verbatim># Nope, looks like it bypasses the entire server-side processing. —Dr Ishmael Diablo the chicken.gif 14:10, August 19, 2010 (UTC)
Mmmh, some parser stage strips off the newlines, so that we get <?phpecho "Hello World";?>; you could try inserting spaces, but it doesn't look promising. --◄mendel► 14:22, August 19, 2010 (UTC)
The newlines aren't necessary, but the fact that it was concatenating ?phpecho was a problem. It still doesn't work, though - it's passing the PHP code straight through to the client. —Dr Ishmael Diablo the chicken.gif 14:33, August 19, 2010 (UTC)
Aw, it would've been awesome if that had worked. Well, thanks for confirming! --◄mendel► 15:05, August 19, 2010 (UTC)
Here's a way to 'pass' a 'parameter' to a verbatim page: set the value you want to pass within a hidden div, and the div's id will be the parameter name. The JS can then get that div by its id and pull the innerHTML into a variable.
The output of MediaWiki:Verbatim sandbox is given between the hashes --> #<verbatim>Verbatim sandbox</verbatim>#
This would have to be restricted/controlled even more rigorously than #var's, but it does work. —Dr Ishmael Diablo the chicken.gif 20:54, August 19, 2010 (UTC)
Well, that's not a MediaWiki $1 or $2 parameter; it's more of a way for the javascript to find stuff on the page. Sanitizing these inputs would probably be paramount. In the example, the wiki parser is doing that for us. --◄mendel► 21:43, August 19, 2010 (UTC)

Another Javascript example, using a Wikia variable: w:c:unanswers:Template:USERNAME. --◄mendel► 21:45, August 19, 2010 (UTC)

Ugh[edit source]

Discovered a major problem with using JS in a verbatim page - the engine inserts the &nbsp; entity before all !, ?, and : characters that occur outside of comments or quoted strings. I have no clue why it does this (probably some sort of security measure), but it means that if the code contains any a ? b : c or != operators, you're gonna end up with syntax errors when the browser tries to parse it.

Luckily, both of those operators can be rewritten without those characters, but this is still a major issue. —Dr Ishmael Diablo the chicken.gif 14:59, September 9, 2010 (UTC)

Another issue: the engine converts all & characters within quoted strings into the &amp; entity. Workaround is to concatenate String.fromCharCode(38) into the string. —Dr Ishmael Diablo the chicken.gif 16:26, September 9, 2010 (UTC)

DPL cache[edit source]

The way this wiki is set up right now, using DPL on a page disables the cache: the page is re-rendered for each new view. This is generally undesirable, so please add the parameter allowcachedresults=true to all of your DPL queries. --◄mendel► 09:57, 9 December 2010 (UTC)

HoM calculator widget[edit source]

I'd like to do a HoM widget, but I lack some javascript skills. I had a look at hom.guildwars2.com . The site accepts a character name, does something I don't quite understand and fetches a 43 character "data string". The file meta-rollup.js contains the code that parses this data (I have a formatted version I could share). The string is in "Arenanet base 64", i.e. using the characters ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ with A=0, B=1 and /=63 . In order, the string contains:

  1. resilience: 32 bit,
  2. fellowship: 32 bit,
  3. honor: 64 bit,
  4. valor: 64 bit,
  5. devotion: four 7-bit numbers , padded to 64 bit

The data corresponds to the variable HOM.character listed in the page source of hom.guildwars2.com, in order, padded to size. In other words, bit 0 of the first letter of the string corresponds to "Elite Canthan Armor".

To Do:

  1. A widget could take the data string as parameter and insert it into Javascript that then toggles page elements with classes corresponding to the items. This would enable a page (possibly a template) that e.g. lists all heroes and greys them out based on which ones have been acquired. (For the devotion/pets, the widget could set global javascript variables that another widget further down the page could display if needed.)
  2. Create templates that use these toggles to display a character's achievements (heroes, titles, elite armor and weapons), and a pet widget. (I could do that.)
  3. Ideally, the input to the widget would be a character name; this would ensure the display updates itself, with no edits to the page required. For that, the javascript needs to query the arenanet site for the data string corresponding to the character name. This appears to be done via a simple form at the head of the page.

I've also found javascript to compute the reward points and a list of rewards with descriptions, but that's of course GW2 data not relevant here and now. :-P

Who's game? --◄mendel► 23:23, 16 January 2011 (UTC)

HoM String[edit source]

I will just list what you found out so that everyone else can see how it works. I'm not sure if I am be able to write such a widget, but maybe I can assist by writing some functions. But I'll think about that tomorrow or so.


The string has 43 characters. Each character of the string represents - as usual for base64 strings - 6 bits. So I guess there are 256 bits (43 * 6 = 258, that means 2 bits would be left out). The bits are assigned as follows:

  1. 32 bits for Resilience
  2. 32 bits for Fellowship
  3. 64 bits for Honor
  4. 64 bits for Valor
  5. 64 bits for Devotion

Raw (AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA):

Reversed:
000000 000000 000000 000000 000000
000000 000000 000000 000000 000000
000000 000000 000000 000000 000000
000000 000000 000000 000000 000000
000000 000000 000000 000000 000000
000000 000000 000000 000000 000000
000000 000000 000000 000000 000000
000000 000000 000000 000000 000000 
000000 000000 0000

Normal:
000000 000000 000000 000000 000000
000000 000000 000000 000000 000000
000000 000000 000000 000000 000000
000000 000000 000000 000000 000000 
000000 000000 000000 000000 000000 
000000 000000 000000 000000 000000
000000 000000 000000 000000 000000
000000 000000 000000 000000 000000
000000 000000 0000

Example (CBDBAMkRAKAAFQQAAAIIAgCICAKAAAAAXAJoGAAAAAA):

Reversed:
000010 000001 000011 000001 000000
001100 100100 010001 000000 001010
000000 000000 000101 010000 010000
000000 000000 000000 001000 001000
000000 100000 000010 001000 000010
000000 001010 000000 000000 000000
000000 000000 010111 000000 001001
101000 000110 000000 000000 000000 
000000 000000 0000

Normal:
010000 100000 110000 100000 000000
001100 001001 100010 000000 010100
000000 000000 101000 000010 000010
000000 000000 000000 000100 000100 
000000 000001 010000 000100 010000 
000000 010100 000000 000000 000000
000000 000000 111010 000000 100100 
000101 011000 000000 000000 000000
000000 000000 0000

The example "character" should have:

  • Elite Exotic Armor, Elite Sunspear Armor, Monument Armor, Obsidian Armor and Marhan's Exclusive Armor
  • Zenmai, Norgu, Tahlkora, Koss, Dunkoro, Vekk, Gwen, Black Moa
  • Eternal Slayer, Eternal Defender of Ascalon, Eternal Protector of Cantha, Eternal Guardian of Elona, Eternal Conquerer of the Deep, Eternal Codex Disciple
  • Destroyer Focus, Destroyer Scepter, Tormented Daggers, Tormented Scythe, Oppressor Shield, Opressor Staff
  • 23 Common Miniatures, 32 Uncommon Miniatures, 2 Rare Miniatures, 53 Unique Miniatures

Resilience[edit source]

32 bits.

Each bit was assigned to one armor:

  1. Elite Cantha Armor
  2. Elite Exotic Armor
  3. Elite Kurzick Armor
  4. Elite Luxon Armor
  5. Imperial Ascended Armor
  6. Ancient Armor
  7. Elite Sunspear Armor
  8. Vabbian Armor
  9. Primeval Armor
  10. Asuran Armor
  11. Norn Armor
  12. Silver Eagle Armor
  13. Monument Armor
  14. Obsidian Armor
  15. Granite Citadel Elite Armor
  16. Granite Citadel Exclusive Armor
  17. Granite Citadel Ascended Armor
  18. Marhan's Grotto Elite Armor
  19. Marhan's Grotto Exclusive Armor
  20. Marhan's Grotto Ascended Armor

Due to the fact that there are only 20 armors there are 4 bits left empty.
Now we can simply go through our 24 (20) bits and set every bit to 1 if we got that armor.
In the end we have to reverse each block before we can calculate the base64 characters.

000000 000000 000000 000000  | 4 blocks of 6 bit 
000000 000000 000000 00----  | 4 blocks of 6 bit minus 4 bit 
We got Elite Exotic, Elite Sunspear, Monument, Obsidian and Marhan's Exclusive:
010000 100000 110000 10----  | string with five armors
000010 000001 000011 ----01  | each block reversed
 2      1      3      1      | decimal sum of each block
 C      B      D      B      | corresponding base64 character
CBDB                       | Link to check the string

Note: instead of reversing the binaries you may also take the first as 2^0, the second as 2^1 and so on - but I guess most existing programming routines convert binary to base64 with 2^5, 2^4 and so on.

If the empty blocks are added to Resilience we gain our first 32 bits of the string.

Fellowship[edit source]

32 bits.

Again, each bit is assigned to one Hero (and the Pet things):

  1. Zenmai
  2. Norgu
  3. Goren
  4. Zhed Shadowhoof
  5. General Morgahn
  6. Margrid the Sly
  7. Tahlkora
  8. Razah
  9. Master of Whispers
  10. Koss
  11. Dunkoro
  12. Melonni
  13. Acolyte Jin
  14. Acolyte Sousuke
  15. Vekk
  16. Livia
  17. Hayda
  18. Ogden Stonehealer
  19. Pyre Fierceshot
  20. Jora
  21. Kahmu
  22. Xandra
  23. Anton
  24. Gwen
  25. Animal Companion
  26. Black Moa
  27. Imperial Phoenix
  28. Black Widow Spider
  29. Olias
  30. M.O.X.

--0000 000000 000000 000000 000000 0000-- | 2 bits remained to Resiliance, so we start our 32 bits with a 4 bit block
We got some heroes: Zenmai, Norgu, Tahlkora, Koss, Dunkoro, Vekk, Gwen, Black Moa
--1100 001001 100010 000000 010100 0000--  | string with heroes
0011-- 100100 010001 000000 001010 --0000  | each block reversed
 12     36     17     0      10     0      | decimal sum of each block
 M      k      R      A      K      A      | corresponding base64 character
MkRAKA                                   | Link to check the string, note that the first 32 bits are set to 0

Honor[edit source]

64 bits.

Each bit is assigned to one achievement:

  1. Eternal Champion
  2. Eternal Commander
  3. Eternal Skillz
  4. Eternal Gladiator
  5. Eternal Hero
  6. Eternal Lightbringer
  7. Eternal Bookah
  8. Eternal Delver
  9. Eternal Slayer
  10. Eternal Ebon Vanguard Agent
  11. Eternal Defender of Ascalon
  12. Eternal Tyrian Cartographer
  13. Eternal Guardian of Tyria
  14. Eternal Protector of Tyria
  15. Eternal Tyrian Skill Hunter
  16. Eternal Tyrian Vanquisher
  17. Eternal Canthan Cartographer
  18. Eternal Guardian of Cantha
  19. Eternal Protector of Cantha
  20. Eternal Canthan Skill Hunter
  21. Eternal Canthan Vanquisher
  22. Eternal Savior of the Kurzicks
  23. Eternal Savior of the Luxons
  24. Eternal Elonian Cartographer
  25. Eternal Guardian of Elona
  26. Eternal Protector of Elona
  27. Eternal Elonian Skill Hunter
  28. Eternal Elonian Vanquisher
  29. Eternal Ale-Hound
  30. Eternal Party Animal
  31. Eternal Master of the North
  32. Eternal Legendary Cartographer
  33. Eternal Legendary Guardian
  34. Eternal Legendary Skill Hunter
  35. Eternal Legendary Vanquisher
  36. Eternal Fortune
  37. Eternal Sweet Tooth
  38. Eternal Spearmarshal
  39. Eternal Survivor
  40. (empty)
  41. Eternal Treasure Hunter
  42. Eternal Misfortune
  43. Eternal Source of Wisdom
  44. Eternal Hero of Tyria
  45. Eternal Hero of Cantha
  46. Eternal Hero of Elona
  47. Eternal Conqueror of Sorrow's Furnace
  48. Eternal Conqueror of the Deep
  49. Eternal Conqueror of Urgoz's Warren
  50. Eternal Conqueror of the Fissure of Woe
  51. Eternal Conqueror of the Underworld
  52. Eternal Conqueror of the Domain of Anguish
  53. Eternal Zaishen Supporter
  54. Eternal Codex Disciple

----00 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 00---- | 64 bits, starting with the 2 leftovers of Fellowship
It's the same game as above, so I just list some achievements:
Slayer, Defender of Ascalon, Protector of Cantha, Guardian of Elona, the Deep, Codex Disciple
----00 000000 101000 000010 000010 000000 000000 000000 000100 000100 000000 00---- | string with achievements
00---- 000000 000101 010000 010000 000000 000000 000000 001000 001000 000000 ----00 | each block reversed
 0      0      5      16     16     0      0      0      8      8      0      0     | decimal sum of each block
 A      A      F      Q      Q      A      A      A      I      I      A      A     | corresponding base64 character
AAFQQAAAIIAA                                                                      | Link to check the string, note that the first 64 bits are set to 0

Valor[edit source]

64 bits.

Each bit is assigned to one weapon:

  1. Destroyer Axe
  2. Destroyer Bow
  3. Destroyer Daggers
  4. Destroyer Focus
  5. Destroyer Maul
  6. Destroyer Scepter
  7. Destroyer Scythe
  8. Destroyer Shield
  9. Destroyer Spear
  10. Destroyer Staff
  11. Destroyer Sword
  12. Tormented Axe
  13. Tormented Bow
  14. Tormented Daggers
  15. Tormented Focus
  16. Tormented Maul
  17. Tormented Scepter
  18. Tormented Scythe
  19. Tormented Shield
  20. Tormented Spear
  21. Tormented Staff
  22. Tormented Sword
  23. Oppressor Axe
  24. Oppressor Bow
  25. Oppressor Daggers
  26. Oppressor Focus
  27. Oppressor Maul
  28. Oppressor Scepter
  29. Oppressor Scythe
  30. Oppressor Shield
  31. Oppressor Spear
  32. Oppressor Staff
  33. Oppressor Sword

--0000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 | 64 bits, starting with the 2 leftovers of Honor
It's just again the same game as above, so I again list some exapmles:
Destroyer Focus, Destroyer Scepter, Tormented Daggers, Tormented Scythe, Oppressor Shield, Opressor Staff
--0001 010000 000100 010000 000000 010100 000000 000000 000000 000000 000000 | string with weapons
1000-- 000010 001000 000010 000000 001010 000000 000000 000000 000000 000000 | each block reversed
 32     2      8      2      0      10     0      0      0      0      0     | decimal sum of each block
 g      C      I      C      A      K      A      A      A      A      A     | corresponding base64 character
gCICAKAAAAA                                                                | Link to check the string, note that the first 128 bits are set to 0

Devotion[edit source]

4 decimal numbers with 7 bits each.

  1. Common
  2. Uncommon
  3. Rare
  4. Unique

000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 0000                        | 64 bits
Example:
We have 23 common, 32 uncommon, 2 rare and awesome 53 unique miniatures:
 23      32      2       53                                                                       | decimal numbers
0010111 0100000 0000010 0110101                                                                   | each converted to 7 bit binaries
To convert the 7 bit binaries into 6 bit binaries, they are rotated:
 C  C  C  C  C  C    U  U  U  U  U  C    R  R  R  R  U  U    G  G  G  R  R  R    X  X  G  G  G  G | which number's bits
32 16  8  4  2  1   16  8  4  2  1 64    8  4  2  1 64 32    4  2  1 64 32 16    2  1 64 32 16  8 | which dec number
 0  1  0  1  1  1    0  0  0  0  0  0    0  0  1  0  0  1    1  0  1  0  0  0    0  0  0  1  1  0 | inserted bits
 C common, U uncommon, R rare, G unique/green, X empty

010111 000000 001001 101000 000110    | 6 bit blocks without spaces
Note: these aren't reversed now!
 32     0      9     40      6        | decimal sum of each block
 X      A      J      o      G        | corresponding base64 character
 Of course we won't forget that usually there are some more Numbers:
 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 0000
 So we "need" 6 As more.
 
XAJoGAAAAAA                         | Link to check the string, note that the first 192 bits are set to 0

That's it. As mentioned above, I'm also not that good at writing widgets - but maybe there's someone out there who is of the opinion that with this information he just needs an hour (or two, or three, or just a couple of weeks) to script something... I'll try that out myself next week. Kaede 17:26, 7 May 2011 (UTC)

Devotion #2[edit source]

I was blind but now I see: It's not that difficult as i mentioned above - that would work also, but in fact they seem just to use a double rotation: First they rotate each 7 bit block, then they split them up into 6 bit blocks and rotate those again.

 23      32      2       53        | decimals
0010111 0100000 0000010 0110101    | 7 bits
1110100 0000010 0100000 1010110    | 1st rotation
111010 000000 100100 000101 011000 | 6 bits (filled)
010111 000000 001001 101000 000110 | 2nd rotation
=> Same result as above.

Kaede 12:21, 8 May 2011 (UTC)

Get string by Character name[edit source]

Okay, I guess that [1] returns the base64 string corresponding to a character's name. I have to say, that I don't really understand how this works and - even worse - how to grab the string by a name.

But I've already written some js to convert the base64 string back to the "reversed binary". Currently I'm rereversing it. Kaede 10:32, 8 May 2011 (UTC)

Okay, I normalized the string and cut it into the pieces I need. Now I will work on some selection algorithm - but for now I'll have a break... Kaede 13:12, 8 May 2011 (UTC)

Can anyone tell me, how to add javascript variables to a template? I want something like this:
{{HoM|String}} for easy user implementation (if we get the string by charactername, we could also use {{HoM|character}}).
{{HoM|String}} shall return something like this (of course full and not only with one tab): User:Kaede/HoM
But I therefor need some variables transferred from js to wiki markup:
  1. I need a boolean switch for some style classes (to grey things out and so on): {{HoMbgcolor|X}} and {{HoMcolor|X}}
  2. I need a way to call the devotionvariables {{HoMDev|0-3}} (0 for unique to 3 for common or something like that)
  3. possibly some others, I have no exact plans at the moment, the script grows...
My greatest problem with this is, that I don't know how (if it is possible) to implement javascript into wiki content... If somebody could tell me that, I might be able to write the rest on my own.
Only then I can also try to implement mendel's suggestion with those javascript toggles.Kaede 12:06, 9 May 2011 (UTC)
You need to be made an admin a Widget editor, then you can write a Widget, which is basically raw HTML/JS that can also use wiki markup.
But first I have to ask, what's the point? It sounds like all you're doing is duplicating what the official HoM calculator already does. What value are you adding beyond that? —Dr Ishmael Diablo the chicken.gif 12:49, 9 May 2011 (UTC)
It is not necessary to be an admin, ask a bureaucrat to put you in the "Widget editors" group. See mw:Extension:Widgets and MediaWikiWidgets.org to find out what you can do (I haven't seen a widget that outputs wikicode, so I don't know whether that'll work - wikicode as input and on the widget page is fine, though). --◄mendel► 14:26, 9 May 2011 (UTC)
I made a widget here, couldn't get it to mix with wikicode, so I used HTML output. It should (in its present state) display all sorts of internals from any given string, including a table of mini counts. If we want tabber, the javascript for it would probably have to be copied to the widget. --◄mendel► 15:15, 9 May 2011 (UTC)
You haven't answered my question. —Dr Ishmael Diablo the chicken.gif 15:28, 9 May 2011 (UTC)
First thanks to mendel. That should be easy now.
At the moment I really just copy the things the HoM-tool can. The main point I see is that we could easily provide wikilinks to everything inside the HoM or help users who already implement their own halls of monuments. Or better those who feel unable to do their own pages but would like to. I just work on mendel's request without thinking about it.
Another point might be that we can have a simpler design than official HoM calculator has - and we can add the miniatures based on mendel's idea by global vars or whatsoever.
But if we don't need such a widget, I can also stop working on it. Then I'm happy with doing research on the data format ;) Kaede 15:45, 9 May 2011 (UTC)