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
user0101
Apprentice


Joined: 01 Aug 2003
Posts: 100
Location: USA

PostPosted: Wed Jun 16, 2004 8:24 pm   

Long Processing
 
I have noticed that on very involved scripts or with quite a few triggers working at once, zmud aborts processing after a specified length of time has passed regardless of any code left to execute.

For instance, I recently made a script that has multiple loops for a block of text with similar patterns:

News Summary for Blah:

Public: 1000/1000
Announce: 1000/1000
Comments: 1000/1000

You get the point. The pattern for the trigger is generic, such as:

#TRIGGER {^(%w)~:%s(%d)~/(%d)} {#loop stuff here}

I got a working solution for it, but at first if I didn't loop through the news command multiple times to give the processor chance to catch up and complete the loop, it would abort the loop and go onto the next line with a similar pattern.

For example, with the above trigger it would add all unread posts into a string list variable. This loop could get quite long for 50+ unread posts. I had my loop echo out the post number just to test and see how many times it would loop before aborting.

Something like this happened:

nstat

News Summary for Blah:

Public: 980/1000
added post number 981 to queue for section Public
added post number 982 to queue for section Public
added post number 983 to queue for section Public
added post number 984 to queue for section Public
Announce: 990/1000
added post number 991 to queue for section Announce
added post number 992 to queue for section Announce
added post number 993 to queue for section Announce
Comments: 1495/1500
--prompt comes up--
added post number 1496 to queue for section Public
added post number 1497 to queue for section Public
added post number 1498 to queue for section Public

Sorry for not having a concrete example, after I found the workaround I didn't save any debug logs. I am working on similar scripts however, and I am wondering if there is a 'cut-off' period for all triggers.

I tested the script in question extensively, and the only time erratic results happened was when there was a lot to process. If there were only about 5 things to add to the queue for instance, it worked with 100% accuracy.
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Wed Jun 16, 2004 9:26 pm   
 
Ok Im not trying to dechipher what your doing cause Im tired but I think loops run in the background so to force a loop to finish before proccessing other triggers you need to enclose it in a #PRIO {#Loop {}} So Try sticking your loops in Prio and see if anything changes gnight
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Jun 16, 2004 9:28 pm   
 
Recent versions of zMUD run loops in the background so that trigger processing of current input won't be delayed. If you want the loops completed before doing any further trigger processing, use #PRIORITY.
NOTE: Delaying trigger processing can be hazardous to your health

If you don't use #PRIORITY, the loops will be completed as the processing load allows. In your example, the processing could be expected to continue something along these lines (I'm assuming those last posts were actually being added to Comments):

added post number 1499 to queue for section Comments
added post number 1500 to queue for section Comments
added post number 994 to queue for section Announce
added post number 995 to queue for section Announce
added post number 996 to queue for section Announce
added post number 997 to queue for section Announce
added post number 998 to queue for section Announce
added post number 999 to queue for section Announce
added post number 1000 to queue for section Announce
added post number 985 to queue for section Public
added post number 986 to queue for section Public
added post number 987 to queue for section Public
added post number 988 to queue for section Public
added post number 989 to queue for section Public
added post number 990 to queue for section Public
added post number 991 to queue for section Public
added post number 992 to queue for section Public
added post number 993 to queue for section Public
added post number 994 to queue for section Public
added post number 995 to queue for section Public
added post number 996 to queue for section Public
added post number 997 to queue for section Public
added post number 998 to queue for section Public
added post number 999 to queue for section Public
added post number 1000 to queue for section Public
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 Wolfpaw.net