Gammon Forum
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 (22,973 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.
20,082 views.
It is now over 60 days since the last post. This thread is closed.
  Refresh page
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.