[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Manipulating Commands Before Sending (Without Sending Them First)

Manipulating Commands Before Sending (Without Sending Them First)

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by MageRooster   (1 post)  [Biography] bio
Date Sun 19 Aug 2012 07:08 PM (UTC)
Message
So, I have a trigger that catches when someone whispers me and stores the variable, no problem. Currently, I have a reply alias that grabs that variable and responds to them automatically (the MUSH I'm on has a different reply command, but it's picky), but I want to make it a bit better.

What I want to do is if a line starts with 'reply', replace it with 'wh myfriend' when I hit enter WITHOUT sending it. If I hit enter again, since it starts with something other than 'reply', it'll send normally.

Right now I'm trying to fiddle with SetCommand and PasteCommand and that family of commands and while it'll replace the string how I want it, it still always sends the command when I hit enter. Is there some command I'm missing for a 'cancel sending'?
[Go to top] top

Posted by Nick Gammon   Australia  (22,982 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Tue 21 Aug 2012 01:38 AM (UTC)
Message
Check out:

http://www.gammon.com.au/scripts/doc.php?general=plugin_callbacks

In particular: OnPluginCommandEntered

You could use a regular expression to detect the reply and modify it. Or if you don't want to send it, return an empty string, and then use PasteCommand to put it back into the command window (possibly after doing SetCommandSelection).

Or maybe the callback: OnPluginCommand

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] 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.


7,952 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]