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
Tarken Aurelius
Apprentice


Joined: 23 Oct 2008
Posts: 120
Location: Cincinnati, Ohio

PostPosted: Sun Nov 02, 2008 1:40 am   

Buff report
 
Ok, our buff tracking system has been recently upgraded so that we can see the time left on our buffs with a command. I'm trying to create an alias to take all the buffs, store to a variable, replace all the long names to abbreviations, then report the Essential ones to the party channel so my group members can see how long my buffs have left by 'tweaking' me or if I tweak myself/initiate the alias.. It should look like this:



show effects
,------------------------------------------.
| Effect                   | Lasts         |
|==========================================|
| War ensemble             | 6min and 50s  |
`------------------------------------------´
tcheck
Tarken [report]: WarE(6m50s)



but...doesn't seem to work like I expected. Or at least, it works in CMUD but not zmud. I end up seeing this when I do the tcheck:

Tarken [report]: WarE( 6

Here's the code:

Code:

#TRIGGER {^%w tweaks your nose mischievously.} {tcheck}
#TRIGGER {^@(%w) tweaks your nose mischievously.} {tcheck}
#TRIGGER {^You tweak your own nose mischievously.} {tcheck}
#TRIGGER {^,------------------------------------------.} {#GAG} "setweak"
#TRIGGER {^`------------------------------------------´} {GAG;#class setweak 0;tcheckrep} "setweak"
#TRIGGER {^|==========================================|} {#GAG} "setweak"
#TRIGGER {^~|~ ({Acid shield|Agility accelerator|Amnesia|Armour of aether|Artificial intelligence|Aura of hate|Aura of power|Aura of wind|Awareness|Beacon of enlightenment|Blessing of tarmalen|Blurred image|Clandestine thoughts|Cold tolerance|Corrosion shield|Cryptozoological protection|Curse of ogre|Disease|Displacement|Earth blood|Earth skin|Earth power|Energy channeling|Enhanced awareness|Enrage|Enwize|Ether boundary|Feeblemind|Fire walking|Flame shield|Flex shield|Floating|Frost insulation|Frost shield|Force absorption|Force shield|Giant strength|Granitize|Haste|Heat reduction|Heavenly protection|Heavy weight|Infravision|Intelligize|Invisibility|Iron will|Kinemortological protection|Levitation|Life link|Lift of load|Lightning shield|Magic dispersion|Mana shield|Melodic embracement|Mesmeric threshold|Minor protection|Mirror image|Pain threshold|Protection from good|Protection from evil|Psionic phalanx|Psionic shield|Psychic sanctuary|Quicksilver|Racial protection|Regeneration|Repulsor aura|Resist disintegrate|Resist entropy|Resist gaseous form|See invisible|See magic|Shield of detoxification|Shield of faith|Shield of protection|Soul hold|Soul shield|Speed|Spell empathy|Spider walk|Strengthen|Toxic dilution|Toxic immunity|Transmute self|Unpain|Unstable mutation|Unstun|Vine mantle|War ensemble|Water walking|Wither|Zoological protection})%s~|%s({%dmin and %ds|%dmin|%ds})%s|} {#add tprots {%1( %2)};#GAG} "setweak"
#TRIGGER {^~|~ Effect%s~|~ Lasts%s~|} {#var tprots {};#GAG} "setweak"
#ALIAS tcheck {show effects;#class setweak 1}
#ALIAS tcheckrep {
#var tprots %replace(@tprots,"min","m")
#var tprots %replace(@tprots," and ","")
#var tprots %replace(@tprots,"Acid shield","GAcid")
#var tprots %replace(@tprots,"Armour of aether","AoA")
#var tprots %replace(@tprots,"Aura of hate","AoH")
#var tprots %replace(@tprots,"Aura of wind","GAsphyx")
#var tprots %replace(@tprots,"Beacon of enlightenment","Boe")
#var tprots %replace(@tprots,"Blessing of tarmalen","BoT")
#var tprots %replace(@tprots,"Blurred image","Blur")
#var tprots %replace(@tprots,"Clandestine thoughts","ClandT")
#var tprots %replace(@tprots,"Cold tolerance","ColdTol")
#var tprots %replace(@tprots,"Corrosion shield","LAcid")
#var tprots %replace(@tprots,"Displacement","Disp")
#var tprots %replace(@tprots,"Earth blood","EBlood")
#var tprots %replace(@tprots,"Earth skin","ESkin")
#var tprots %replace(@tprots,"Earth power","EPower")
#var tprots %replace(@tprots,"Energy channeling","LElec")
#var tprots %replace(@tprots,"Enhanced awareness","EAwa")
#var tprots %replace(@tprots,"Enrage","Enrage")
#var tprots %replace(@tprots,"Ether boundary","LAsphyx")
#var tprots %replace(@tprots,"Fire walking","FWalk")
#var tprots %replace(@tprots,"Flame shield","GFire")
#var tprots %replace(@tprots,"Flex shield","Flex")
#var tprots %replace(@tprots,"Floating","Float")
#var tprots %replace(@tprots,"Frost insulation","LCold")
#var tprots %replace(@tprots,"Frost shield","GCold")
#var tprots %replace(@tprots,"Force absorption","Fabs")
#var tprots %replace(@tprots,"Force shield","FS")
#var tprots %replace(@tprots,"Haste","Haste")
#var tprots %replace(@tprots,"Heat reduction","LFire")
#var tprots %replace(@tprots,"Heavenly protection","HProt")
#var tprots %replace(@tprots,"Heavy weight","HW")
#var tprots %replace(@tprots,"Infravision","Infra")
#var tprots %replace(@tprots,"Invisibility","Invis")
#var tprots %replace(@tprots,"Iron will","IW")
#var tprots %replace(@tprots,"Life link","Link")
#var tprots %replace(@tprots,"Lift of load","LoL")
#var tprots %replace(@tprots,"Lightning shield","GElec")
#var tprots %replace(@tprots,"Magic dispersion","LMana")
#var tprots %replace(@tprots,"Mana shield","ManaSh")
#var tprots %replace(@tprots,"Melodic embracement","MEmbr")
#var tprots %replace(@tprots,"Mesmeric threshold","MeTrsh")
#var tprots %replace(@tprots,"Minor protection","MinorProt")
#var tprots %replace(@tprots,"Mirror image","Mirrors")
#var tprots %replace(@tprots,"Pain threshold","PainT")
#var tprots %replace(@tprots,"Protection from good","PFG")
#var tprots %replace(@tprots,"Protection from evil","PFE")
#var tprots %replace(@tprots,"Psionic phalanx","GPsi")
#var tprots %replace(@tprots,"Psionic shield","PsiSh")
#var tprots %replace(@tprots,"Psychic sanctuary","LPsi")
#var tprots %replace(@tprots,"Quicksilver","QS")
#var tprots %replace(@tprots,"Regeneration","Regen")
#var tprots %replace(@tprots,"Repulsor aura","GMana")
#var tprots %replace(@tprots,"Resist disintegrate","RDisint")
#var tprots %replace(@tprots,"Resist entropy","REntro")
#var tprots %replace(@tprots,"Resist gaseous form","RGasForm")
#var tprots %replace(@tprots,"See invisible","SeeInvis")
#var tprots %replace(@tprots,"See magic","SeeMagic")
#var tprots %replace(@tprots,"Shield of detoxification","GPoison")
#var tprots %replace(@tprots,"Shield of faith","SoF")
#var tprots %replace(@tprots,"Shield of protection","SoP")
#var tprots %replace(@tprots,"Soul hold","SoulH")
#var tprots %replace(@tprots,"Soul shield","SS")
#var tprots %replace(@tprots,"Spell empathy","SpellE")
#var tprots %replace(@tprots,"Spider walk","SWalk")
#var tprots %replace(@tprots,"Toxic dilution","LPoison")
#var tprots %replace(@tprots,"Toxic immunity","TxcImm")
#var tprots %replace(@tprots,"Transmute self","Transm")
#var tprots %replace(@tprots,"Unpain","Unp")
#var tprots %replace(@tprots,"Unstable mutation","Mutate")
#var tprots %replace(@tprots,"Unstun","Us")
#var tprots %replace(@tprots,"Vine mantle","VMant")
#var tprots %replace(@tprots,"War ensemble","WarE")
#var tprots %replace(@tprots,"Water walking","WW")
p report @tprots}


Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sun Nov 02, 2008 4:17 am   
 
I suspect this is because the @tprots variable can have spaces in, and zMUD will require quotes "" around it inside functions to work in that case. Try using "@tprots" instead of @trprots inside your %replace functions.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Tarken Aurelius
Apprentice


Joined: 23 Oct 2008
Posts: 120
Location: Cincinnati, Ohio

PostPosted: Sun Nov 02, 2008 11:44 am   
 
No, that didn't work. It just makes the value of the variable tprots = @tprots. I think the problem might lie in the #add perhaps? It's the only thing that doesn't seem right at least once the editor messes with it when I save the trigger. It's key though that I make it "%1(%2) " with the space at the end, and it just reconfigures it like #add tprots { (%1), (%2)}
_________________
Tarken Aurelius, quality triggers since 2004! Trigger consulting since 2008! Content Developer at BatMUD (www.bat.org)
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sun Nov 02, 2008 1:00 pm   
 
Actually, yes, that's a good point. Frankly I'm surprised it works in CMUD - it must be something CMUD's doing checking the type of the argument. Because there's a separate #add command that you're using here, where I think you mean to be using #additem.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Tarken Aurelius
Apprentice


Joined: 23 Oct 2008
Posts: 120
Location: Cincinnati, Ohio

PostPosted: Sun Nov 02, 2008 1:26 pm   
 
Ok it works, just not quite how I would like but it works. I use cmud actively but I'm also active maintainer of a majority of the muds zmud trigger sets, so I try to keep things backward compatible as I make them. Too bad they're all too stingy to go get CMUD.
_________________
Tarken Aurelius, quality triggers since 2004! Trigger consulting since 2008! Content Developer at BatMUD (www.bat.org)
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Sun Nov 02, 2008 3:41 pm   
 
First I would suggest putting all the match and replacement information into a record variable.
#CLASS setweak
#VAR TProtList "Acid shield=GAcid|Armour of aether=AoA|Aura of hate=AoH|Aura of wind=GAsphyx|Beacon of enlightenment=Boe|Blessing of tarmalen=BoT|Blurred image=Blur|Clandestine thoughts=ClandT|Cold tolerance=ColdTol|Corrosion shield=LAcid|Displacement=Disp|Earth blood=EBlood|Earth skin=ESkin|Earth power=EPower|Energy channeling=LElec|Enhanced awareness=EAwa|Enrage=Enrage|Ether boundary=LAsphyx|Fire walking=FWalk|Flame shield=GFire|Flex shield=Flex|Floating=Float|Frost insulation=LCold|Frost shield=GCold|Force absorption=Fabs|Force shield=FS|Haste=Haste|Heat reduction=LFire|Heavenly protection=HProt|Heavy weight=HW|Infravision=Infra|Invisibility=Invis|Iron will=IW|Life link=Link|Lift of load=LoL|Lightning shield=GElec|Magic dispersion=LMana|Mana shield=ManaSh|Melodic embracement=MEmbr|Mesmeric threshold=MeTrsh|Minor protection=MinorProt|Mirror image=Mirrors|Pain threshold=PainT|Protection from good=PFG|Protection from evil=PFE|Psionic phalanx=GPsi|Psionic shield=PsiSh|Psychic sanctuary=LPsi|Quicksilver=QS|Regeneration=Regen|Repulsor aura=GMana|Resist disintegrate=RDisint|Resist entropy=REntro|Resist gaseous form=RGasForm|See invisible=SeeInvis|See magic=SeeMagic|Shield of detoxification=GPoison|Shield of faith=SoF|Shield of protection=SoP|Soul hold=SoulH|Soul shield=SS|Spell empathy=SpellE|Spider walk=SWalk|Toxic dilution=LPoison|Toxic immunity=TxcImm|Transmute self=Transm|Unpain=Unp|Unstable mutation=Mutate|Unstun=Us|Vine mantle=VMant|War ensemble=WarE|Water walking=WW"
#CLASS 0

Next change the trigger that captures this stuff:
#REGEX {^\| (@TProtList)\s\|(?:(\d+m)in| and |(\d+s))+\s\|} {#addkey tprots {%db(@TProtList,%1)} {%2 %3};#GAG} "setweak"

Finally change the display alias:
#ALIAS tcheckrep {p report %expanddb(@tprots," ",",")}
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Tarken Aurelius
Apprentice


Joined: 23 Oct 2008
Posts: 120
Location: Cincinnati, Ohio

PostPosted: Sun Nov 02, 2008 3:45 pm   
 
Oh, thats interesting. I guess that would help with future expansion.
_________________
Tarken Aurelius, quality triggers since 2004! Trigger consulting since 2008! Content Developer at BatMUD (www.bat.org)
Reply with quote
Tarken Aurelius
Apprentice


Joined: 23 Oct 2008
Posts: 120
Location: Cincinnati, Ohio

PostPosted: Sun Nov 02, 2008 5:27 pm   
 
Would that accommodate for something being in the pattern that isn't in the list? Doesn't look like it but I dunno about regex much.
_________________
Tarken Aurelius, quality triggers since 2004! Trigger consulting since 2008! Content Developer at BatMUD (www.bat.org)
Reply with quote
Rappy
Wanderer


Joined: 15 Jul 2005
Posts: 96

PostPosted: Sun Nov 02, 2008 9:53 pm   
 
You can also eliminate 'some' code by using #GAGON for the top part of the box and #GAGOFF for the bottom, that will eliminate triggers that just #GAG as well as all the #GAG's within the script.

-Rappy
_________________
Windows 11 Pro,
cMUD 3.34
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