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
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4690
Location: Pensacola, FL, USA

PostPosted: Mon Jun 12, 2006 10:24 pm   

Not firing as often as it should.
 
I am having a bit of trouble with a trigger i wrote for Split-Infinity (si.nu 4000).
Code:
#VAR magiiskills {air magic|blacksmithing|blade defense|blunt attack|blunt defense|cooking|creation magic|death magic|earth magic|fire magic|firebreathing|healing magic|intimidation|knife defense|melee attack|melee defense|psychometabolism|sex appeal|water magic}
#TRIGGER {({@magiiskills})%s(%d).(%d)} {
  #VAR thisskill {%1}
  #VAR thisskillvalue {%2%3}
  #IF (%eval( @thisskillvalue-%db( @magiiskillslog, @thisskill))!=0) {#SAY @thisskill has been adjusted by %eval( @thisskillvalue-%db( @magiiskillslog, @thisskill))}
  #ADDKEY magiiskillslog {@thisskill=@thisskillvalue}
  }

For some reason the trigger will only fire once per line when the pattern should be matched 2-3 times per line. It only catches the first instance of it.
And here is some actual MUD output:
Code:
Skill Name             Level        Skill Name             Level        Skill Name             Level       
----------------------------        ----------------------------        ----------------------------       
air magic              39.00        death magic            42.17        melee attack           34.51       
blacksmithing          38.70        earth magic            40.21        melee defense          33.15       
blade defense          22.59        fire magic             30.14        psychometabolism       87.32       
blunt attack           23.19        firebreathing          30.74        sex appeal             25.17       
blunt defense          36.11        healing magic          56.64        water magic            28.68       
cooking                14.72        intimidation           11.43                                           
creation magic         41.98        knife defense          23.40   
_________________
Discord: Shalimarwildcat
Reply with quote
edb6377
Magician


Joined: 29 Nov 2005
Posts: 482

PostPosted: Mon Jun 12, 2006 10:41 pm   
 
sounds like its doing per line triggering maybe turn off NEW LINE see if that helps. i am running into similar issues. I am working on them one by one. For you id first check the TRIGGER options as they seem to work a bit differently than they used too.
_________________
Confucious say "Bugs in Programs need Hammer"
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon Jun 12, 2006 11:14 pm   
 
In ZMud, patterns only match one time per line (using the broadest match). There's no repeat parsing to see if other parts of the line match as well.
_________________
EDIT: I didn't like my old signature
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4690
Location: Pensacola, FL, USA

PostPosted: Mon Jun 12, 2006 11:27 pm   
 
if it only fires once per line, then explain why
#TRIGGER {magic} {#cw 11}
is firing multiple times on the same line

my original trigger pattern is not so loosely defined as to allow it to grab extra data in the first place
_________________
Discord: Shalimarwildcat
Reply with quote
Ceres
Wanderer


Joined: 25 May 2006
Posts: 88

PostPosted: Tue Jun 13, 2006 1:09 am   
 
I think the problem is because you are trying to use parameters within the script unlike a simple colouring trigger. The following should work, I added conditionals and modified the original trigger pattern to only match either the middle or final pattern. Quite possibly you may need to remove the final %s on the pattern match for the 2nd conditional.
Code:
#TRIGGER {^({@magiiskills})%s(%d).(%d)%s} {#VARIABLE thisskill {%1}
   #VARIABLE thisskillvalue {%2%3}
   #IF (%eval( @thisskillvalue-%db( @magiiskillslog, @thisskill))!=0) {#SAY @thisskill has been adjusted by %eval( @thisskillvalue-%db( @magiiskillslog, @thisskill))}
   #ADDKEY magiiskillslog {@thisskill=@thisskillvalue}}
#CONDITION {%s({@magiiskills})%s(%d).(%d)%s} {#VARIABLE thisskill {%1}
   #VARIABLE thisskillvalue {%2%3}
   #IF (%eval( @thisskillvalue-%db( @magiiskillslog, @thisskill))!=0) {#SAY @thisskill has been adjusted by %eval( @thisskillvalue-%db( @magiiskillslog, @thisskill))}
   #ADDKEY magiiskillslog {@thisskill=@thisskillvalue}} {reparse}
#CONDITION {%s({@magiiskills})%s(%d).(%d)%s$} {#VARIABLE thisskill {%1}
   #VARIABLE thisskillvalue {%2%3}
   #IF (%eval( @thisskillvalue-%db( @magiiskillslog, @thisskill))!=0) {#SAY @thisskill has been adjusted by %eval( @thisskillvalue-%db( @magiiskillslog, @thisskill))}
   #ADDKEY magiiskillslog {@thisskill=@thisskillvalue}} {reparse}

Hope this helps.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4690
Location: Pensacola, FL, USA

PostPosted: Tue Jun 13, 2006 3:21 am   
 
That works, thanks
_________________
Discord: Shalimarwildcat
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Tue Jun 13, 2006 6:58 am   
 
Weirdo, asking zMUD questions on the day CMUD was released. ;)
_________________
CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;)
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4690
Location: Pensacola, FL, USA

PostPosted: Tue Jun 13, 2006 9:30 am   
 
*points at his signature* CMUD wont run on my OS...
_________________
Discord: Shalimarwildcat
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