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
zmudnoob
Beginner


Joined: 09 Sep 2005
Posts: 14

PostPosted: Tue Sep 27, 2005 3:05 am   

Trigger misfire? (long but desperate)
 
I am a bit embarrassed to post any script I have as I have learned scripting from help files and dissecting other people's scripts with very little other computer background so bear that in mind as you look at this :-P I have an alias which allows me to look at someone and automatically reference my database, giving me stats on their eq for anything in my database as well as a list of eq they are wearing not currently in my database. The alias involved triggers which fired on <worn> <wield> <held> etc etc and looked like this:

#TRIGGER {^~<held*>%s(*)} {#ADDITEM eqnames { %replace( %quote( %remove( " (glowing)", %remove( " (illuminating)", %remove( " (magic)", %replace( "%1", "," , " "))))), " ", " ")}}

I then had a trigger which fired when it hit a blank line to close the class containing these triggers and query everything in my eqnames variable, returning the lists of items in my database and items not in database.

These triggers worked great for months until a week ago when I decided to also use these triggers to capture ansi on items for which my database already had stats but not ansi. The <held> <wield> etc triggers were changed to look like this:

#TRIGGER {^~<held*>%s(*)} {#ADDITEM eqnames { %replace( %quote( %remove( " (glowing)", %remove( " (illuminating)", %remove( " (magic)", %replace( %stripansi( "%1", "," , " "))))), " ", " "))}
#VAR dbitem.Name { %replace( %quote( %remove( " (glowing)", %remove( " (illuminating)", %remove( " (magic)", %replace( %stripansi( "%1", "," , " "))))), " ", " "))}
#VAR whereflaga %pos( "(", "%1")
#IF (@whereflaga > 0) {
#ADD whereflaga -2
#VAR dbitem.AnsiName %left( %1, @whereflaga)
} {#VAR dbitem.AnsiName { %replace( "%1", " ", " ")}}
#VARIABLE querya %query( @dbItem.Name = &Name, All)
#IF (%null( @querya)) {} {
#IF ((%numitems( @querya) == 1) & (%null( %db( @querya, AnsiName)))) {
#DBGET @querya
#IF (%numitems( @querya) = 1) {
#DBPUT @querya {AnsiName=@dbitem.AnsiName}
#DBRESET
#VIEW All}}}}

I didn't change any other part of the triggerset but now these triggers sometimes compare and update ansi, referencing my database for stats as intended but more often they spam thru the look at someone's eq, misfiring at the end and telling me I have none of their eq in my database and capturing the ansi of none or just a couple of the items that need ansi info in my database. I can look at the same person four or five times in a row and the triggers may fire correctly one of those times if I'm lucky. I have checked all the variables in my triggers and they are collecting the data they should even on misfires so I am stumped. Did I create an order of operations problem? What have I done?!? Any help would be greatly appreciated as I don't know what else to try. Help!!

I am using Zmud 7.20a and Windows XP. Thanks in advance :-)
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Sep 27, 2005 7:58 am   
 
It appears that your parenthesis were improperly placed in a few statements. You are missing proper delimiters on many statements, and have a number of redundant commands. Just a minor revision should fix it up.
#TRIGGER {^~<held*>%s(*)} {
#VAR dbitem.Name {%replace( %quote( %remove( " (glowing)", %remove( " (illuminating)", %remove( " (magic)", %replace( %stripansi( "%1"), "," , " "))))), " ", " ")}
#ADDITEM eqnames {@dbitem.Name}
#VAR whereflaga {%pos( "(", "%1")}
#IF (@whereflaga > 0) {
#ADD whereflaga -2
#VAR dbitem.AnsiName {%left( "%1", @whereflaga)}
} {#VAR dbitem.AnsiName { %replace( "%1", " ", " ")}}
#VARIABLE querya {%query( @dbItem.Name = &Name, All)}
#IF ((%numitems( @querya) = 1) & (%null( %db( @querya, AnsiName)))) {
#DBPUT @querya {AnsiName=@dbitem.AnsiName}
#DBRESET
#VIEW All}}

I would suggest also adjusting the trigger pattern so you only have 1 trigger instead of 17, as this will simplify editting the script. Also be sure to test my changes before you delete your old triggers.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
zmudnoob
Beginner


Joined: 09 Sep 2005
Posts: 14

PostPosted: Wed Sep 28, 2005 5:34 pm   
 
Thank you so much for helping me clean up this triggerset! After inputting your revisions I am sure my zmud is much happier but, frustratingly, the same problems are still occurring with the triggers sometimes working correctly and sometimes not. Any other ideas of what I might have done wrong when I added the ansi capturing information?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Sep 28, 2005 9:22 pm   
 
I have no ideas, perhaps a clean ANSI log with a fair number of examples would help to sort out the problem. Be sure to use code tags on your log so spacing is preserved.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
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