Htmlform

From Kolmafia
Revision as of 19:52, 29 November 2010 by imported>StDoodle (lies & damn lies (I'm bored))
Jump to navigation Jump to search

Attention KoLmafia Users!

This page details the use of functions in a script library. The information here is only useful to those who have followed the included steps to make use of these functions; they are not built-in to KoLmafia.

About jasonharper's Form Library

It does stuff with forms. Like Magic. Also, it turns your body into html so that all your attacks will do html damage. This is obviously placeholder text, duh.

Note: This author wants to warn the user that you actually turn into an xml document, not an html document. While your damage will still be similar to html damage, this actually leaves you vulnerable to attacks by the W3C should you ever fail to validate against your schema. Oh the horror!

Functions

Generating the Page Structure

write_header

void write_header()

void finish_header()

void write_page()

write_page() is equivalent to write_header() followed by finish_header(), but the separate functions may be preferred so that you can add information into the page header such as a script or stylesheet.


finish_page

void finish_page()

This must be used at the end of the form.


write_box

void write_box(string label )

void finish_box()

These can be used in matched pairs around a group of elements to enclose them in a box. The label will be at the top of the box.
attr("align=center") or attr("align=right") will change the position of the label.

Making use of HTMLform

To include this library in your script, first you must download it from the location provided below and make sure it is in your /scripts directory (or a sub-directory thereof). Then, simply add the following towards the top any script in which you wish to have access to these functions:

import "htmlform.ash";

Then all these functions will be available in your script. Have fun! Note that most of these functions are intended for use in relay info scripts, which must be placed in the /relay directory (top-level only, no sub-directories) and must begin with "relay_" to show in the user's relay browser.

More Information

See the thread for HTMLform on the KoLmafia forum here.