I don't know if a thread like this exists already, but, here are some I've made that I think are useful:
What's it do: Has you send clan tells by the short name; makes you less likely to miss between clans or onto CT
What you need to do: Make a new alias, put in the pattern, put in the code. For the empty parenthesis in the pattern, put the shortnames of your clans, separated by a |. So if you have two clans, xyz and abc, you would put xyz|abc in. So the pattern would look like this: ^(xyz|abc) (.*)$
Pattern: ^() (.*)$
Code: send("clan " .. matches[2] .. " tell " .. matches[3])
To use: xyz Hi
The result: (Clan XYZ): You say, "Hi."
What's it do: Simplistic curio rubbing; gives you lots of control with less typing; not automatic
What you need to do: Make a new alias, put in the pattern, put in the code.
Pattern: ^crub ([\d ]+)$
Code:
tempcuriolist = matches[2]:split(" ")
for i=1, table.size(tempcuriolist) do
send("curio rub " .. tempcuriolist[i])
end
tempcuriolist = nil
To use: crub 1069 4687 2098612
The result: << curio rubbing spam >>
What's it do: Returns a list of keys of a table
What you need to do: Make a script or put it in an existing script of yours, not as part of a pre-existing function
Code:
function keys(tab)
temptable = {}
for k,v in pairs(tab) do
table.insert(temptable, k)
end
return temptable
end
To use in your code: display(keys(SomeTableWithKeysAndValues))
The result: << all the keys for the table SomeTableWithKeysAndValues >>
Comments
^x (.*)$
sends
target = matches[2]
cecho("<blue>[<white>System<blue>]<white>: <white:blue>Target set: " .. string.upper(matches[2]) .. ".")
------------------------------------------If you want to change the variable (in this case "target"), you can do so. Just change the bolded target to whatever you want. Likewise, you can actually change the colours in the bottom line to whatever you want, and the words in the prompt to whatever you want as well. Make sure the top portion is set to regex.
Trigger Pattern: return isPrompt()
Code: Result: Prepends a timestamp to your prompt that gets included in logs.
Sorry if there's a potential error... Was writing completely from memory >.>
Create Them
[spoiler]
(important) Name: create_gauges()
Event Handler: sysLoadEvent
Code:
function create_gauges()
setBottomBorder(30)
gWW, gWH = getMainWindowSize()
health_gauge = Geyser.Gauge:new({ name = "health_gauge", x = "5%", y = gWH-30,height = 30, width = "17%",})
health_gauge.front:setStyleSheet([[background-color: red; border-top: 1px black solid; border-left: 1px black solid; border-bottom: 1px black solid; border-radius: 7; padding: 3px;]])
health_gauge.back:setStyleSheet([[background-color: black; border-width: 1px; border-color: red; border-style: solid; border-radius: 7; padding: 3px;]])
health_gauge:setValue(50,100)
mana_gauge = Geyser.Gauge:new({ name = "mana_gauge", x = "23%", y = gWH-30,height = 30, width = "17%",})
mana_gauge.front:setStyleSheet([[background-color: blue; border-top: 1px black solid; border-left: 1px black solid; border-bottom: 1px black solid; border-radius: 7; padding: 3px;]])
mana_gauge.back:setStyleSheet([[background-color: black; border-width: 1px; border-color: blue; border-style: solid; border-radius: 7; padding: 3px;]])
mana_gauge:setValue(50,100)
ego_gauge = Geyser.Gauge:new({ name = "ego_gauge", x = "41%", y = gWH-30,height = 30, width = "17%",})
ego_gauge.front:setStyleSheet([[background-color: LightSkyBlue; border-top: 1px black solid; border-left: 1px black solid; border-bottom: 1px black solid; border-radius: 7; padding: 3px;]])
ego_gauge.back:setStyleSheet([[background-color: black; border-width: 1px; border-color: LightSkyBlue; border-style: solid; border-radius: 7; padding: 3px;]])
ego_gauge:setValue(50,100)
will_gauge = Geyser.Gauge:new({ name = "will_gauge", x = "59%", y = gWH-30,height = 30, width = "17%",})
will_gauge.front:setStyleSheet([[background-color: purple; border-top: 1px black solid; border-left: 1px black solid; border-bottom: 1px black solid; border-radius: 7; padding: 3px;]])
will_gauge.back:setStyleSheet([[background-color: black; border-width: 1px; border-color: purple; border-style: solid; border-radius: 7; padding: 3px;]])
will_gauge:setValue(50,100)
end_gauge = Geyser.Gauge:new({ name = "end_gauge", x = "77%", y = gWH-30,height = 30, width = "17%",})
end_gauge.front:setStyleSheet([[background-color: yellow; border-top: 1px black solid; border-left: 1px black solid; border-bottom: 1px black solid; border-radius: 7; padding: 3px;]])
end_gauge.back:setStyleSheet([[background-color: black; border-width: 1px; border-color: yellow; border-style: solid; border-radius: 7; padding: 3px;]])
end_gauge:setValue(50,100)
end
[/spoiler]
Update Them
[spoiler]
(important) Name: update_gauges()
Event Handler: gmcp.Char.Vitals
Code:
function update_gauges()
local php = math.floor((tonumber(gmcp.Char.Vitals.hp)/tonumber(gmcp.Char.Vitals.maxhp))*100)
local pmp = math.floor((tonumber(gmcp.Char.Vitals.mp)/tonumber(gmcp.Char.Vitals.maxmp))*100)local pegp = math.floor(tonumber(gmcp.Char.Vitals.ego)/tonumber(gmcp.Char.Vitals.maxego))*100)
local pep = math.floor((tonumber(gmcp.Char.Vitals.ep)/tonumber(gmcp.Char.Vitals.maxep))*100)
local pwp = math.floor((tonumber(gmcp.Char.Vitals.wp)/tonumber(gmcp.Char.Vitals.maxwp))*100)
if php > 100 then php = 100 end
health_gauge:setValue(php,100)
if pmp > 100 then pmp = 100 end
mana_gauge:setValue(pmp,100)
if pegp > 100 then pegp = 100 end
ego_gauge:setValue(pegp,100)
if pep > 100 then pep = 100 end
endurance_gauge:setValue(pep,100)
if pwp > 100 then pwp = 100 end
willpower_gauge:setValue(pwp,100)
end
[/spoiler]
gust - gusts whoever is set as 'target', checks roomexits and picks the 2nd one
gust <person> - gusts whoever, direction is decided as above
gust <direction> - gusts target in chosen direction
gust <person> <direction> - obvious.
gust <direction> <person> - also obvious.
Alias: ^gust$|^gust (\w+)$|^gust (\w+) (\w+)$
Code:
[spoiler]
p, li { white-space: pre-wrap; }
local currentRoomExits = getRoomExits(mmp.currentroom)
local gustDirection = "none"
local gustTarget = "none"
local directions = {
"north",
"south",
"west",
"east",
"northwest",
"northeast",
"southwest",
"southeast",
"up",
"down",
"in",
"out"
}
local short_dir = {
n = "north",
s = "south",
w = "west",
e = "east",
nw = "northwest",
ne = "northeast",
sw = "southwest",
se = "southeast",
u = "up",
d = "down",
i = "in",
o = "out"
}
if not matches[2] then
gustTarget = target
for k,v in pairs(currentRoomExits) do
gustDirection = k
break
end
elseif matches[2] and not matches[3] then
if short_dir[matches[2]] or directions[matches[2]] then
gustDirection = matches[2]
gustTarget = target
else
if ndb.isperson(string.title(matches[2])) then
gustTarget = matches[2]
for k,v in pairs(currentRoomExits) do
gustDirection = k
break
end
else
gustTarget = target
for k,v in pairs(currentRoomExits) do
gustDirection = k
break
end
end
end
else
if short_dir[matches[2]] or directions[matches[2]] then
gustDirection = matches[2]
gustTarget = matches[3]
else
gustDirection = matches[3]
gustTarget = matches[2]
end
end
if gustTarget ~= "none" then
mm.doadd("point gust at " .. gustTarget .. " " .. gustDirection)
if gustRecharge then killtrigger(gustRecharge) end
gustRecharge = tempTrigger([[A gust of wind rises to push]], [[send("recharge gust from cube")]])
end
[/spoiler]Edit: Holy mangled code. Way to go, forums.
Know what this thread needs? More snippets.
cecho("<white>Targetting: " .. target)
if target_lower then killTrigger(target_lower) end
target_lower = tempTrigger(target, [[selectString("]] .. target .. [[", 1) fg("dark_orange")bg("midnight_blue") deselect() resetFormat()]])
if target_title then killTrigger(target_title) end
target_title = tempTrigger(target:title(), [[selectString("]] .. target:title() .. [[", 1) fg("dark_orange") bg("midnight_blue") deselect() resetFormat()]])
end[/spoiler]
EDIT: I...I don't understand this spoiler tag.
Here is an old gem for which I take no credit, I forget where this thing came from. It's ridiculously simple.
Use: #40 thing will send "thing" 40 times.
alias: ^#(\d+) (.*)$
code:
for i = 1, tonumber(matches[2]) do
send(matches[3])
end
And finally, here is a tiny alias that I made to make my life easier with having to quickly make and populate covens for resurgems and such. It could pretty easily be repurposed for you southern folk -peer-.
alias: ^cv(?: )?(\w+)( .*)?$
code:
[spoiler]
if matches[2] then
if matches[3] then
if matches[2] == "add" then
send("mooncoven join" .. matches[3])
else
send("mooncoven " .. matches[2] .. matches[3])
end
else
send("mooncoven " .. matches[2])
end
end
use:
cvform, cvcircle, cvappoint, cvleave, etc.
cvadd <person> is the same as cvjoin <person>, because I kept forgetting the syntax and that seems more intuitive.[/spoiler]
cecho(" <magenta>(+".. essenceValue ..")")
This compares your essence after killing something with what you had when you initiated the attack, and shows the difference. The result is a cute little indication of how much essence you get for killing all the things.
I haven't tested it for aetherhunting yet, but I feel like it should also work if you stick the first snippet in a ^Drawn by the flux of energy trigger and the second in suddenly explodes!$ trigger.
Estarra the Eternal says, "Give Shevat the floor please."
Estarra the Eternal says, "Give Shevat the floor please."
crystals = 0
end
crystals = crystals + 1
deleteLineP()
cecho("\n<purple>You have <white>".. crystals .."<purple> crystals.")
This simply counts your crystal corpses collected from the air above the Transphenortex Grid and shows you how many you have. When you get 44, that's all of them!
Step 2.
Trigger type: Perl regex
Trigger pattern: ^"(.+)hedron(.+)"
Code:
send("give crystal to " .. matches[3])
This fires when you do IH in a room with any Continuum polyhedron. It will attempt to give each one a crystal (even wonder crystals). Polyhedra will spit back anything other than crystal corpses, and if they're already charged, they won't accept further corpses.
Step 3.
Trigger type: Perl regex
Trigger pattern: ^(.+) begins to glow as the corpse of a glistening crystal sinks into it
Code:
crystals = crystals - 1
cecho("\n<purple>You have <white>" .. crystals .. "<purple> crystals.")
This just counts your crystals back down to zero so you know when you've fed all the polyhedra. I'm sure a better coder than I could automate this even further by using GMCP to detect crystal corpses in your inventory and polyhedra in the room on Continuum, but this is functional enough for my purposes even if it's not the most efficient code. ">
P.S. The Continuum power quest generates Hallifax ikons, so it can be marginally worthwhile for influencers and psychodrama enthusiasts!
Estarra the Eternal says, "Give Shevat the floor please."
Min-Heaps one way of creating priority queues, allowing you execute specific actions in order, given a certain priority. They're called "Min-Heaps" because the smallest number priority goes first (1 goes before 2, etc). The interface is pretty simple:
local h = heap.new()
heap.insert(h, action("actionName", 1, "balance", "say Hiya!"))
local someAction = heap.extract(h) -- "actionName"
heap.insert(h, action("action2", 2, "balance", "say Hiya!"))
heap.insert(h, action("action1", 1, "balance", function() send("say Hello!") end))
someAction = heap.head(h) -- "action1"
someAction = heap.extract(h) -- "action1"
someAction = heap.extract(h) -- "action2"
The "action" function as shown above has 4 parameters: the action name, it's priority, whatever in-game balance it uses (balance, equilibrium, psiid, etc), and the command to be sent. The command can either be a string (good for simple, one line commands) or an anonymous function -- which is just a function without a name -- , depending on how complex your needs are.
The heap itself has 3 main functions: insert, which will insert a new action into the queue; head, which will return the highest priority action in the queue, but not remove it; and extract, which will remove the highest priority action from the queue and return it (just in case it needs to be used later).
http://pastebin.com/6EFTEcZY
You can always upload your XML package to Github as a Gist. From there, if anyone wants to make improvements to your code, they can fork, change, then submit a pull request for your approval.
https://www.dropbox.com/s/bkpl0vvkb3dq2gs/EsteemEssenceCalculator.xml.xml?dl=1
https://www.dropbox.com/s/q8v27nxz5j10mqu/FamilyPoliticsTracker.xml?dl=1
PS. You can also use houses["Shevat"], houses["Stormcrow"], houses["d'Murani"] etc. as variables for the honour of each house since you last updated using "uph" to make fun aliases to keep track of the progress of your favourite (and least favourite) houses. I have an alias to check how much honour Shevat still needs to be officially declared the best house in Hallifax.
The eye of Dylara materialises in your hands and flings itself around your neck, tightening incomprehensibly until it is irremovable.
Perfectly clean, this eyeball has been wrenched from the socket of Dylara. It has been animated by some unusual force, constantly looking around itself as if in shock or fear. It is bathed in a light covering of white flames that roll endlessly over its surface. A single chain of empyreal metal pierces either side of the eye, allowing it to be worn around the neck.
https://www.dropbox.com/s/31qbex4f9eyg0aj/GMCPChat.trigger.xml?dl=0
if entity == nil then
entity = 0
end
entity = entity + 1
cecho("\n<blaze_orange>You have <white>".. entity .."<blaze_orange> entities.")
Trigger 2:
Exact Match
You suddenly scoop up a congealed wad of flesh.
You pick up a congealed wad of flesh.
A screeching morrible thrusts a congealed wad of flesh back into your hands.
if flesh == nil then
flesh = 0
end
if entity > 0 then
entity = entity - 1
end
flesh = flesh +1
cecho("\n<blaze_orange>You have <white>".. entity.."<blaze_orange> entities.")
cecho("\n<blaze_orange>You have <gold>".. flesh .."<blaze_orange> globs of flesh.")
Trigger 3:
Exact Match
You give a congealed wad of flesh to a squirming sludgeworm.
You give a congealed wad of flesh to a floating spix.
You give a congealed wad of flesh to a tangled hekoskeri.
You give a congealed wad of flesh to a screeching morrible.
You give a congealed wad of flesh to a bulbous ribbachi.
flesh = flesh - 1
cecho("\n<blaze_orange>You have <gold>" .. flesh .. "<blaze_orange> flesh.")
Trigger 4:
Perl Regex
^"morrible(.+)"
^"spix(.+)"
^"sludgeworm(.+)"
^"ribbachi(.+)"
^"hekoskeri(.+)"
send("give flesh to " .. matches[2])
send("take flesh")
Alias:
Pattern
^alldone$
flesh = 0
entity = 0
cecho("\n<blaze_orange>You're all done with this! Variables reset!")
This runs just like his, IH will give flesh to appropriate creatures, pick it up as necessary, and count it for you. Hope it helps.
Ixion tells you, "// I don't think anyone else had a clue, amazing form."
Code
if not Tags then Tags = {} end
if matches[5] then
if Tags[matches[4]] then
killTrigger(Tags[matches[4]])
Tags[matches[4]] = nil
Tags[matches[4]] = tempTrigger(matches[4], [[selectString("]] .. matches[4] .. [[", 1) fg("]]..matches[5]..[[") resetFormat()]])
else
Tags[matches[4]] = tempTrigger(matches[4], [[selectString("]] .. matches[4] .. [[", 1) fg("]]..matches[5]..[[") resetFormat()]])
end
else
if Tags[matches[3]] then
killTrigger(Tags[matches[3]])
Tags[matches[3]] = nil
else
Tags[matches[3]] = tempTrigger(matches[3], [[selectString("]] .. matches[3] .. [[", 1) fg("cyan") resetFormat()]])
end
end
Constraints Only takes 1 word or 1 word and 1 colour (where colours are mudlet's predefined colours). Case sensitive.
Use 'tag <x>' will highlight x in cyan. If x is already being highlighted the temptrigger will be removed and x will no longer be highlighted.
'tag <x> <col>' will highlight x in col. If x is already being highlighted the temptrigger will be removed and a new temp trigger will be created with the appropriate colour. It will not purge a temptrigger which already exists if the same conditions are already met (Use 'tag <x>' for this)
Note that select string is used so if you 'tag box' then the 'box' in boxers will be highlighted but the 'ers' in boxers will not.
Like all temp triggers they will purge when the client closes and there's no fuss with playing around in mudlet.
If there's an easier way to do with without code please let me know!
== Professional Girl Gamer ==
Yes I play games
Yes I'm a girl
get over it