Skip to content

Instantly share code, notes, and snippets.

@chenasraf
Last active October 8, 2023 20:21
Show Gist options
  • Save chenasraf/0c294ebf7bee61fe96f8a77a81c5f466 to your computer and use it in GitHub Desktop.
Save chenasraf/0c294ebf7bee61fe96f8a77a81c5f466 to your computer and use it in GitHub Desktop.
Aardwolf MUSHclient alias - easy cexits for direction and back

How to use

  1. Add this alias
    • regular expression: true
    • send to: script
  2. Use m[o|u] to open. For example: mou becomes mapper cexit open u;;u mue becomes mapper cexit cast knock e;;open e;;e and also adds sets higher cexit_wait to make sure it succeeds
  3. If it's successful, it will create the same cexit in the opposite way

Notes

  1. If you want to change the command cast knock you can do so by changing the unlockCmd variable
  2. If you want to change the time it waits on unlock, change the unlockTimeout variable

Happy mudding!

require "gmcphelper"
require "wait"
local opposites = {
["w"] = "e",
["e"] = "w",
["s"] = "n",
["n"] = "s",
["u"] = "d",
["d"] = "u",
}
local dir = "%2"
local unlock = string.lower("%1") == "u"
local oppDir = opposites[dir]
local curRid = gmcp("room.info.num")
local unlockCmd = "cast knock"
local unlockTimeout = 7
local cmd = "mapper cexit "
local oppCmd = "mapper fullcexit {"
if unlock == true then
cmd = "mapper cexit_wait " .. unlockTimeout .. ";" .. cmd
cmd = cmd .. unlockCmd .. " " .. dir .. ";;"
oppCmd = oppCmd .. unlockCmd .. " " .. oppDir .. ";;"
end
cmd = cmd .. "open " .. dir .. ";;" .. dir
oppCmd = oppCmd .. "open " .. oppDir .. ";;" .. oppDir
wait.make(function()
Execute(cmd)
wait.time(unlock and unlockTimeout or 2)
local newRid = gmcp("room.info.num")
if curRid == newRid then
ColourNote("red", "", "mapper cexit didn't work, not adding opposite side")
else
oppCmd = oppCmd .. "} " .. newRid .. " " .. curRid .. " 0"
Execute(oppCmd)
end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment