Tracking Levels and Wish Protections in MUSHClient
In this article, we walk through creating some aliases and triggers that will allow you to track any wish protections (such as from web, marbu, dirt kick, etc.).
Tracking wish protection
If you’d like to see the payoff for your well-spent quest points, you can add the following alias to print your protection stats.
Copy the following XML, and then hit Ctrl-Shift-9 in MUSHClient to open the Aliases page. Click the Paste button and your new alias will be created:
<aliases>
<alias
match=”protectionstats”
enabled=”y”
send_to=”12″
sequence=”100″
>
<send>Note(GetVariable(‘n_levels’) .. ” levels recorded so far.”)
Note(GetVariable(‘n_dirt’) .. ” dirt attacks prevented.”)
Note(GetVariable(‘n_web’) .. ” web attacks prevented.”)
Note(GetVariable(‘n_marbu’) .. ” marbu attacks prevented.”)
Note(GetVariable(‘n_teleport’) .. ” teleports prevented.”)
Note(GetVariable(‘n_vorpal’) .. ” vorpals prevented.”)</send>
</alias>
</aliases>
Note: if you don’t have any of the above wishes, this would be a good opportunity to track the attacks that DO affect you! Then just remove the “prevented” word in the above alias, and your report will make sense.
Next, we’ll start filling in those variables.
Creating a level up trigger
Copy the following XML, and then hit Ctrl-Shift-8 in MUSHClient to open the Triggers page. Click Paste and your new trigger will be created:
<triggers>
<trigger
clipboard_arg=”1″
enabled=”y”
expand_variables=”y”
match=”You raise a level! You are now level *.”
send_to=”12″
sequence=”100″
>
<send>– Search for equipment
SetVariable(‘level’, %1)
SetVariable(‘tierlevel’, GetVariable(‘level’) + 10)
Execute(‘dinv search level ‘ .. GetVariable(‘tierlevel’))
Note(‘New level: ‘ .. GetVariable(‘level’) .. ‘. Searched for gear at level ‘ .. GetVariable(‘tierlevel’))
— Set n_levels
if GetVariable(‘n_levels’) == nil then
SetVariable(‘n_levels’, 0)
end
SetVariable(‘n_levels’, tonumber(GetVariable(‘n_levels’)) + 1)</send>
</trigger>
</triggers>
Now, I threw in a bonus here, which will search for any equipment at your new level, each time you level up. To ensure it works, create a variable called ‘tierlevel’ with your tier (0, 1, etc.). If you don’t have dinv installed, or don’t want to use this portion, simply remove the top section of the <send> block, and only keep the part below “Set n_levels”.
This trigger will start tracking the number of levels you have risen from the time you created the trigger.
Creating the protection triggers
Now you can create the following triggers (using the same Paste method above):
Dirt Kick
<triggers>
<trigger
custom_colour=”11″
enabled=”y”
group=”detections”
make_underline=”y”
match=”Unseen * dirt*”
send_to=”12″
sequence=”100″
>
<send>if GetVariable(‘n_dirt’) == nil then
SetVariable(‘n_dirt’, 0)
end
SetVariable(‘n_dirt’, tonumber(GetVariable(‘n_dirt’)) + 1)
Note(GetVariable(‘n_dirt’) .. ” dirt attacks avoided in ” .. GetVariable(‘n_levels’) .. ” levels!”)</send>
</trigger>
</triggers>
I no longer know the text that would appear if you actually got dirt kicked in your eyes, but I’m hoping someone will provide an example in case you don’t have the wish and want to track how many times you’ve had your eyes dirt-kicked.
Vorpal
If you don’t have the novorpal wish, you can track it here:
<triggers>
<trigger
custom_colour=”1″
enabled=”y”
group=”detections”
make_underline=”y”
match=”* DECAPITATES you!*”
regexp=”n”
send_to=”12″
sequence=”100″
>
<send>if GetVariable(‘n_vorpal’) == nil then
SetVariable(‘n_vorpal’, 0)
end
SetVariable(‘n_vorpal’, tonumber(GetVariable(‘n_vorpal’)) + 1)
Note(GetVariable(‘n_vorpal’) .. ” vorpal attacks in ” .. GetVariable(‘n_levels’) .. ” levels!”)</send>
</trigger>
</triggers>
If you do have the novorpal wish, track protections with this:
<triggers>
<trigger
custom_colour=”1″
enabled=”y”
group=”detections”
make_underline=”y”
match=”^Unseen (.*?) (head|decapitat)(.*?)$”
regexp=”y”
send_to=”12″
sequence=”100″
>
<send>if GetVariable(‘n_vorpal’) == nil then
SetVariable(‘n_vorpal’, 0)
end
SetVariable(‘n_vorpal’, tonumber(GetVariable(‘n_vorpal’)) + 1)
Note(GetVariable(‘n_vorpal’) .. ” vorpal attacks avoided in ” .. GetVariable(‘n_levels’) .. ” levels!”)</send>
</trigger>
</triggers>
Web
<triggers>
<trigger
custom_colour=”1″
enabled=”y”
group=”detections”
make_underline=”y”
match=”Unseen * web*”
send_to=”12″
sequence=”100″
>
<send>if GetVariable(‘n_web’) == nil then
SetVariable(‘n_web’, 0)
end
SetVariable(‘n_web’, tonumber(GetVariable(‘n_web’)) + 1)
Note(GetVariable(‘n_web’) .. ” web attacks in ” .. GetVariable(‘n_levels’) .. ” levels!”)</send>
</trigger>
</triggers>
Marbu
If you don’t have the nomarbu wish, you can track it here:
<triggers>
<trigger
custom_colour=”7″
enabled=”y”
group=”detections”
make_underline=”y”
match=”* poison * your eyes stream in agony*”
send_to=”12″
sequence=”100″
>
<send>if GetVariable(‘n_marbu’) == nil then
SetVariable(‘n_marbu’, 0)
end
SetVariable(‘n_marbu’, tonumber(GetVariable(‘n_marbu’)) + 1)
Note(GetVariable(‘n_marbu’) .. ” marbu attacks in ” .. GetVariable(‘n_levels’) .. ” levels!”)</send>
</trigger>
</triggers>
If you do have the nomarbu wish, track it this way:
<triggers>
<trigger
custom_colour=”7″
enabled=”y”
group=”detections”
make_underline=”y”
match=”Unseen* poison *”
send_to=”12″
sequence=”100″
>
<send>if GetVariable(‘n_marbu’) == nil then
SetVariable(‘n_marbu’, 0)
end
SetVariable(‘n_marbu’, tonumber(GetVariable(‘n_marbu’)) + 1)
Note(GetVariable(‘n_marbu’) .. ” marbu attacks in ” .. GetVariable(‘n_levels’) .. ” levels!”)</send>
</trigger>
</triggers>
Teleport
I’ve never encountered this one, but so far this is my guess for preventing a teleport:
<triggers>
<trigger
custom_colour=”1″
enabled=”y”
group=”detections”
make_underline=”y”
match=”Unseen * teleport*”
send_to=”12″
sequence=”100″
>
<send>if GetVariable(‘n_teleport’) == nil then
SetVariable(‘n_teleport’, 0)
end
SetVariable(‘n_teleport’, tonumber(GetVariable(‘n_teleport’)) + 1)
Note(GetVariable(‘n_teleport’) .. ” teleport attacks in ” .. GetVariable(‘n_levels’) .. ” levels!”)</send>
</trigger>
</triggers>
Summing up
Once you’ve created either the positive or negative detection triggers, you can run your “protectionstats” alias to see how many things have been either done to you or stopped from being done to you, compared with the number of levels. An example of my output is:
154 levels recorded so far.
130 dirt attacks prevented.
78 web attacks prevented.
44 marbu attacks.
0 teleports prevented.
0 vorpals prevented.
Due to this, I suspect my teleport and vorpal prevention triggers may be off, but I’ll correct it as necessary.
- Published in Public, Public-Guides
More MUSHClient aliases
Just to build on my article, I’ll add some more useful aliases I’ve used:
<aliases>
<alias
match="do * *"
enabled="y"
send_to="12"
keep_evaluating="y"
sequence="100"
>
<send>local num = %1
for i = 1,num,1 do
Execute ("%2")
end</send>
</alias>
</aliases>
This lets you repeat an action. Let’s say you’re at Pixie, our healer:
do 10 heal heal
This will run the command “heal heal” 10 times
- Published in Public
MUSHclient Meta Aliases and useful Triggers
-
- In MUSHclient, hit Ctrl-Shift-9 to bring up the Aliases configuration.
- For this article, click the Tree View check box so we can easily group the aliases.
- Expand special_convenience_aliases
- Double-click on #alias {*} {*} to see what it does.
Cycling Attack Meta Alias
> t1 kobold
> hol
cast 'holy strike' kobold
> hol
cast repentance kobold
> hol cast 'holy strike' kobold
Creating a Target alias/variable
<aliases>
<alias
match="t1 *"
enabled="y"
variable="target1"
send_to="9"
sequence="100"
>
<send>%1</send>
</alias>
</aliases>
-
- Hit Ctrl-Shift-9.
- Copy the above XML.
- Click the Paste button in the Aliases configuration screen.
<aliases>
<alias
match="unmagic"
enabled="y"
expand_variables="y"
group="attack_aliases"
send_to="10"
sequence="100"
>
<send>cast 'dampening field' @target1</send>
</alias>
</aliases>
Creating a script that cycles through attacks
function cycle_attack (cmdvar, idxvar)
if not GetVariable(idxvar) then
SetVariable(idxvar, 0)
end -- if
idx = tonumber(GetVariable(idxvar))
cmds = utils.split(GetVariable(cmdvar), ",")
nextcmd = cmds[idx + 1]
Send (nextcmd .. " " .. GetVariable ("target1") )
SetVariable(idxvar, bit.mod(idx + 1, #cmds))
end -- function
- A command variable (cmdvar). This must contain a list of comma-separated commands that can be run by the client. For example, it might contain “cast ‘holy strike’,cast repentance”. Here, the idea would be to somehow cycle through those two attack commands.
- An index variable (idxvar). This is where an array index pointer is kept. The functions start it off at 0 if it hasn’t been defined yet.
-
- Place this script file under your MUSHclient home folder, under the scripts directory.
- In MUSHclient, hit Ctrl-Shift-6 to bring up the Scripts configuration.
- In the External Script File section, select Browse, and select the cycle_commands.lua script. Ensure “Enable scripting” is checked.
Creating the meta attack alias
<aliases>
<alias
match="#attackalias {*} {*}"
enabled="y"
group="special_convenience_aliases"
send_to="12"
ignore_case="y"
sequence="100"
>
<send>require "addxml" -- addxml extension
-- add the alias
addxml.alias {
name = "command_line_alias_" .. string.gsub(Base64Encode("%1"), "=", ""),
match = "%1",
send = "cycle_attack ('%1cmds', '%1idx')",
sequence = 100,
enabled = true,
send_to = 12,
group = "attack_aliases"
}
ColourNote ("white", "green", "Added alias to match on '%1' with '%2' attacks")
SetVariable ("%1cmds", "%2")
</send>
</alias>
</aliases>
> #attackalias {hol} {cast 'holy strike',cast repentance}
-
- Set a new variable called ‘holcmds’ to the value: cast ‘holy strike’,cast repentance
- Set a new variable called ‘holidx’ to the value: 0
- Define a new alias in the attack_aliases group called ‘hol’ that sends the following to a Script:
cycle_attack ("holcmds", "holidx")
> hol
cast 'holy strike' kobold
> hol
cast repentance kobold
Portal Meta Alias
<aliases>
<alias
match="portal *"
enabled="y"
group="portal_aliases"
send_to="10"
sequence="100"
>
<send>get %1 backpack
hold %1
enter
rem %1
put %1 backpack
dual @dual
remove invis
wear invis lfinger</send>
</alias>
</aliases>
-
- Gets the portal from the portal bag (a backpack, in my case)
- Holds the portal, enters it, removes it, puts it back in the bag.
- Dual wields a weapon whose name I’ve put in my @dual variable (a good practice, as well).
- Re-applies the ring of invisibility.
<aliases>
<alias
match="#portalalias {*} {*}"
enabled="y"
group="special_convenience_aliases"
send_to="12"
ignore_case="y"
sequence="100"
>
<send>require "addxml" -- addxml extension
-- add the alias
addxml.alias {
name = "command_line_alias_" .. string.gsub(Base64Encode("%1"), "=", ""),
match = "%1",
send = "portal %2",
sequence = 100,
enabled = true,
send_to = 10,
group = "portal_aliases"
}
ColourNote ("white", "green", "Added alias to match on '%1' with 'portal %2'")
</send>
</alias>
</aliases>
> #portalalias {preme} {mirror}
> mapper portal preme
Disarming Triggers
<aliases>
<alias
match="setweap *"
enabled="y"
variable="weap"
send_to="9"
sequence="100"
>
<send>%1</send>
</alias>
</aliases>
> setweap sword
<triggers>
<trigger
enabled="y"
expand_variables="y"
match="*DISARMS you and you struggle not to drop your weapon*"
send_to="12"
sequence="100"
>
<send>Note ("++++++++++++++++++++++++++++++++++++ You have been DISARMED! +++++++++++++++++++++++++++++++++++")
Send("wield @weap")</send>
</trigger>
</triggers>
<triggers>
<trigger
enabled="y"
expand_variables="y"
match="^.*DISARMS you and sends(.*?)$"
regexp="y"
send_to="12"
sequence="100"
>
<send>Note ("++++++++++++++++++++++++++++++++++++ You have been DISARMED! ++++++++++++++++++++++++++++++++++++")
Send ("get @weap")
Send("wield @weap")</send>
</trigger>
</triggers>
Now you shouldn’t worry, as long as you keep your @weap variable up to date.
- Published in Public, Public-Guides