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
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Mon Apr 17, 2006 6:26 pm   

Quick trigger question
 
Level~:%s%d%s&StatTracked%sLearned~:%s(%d)~%
Code:
Level:  13 Backstab               Learned:  65%
Does not work. This is the actual mud output

Level: 13 Backstab Learned: 65%
Does work. and is what i get when i do #echo Level:  13 Backstab               Learned:  65%
So i don't want this one, but the above one.


Not sure why this is failing to trigger.
I changed up the code from 1 trigger for each of the skills to a one liner. The only change is the &StatTracked part. But for some reason that's not letting it match. I don't think a %trim would help in this as the trigger is failing to match.
Any ideas?

Code:
#CLASS {Spell Skill Tracker}
#ALIAS stattrack2 {#LOOP 1,%numwords( @StatTracks, "|") {show %word( @StatTracks, %i, "|")}}
#VAR Skills_Check {Blockexitpercent0Awarenesspercent0Backstabpercent65Blackrootpercent0Burntmarbupercent0Cobrabanepercent0Counterstrikepercent0Dodgepercent0Dualwieldpercent0Enhancedbackstabpercent0Fifthattackpercent0FourthAttackpercent0Handtohandpercent0Heightensensespercent73Hydrabloodpercent0Parrypercent0Powergrippercent0Secondattackdualpercent0Secondattackpercent0Shieldblockpercent0Stranglepercent0Thirdattackdualpercent0Thirdattackpercent0Timeshiftpercent0}
#VAR StatTracks {Awareness|Backstab|Black root|Blockexit|Burnt marbu|Cobra bane|Counter strike|Dodge|Dual wield|Enhanced backstab|Fifth attack|Fourth Attack|Hand to hand|Heighten senses|Hydra blood|Parry|Power grip|Second attack dual|Second attack|Shield block|Strangle|Third attack dual|Third attack|Time shift}
#VAR StatTracked {Backstabpercent}
#TRIGGER "StatCheckTrigger" {Level~:%s%d%s&StatTracked%sLearned~:%s(%d)~%} {#IF {%ismember( "%1", @StatTracks)} {#VARIABLE StatTracked %replace( @StatTracked, " ", "")percent;#VARIABLE Skills_Check.@{StatTracked} %2}}
#MENU {"Skills"} {} "" {Skills}
#CLASS 0

#CLASS {Spell Skill Tracker|Skills} {menu}
#MENU {2nd dual: @Skills_Check.Secondattackdualpercent%} {stattrack} ""
#MENU {2nd: @Skills_Check.Secondattackpercent%} {stattrack} ""
#MENU {3rd dual: @Skills_Check.Thirdattackdualpercent%} {stattrack} ""
#MENU {3rd: @Skills_Check.Thirdattackpercent%} {stattrack} ""
#MENU {4th: @Skills_Check.Fourthattackpercent%} {stattrack} ""
#MENU {5th: @Skills_Check.Fifthattackpercent%} {stattrack} ""
#MENU {Awareness: @Skills_Check.Awarenesspercent%} {stattrack} ""
#MENU {Black Root: @Skills_Check.Blackrootpercent%} {stattrack} ""
#MENU {Blockexit: @Skills_Check.Blockexitpercent%} {stattrack} ""
#MENU {BS: @Skills_Check.Backstabpercent%} {stattrack} ""
#MENU {Burnt: @Skills_Check.Burntmarbupercent%} {stattrack} ""
#MENU {Cobra: @Skills_Check.Cobrabanepercent%} {stattrack} ""
#MENU {CounterStrike: @Skills_Check.Counterstrikepercent%} {stattrack} ""
#MENU {Dodge: @Skills_Check.Dodgepercent%} {stattrack} ""
#MENU {Dual: @Skills_Check.Dualwieldpercent%} {stattrack} ""
#MENU {Enh BS: @Skills_Check.Enhancedbackstabpercent%} {stattrack} ""
#MENU {H2H: @Skills_Check.Handtohandpercent%} {stattrack} ""
#MENU {Heighten: @Skills_Check.Heightensensespercent%} {stattrack} ""
#MENU {Hydra: @Skills_Check.Hydrabloodpercent%} {stattrack} ""
#MENU {Parry: @Skills_Check.Parrypercent%} {stattrack} ""
#MENU {Powergrip: @Skills_Check.Powergrippercent%} {stattrack} ""
#MENU {ShieldBlock: @Skills_Check.Shieldblockpercent%} {stattrack} ""
#MENU {Strangle: @Skills_Check.Stranglepercent%} {stattrack} ""
#MENU {TimeShift: @Skills_Check.Timeshiftpercent%} {stattrack} ""
#CLASS 0
_________________
http://www.Aardwolf.com
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon Apr 17, 2006 8:29 pm   
 
I don't see anything at all wrong with the pattern, so I'm going to call it as your mismatched brackets in the #IF condition. You have something like #if (something()}, that curly brace needs to be a parenthesis.
_________________
EDIT: I didn't like my old signature
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Mon Apr 17, 2006 8:47 pm   
 
MattLofton,
Good catch on the {}'s but that didnt help :(

Code:
#echo "Level:  13 Backstab               Learned:  61%"

#echo Level: 13 Backstab Learned: 61%
Backstab StatTracks
61 Percent


#IF (%ismember( "%1", @StatTracks)) {
  #ECHO %1 StatTracks
  #ECHO %2 Percent
  #VARIABLE StatTracked %replace( @StatTracked, " ", "")percent
  #VARIABLE Skills_Check.@{StatTracked} %2
  }

Still not triggering...Set to Trigger on Trigger and on New Line just like it was before and just like all my triggers are.
_________________
http://www.Aardwolf.com
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue Apr 18, 2006 4:53 am   
 
So are you saying that if you replace the &StatTracked with %w then the trigger works? It's possible that it's a bug with the &varname syntax somehow messing up the %s.

Can you try a few different variations on the MUD text where you put more than one space just one at a time in various places to see which %s isn't working?
Reply with quote
Strakc
Apprentice


Joined: 31 Jan 2006
Posts: 106
Location: Virginia Beach, Virginia

PostPosted: Tue Apr 18, 2006 5:38 am   
 
why not replace %s with the actual number of spaces, and if that changes you'll simply know it was %s as the fault there.
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Tue Apr 18, 2006 2:23 pm   
 
Zugg,
This does not work either:

Level~:%s%d (%*)%sLearned~:%s(%d)~%

I've used (%*) lots of times in my scripts. I know i've seen some people say it's as evil as the #wait command, but i've seen that I've never had any problems with it if the trigger is strictly defined.


Had to make a change to the code because I'd forgotten to do something. The way it is now it works fine (so far Wink):

Level~:%s%d ({%w|%w %w|%w %w %w})%sLearned~:%s(%d)~%

#VARIABLE StatTracked {}
#IF (%ismember( "%1", @StatTracks)) {
#VARIABLE StatTracked {%replace( %1, " ", "")percent}
#ADDKEY Skills_Check @{StatTracked} %2
}

Now here's the kicker, went into the test tab on the trigger and the old &varname version works??!!
So, in USE the trigger will not work, but in the test tab it works.
Pasted into the part where you enter sample text
Code:
Level:  13 Backstab               Learned:  65%

Get the msg that the pattern matches and it outputs:
%1: Backstab
%2: 65
So why the heck won't the trigger work when being used?!?!

===

Strakc, Since the # of spaces is ever changing that is not likely to work as a normal trigger.
Code:
Level:   1 Second attack          Learned:  66%
Level:   1 Parry                  Learned:  64%
Level:  10 Heighten senses        Learned:  73%
Level:   3 Shield block           Learned:   1%

As you can see the ONE constant is the space after the level #.
So, I tried this:
Level~:%s%d &StatTracked%sLearned~:%s(%d)~%
Also, tried
Level~:%s%d &StatTracked %sLearned~:%s(%d)~%
just in case the %s on either end was the screwing part.
Neither one worked. (tho the test tab HAPPILY matches them.
Figured since what you might have meant was a more equal spaced test I did this:
Code:
Level~:   %d &StatTracked                  Learned~:  (%d)~%
#echo "Level:   1 Parry                  Learned:  64%"
Level:   1 Parry                  Learned:  64%
Parry StatTracks
64 Percent

Bloody hell, it was the %s stuff....so...I'm confused. But like I said above, in the test tab everything checks out as is.
I've used %s plenty in my scipts, and have a few &varnames, but this is the 1st time i've used &varname and %s in the same script
_________________
http://www.Aardwolf.com
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