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
Ekjavel
Newbie


Joined: 06 Jan 2009
Posts: 3

PostPosted: Tue Jan 06, 2009 4:19 pm   

Need help altering triggers
 
Okay, for starters, I'm using a trigger atm that looks like this.

#CLASS {extraPrompt}
#TRIGGER {Hp:&{stats.hp}~(&{stats.maxhp}~) Sp:&{stats.sp}~(&{stats.maxsp}~) T:%d/%d C:%d~(%d~) B:%d P:%d Xp:&{stats.xp} Tactics: %d} {
#if (%null( @oldstats)=0) {
specdmg = %eval( @stats.xp - @oldstats.xp)
damage = %eval( @specdmg/2)
lhp = %eval( @stats.hp - @oldstats.hp)
lsp = %eval( @stats.hp - @oldstats.hp)
#show ~[L-Hp: @lhp~] ~[L-Sp: @lsp~] ~[SpecDmg: @specdmg~] ~[Damage: @damage~]
} {#show No data yet.}
oldstats = @stats
} "" {prompt}
#CLASS 0

What it does is that it adds a line to an original report line which looks like this:
Hp:252(252) Sp:340(340) T:0/0 C:0(70) B:0 P:0 Xp:5694268 Tactics: 25

so with the trigger the report line looks like this:

Hp:252(252) Sp:340(340) T:0/0 C:0(70) B:0 P:0 Xp:5694268 Tactics: 25
[L-Hp: 0] [L-Sp: 0] [SpecDmg: 0 ] [Damage: 0 ]

Anyway, what I want to do is alter the colour of the first piece of the upper line Hp:252(252). I thought there might be some way to alter the above trigger to include chaning the colour of that particular piece.

Would be grateful for answers.

Cheers
Very Happy
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Tue Jan 06, 2009 5:04 pm   
 
#PCOL and #PSUB may come in handy but I'm not sure you'll be able to use the %x1-%x99 pattern matches due to the database variable captures in the trigger.

EDIT: You could certainly use PCOL with fixed numbers like 0 and 11 after the colour so #PCOL {mxpred} (0) (11) oh and that should probably be the very first line in script part of the trigger too.
_________________
Taz :)
Reply with quote
Ekjavel
Newbie


Joined: 06 Jan 2009
Posts: 3

PostPosted: Tue Jan 06, 2009 7:52 pm   
 
Can't get it to work, maybe I could try a new trigger but what would the pattern be?
The report line looks like this normally

Hp:107(107) Sp:110(110) T:0/0 C:0(26) B:0 P:0 Xp:30598 Tactics: 0

and what I want to change color on is the different pieces like Hp:107(107)
Reply with quote
calesta
Apprentice


Joined: 07 Dec 2008
Posts: 102
Location: New Hampshire, USA

PostPosted: Wed Jan 07, 2009 5:02 am   
 
Without changing the trigger at all you can color just the numeric portions such as red for hp and maxhp and blue for sp and maxsp by adding:
Code:
#pcol mxpred %x1
#pcol mxpred %x2
#pcol mxpblue %x3
#pcol mxpblue %x4

If you want to color the whole Hp:107(107) section one color and the Sp:110(110) another color, add parenthesis around the sections you want to color:
Code:
#TRIGGER {(Hp:&{stats.hp}~(&{stats.maxhp}~)) (Sp:&{stats.sp}~(&{stats.maxsp}~)) T:%d/%d C:%d~(%d~) B:%d P:%d Xp:&{stats.xp} Tactics: %d} {#pcol mxpred %x1;#pcol mxpblue %x4;#if (%null( @oldstats)=0) {specdmg = %eval( @stats.xp - @oldstats.xp);damage = %eval( @specdmg/2);lhp = %eval( @stats.hp - @oldstats.hp);lsp = %eval( @stats.hp - @oldstats.hp);#show ~[L-Hp: @lhp~] ~[L-Sp: @lsp~] ~[SpecDmg: @specdmg~] ~[Damage: @damage~]} {#show No data yet.};oldstats = @stats} "" {prompt}
Reply with quote
Ekjavel
Newbie


Joined: 06 Jan 2009
Posts: 3

PostPosted: Wed Jan 07, 2009 7:04 pm   
 
Thanks alot Calesta! #pcol works like a charm
I Very Happy
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