User:Vasi/Scripts/UrbanDead.pm

From The Urban Dead Wiki
Jump to navigationJump to search

Description

This is my library of perl routines for scripting UrbanDead and its wiki.


View the code


To use this module, you'll need the perl modules WWW::Mechanize, HTML::Tree and URI.

Current capabilities

Generic web capabilities

Using HTML::Tree and WWW::Mechanize, web pages can be fetched and the results can be manipulated as trees or through forms.

  • get - Get a HTML page from a URL.
  • mech - Get a WWW::Mechanize object which uses our stored cookies.
  • html - Turn a few type (plain text, Tree, Mech) into raw HTML.
  • htmlTree - Turn a few types into HTML trees.

Wiki manipulation

Bots using the script are good wiki citizens, refusing to alter pages if they have messages waiting.

  • wiki - Get a page from this wiki, returning a Mech.
  • wikiLogin - Log into the wiki so pages can be edited, using saved user/pass if possible and prompting otherwise.
  • wikiSubmit - Make an edit to a wiki page, logging in if necessary. Can edit individual sections.
  • wikiSectionNamed - Get the number of the section with the given name.
  • wikiSource - Get the wikicode source for a page
  • wikiProtect - Protect a wiki page (requires admin login)

Misc

  • suburbs - Get an array of all the suburbs in Malton
  • timeout - Perform an action, timing out after waiting too long

Todo

I have a numer of other scripts which are currently private, but aspects of them may be moved into this library. If any of the below functions would be useful to you, just ask:

  • Generating a table of my characters from an Excel spreadsheet
  • Generating a map of a suburb, and tagging squares with information from an Excel spreadsheet including the following:
    • Groups occupying a given square
    • Barricade levels
    • Revive points
    • Misc free-text
  • Encoding and decoding the RAF cipher in a flexible way, including some auto-detection of ciphertext
  • Scanning a website for profile links and adding them all to a contact list

Changelog

  • Version 1.1, 06:53, 13 Feb 2006 (GMT)
    • Remove wikiPurge, it's kinda simplistic
    • Add wikiSource and wikiProtect
    • Deal with timeouts