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
Bromax
Wanderer


Joined: 03 Jan 2002
Posts: 66

PostPosted: Wed Jun 23, 2004 2:45 am   

Make it stop looping!!!
 
Working on this script to give me the stats from a piece of equipment:

#CLASS {eqcheck}
#ALIAS eqcheck {
#VAR eqcheck %1
#SEND stats
}
#VAR eqcheck {none} {none}
#TRIGGER {Offensive bonus: (%d), Dodging bonus: (%d), Parrying bonus: (%d)} {
#VAR oldob %1
#VAR olddb %2
#VAR oldpb %3
remove @eqcheck
stats
}
#CLASS 0

usage is:
eqcheck hood(or whatever piece of eq)and it checks the different stats...then I remove the equipment and check the stats again except that I now need to set the new stats to new variables...which is where I'm stuck...I'd imagine something nested needs to go here...but I just cant figure it out.

-Bromax
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Jun 23, 2004 2:56 am   
 
I little indirection would serve you well.

#CLASS {eqcheck}
#ALIAS eqcheck {
#VAR eqcheck %1
#SEND stats
}
#VAR eqcheck {none} {none}
#TRIGGER {Offensive bonus: (%d), Dodging bonus: (%d), Parrying bonus: (%d)} {
#VAR @{eqcheck}_ob {%1} {_nodef} {eqcheck}
#VAR @{eqcheck}_db {%2} {_nodef} {eqcheck}
#VAR @{eqcheck}_pb {%3} {_nodef} {eqcheck}
remove @eqcheck
#VAR eqcheck {@{eqcheck}_removed}
stats
}
#CLASS 0
Reply with quote
Bromax
Wanderer


Joined: 03 Jan 2002
Posts: 66

PostPosted: Wed Jun 23, 2004 3:31 am   
 
"You don't seem to be using a hat_removed_removed_removed_removed_removed_removed_removed." etc.... Well..its a DIFFERENT loop ;-)

What you are doing might be what I am looking for, I just don't completely understand it ;-)...but I want to find the differences in OB, PB and DB for the piece of eq.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Jun 23, 2004 10:53 am   
 
Oh, I see, I get idiot points for that.

#TRIGGER {Offensive bonus: (%d), Dodging bonus: (%d), Parrying bonus: (%d)} {
#VAR @{eqcheck}_ob {%1} {_nodef} {eqcheck}
#VAR @{eqcheck}_db {%2} {_nodef} {eqcheck}
#VAR @{eqcheck}_pb {%3} {_nodef} {eqcheck}
#IF (!%ends(@eqcheck,"_removed")) {
remove @eqcheck
#VAR eqcheck {@{eqcheck}_removed}
stats
}}
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Wed Jun 23, 2004 12:22 pm   
 
This seems to work for me. I don't know what kind of loop you might need, but if you mean to check every item worn, then I think you could just create a string list of items and loop through it to do the eqcheck alias.

quote:
#CLASS {eqcheck}
#ALIAS eqcheck {
#VAR check.item %1 {} {eqcheck}
#VAR worn.item %1 {} {eqcheck}
#VAR removed.item %1 {} {eqcheck}
#T+ eqBonusTrig
#STATE eqBonusTrig 0
#SEND stats
}
#TRIGGER "eqBonusTrig" {Offensive bonus: (%d), Dodging bonus: (%d), Parrying bonus: (%d)$*$Your armor absorbs about (%d)~% on average.} {
#ADDKEY worn {ob=%1|db=%2|pb=%3|ap=%4}
remove @check.item
stats
} "" {disable}
#COND {Offensive bonus: (%d), Dodging bonus: (%d), Parrying bonus: (%d)$*$Your armor absorbs about (%d)~% on average.} {
#ADDKEY removed {ob=%1|db=%2|pb=%3|ap=%4}
#VAR check.ob %eval( @worn.ob - @removed.ob) {} {eqcheck}
#VAR check.db %eval( @worn.db - @removed.db) {} {eqcheck}
#VAR check.pb %eval( @worn.pb - @removed.pb) {} {eqcheck}
#VAR check.ap %eval( @worn.ap - @removed.ap) {} {eqcheck}
#SHOW @check.item~: Offensive bonus~: @check.ob Dodging bonus~: @check.db Parrying bonus~: @check.pb
#SHOW Current absorption due to @check.item is~: @check.ap~%
wear @check.item
#UNVAR worn {eqcheck}
#UNVAR removed {eqcheck}

#T- eqBonusTrig
} {disable}
#CLASS 0
Reply with quote
Bromax
Wanderer


Joined: 03 Jan 2002
Posts: 66

PostPosted: Wed Jun 23, 2004 7:06 pm   
 
Mr. Kent...you got it! Thanks....2 more things though, I want to wear the eq again when all is said and done...and I want to check its absorption % also...this is the text from the mud for thatand it also conesup with the stats command:

Your armor absorbs about 44% on average.

Thanks again.
Reply with quote
Bromax
Wanderer


Joined: 03 Jan 2002
Posts: 66

PostPosted: Thu Jun 24, 2004 6:15 am   
 
Hmmmmm...it all looks good, but when I eqcheck it runs through the stats once and stops...thanks once again for your help Mr. Kent.
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Thu Jun 24, 2004 12:34 pm   
 
quote:
Originally posted by Bromax

Hmmmmm...it all looks good, but when I eqcheck it runs through the stats once and stops...thanks once again for your help Mr. Kent.



How about providing a cut and paste of the scroll when you do everything manually? The trigger probably isn't matching both lines correctly and without a cut and paste of both the stat bonus line and the absorbtion line, I can't fix it if that is the problem.
Reply with quote
Bromax
Wanderer


Joined: 03 Jan 2002
Posts: 66

PostPosted: Thu Jun 24, 2004 3:33 pm   
 
You are a 17 year old male trolloc rogue. It's your birthday today!
Your height is 6 feet, 6 inches, and you weigh 214.0 lbs.
You are carrying 11.0 lbs and wearing 36.5 lbs, very light.
Offensive bonus: 9, Dodging bonus: 0, Parrying bonus: 2
Your mood is: Wimpy. You will flee below: 18 Hit Points
Your armor absorbs about 0% on average.

might be that middle line that is messing it up.
Reply with quote
Bromax
Wanderer


Joined: 03 Jan 2002
Posts: 66

PostPosted: Fri Jun 25, 2004 12:17 am   
 
YOU ROCK!!!

Thanks again.
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