Older blog entries for Ohayou (starting at number 1)

Kingdom of Loathing

Today I made another KoL scriptlet, a variation on a theme I did ages ago, this time customized to just make generic KoL scriptlets. Yes -- a meta scriptlet, designed to automate the creation of other nifty scriptlets. It will arm all forms, to, when submitted, present the user with a scriptlet that does that, when invoked. Any form will do, but to work outside of the kingdom it needs some tiny bit of rewriting, since it assumes that it's frame two that holds all the action.

It's based on a hack I seem to have thought out before the Millennium -- archive.org still holds a copy of my bookmarklet page from those days. I'm not sure it works very splendidly in modern browsers -- when I tried it, it seemed to have some trouble recursing through all frames, but I suppose archive.org might have caught a buggy version of it before I fixed some minor detail.

Anyway, it was a good recap. I hope some people will find it the best thing since... ...well, I don't know. My first KoL scriptlet hack? :-)

Hack mode has recently paid intermittent visits, after some time of dense inactivity on the computer front, being in a human oriented line of work since a month or two. It's a welcome change from the life I used to live, with both life and work in the geek community. Also, it was a welcome return to hobby hacking for the sheer fun of it. It's easy to forget how to have fun when you work with something for salary.

But enough about life. I've been playing Kingdom of Loathing for perhaps a quarter now, and while the joy of playing declines a bit once you have done all there is to do (it's a traditional mud, in an HTML suit, without wizards but with a healthy twisted humour, both linguistically and graphically) I seem to stick to my gaming tradition of finding other stimulating ways of expanding gameplay.

The past week or so, I've been hacking about at little more or less helpful scriptlets (okay, I think the term that won the audience was bookmarklets, but I prefer the shorter term) to do this or that more conveniently. Such as repeating an action for a number of times, which was my first stab at making boring manual labour go away.

Next in line, I made a useless hack or two (this one, for instance, will use some default item in combat, like the dictionary or the meat vortex similarly), and then I helped out a few friendly people in the clan (can a multiplayer game be without them?) with boring tasks, too.

Yesterday, as randomness had it, I advanced to something a bit more complex than the mere repeated form submittal or URL loading, in putting together a hack to search out users in a roster. I got something rather crude working after a full three hours of work, most of it lost in trial and error hacking trying to figure out ways of doing load event callback oriented triggering of the next pageload. I was too absent-minded and tired to actually get something along those lines working though, until this morning, when I gave it another stab. With a helpful hint from Andreas Lange about cooking a frameset around the page to load, and give the frameset an onLoad property that will invoke a callback, I got it to work the way I intended from the very beginning.

That feeling is rewarding. Even if it's just putting your mind to solving needless problems put up by a just barely general-purpose scripting language such as javascript. The joy of overcoming limitations has always been high on my list of sources of joy, pride or play, had I had one.

Almost the same joy as a few weeks ago, when I took down one of the fairly long outstanding bugs in AIDO (with very abundant help from Per) where metadata would get out of sync between the local medialibrary (where it broke) and the metaserver, upon joining productions. Nailing that misfeature really made my day, or night, as it were. ...I wonder when we'll see the next AIDO hack session; it's been a while again, now.

Today I sat down for a long time, spending even more time on reading up on what little has happened on the javascript front since I left the professional web a year or two ago. Not in general, but to solve the specific problem of getting a callback run after a form has been posted and the result has come back. For a while, I thought I might have struck something, on finding the W3C standard for events -- for once something potentially really good come out of that corner -- but I couldn't put it to use seccessfully for my specific application. Or, at least, didn't manage to. I want my scriptlet to post a form, get a callback, and continue chewing on the result page once it's back. The frameset technique does not lend itself to the problem, and the promising [element].addEventListener('load',callback,false) did not seem to do my bidding either.

Not that there's anything wrong about that particular system -- it's obviously great for doing these things when you can inject the code into the pages themselves (tried that, quite successfully) -- but I would have been glad to see it work if I set the listener to trig on load on a frame I posted a form in. But no such luck today.

I did, however, engross myself in the joyful study of a few sites covering scriptlets (nodding recognition for most techniques I had already found myself, except perhaps the space conservatory technique of putting the pascalesque with(object) syntax to good use which was not covered), event models (great thoroughness and clarity) and, mostly by chance, the Friend of a Friend project.

That actually surprised me somewhat -- the Semantic Web finally being put to some luser appealing purpose. Luser, here, referring to anyone not drooling about the wide prospects and dazzling possibilities offered by RDF, OWL, inference engines and XML Namespaces. That is to say, most of us. My ex employer, the easily loved Uwe AƟmann, was not one of these lusers. Unfortunately (well -- I'm not very sad, to be quite honest, but then I wasn't converted, so that opinion falls short) he did not happen to convey the glory of it to me, at the time; I mostly saw all the Really Hairy muck Martin and Leif were battling with, in making Pike the first scripting language of the Semantic Web. To make a long story shorter, I think the FOAF project, once it gathers some steam, might actually do the SWEB people more good than anything else they have mustered to date. For kicks, I made my own FOAF entry.

But truth be told, RDF still looks thoroughly dreadful. It won't ever (or at least I so hope it won't) be the hand tweaked mess HTML became. Perhaps that is actually a good thing.

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!