Scripting for vibes
I've been working on them for about two days now, trying to figure out how to do what... finally got enough down to get individual vibes down:
Pattern:^e (.+)$
local vibes={
dissipate="outr pentagon;spin pentagon;embed dissipate",
palpitation="outr cylinder;spin cylinder;embed palpitation",
heat="outr pyramid;spin pyramid;embed heat",
alarm="outr spiral;spin spiral;embed alarm",
tremors="outr disc;outr egg;spin disc;spin egg;embed tremors;inr disc",
reverberation="outr disc;outr pentagon;spin disc;spin pentagon;embed reverberation",
adduction="outr disc;outr polyhedron;spin disc;spin polyhedron;embed adduction",
harmonyheal="outr egg;outr sphere;spin egg;spin sphere;embead harmony;tune harmony healing",
harmonyrestoration="outr egg;outr sphere;spin egg;spin sphere;embead harmony;tune harmony restoration",
creeps="outr torus;spin torus;embed creeps",
silence="outr egg;spin egg;embed silence",
revelation="outr cube;outr diamond;embed revelation",
grounding="outr sphere;spin sphere;embed grounding",
oscillate="outr diamond;spin diamond;embed oscillate",
focus="outr pyramid;spin pyramid;embed focus",
disorentation="outr spiral;spin spiral;embed disorentation",
damage="outr pentagon;outr cylinder;spin pentagon;spin cylinder; embed dissipate;queue add eq embed palpitation",
}
if matches[2] then
send(vibes[matches[2]])
end
I have only scripted what I have up to at the moment. Wondering if there was an easier way to do this, or if this is genrally it?
I have dampen in a separate alias workup, generally the same as above, but shorter, again dampening individually.
Comments
-
I guess it depends what you're looking to do, you could automate (gasp) all your vibes to be spun for you with a single alias, and having an alias to stop it for whatever reason, and utilise the trigger line of the vibe being embeded to enable to next vibration to be spun/embeded.
0 -
i had svof auto all my harmonics for me but then i realized usually i just wanted one or two harmonics for most rooms and situations, so i made aliases for each one and now i just use those aliases if i want all the harmonics in one room as well
one suggestion is that you shorten the name for the vibe so e dissipate becomes e dis or whatever is easy for you to rememberspread positivity1 -
Aylek said:you could automate (gasp) all your vibes to be spun for you with a single alias
I mean I have already started to build the damage vibes into one summoning and working on affliction.0 -
You've got a typo in the spelling of disorientation. Also, unless I'm mistaken, the lines should be more of:
["grounding"] = "outr sphere;spin sphere;embed grounding",
since doing: grounding = "outr sphere;spin sphere;embed grounding",
would be equivalent to setting: vibes[grounding] = "outr sphere;spin sphere;embed grounding",
If you don't have a variable called grounding set up already, that should be throwing an error because vibes[nil] can't be assigned a value.
Syntax/spelling aside, that seems to be a pretty efficient way to handle it, although since efficiency isn't really vital in an alias you're running at most a few times a second, you could change it to the following if you found that it improved readability for you:if matches[2]=="heat" then<br> send(<span>"outr pyramid;spin pyramid;embed heat")<br>elseif matches[2]=="</span><span>alarm" then<br> send("</span><span>outr spiral;spin spiral;embed alarm")<br>etc...</span>
Not sure there is an objectively best way to do this particular task really.1 -
-
{["thing"] = thing} is only really needed for stuff that has multiple words, like limb counters for example:
limbC = {["right leg"] = 6, ["right arm"] = 3, head = 0}
etc. All function the same way, but now you can, for example have a trigger that does:
You swing giant weapon at victim's right leg.
You swing giant weapon at victim's head.
Use a catch-all trigger of: ^You swing (.+) at \w+'s (.+).$
Then rather searching the table, you can just do limbC[matches[3]] = limbC[matches[3]] + 1
0 -
Kaylalee said:Aylek said:you could automate (gasp) all your vibes to be spun for you with a single alias
I mean I have already started to build the damage vibes into one summoning and working on affliction.
0 -
Vessil said:Also, unless I'm mistaken, the lines should be more of:
["grounding"] = "outr sphere;spin sphere;embed grounding",
since doing: grounding = "outr sphere;spin sphere;embed grounding",
would be equivalent to setting: vibes[grounding] = "outr sphere;spin sphere;embed grounding",
If you don't have a variable called grounding set up already, that should be throwing an error because vibes[nil] can't be assigned a value.
I'm really, really not a fan of when people define tables inside an alias/trigger/etc. Initialising a table every single time you run the alias just seems wasteful; create a script object that initialises the table and actually stores it in memory, and use that every time. I'm also a fan of namespaces since they reduce the chances of conflicts with other people's scripts and their variables.
I'd likely do something like this:vibes = vibes or {} vibes.crystals = vibes.crystals or { dissipate = {"pentagon"}, adduction = {"disc", "polyhedron"}, } vibes.shortnames = { diss = "dissipate", add = "adduction", gr = "grounding" } vibes.embed = function(vibe) local vibe = vibes.shortnames[vibe] or vibe local crystals = vibes.crystals[vibe] local commands = {} for _, crystal in ipairs(crystals) do table.insert(commands, "outr " .. crystal) table.insert(commands, "spin " .. crystal) end table.insert(commands, "embed " .. vibe) send(table.concat(commands, ";")) -- I'd actually call a function to queue it here end
Uses a namespace, keeps the list of crystals around (this is useful information for other things you might want to do, such as determining which vibe(s) an opponent Magi is embedding), and also allows mapping shortnames to full vibe names easily. Your alias would just have vibes.embed(matches[2]) as the code.
3 -
-
oh, alias, derp.
Thank you0 -
Having the ones added after not working for me now, unsure what I've done wrong,
vibes = vibes or {} vibes.crystals = vibes.crystals or { dissipate = {"pentagon"}, adduction = {"disc", "polyhedron"}, palpitation = {"cylinder"}, heat = {"pyramid"}, alarm = {"spiral"}, tremors = {"disc", "egg"}, reverberation = {"disc", "pentagon"}, harmony = {"egg", "sphere"}, creeps = {"torus"}, silence = {"egg"}, revelation = {"cube", "diamond"}, grounding = {"sphere"}, oscillate = {"diamond"}, focus = {"pyramid"}, disorientation = {"spiral"}, } vibes.shortnames = { diss = "dissipate", add = "adduction", pal = "palpitation", he = "heat", al = "alarm", tr = "tremors", reverb = "reverberation", har = "harmony", cre = "creeps", sil = "silence", gr = "grounding", osc = "oscillate", fo = "focus", diso = "disorientation", } vibes.embed = function(vibe) local vibe = vibes.shortnames[vibe] or vibe local crystals = vibes.crystals[vibe] local commands = {} for _, crystal in ipairs(crystals) do table.insert(commands, "outr " .. crystal) table.insert(commands, "spin " .. crystal) end table.insert(commands, "embed " .. vibe) send(table.concat(commands, ";")) -- I'd actually call a function to queue it here end
0 -
saving profile and restarting mudlet was the answer.0
-
@Kaylalee Oh, should probably explain the x = x or y syntax. If the variable x doesn't exist (i.e. is nil) then it will give it the value y, otherwise it will just be the existing value (x). That means that it will only initialise the table once, so any changes to the contents of the table in the script object after the first time that script executes won't be reflected until you restart Mudlet (or manually set x to nil, then save the script object again).1
-
Here's my script:
magi={}
cmd_sep="|"
function magi.embed(vibe, misc)
local command = ""
for i, crystal in ipairs(magi.crystals[vibe]) do
command = command.."outr "..crystal..cmd_sep.."spin "..crystal..cmd_sep
end
if misc ~= nil and vibe == "sonicportal" then
command = command.."embed "..vibe.." "..misc
else
command = command.."embed "..vibe
end
send("queue add eqbal stand"..cmd_sep..command)
end
magi.crystals = {
["dissipate"] = { "pentagon" },
["palpitation"] = { "cylinder" },
["heat"] = { "pyramid" },
["alarm"] = { "spiral" },
["tremors"] = { "disc", "egg" },
["reverberation"] = { "disc", "pentagon" },
["sonicportal"] = { "sphere", "torus" },
["adduction"] = { "disc", "polyhedron" },
["harmony"] = { "egg", "sphere" },
["creeps"] = { "torus" },
["silence"] = { "egg" },
["revelation"] = { "cube", "diamond" },
["grounding"] = { "sphere" },
["oscillate"] = { "diamond" },
["focus"] = { "pyramid" },
["energise"] = { "polyhedron"},
["stridulation"] = { "cylinder", "polyhedron" },
["gravity"] = { "egg", "torus" },
["forest"] = { "diamond", "pyramid" },
["dissonance"] = { "cylinder", "sphere", "spiral" },
["plague"] = { "cube", "pyramid", "spiral" },
["lullaby"] = { "pyramid" },
["retardation"] = { "disc" },
["disorientation"] = { "spiral" },
["forest"] = { "diamond", "pyramid" },
}
2
Categories
- 6K All Categories
- 3K Everything Achaea
- 1.5K North of Thera
- 21 Archives of the Terraformer
- 240 The Matsuhama Arena
- 873 The Golden Dais of Creation
- 283 The Scarlattan Theatre
- 144 The Blank Canvas
- 1.9K Getting Help
- 389 General Questions
- 247 Quick Class Questions
- 1.3K Tech Support
- 298 Client Help
- 456 Curing Systems and Scripts
- 829 Off-Topic
- 250 The Wander Inn
- 579 The Universal Membrane
- 280 Class Discussions
- 280 Individual Class Sections
- 20 Alchemist
- 8 Apostate
- 29 Blademaster
- 9 Depthswalker
- 12 Druid
- 4 Infernal
- 20 Jester
- 19 Magi
- 30 Monk
- 9 Occultist
- 7 Paladin
- 7 Priest
- 28 Runewarden
- 17 Sentinel
- 24 Serpent
- 19 Shaman
- 9 Sylvan