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
➜ Suggestions
➜ Literal command option
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| AdInfinitum
(74 posts) Bio
|
| Date
| Fri 30 Nov 2018 06:01 PM (UTC) |
| Message
| If this already exists and I've missed it, then I would appreciate being pointed towards the actual solution. However, it was asked if there was a 'literal' command option much like z/CMUD's "~<command>".
Essentially, "~<command>" would send the command literally to the MUD rather than through the client. It allows a user to bypass defined aliases. Or in other words, it utilizes "Send" rather than "Execute". I've created an alias to emulate that feature in z/CMUD, but I'm wondering if it's not something that should be native to MUSHclient at all. Below is the alias I've written:
<aliases>
<alias
match="~*"
enabled="y"
send_to="12"
sequence="100"
>
<send>Send("%1")</send>
</alias>
</aliases>
Is this already a feature and I'm missing it? Or can it be added to a future MUSHclient release? | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Fri 30 Nov 2018 08:03 PM (UTC) |
| Message
| See How MUSHclient processes commands you type for how commands are processed.
I don’t think there is a literal command option, nor has anyone asked for one that I recall.
If I were to add one now there would be the issue of what the prefix is (people may already be using “~” for other purposes).
Also there are other issues:
Would it take precedence over what is processed by plugins?
Would, or would not, plugin callback functions be called in the place they normally are to handle what you typed? For example, some mapper plugins use that to find if you recently typed a direction so they know what direction you tried to move.
If you do a world.Execute (“~foo”) from a script would this new literal command apply?
How would you handle the situation where a MUD needs you to type “~” to achieve something? (I suppose you could type “~~”).
Would such a command be logged?
I think your simple alias solves the problem for you, and any side issues relating to it you would therefore be aware of. You could conceivably put it into a plugin with a low (negative) plugin sequence number so that it takes precedence over other plugins, if that is what you wish. You can set up global plugins (see Global Preferences) to be automatically loaded, so your special plugin would load for every world, and thus would become an “invisible” feature for you.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| AdInfinitum
(74 posts) Bio
|
| Date
| Reply #2 on Fri 30 Nov 2018 08:23 PM (UTC) |
| Message
|
Quote:
If I were to add one now there would be the issue of what the prefix is (people may already be using "~" for other purposes).
If you implemented this, possibly make it a setting for users (much like the script prefix option).
Quote:
* Would it take precedence over what is processed by plugins?
...
* Would such a command be logged?
The answer to your questions relatively stay the same for each. The literal command would take precedence over all, pre-plugin processing, etc. The point of the literal command is to be able to send the command as-is to the MUD.
Consider the case where a plugin is created that makes use of the command "pat" (maybe it's a plugin called Precision Ability Tracker). Now, I've just discovered a new room, and one of the exits is "pat". If I type "pat", it gets processed by the plugin, and I'm never able to utilize the exit until I briefly disable the plugin. This, of course, is just a basic example. This also applies to created aliases. Perhaps I have a "drink" alias to execute a series of commands just to quench my thirst. I'd have to disable the "drink" alias to use it in a goal where I have to "drink" as a literal command.
Regarding needing to type that specific character in the MUD (in this example, the "~"), you are correct in that you'd double it up to use it. It's how it was done in z/CMUD, too; you had to double the tilde to get it to show.
As far as world.Execute("~foo"), I think it should treat it as it does anything else. If this were implemented, it'd be a new step for Execute to check (since, from the link, it appears Execute looks for script prefix first). By adding the new literal prefix to the Execute process, it'd recognize that "~foo" is meant to be sent literally. Therefore, you could execute command stacks with it (something you cannot do with Send()). | | Top |
|
| Posted by
| AdInfinitum
(74 posts) Bio
|
| Date
| Reply #3 on Fri 30 Nov 2018 11:35 PM (UTC) |
| Message
| It was pointed out that this function more or less exists, by a person who doesn't even use MUSHclient! It's something I remember using in the past, but blanked out on it when the question was asked. I'm not sure if it was intended or not, but you can start the line off with a space in order to bypass aliases and plugins. Sending " foo" will send "foo" literally to the MUD.
If that was never intended, we've found a useful bug. If it WAS intended, then we should probably get some documentation on it. If it was a feature you weren't aware of, well, now at least a handful of people are, and still should be documented.
Either way, it looks like there doesn't need to be any implementing of a literal character if this continues to work. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #4 on Sat 01 Dec 2018 12:26 AM (UTC) Amended on Sat 01 Dec 2018 04:31 AM (UTC) by Nick Gammon
|
| Message
| That trick only works because it puts a space at the start of the line, and thus aliases won't match ... unless they happen to be designed to match anyway, eg. *foo*
The alias you provided, which I have put into a plugin for you, should do the trick.
 |
To save and install the Literal_Command 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 Literal_Command.xml
- Go to the MUSHclient File menu -> Plugins
- Click "Add"
- Choose the file Literal_Command.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="Literal_Command"
author="Nick Gammon"
id="1e0752b3ad8340eb1f8bd1fa"
language="Lua"
sequence="-10000"
purpose="Lets you send to the MUD without aliases being processed"
date_written="2018-12-01 11:14:26"
requires="5.00"
version="1.0"
>
<description trim="y">
<![CDATA[
Type "~" in front of a command to send it directly to the MUD, bypassing alias processing.
]]>
</description>
</plugin>
<!-- Aliases -->
<aliases>
<alias
match="~*"
enabled="y"
send_to="12"
sequence="100"
>
<send>Send("%1")</send>
</alias>
</aliases>
</muclient>
The point of plugins was to extend the client without new code having to be written, and I think this succeeds in that aim.
However, if putting a space at the start of the line works for you (assuming the MUD strips out leading spaces) then that is pretty simple too. |
- 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.
21,840 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top