|
Manipulating Commands Before Sending (Without Sending Them First)
|
Reply to this subject
Start a new subject
 
Refresh page
| Posted by |
MageRooster
(1 post) bio
|
| Date |
Sun 19 Aug 2012 07:08 PM (UTC) [ quote
] |
| 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'?
| top |
|
| Posted by |
Nick Gammon
Australia (18,770 posts) bio
Forum Administrator |
| Date |
Reply #1 on Tue 21 Aug 2012 01:38 AM (UTC) [ quote
] |
| 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 | 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.
594 views.
Reply to this subject
Start a new subject
 
Refresh page
top
Comments to:
Gammon Software support
Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )