Register to post in forums, or Log in to your existing account

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion

Joined: 13 Jul 2003
Posts: 17

PostPosted: Fri Jul 09, 2004 12:16 am   

help with gags and hooks
This is really two questions, but here goes.

My mud uses RDMP, a propietary protocol, and I use this trigger to process an informational line that gets sent out every three seconds:

^RDMP @RDMP_code HEALTH (%d) (%d) (%d) (%d) (%d) (%d) (%d)$

#var RDMP_hp %1
#var RDMP_hpmax %2
#var RDMP_sp %3
#var RDMP_spmax %4
#var RDMP_ep %5
#var RDMP_epmax %6
#var RDMP_hunger %7

This part works just fine. Today I was playing around with adding hook functionality to zMUD. I'm using a call_hooks alias that retrieves a list of aliases for a supplied hook id from a db variable and then executes each one of them with the supplied arguments.

I added the line '#if %class( Hooks) {#exec call_hooks heartbeat %1 %2 %3 %4 %5 %6 %7}' just after the #gag in the trigger above and set up one hook with the 'heartbeat' id, which just does a small amount of data-crunching. The problem is that when I enable the Hooks class, the gagging behavior changes. Before, I would very occasionally see a quick blip on the screen as zMUD wrote the RDMP line and then immediately erased it. Now, I actually see all the text in the window shift up one line and then back down, which is very distracting when it happens every three seconds.

So my first question is: why does this change even though the #gag is still the first thing the trigger does, and how can I fix it?

And my second question is: is there a better way to use hooks in zmud that I'm not aware of?
Reply with quote

Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Jul 09, 2004 11:21 am   
Your right, the addition of the 'data crunching code' is what causes the delay in gagging. When a #GAG command is issued in a trigger zMud flags the line to be gagged. That line does not actually get gagged until all trigger proccessing is completed on it. This allows the #UNGAG command a chance to remove the flag. You can override this behavior with "#GAG 0".

As to your usage of 'hooks' it sounds like you are making things more complex then they need to be. I can not say if there is a better way without knowing what exactly you are doing and what your looking to do.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by