Is there any chance the spam prevention feature of MUSHClient could be expanded upon in future so that it can either call a function, or at least execute an alias which could itself contain scripting? I don't always want to send the same text with spam prevention, and being able to script or call alias would give me a way to vary the response from the client.
Scripting Spam Prevention
Posted by Xvordan on Tue 27 Oct 2015 12:10 AM — 2 posts, 11,252 views.
Most of this sort of thing can be achieved by a simple plugin. Here is one I just wrote to show the idea:
This uses the OnPluginCommand callback to detect you planning some text to the MUD. There are other callbacks that work slightly differently (for example, to detect a scripted send, rather than a player-typed send).
In that plugin you can count the number of times something identical is sent, and then send something else first. Thus you could modify the count, or choose to send something different if you wanted.
To save and install the Spam_Prevention plugin do this:
- Copy the code below (in the code box) to the Clipboard
- Open a text editor (such as Notepad) and paste the plugin code into it
- Save to disk on your PC, preferably in your plugins directory, as
Spam_Prevention.xml- The "plugins" directory is usually under the "worlds" directory inside where you installed MUSHclient.
- Go to the MUSHclient File menu -> Plugins
- Click "Add"
- Choose the file
Spam_Prevention.xml(which you just saved in step 3) as a plugin - Click "Close"
- Save your world file, so that the plugin loads next time you open it.
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<muclient>
<plugin
name="Spam_Prevention"
author="Nick Gammon"
id="45ffbf9a9215cac359817593"
language="Lua"
purpose="Script spam prevention"
date_written="2015-10-27 16:50:12"
requires="4.90"
version="1.0"
>
</plugin>
<!-- Script -->
<script>
<![CDATA[
MAX_SAME_COMMANDS = 3
lastCommand = ""
commandCount = 0
function OnPluginCommand (sText)
if sText ~= lastCommand then
lastCommand = sText
commandCount = 1
else
commandCount = commandCount + 1
end -- if
if commandCount > MAX_SAME_COMMANDS then
Send ("emote sighs")
commandCount = 0
end -- if
return true -- process it
end -- function OnPluginCommand
]]>
</script>
</muclient>
This uses the OnPluginCommand callback to detect you planning some text to the MUD. There are other callbacks that work slightly differently (for example, to detect a scripted send, rather than a player-typed send).
In that plugin you can count the number of times something identical is sent, and then send something else first. Thus you could modify the count, or choose to send something different if you wanted.