Re: 'Fake' input?

will guaraldi <[email protected]> Sun, 28 Aug 2005 21:59:29 -0500 (CDT)
Newsgroups gmane.comp.games.mud.client.lyntin
Message-ID <[email protected]>
Generally, if you have problems with wanting to do things and not knowing 
how to do them, the first step is to skim the code.  It's fairly well 
documented and knowing how Lyntin's internals work will help you do the 
things you want to do.

The network code (in net.py) creates MudEvent objects (the code is in 
event.py) and sticks them in the queue.  When the MudEvent object 
executes, it does the following:

    exported.hook_spam("from_mud_hook", {
                      "session": self._session,
                      "data": self._input})
    exported.myengine.handleMudData(self._session, self._input)

I don't have time to test this at the moment, but I think doing those 
would work just fine.

Note that "self._input" is the data itself (probably want to replace 
"self._input" with "input" and have that be your "fake" data) and 
"self._session" is the session that the mud data came from.

Taking those two lines and turning them into a function and/or a Lyntin 
command should be really easy, I think.

Hope that helps.  If it's still confusing, I'll try to find some time to 
work up some code and send it out.

/will


On Thu, 25 Aug 2005, Malachi Clark wrote:

>> On 8/25/05, Eugene <[email protected]> wrote:
>>
>>> On Wed, 24 Aug 2005 17:37:37 -0700 (PDT)
>>> "Malachi Clark" <[email protected]> wrote:
>>>
>>>> Is there a command (or similar) that will enable me to
>>>> "fake" input from the mud? <...>
>>>> If there isn't a command already, should I just use the
>>>> hooks to create my own?  Just wanted to ask before I go off reinventing
>>>> the wheel.
>>>
>>> No, there is no such a thing. For me, it was always easier
>>> to run quick-and-dirt "server-like" script via netcat (on Linux) and
>>> connect to it with the client. YMMV.
>>
>> Such a command would be useful for another reason also - though
>> perhaps not so applicable to muds... I used to use lyntin for an IRC
>> client. On IRC, the server sends you a message when someone else says
>> something, but when you say something the server gives you no indication
>> that it happened. So, obviously, my #sub command which formats incoming
>> messages nicely isn't going to work when I talk - I have to make an alias
>> and stick in a #showme to format my messages nicely. But then this still
>> isn't great because my messages don't get #highlight'd (and I'm forced to
>> have "# " at the front of my format style to match #showme). So yeah, I
>> often thought about a simulate command but I never worked out how I'd
>> implement it.
>>
>>
>
>
> Isn't there a hook that we could use to simulate or "fake" data to lyntin in such a way that lyntin wouldn't be able to tell the difference between "real" mud data and "fake" mud data.  It would be VERY helpful for testing to have a module like this.  I would be happy to write it, if I could figure out where/how it needs to hook in.
>
> Malachi
>
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> Lyntin-devl mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/lyntin-devl
>

-- 
whatever it is, you can find it at http://www.bluesock.org/~willg/
except Will--you can only see him in real life.


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf