Re: exported.writes inside a hook threadlock?

will guaraldi <[email protected]>
Newsgroups gmane.comp.games.mud.client.lyntin
Message-ID <[email protected]>
You want to send data to the mud based on things you're doing in the
to_user_hook?

If you're writing stuff to the mud, why're you using the write_user_data
function?  The write_user_data function will spam the to_user_data hook.
One of the things registered with that hook is the ui.  This hook is
specifically for displaying data to the user--it shouldn't be used for
parsing or triggers or anything else.

Because you're doing what you're doing in the to_user_hook, you're
essentially creating an infinite loop:

to_user_data hook calls your thing which calls write_user_data which
spams the to_user_data hook which calls your thing which calls
write_user_data which spams the to_user_data hook ....

to_user_data is specifically for displaying text to the user.  We have it
in its own hook because we allow for multiple user interfaces (which
sounds silly, but there are existing uses for this).

I'nm not really sure what you're trying to do here.  Sounds like you want
to be parsing data that's come from the mud and then performing some
action based on that data.  This sounds an awful lot like the action
module (lyntin/modules/action.py).  Is there any reason you're not using
#action instead?  Can you explain what you're trying to do more
specifically?

/will


On Mon, 12 Apr 2004 [email protected] wrote:
>
> Is Lyntin expected to freeze when I perform exported.write_user_data in
> a to_user_hook?
>
> I just want to parse some text from the mud and write something back to
> the mud...
>
> In load() I register...
>
> exported.hook_register("to_user_hook", handle_to_user)
>
> In handle_to_user(args) all these freeze...
>
> exported.write_message('...')
> exported.write_user_data('n')
> exported.write_user_data('n',msg.session)
> exported.write_user_data('n\n')
> exported.write_user_data('n\n',msg.session)
>
> What am I supposed to be doing here?
> Are the writes supposed to be elsewhere?
>
> Python 2.3.3 in Windows, latest stable Lyntin.
>
> -kaishaku


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.