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
➜ Capturing outgoing commands
|
Capturing outgoing commands
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| LupusFatalis
(154 posts) Bio
|
| Date
| Fri 05 Jun 2009 09:03 PM (UTC) |
| Message
| | I'm working on a plugin at the moment, and one of the features I need to be able to do is capture the commands I send to the mud... I would prefer to stay away from aliases with this if possible. Is there some sort of function I can use that will allow for this? | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Sat 06 Jun 2009 12:31 AM (UTC) Amended on Sat 06 Jun 2009 10:19 PM (UTC) by Nick Gammon
|
| Message
| See http://www.gammon.com.au/scripts/doc.php?general=plugin_callbacks
In particular, the OnPluginSent callback. This lets you know something is definitely being sent (whether via a script, plugin, alias or whatever), if that is what you want. The idea here was for situations where you needed to know if you sent "north" to the MUD (for example), so you could track a mapping situation.
However if you literally want to capture commands you type (as opposed to what gets sent) then you might want the OnPluginCommand callback or the OnPluginCommandEntered callback. This captures things you type (which may or may not end up going to the MUD, because of aliases etc.). |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| LupusFatalis
(154 posts) Bio
|
| Date
| Reply #2 on Sat 06 Jun 2009 04:04 PM (UTC) |
| Message
| | Perfect, i'll check it out later today... And you guessed it, I need it for mapping purposes. | | Top |
|
| Posted by
| LupusFatalis
(154 posts) Bio
|
| Date
| Reply #3 on Sat 06 Jun 2009 05:05 PM (UTC) Amended on Sat 06 Jun 2009 05:06 PM (UTC) by LupusFatalis
|
| Message
| I get a type mismatch here... not sure what thats about... And then it stops sending anything to the mud. Any ideas?
def OnPluginSent(sText):
import os
path = 'C:\\DM_Maps\\'
if not os.path.exists(path): os.mkdir(path)
logfile = open(path + 'RoomCaptureTest.log', 'a')
logfile.write('MoveCommand=' + str(sText))
logfile.write('\n')
logfile.close()
| | Top |
|
| Posted by
| Worstje
Netherlands (899 posts) Bio
|
| Date
| Reply #4 on Sat 06 Jun 2009 06:55 PM (UTC) Amended on Sat 06 Jun 2009 10:20 PM (UTC) by Nick Gammon
|
| Message
| I do. :)
Add return 0 to the end of your plugin callbacks that do not return a value. Something about the Python WSH bindings is odd and MUSHclient chokes on it. My experience says you totally mess up the innards, since triggering that error a second time tends to crash MUSHclient hard. | | Top |
|
| Posted by
| LupusFatalis
(154 posts) Bio
|
| Date
| Reply #5 on Sun 07 Jun 2009 03:23 AM (UTC) |
| Message
| | Perfect, thanks! I always miss stuff like that... Probably because I'm more of a chronic dabbling coder than a programmer. Thanks again. | | Top |
|
| Posted by
| Worstje
Netherlands (899 posts) Bio
|
| Date
| Reply #6 on Sun 07 Jun 2009 06:15 AM (UTC) |
| Message
| | I ran into it around four years ago. Nick helped me out with the answer then. I'm just sharing the knowledge. | | 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.
31,290 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top