Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ Scripting Spam Prevention
|
Scripting Spam Prevention
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Xvordan
(29 posts) Bio
|
| Date
| Tue 27 Oct 2015 12:10 AM (UTC) |
| Message
| | 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. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,166 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Tue 27 Oct 2015 05:59 AM (UTC) |
| Message
| Most of this sort of thing can be achieved by a simple plugin. Here is one I just wrote to show the idea:
 |
To save and install the Spam_Prevention plugin do this:
- Copy between the lines below (to the Clipboard)
- Open a text editor (such as Notepad) and paste the plugin into it
- Save to disk on your PC, preferably in your plugins directory, as Spam_Prevention.xml
- 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"
|
<?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. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
10,263 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top