Mudlet Scripts
From LSWiki
Revision as of 01:49, 10 September 2022; Rebus (Talk | contribs)
(diff) ←Older revision | Current revision | Newer revision→ (diff)
(diff) ←Older revision | Current revision | Newer revision→ (diff)
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()]])