Mudlet 'Plugins'

by Anisu

Back to Mechanic's Corner.

Unknown2012-02-21 16:36:18
Oops.

Fixed a nil table value. :)

Also changed to only display Lusternia data. (It was a little spammy.)
Unknown2012-02-22 16:09:58
Added help and syntax scripts.

Do you guys want the settings to have a permanency feature? It'll be defaulted to Lusternia only. These are the data types:


bwl.tracking.convertJSONTypes = {
DEA = "Player Death",
ARE = "Arena Event",
DUE = "Arena Duel",
POL = "Politics",
NEW = "New Character",
TOU = "Tour Completed",
LUP = "Level Gained",
LDN = "Level Lost",
ACH = "Achievement Gained",
LOG = "Ally Logged In",
LOU = "Ally Logged Out",
MSG = "Message Received",
DAL = "Ally Death",
CRE = "Credit Transfer",
CRS = "Credits Sold",
ISS = "Issue Filed"
}


I was thinking of defaulting to just LUP, LDN (if level exceeds 95), LOG and LOU here.

Thanks.
Neos2012-02-22 16:22:08
When(not if!) I get my laptop back up and running, would be awesome to get this for other games, and I generally only care for deaths, login/out, achievements, and arena stuff. Level up/down stuff is meh, don't want to see 10 level up messages for someone low level.
Unknown2012-02-24 16:14:39
Updated.

Changelog:

* Settings script added. (Just open the scripts folder and edit to your liking.)
* Added filtered table. (sys.tracking.filteredFeed)
* Added documentation functions and help files.
* Moved JSON decoding from JSON4Lua to YAJL.
* Added echo toggle: LIVEFEED
* Added sysEcho() function to package.

Todo:

* Browser cookie check for login credentials. (Will enable ally login/logout.)
* Complete data type toggling.
* Add configuration persistence.

Download here.

Install with the package manager. (Uninstall previous version if applicable.)

For any bugs or other funky action, please let me know.

Enjoy!
Unknown2012-02-27 01:12:11
This package will display the local area next to the room name. (Similar to how Mudbot used to work.)

i.e.

On the upper deck of the Pool of Stars. (City of New Celest)
A golden light flows outward from a shield shrine of Terentia nearby. This location is flooded with
shallow, crystal clear water. There is a moderate breeze here. A statue of Eventru stands here,
memorializing his noble spirit.
You see exits leading north, northeast, southeast, southwest, northwest, down (open door), and in.


Should the room name be a multi match, the script will display (?) after the area name.

As always, this requires a recent version of Mudlet. (Import with the package manager.)

Download link here.
Neos2012-02-27 01:16:03
Stop making me miss my comp more!!!!
Unknown2012-02-27 01:33:30
* Added an "(Unmapped)" cecho.
* Removed erroneous setting causing an unwanted echo.
Unknown2012-02-27 12:32:16
* Fixed a rather embarrassing error where it was incorrectly matching on Terentia's shrine lines.
Unknown2012-03-03 20:37:43
This function will provide Mudlet users with easy access to "warning" style labels.

The function currently accepts two arguments, label name and label text. The function is called as standard, i.e.
visWarning("test", "test")

It currently accepts two concurrent labels, with the second receiving a 75 pixel offset.


function visWarning(name, text)
local width, height = getMainWindowSize() -- Get our current window dimensions
local strLen = text:len() -- Find the character length of our "warning"
if windowExists == false then -- Does a warning window already exist?
createLabel(name, (width / 2) - 300, (height / 2) - 100, 250, 150, 1)
resizeWindow(name, strLen * 25, 70)
moveWindow(name, (width - (strLen * 25)) / 2, (height / 2) - 100) -- Dynamically place the window dependent on the length of our "warning"
windowExists = true
else
moveWindow(name, (width - (strLen * 25)) / 2, (height / 2) - 175)
end
setBackgroundColor(name, 255, 51, 51, 200)
echo(name, ] .. text .. ])
showWindow(name)
tempTimer(3, ] .. name .. ]) -- Remove the window after 3 seconds
resetFormat()
end


As always, this code is provided, "as-is" - Should there be any glaring issues, please do report them on this thread.

Thanks, and enjoy!
Unknown2012-03-03 22:00:07
Sample usage:

Pattern match:^(\\w+) begins to tumble towards the (\\w+)\\.$

Script:if matches == target:title() then
visWarning("tumble", matches:upper() .. " is tumbling " .. matches:upper() .. "!")
end
Unknown2012-03-04 15:15:06
Well, after popular request, I made the labels a little more "pretty" so to speak.

A small "shadowbox" stylesheet has been added to make these look more aesthetically pleasing.

function visWarning(name, text)
local width, height = getMainWindowSize() -- Get our current window dimensions
local strLen = text:len() -- Find the character length of our "warning"
if bwl.tracking.labelExists == false then -- Does a warning label already exist?
createLabel(name, (width / 2) - 300, (height / 2) - 100, 250, 150, 1)
setLabelStyleSheet(name, ])
resizeWindow(name, strLen * 25, 70)
moveWindow(name, (width - (strLen * 25)) / 2, (height / 2) - 100) -- Dynamically place the label dependent on the length of our "warning"
bwl.tracking.labelExists = true
else
moveWindow(name, (width - (strLen * 25)) / 2, (height / 2) - 175) -- Dynamically place with a 75 pixel offset if a label is already visible
end
setBackgroundColor(name, 255, 51, 51, 200)
echo(name, ] .. text .. ])
showWindow(name)
tempTimer(3, ] .. name .. ]) -- Remove the label after 3 seconds
resetFormat()
end



This was just a random stylesheet I located and added, so feel free to experiment with your own. Bear in mind, for Mudlet labels, it's QT's stylesheet properties you need, not plain CSS. There's a very subtle difference and some things will work, whilst others will not. Do take this into account if you are looking to apply a CSS3 stylesheet, for example.
Have fun.
Unknown2012-03-10 18:25:01
Unknown2012-03-10 19:11:17
If you want it all nicely aligned, just change the update_domoth_data() function to:


function update_domoth_data()
clearWindow("domoth_data")
domothData = createMiniConsole("domoth_data", 900, 350, 300, 300)
setMiniConsoleFontSize("domoth_data", 12)
for throne, holder in pairs(daze.core.domoths) do
cecho("domoth_data", "" .. throne .. string.rep(" ", (18 - #throne)) .. " - " .. holder .. "\\n")
end
end
Unknown2012-03-27 18:21:31
Need a quick and easy way to fill your rift with herbs? This script takes just a single argument, that being the number you wish to fill to. i.e.

rfill 1000

Omitting the number will default to 2000 of each herb.
Just copy the following code into a script object:

Code here.

Finally, create an alias with the pattern match of:

^rfill( \\d+)?$

Containing the code:

createHerbTable()
if matches then
parseRiftContents(matches)
doFillRift()
else
parseRiftContents()
doFillRift()
end


Enjoy :)
Arsalil2012-03-27 21:01:38
Thanks for being so awesome and taking the time to make all of these things, Draylor! I don't use most of them because I'm pretty dumb when it comes to coding and stuff and I'm afraid I'll break Mudlet and my laptop and maybe Lusternia altogether if I even touch this stuff. But you still put a lot of time and effort, and even make upgrades when people ask. So, thanks!
Lilia2012-03-27 22:03:18
If I wasn't so ocd about checking every shop, one herb at a time, I would totally use that. Maybe some day I'll settle on a shop I really like. >_>
Unknown2012-03-28 04:13:27
Lilia:

If I wasn't so ocd about checking every shop, one herb at a time, I would totally use that. Maybe some day I'll settle on a shop I really like. >_>


Heh. I used to be like this. Got tired of it in the end.
Unknown2012-03-28 13:04:54
I had to write this earlier for somebody who is happy for me to share, so here. As this is more advanced system coding stuff, I'm not going to bother explaining how to use it. I figure these functions are more suited to those who are like me... Know Lua but are either lazy or simply don't like reinventing the wheel.


timers = timers or {}
timers.sets = timers.sets or {}

function timing.set(name)
require("socket")
assert(type(name) == "string", "String required for timer name.")
local newtime = tostring(socket.gettime()):match("%w%w%.%w%w%w")
if timers.sets then
sysEcho("error", "Timer already exists!")
else
timers.sets = newtime
sysEcho("debug", "Time set.")
end
end

function timing.diff(name)
if timers.sets == {} then
sysEcho("error", "No timers set.")
else

timers.check = true
if not table.contains(timers.sets, name) then
sysEcho("error", "No timer by that name exists!")
timers.check = nil
end

if timers.check then
for k, v in pairs(timers.sets) do
if k == name then
local timenow = tostring(socket.gettime()):match("%w%w%.%w%w%w")
return tonumber((timenow - tonumber(v)))
end
end
end
end
end
Unknown2012-05-23 14:19:08
Handy little function for those people not using Mudlet that will return the area from a given room name.

function mmp.tellArea(query, who)
if query:ends('.') then query = query:sub(1,-2) end
local result = mmp.searchRoom(query)

if type(result) == "string" or not next(result) then
send("tell " .. who .. " room not found!") return end

local foo = "relevant area: "

currentRoom = mmp.currentroom
if not tonumber(select(2, next(result))) then -- old style
for roomid, roomname in pairs(result) do roomid = tonumber(roomid)
local foo = foo .. string.format("%s", tostring(roomname))
local foo = foo .. string.format(" is in %s", tostring(mmp.areatabler))
send("tell " .. who .. " " .. foo)
end
else -- new style
for roomname, roomid in pairs(result) do roomid = tonumber(roomid)
cecho(string.format(" %s (",
tostring(roomname)))
echoLink(roomid, 'mmp.gotoRoom('..roomid..')', string.format("Go to %s (%s)", roomid, tostring(roomname)))
cecho(string.format(") in the %s.\\n", tostring(mmp.areatabler)))
end
end
end



Usage:

Trigger: ^(\\w+) tells you\\, \\"Whereis (.+)\\.\\"$
Script: mmp.tellArea(matches, matches)
Unknown2012-05-23 14:34:59
This confuses me somewhat...