 |
unebc Newbie
Joined: 18 Dec 2002 Posts: 6
|
Posted: Thu Jan 23, 2003 8:54 pm
varible color trigger |
Ok here is what im trying to do. In the mud that I play Ages of Despair I can use a command "v" that will give me a three lines
HP: [339/385] CONC: [939/939]
LINK: [120/120] CR: 0 MI: 0 WSTAFF: [41/300:Shock] TAL: [1/1]
ELEM: [100%] CASTING: (none)
Im trying to capture the numbers into vars like this
HP: [(%d)/(%d)] CONC: [(d%)/(%d)]
#VAR HP %1;#VAR MHP %2;#VAR CP %3;#VAR MCP %4
LINK: [(%d)/(%d)] CR: (%d) MI: (%d) WSTAFF: [(%d)/(%d):(%w)] TAL: [(%d)/(%d)]
#VAR LP %1;#VAR MLP %2;#VAR CR %3;#VAR MI %4;#VAR WS %5;#VAR MWS %6;
#VAR WTYPE %7;#VAR TAL %8;#VAR MTAL %9
ELEM: [(%d)%] CASTING: (%w)
#VAR ELE %1;#VAR SPELL %2
After its captured I want it to be colored depending on what percentiage. for example MHP is the total i can have while HP is how much i have at the curent time. Not sure on the math to work that out but i can find it (my wife is a math teacher :) )
at 100-80% it would be color 3
at 79-60% it would be color 14
at 59-30% it would be color 12
at 29-0 it would be color 15
the vars that need to be percentages are
hp/mhp cp/mcp ws/mws tal/mtal
the others are allready in percentiages.. or are the names of a spell or type
var SPELL i would like to be color 11
and var WTYPE i would like color 11 as well..
now the problem is im not sure how to set any of it up.. I pasted them in my triggers just to see if it would capture the variables but it isnt..
I have another trigger like this
You are carrying (%d) coins.
#VAR cash %1;#color 6
that works fine.. but this one isnt doing anything.. any help would be appreciated. I hope this makes since.. if you need any other info please let me know.
Thanks in advanced!
Edit: TonDiening
Thanks to Lightbulb for giving me the original
which I killed by accident!
Edited by - tondiening on 01/23/2003 14:43:47 |
|
|
 |
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Thu Jan 23, 2003 9:30 pm |
Your first problem is that [] are special characters and have a special meaning when used in patterns. Just put a ~ in front of them and your patterns should work.
HP: ~[(%d)/(%d)~] CONC: ~[(d%)/(%d)~]
#VAR HP %1;#VAR MHP %2;#VAR CP %3;#VAR MCP %4
As for the colors, every line has two or more values that might need different colors. To accomplish that, you'd need to use a complicated formula involving #SUB and multiple uses of the %if and %ansi functions. Personally, I'd just use the variables to set up standard two-color gauges.
Edit: Hadn't really noticed the new #PCOL command and %x1-%x99 variables. Good idea.
LightBulb
Senior Member |
|
|
 |
Talahaski Enchanter
Joined: 10 Oct 2000 Posts: 656 Location: USA
|
Posted: Thu Jan 23, 2003 9:33 pm |
Looks like you have a good start.
Your first line:
HP: [(%d)/(%d)] CONC: [(d%)/(%d)]
#VAR HP %1;#VAR MHP %2;#VAR CP %3;#VAR MCP %4
The trigger here would look like.
#TR {HP~: ~[(%d)~/(%d)~] CONC~: ~[(d%)~/(%d)~]} {#VAR HP %1;#VAR MHP %2;#VAR CP %3;#VAR MCP %4;#math hp_per @hp/@mhp;#math cp_per @cp/@mcp;#if (@hp_per<30) {#var color1 15} {#if (@hp_per<60) {#var color1 12} {#if (@hp_per<80) {#var color1 14} {#var color1 3};if (@cp_per<30) {#var color2 15} {#if (@cp_per<60) {#var color2 12} {#if (@cp_per<80) {#var color2 14} {#var color2 3};#sub {%ansi(high,@color)HP~: ~[(%1)~/(%1)~] %ansi(high,color2)CONC~: ~[(3%)~/(%4)~]
That should get you going for the first line. I have not tested this though, the #sub line may need some tweaking. hope it helps.
Talahaski
Processor PIII 1000
Memory 265MB
Video NVIDIA 64MB
Windows XP
Zmud Version 6.50
Zmapper Version 1.14 |
|
|
 |
Talahaski Enchanter
Joined: 10 Oct 2000 Posts: 656 Location: USA
|
Posted: Thu Jan 23, 2003 9:35 pm |
wow. look like we all decided to respond to his message at the same time.
Talahaski
Processor PIII 1000
Memory 265MB
Video NVIDIA 64MB
Windows XP
Zmud Version 6.50
Zmapper Version 1.14 |
|
|
 |
TonDiening GURU

Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Thu Jan 23, 2003 9:45 pm |
In the end only thing useful I have to
contribute is for the colouring aspect:
Trigger:
HP~: ~[(%d)~/(%d)~] CONC~: ~[(%d)~/(%d)~]
Value:
#VAR HP %1;#VAR MHP %2;#VAR CP %3;#VAR MCP %4
#VAR percentHP [@HP*10/@MHP]
#CASE @percentHP {#PCOL 3 %x1} {#PCOL 3 %x1} {#PCOL 12 %x1} {#PCOL 12 %x1} {#PCOL 12 %x1} {#PCOL 14 %x1} {#PCOL %x1} {#PCOL 15 %x1} {#PCOL 15 %x1} {#PCOL 15 %x1}
For the math I chose to examine only the tens
digit then put them through a case function.
Ton Diening
Time for more coffee it seems ^_^ |
|
|
 |
Talahaski Enchanter
Joined: 10 Oct 2000 Posts: 656 Location: USA
|
Posted: Thu Jan 23, 2003 9:46 pm |
TonDiening, I was looking at your reply, what is that #pcol command. I never herd of that one and don't see it in the help files. Although I'm looking in the online help file right now cause i don't have zmud on this pc.
[edit]
I should pay more attention to the version history. that pcol and psub commands look very intresting.
Talahaski
Processor PIII 1000
Memory 265MB
Video NVIDIA 64MB
Windows XP
Zmud Version 6.50
Zmapper Version 1.14 |
|
|
 |
TonDiening GURU

Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Thu Jan 23, 2003 9:50 pm |
Ref: #PCOL
Great question, I found it last night and it
simplified many noprompt triggers of mine.
From the zmud help file with v6.40:
quote:
PCOL
Syntax: #PCOL color [XStart] [XEnd] [YStart] [YEnd]
Related: #COLOR, #CW
Colors part of a line on the screen. Color is the name of the color, or the ANSI attribute value (given by %color). HTML color names can be used. If the color name conflicts with an ANSI color name, put "mxp" in front of the name (e.g. mxpred) to get the HTML version.
If XStart is omitted, the start of the line is used. If XEnd is omitted, the end of the line is used. YStart and YEnd are relative to the current line. If missing, the current line is used. If 1, the previous line is used, etc.
The %x1..%x99 system variables can be used for the "XStart XEnd" values of matched trigger patterns in a trigger command.
PCOL Example
#TRIGGER {(%w) tells you} {#PCOL mxpblue %x1}
Colors the text matched by the (%w) in the pattern (XStart and XEnd given by %x1 variable) bright blue.
Edit: Wow #PSUB as well - another non version
reading person. More Value added by Zugg! Thanks Zugg!!
Ton Diening |
|
|
 |
Kjata GURU

Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Thu Jan 23, 2003 10:20 pm |
That's why I always read the version history before even opening a new version of zMUD for the first time. A lot of stuff is learned by doing that. You still need to watch out for the occasional command or function that slips by the version history, but you can always find a complete list of commands and functions in the Function/Command Wizard in the Help menu.
Kjata |
|
|
 |
unebc Newbie
Joined: 18 Dec 2002 Posts: 6
|
Posted: Fri Jan 24, 2003 12:05 am |
Wow thanks you guys are fast.. Im going to work on it tonight and post the finished results.
Thanks again!
All right got it set up and its working good. I ended up spliting everything up into parts.. ie a trigger for HP a trigger for CONC ext.. when they where combined it was only coloring the first var and not any of the others.. also for this exp
#CASE @percentHP {#PCOL 3 %x1} {#PCOL 3 %x1} {#PCOL 12 %x1} {#PCOL 12 %x1} {#PCOL 12 %x1} {#PCOL 14 %x1} {#PCOL %x1} {#PCOL 15 %x1} {#PCOL 15 %x1} {#PCOL 15 %x1}
its actuly backwards.. it should go 15 14 12 then 3.. was easy enough to figure out cause the HP when maxed was red ;) Thanks again for the help |
|
|
 |
unebc Newbie
Joined: 18 Dec 2002 Posts: 6
|
Posted: Sun Jan 26, 2003 7:04 pm |
Ok there are a couple of problems that ive came across after using it more.
This is the HPBar.. CR and MI will get values only during a battle when a spell is casted
right now MI i dont know how to get but the CR becomes a value of 4.. i dont know if this
value will change as my spell gets better or not yet.. but I think changing its trigger so
that there is 4 cases one for 0 1 2 3 4 going from white red yellow yellow and 4 being blue
for TAL i know that number will eventualy get to 10 but right now what is happing is when
Var TAL is 0 its blue 1 its yellow and 2 its blue.. it would be better if it was white yellow
and then blue when at 2.. allso with all of them once the first VAR gets down to about 10% of VAR 2
then the color goes back to blue instead of staying white.. VAR being somehting like HP and VAR 2
being MHP ext..
HP: [385/385] CONC: [938/939]
LINK: [120/120] CR: 0 MI: 0 WSTAFF: [320/320:Rest] TAL: [2/2]
ELEM: [100%] CASTING: (none)
These two are for the first line
#TRIGGER {HP~: ~[(%d)~/(%d)~]} {#VAR HP %1;#VAR MHP %2;#VAR percentHP [(@HP*10)/@MHP];#CASE @percentHP {#PCOL 15 %x1} {#PCOL 15 %x1} {#PCOL 12 %x1} {#PCOL 12 %x1} {#PCOL 14 %x1} {#PCOL 14 %x1} {#PCOL 14 %x1} {#PCOL 14 %x1} {#PCOL 3 %x1} {#PCOL 3 %x1};#PCOL 3 %x2}
#TRIGGER {CONC~: ~[(%d)~/(%d)~]} {#VAR CP %1;#VAR MCP %2;#VAR percentCP [(@CP*10)/@MCP];#CASE @percentCP {#PCOL 15 %x1} {#PCOL 15 %x1} {#PCOL 12 %x1} {#PCOL 12 %x1} {#PCOL 14 %x1} {#PCOL 14 %x1} {#PCOL 14 %x1} {#PCOL 14 %x1} {#PCOL 3 %x1} {#PCOL 3 %x1};#PCOL 3 %x2}
these five are for the second line
#TRIGGER {LINK~: ~[(%d)~/(%d)~]} {#VAR LN %1;#VAR MLN %2;#VAR percentLN [(@LN*10)/@MLN];#CASE @percentLN {#PCOL 15 %x1} {#PCOL 15 %x1} {#PCOL 12 %x1} {#PCOL 12 %x1} {#PCOL 12 %x1} {#PCOL 14 %x1} {#PCOL 14 %x1} {#PCOL 14 %x1} {#PCOL 3 %x1} {#PCOL 3 %x1};#PCOL 3 %x2}
#TRIGGER {CR~: (%d)} {#VAR CR %1;#CASE @CR {#PCOL 15 %x1} {#PCOL 15 %x1} {#PCOL 12 %x1} {#PCOL 12 %x1} {#PCOL 12 %x1} {#PCOL 14 %x1} {#PCOL 14 %x1} {#PCOL 14 %x1} {#PCOL 3 %x1} {#PCOL 3 %x1}}
#TRIGGER {MI~: (%d)} {#VAR MI %1;#CASE @MI {#PCOL 15 %x1} {#PCOL 15 %x1} {#PCOL 12 %x1} {#PCOL 12 %x1} {#PCOL 12 %x1} {#PCOL 14 %x1} {#PCOL 14 %x1} {#PCOL 14 %x1} {#PCOL 3 %x1} {#PCOL 3 %x1}}
#TRIGGER {WSTAFF~: ~[(%d)~/(%d)~:(%w)~]} {#VAR WS %1;#VAR MWS %2;#VAR WTYPE %3;#VAR percentWS [(@WS*10)/@MWS];#CASE @percentWS {#PCOL 15 %x1} {#PCOL 15 %x1} {#PCOL 12 %x1} {#PCOL 12 %x1} {#PCOL 12 %x1} {#PCOL 14 %x1} {#PCOL 14 %x1} {#PCOL 14 %x1} {#PCOL 3 %x1} {#PCOL 3 %x1};#PCOL 3 %x2;#PCOL 11 %x3}
#TRIGGER {TAL~: ~[(%d)~/(%d)~]} {#VAR TAL %1;#VAR MTAL %2;#VAR percentTAL [(@TAL*10)/@MTAL];#CASE @percentTAL {#PCOL 15 %x1} {#PCOL 15 %x1} {#PCOL 12 %x1} {#PCOL 12 %x1} {#PCOL 14 %x1} {#PCOL 14 %x1} {#PCOL 14 %x1} {#PCOL 14 %x1} {#PCOL 3 %x1} {#PCOL 3 %x1};#PCOL 3 %x2}
these last two are for the last line
#TRIGGER {ELEM~: ~[(%d)~%~]} {#VAR ELE %1;#VAR percentELE [(@ELE*10/100)];#CASE @percentELE {#PCOL 15 %x1} {#PCOL 15 %x1} {#PCOL 12 %x1} {#PCOL 12 %x1} {#PCOL 12 %x1} {#PCOL 14 %x1} {#PCOL 14 %x1} {#PCOL 14 %x1} {#PCOL 3 %x1} {#PCOL 3 %x1}}
#TRIGGER {CASTING~: (%*)} {#PCOL 11 %x1} |
|
|
 |
|
|