The World of Layonara  Forums

Author Topic: Reproducing parchments with Autohotkey  (Read 222 times)

Pen N Popper

Reproducing parchments with Autohotkey
« on: June 06, 2007, 06:15:32 am »
Some time ago I posted on using the program Autohotkey  http://forums.layonara.com/roleplaying/114411-emote-your-heart-out.html .  This program has many uses for repetitive tasks.

The recent threads on parchment copying leads me to share how my PC is working on a rather complexly formatted ingame newsletter.

Note in the script below, please(!) change the references to "Pen N Popper" to your own player name.  I don't want to get the tells spammed at me. :-)

Code: [Select]

^9::
    Write_Example()
return


Say(s, end_delay=0)
{
    global prefix

    SendInput {Enter}
    Sleep 250
    IfInString, s, /
        SendInput {Raw}%s%
    else
        SendInput {Raw}%prefix%%s%
    SendInput {Enter}

    if ( end_delay != 0 ) {
        Sleep end_delay
    }
}

last_color := ""

Write_Quill()
{
    MouseClick, right, 282, 382
    Sleep 250
    MouseClick, right, 350, 459
    Sleep 250
    MouseClick, left, 271, 241
    Sleep 6000
}

Write_Ink(name, x, y)
{
    MouseClick, right, 282, 382
    Sleep 250
    MouseClick, right, 350, 459
    Sleep 250
    MouseClick, left, x, y
    Sleep 250
    Say( "/tp ""Pen N Popper"" READY TO WRITE IN " . name . " INK")

    Sleep 6000

    return 1
}

Write_Gold_Ink()
{
    Write_Ink("gold", 312, 235)
}

Write_Red_Ink()
{
    Write_Ink("red", 314, 270)
}

Write_Green_Ink()
{
    Write_Ink("green", 315, 302)
}

Write_Blue_Ink()
{
    Write_Ink("blue", 316, 335)
}

Write_White_Ink()
{
    Write_Ink("white", 316, 370)
}

Write_Purple_Ink()
{
    Write_Ink("purple", 316, 399)
}

Write(color, text)
{
    global last_color

    if ( color != last_color ) {
        last_color := color
        if ( color == "white" ) {
            Write_White_Ink()
        } else if ( color == "green" ) {
            Write_Green_Ink()
        } else if ( color == "red" ) {
            Write_Red_Ink()
        } else if ( color == "blue" ) {
            Write_Blue_Ink()
        } else if ( color == "gold" ) {
            Write_Gold_Ink()
        } else if ( color == "purple" ) {
            Write_Purple_Ink()
        } else {
            Say( "/tp ""Pen N Popper"" ERROR!! UNKNOWN COLOR " . color . " ")
            return
        }
    }
    Say(text, 6000)

    return
}

Write_Example()
{
    global last_color

    gold := "gold"
    white := "white"
    red := "red"
    blue := "blue"
    green := "green"
    purple := "purple"

    Write_White_Ink()
    Write_Quill()
    Say("~~erase", 1000)
    last_color := "white"

    Write(gold, "~~title Bumblebee is the man!")

    Write(white, "~~~~")
    Write(gold, "~ ~~ All About My Favorite Brownie ~~")
    Write(white, "~~nl")
    Write(white, "~What a cute little fellow, dressed in yellow.")
    Write(white, "~~nll")
    Write(white, "~Wonder if he's married, or likes to be carried.")
    Write(white, "~~nl")

    Say("/tp ""Pen N Popper"" FINISHED!")

    return
}

Since this script will actually dip your quill into the inks, it is required that your inventory be structured in a certain way.  (Note that the coordinates may need adjusting to match your graphics resolution / screen size.)



The line of ink vials are ordered from top to bottom:  Gold, red, green, blue, white, purple.  The parchment next to the ink vials is the one that will be written upon.  The quill must be in its position next to the ink vials.

It doesn't matter what page of inventory this is on, but your inventory must be open to that page and positioned above the chat window.

This is all very important since Autohotkey will be moving your mouse.

Once you are ready to start writing, simply type Ctrl-9 (control key and 9 key together).  Now sit back and relax!  Don't move the mouse or try to type until it is finished.

Note that if your text is long there is a chance that an action will be missed and you'll end up resting or skipping a line or such.  Just let the script finish and try again.  The built-in delays of the script are often enough, though.

 
The following users thanked this post: Acacea, darkstorme, Tialle Dianesis

darkstorme

Re: Reproducing parchments with Autohotkey
« Reply #1 on: June 06, 2007, 11:08:40 am »
Brilliant and useful as always, PnP.  And a lovely workaround for the current disconnect between LORE and the parchment folders.
 

 

anything