Mudlet Scripts

From LSWiki

Jump to: navigation, search

This is a place for mudlet scripts that may be of interest to others.

Datetime conversion

This script converts datetimes (for example, from channel histories) into the corresponding date and time from the in-game calendar:

Trigger:

(\d+) (\w+) (\d+) (\d+):(\d+)

Script:

inyear = matches[2]
inmonnm = matches[3]
inday = matches[4]
inhr = matches[5]-3 -- This includes a manual offset for the difference between the system time in EST and my local time in PST.
inmin = matches[6]
if inmonnm == "Jan" then inmon = 1 end
if inmonnm == "Feb" then inmon = 2 end
if inmonnm == "Mar" then inmon = 3 end
if inmonnm == "Apr" then inmon = 4 end
if inmonnm == "May" then inmon = 5 end
if inmonnm == "Jun" then inmon = 6 end
if inmonnm == "Jul" then inmon = 7 end
if inmonnm == "Aug" then inmon = 8 end
if inmonnm == "Sep" then inmon = 9 end
if inmonnm == "Oct" then inmon = 10 end
if inmonnm == "Nov" then inmon = 11 end
if inmonnm == "Dec" then inmon = 12 end
timestamp = os.time{day=inday, year=inyear, month=inmon, hour=inhr, min=inmin}
year = math.floor(timestamp/16200000)+480
month = math.floor(timestamp/1620000)%10+1
day = math.floor(timestamp/54000)%30+1
hour = math.floor(timestamp/1800)%30
hour = string.format("%02i",hour)
minute = math.floor(timestamp/30)%60
minute = string.format("%02i",minute)
selectCaptureGroup(2)
replace(year)
selectCaptureGroup(3)
replace(month)
selectCaptureGroup(4)
replace(day)
selectCaptureGroup(5)
replace(hour)
selectCaptureGroup(6)
replace(minute)
  • This script changes the in-game dates from the events history to regular-world dates:

Trigger:

(\w+) (\d+) (\d+):(\d+) (\d+) 

Script:

inyear = matches[6]
inmonnm = matches[2]
inday = matches[3]
inhr = matches[4]
inmin = matches[5]
if inmonnm == "Arienle" then inmon = 1 end
if inmonnm == "Teliminus" then inmon = 2 end
if inmonnm == "Valien" then inmon = 3 end
if inmonnm == "Ysaril" then inmon = 4 end
if inmonnm == "Karmina" then inmon = 5 end
if inmonnm == "Ingot" then inmon = 6 end
if inmonnm == "Alystos" then inmon = 7 end
if inmonnm == "Gettrellyn" then inmon = 8 end
if inmonnm == "Rozgayn" then inmon = 9 end
if inmonnm == "Blayhrr" then inmon = 10 end
ts = ((inyear - 480)*16200000)+((inmon-1)*1620000)+((inday-1)*54000)+(inhr*1800)+(inmin*30)
dt = os.date("*t", ts)
dt["hour"] = string.format("%02i",dt["hour"])
dt["min"] = string.format("%02i",dt["min"])
dt["day"] = string.format("%02i",dt["day"])
dt["month"] = os.date("%b", ts)
selectCaptureGroup(6)
replace(dt["year"])
selectCaptureGroup(2)
replace(dt["month"])
selectCaptureGroup(3)
replace(dt["day"])
selectCaptureGroup(4)
replace(dt["hour"])
selectCaptureGroup(5)
replace(dt["min"])

Local Gag

Spammy minions? Wearing a flux suit? This script removes unwanted lines from your local display

Trigger? Whatever you want blocked. Put in as many of those annoyances you don't want to see as you want. Something like

As (.*) makes contact upon your fluxflow suit it emits a small flare of energy.
The (.*) rat

Script:

selectCurrentLine()
deleteLine()
tempLineTrigger(1,1, [[deleteLine()]])

Quick and dirty vitals bar capture

Want your vitals bar to just stay at the bottom and not spam every round and the in game settings for this don't work for you? This is something similar to what you want. Works good enough for me and I am sure you can do better if it isn't good enough for you!

Create a script called something dumb like Stuff Window with this in it

myinfo = Geyser.MiniConsole:new({
  name="myinfo",
  x = "0.2%", y = "98.5%",
  width = "99%", height = "2%",
})
setMiniConsoleFontSize("myinfo",10)
myinfo:setColor("black")

You'll probably want to screw with some numbers like the font size and space it takes up on your screen. Do what you want, I'm not your dad.

In the Mudlet options in the main display tab set the bottom border height to 25 is good enough those settings, more or less to taste.

Make a mudlet alias called cbar or something with this

clearWindow("myinfo")

just to clear it when it is not needed or the auto clear fails

Make a trigger called something like bar gag

Have a few triggers that are pearl regex. I have found these seem to cover most of the things needed, and I am sure there is a better way to do it but shut up!

^\[ Head(.*)\]
^\[ Body(.*)\]
^\[ Fear(.*)\]
^\[ Spiritual(.*)\]
^\[ Pain(.*)\]
^\[ Pleasure(.*)\]
^\[ Anger(.*)\]

Want it to do your sbar too? Just put a trigger in there to match it as well Code is

selectCurrentLine()
copy()
appendBuffer("myinfo")
deleteLine()
tempLineTrigger(1,1, [[deleteLine()]])

Want it to clear on combat end? another trigger with things like

(.*) disintegrates
(.*) dies
(.*) collapses into a pile of bones

and code of

clearWindow("myinfo")

will do it.

You now might have a dodgy but working vitals bar at the bottom of your screen.

Personal tools