|
Foma Newbie
Joined: 11 Feb 2002 Posts: 7
|
Posted: Mon Feb 11, 2002 4:57 pm
coloring hps in the prompt |
my prompt looks like this:
136/136 >
i have been trying for hours to set up a trigger to color the first instance of 136 to be diffrent colors based on what percent of full health it is at, like green for 75%-100%, yellow from 50%-74%, orange from 25%-49%, red from 0%-24%,ive tried all kinds of if statements etc and have got nothing, im not even sure if im setting up the actual triggering part correctly, ive tried it like a hundred diffrent ways and even tried the examples in other post on these boards, any help? |
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Mon Feb 11, 2002 5:39 pm |
Trigger:
^(%d)/(%d) ~>
Value
#SUB {%ansi( %case( %eval( %1*3/%2)+1, "high,red", yellow, green, blue), black)%1/%2hp ~>}
Options on trigger:
[ ] trigger on trigger
[X] prompt
[ ] newline
There is no orange but you can play with
around with the colors. I included the
"high, red" so you can see other possibilities.
I added "hp" to the #SUB so you wouldn't get
a trigger flood if you didn't uncheck
the trigger on trigger.
I have unchecked the newline just in case
you get things like:
2/136 > Bobbie chats, 'blah'
As your prompt happens often, this might
not be the best solution for speed issues.
TonDiening
Uses 6.16 |
|
|
|
dacheeba Adept
Joined: 29 Oct 2001 Posts: 250
|
Posted: Mon Feb 11, 2002 6:33 pm |
Hmm, this is though because it requires some math, and after testing it, i wouldnt work...though I know the math is right, this may be a bug.
Pattern:&hp/&maxhp ~>
Value:
#MATH perchp (@hp@maxhp)
#IF (@perchp>=.75 & @perchp<=1) {#CW @hp green}
#IF (@perchp>=.5 & @perchp<=.74) {#CW @hp yellow}
#IF (@perchp>=.25 & @perchp<=.49) {#CW @hp orange}
#IF (@perchp>=0 & @perchp<=.24) {#CW @hp red}
Unfortunatly this script doesnt work, as the @perchp variable doesnt get figured by the #MATH.All it does is assign the value of @hp to @perchp...?If someone wants to correct it, please do I dont use the #math command enough |
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Mon Feb 11, 2002 6:51 pm |
Version 6.16 doesn't support floating point
operations or decimal numbers.
Easiest way would be to push it to a whole
number.
#MATH perchp (@hp*100/@maxhp)
#IF (@perchp>=75 AND @perchp<=100) {#CO green}
#IF (@perchp>=50 AND @perchp<=74) {#CO yellow}
#IF (@perchp>=25 AND @perchp<=49) {#CO orange}
#IF (@perchp>=0 AND @perchp<=24) {#CO red}
Hmm the #CW pattern color makes another trigger. So I modified it to #CO
TonDiening
Uses 6.16 |
|
|
|
dacheeba Adept
Joined: 29 Oct 2001 Posts: 250
|
Posted: Mon Feb 11, 2002 7:18 pm |
Thank for the correction, but now i get a syntax err on the # in #CO...dont know why.
BTW, you say v6.16 doesnt support floating pts and decimal points, but does 6.25a.I think i remeber seeing that it does floating pts, but i dont know if that include decimal pts. or not. Thanks |
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Mon Feb 11, 2002 8:08 pm |
Try with numbers instead.
#co 31
#co 71
or extract the number with:
#co %color(green,highlight)
#co %color(yellow,highlight)
#co %color(red,highlight)
Intersting. Orange is handled differently.
Probably a RGB large number with function
or something. I just loaded 6.26 so I shall
not go into much detail as I might be seeing
new things.
TonDiening
Uses 6.16 |
|
|
|
dacheeba Adept
Joined: 29 Oct 2001 Posts: 250
|
Posted: Mon Feb 11, 2002 8:48 pm |
Got it working. Curiously, the problem was i was using #CO instead of #co.Dont see the difference. And this is a pretty slow method,im going to check your method above and see if its any faster :)
Thanks for your help :) |
|
|
|
Pagan Beginner
Joined: 23 Feb 2001 Posts: 21 Location: South Africa
|
Posted: Wed Feb 13, 2002 10:40 pm |
ok..but what if your prompt is as follows?
<362/282>
The 362 being max hps and the 282 being max sps.
Pagan
Chaos, Panic, Disorder, my work here is done. |
|
|
|
dacheeba Adept
Joined: 29 Oct 2001 Posts: 250
|
Posted: Wed Feb 13, 2002 10:56 pm |
You mean your prompt never changes until you level?You can do this type of thing unless you recieve some sort of message that tells you exactly how much hp/sps you spend or lose, in addition to having a way of knowing exacly how much you recover from resting/potions and the such.It seems kind of odd to me that your prompt only shows your maxes,perhaps you should check to see it your mud has a way to change your prompt(most muds do) and if you can, it would make making a trigger MUCH easier.
|
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Thu Feb 14, 2002 12:20 am |
If your prompt only shows max hp, there is no reason to color how much you have left based on the percentage it represents of the max hp because you do not see your current hp to begin with.
Kjata |
|
|
|
Pagan Beginner
Joined: 23 Feb 2001 Posts: 21 Location: South Africa
|
Posted: Fri Feb 15, 2002 1:43 am |
whoops, sorry, what i meant was that 362 is the highest the
hps can go..and 282 is the highest the sp can go.
they drop whenever you get hit or cast a spell..just like normal.
for example, im a rogue, so if i throw a dagger my
prompt will change from <312/282> to <312/252> a dagger
costing 30sps.
Pagan
Chaos, Panic, Disorder, my work here is done. |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Fri Feb 15, 2002 3:31 am |
Then it's the same setup, but you need a way to capture your max hp and max sp from somewhere else. Perhaps from the score command (and so you would have to type it every so often, or at least every time your max hp or max sp changes) or from some other MUD output.
Kjata |
|
|
|
Aselarin Beginner
Joined: 23 Jul 2005 Posts: 26
|
Posted: Sat Jul 30, 2005 12:30 am |
hi, i have tried this approach, but i can't make it work correct, anyone help me plz ?
This is my current prompt: (60 H 17 M):
How do i make the hp change color ? |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sat Jul 30, 2005 1:25 am |
#TRIGGER "prompt" {^ ~((%d) H (%d) M):} {
#PCOL %if(%1>%1/2,green,red) %x1
#PCOL %if(%2>%2/2,green,red) %x2
} "" {nocr|prompt} |
|
|
|
demoneyoungblood Apprentice
Joined: 16 Dec 2002 Posts: 114 Location: USA
|
Posted: Sun Jul 31, 2005 3:11 pm My prompt script |
Ok, this is for *my* prompt, but its a very thorough gauge prompt. You should be able to change it to suit your needs :-D
[btw, my prompt is: (hp/maxhp mana/maxmana move/maxmove *XPTNL* EXITS) ]
Here is the trigger:
Code: |
~((%d)/(%d) (%d)/(%d) (%d)/(%d) ~*(%d)~* (%w)~)
|
and here is the trigger value
Code: |
#var hp %1
#var maxhp %2
#var mana %3
#var maxmana %4
#var move %5
#var maxmove %6
#var tnl %7
#var directions %8
#pcol lime %x2
#pcol lime %x4
#pcol lime %x6
#pcol fuchsia %x7
#IF (((@hp * 100) / @ maxhp)==100) {#pcol lime %x1}
#IF (((@hp * 100) / @ maxhp)<=99 AND ((@hp * 100) / @ maxhp)>=90) {#pcol lawngreen %x1}
#IF (((@hp * 100) / @ maxhp)<=89 AND ((@hp * 100) / @ maxhp)>=80) {#pcol lightgreen %x1}
#IF (((@hp * 100) / @ maxhp)<=79 AND ((@hp * 100) / @ maxhp)>=70) {#pcol yellow %x1}
#IF (((@hp * 100) / @ maxhp)<=69 AND ((@hp * 100) / @ maxhp)>=60) {#pcol khaki %x1}
#IF (((@hp * 100) / @ maxhp)<=59 AND ((@hp * 100) / @ maxhp)>=50) {#pcol lightyellow %x1}
#IF (((@hp * 100) / @ maxhp)<=49 AND ((@hp * 100) / @ maxhp)>=40) {#pcol red %x1}
#IF (((@hp * 100) / @ maxhp)<=39 AND ((@hp * 100) / @ maxhp)>=30) {#pcol crimson %x1}
#IF (((@hp * 100) / @ maxhp)<=29 AND ((@hp * 100) / @ maxhp)>=20) {#pcol darkred %x1}
#IF (((@hp * 100) / @ maxhp)<=19 AND ((@hp * 100) / @ maxhp)>=10) {#pcol lightslategray %x1}
#IF (((@hp * 100) / @ maxhp)<=9 AND ((@hp * 100) / @ maxhp)>=0) {#pcol darkslategray %x1}
#IF (((@mana * 100) / @ maxmana)==100) {#pcol lime %x3}
#IF (((@mana * 100) / @ maxmana)<=99 AND ((@mana * 100) / @ maxmana)>=90) {#pcol lawngreen %x3}
#IF (((@mana * 100) / @ maxmana)<=89 AND ((@mana * 100) / @ maxmana)>=80) {#pcol lightgreen %x3}
#IF (((@mana * 100) / @ maxmana)<=79 AND ((@mana * 100) / @ maxmana)>=70) {#pcol yellow %x3}
#IF (((@mana * 100) / @ maxmana)<=69 AND ((@mana * 100) / @ maxmana)>=60) {#pcol khaki %x3}
#IF (((@mana * 100) / @ maxmana)<=59 AND ((@mana * 100) / @ maxmana)>=50) {#pcol lightyellow %x3}
#IF (((@mana * 100) / @ maxmana)<=49 AND ((@mana * 100) / @ maxmana)>=40) {#pcol red %x3}
#IF (((@mana * 100) / @ maxmana)<=39 AND ((@mana * 100) / @ maxmana)>=30) {#pcol crimson %x3}
#IF (((@mana * 100) / @ maxmana)<=29 AND ((@mana * 100) / @ maxmana)>=20) {#pcol darkred %x3}
#IF (((@mana * 100) / @ maxmana)<=19 AND ((@mana * 100) / @ maxmana)>=10) {#pcol lightslategray %x3}
#IF (((@mana * 100) / @ maxmana)<=9 AND ((@mana * 100) / @ maxmana)>=0) {#pcol darkslategray %x3}
#IF (((@move * 100) / @ maxmove)==100) {#pcol lime %x5}
#IF (((@move * 100) / @ maxmove)<=99 AND ((@move * 100) / @ maxmove)>=90) {#pcol lawngreen %x5}
#IF (((@move * 100) / @ maxmove)<=89 AND ((@move * 100) / @ maxmove)>=80) {#pcol lightgreen %x5}
#IF (((@move * 100) / @ maxmove)<=79 AND ((@move * 100) / @ maxmove)>=70) {#pcol yellow %x5}
#IF (((@move * 100) / @ maxmove)<=69 AND ((@move * 100) / @ maxmove)>=60) {#pcol khaki %x5}
#IF (((@move * 100) / @ maxmove)<=59 AND ((@move * 100) / @ maxmove)>=50) {#pcol lightyellow %x5}
#IF (((@move * 100) / @ maxmove)<=49 AND ((@move * 100) / @ maxmove)>=40) {#pcol red %x5}
#IF (((@move * 100) / @ maxmove)<=39 AND ((@move * 100) / @ maxmove)>=30) {#pcol crimson %x5}
#IF (((@move * 100) / @ maxmove)<=29 AND ((@move * 100) / @ maxmove)>=20) {#pcol darkred %x5}
#IF (((@move * 100) / @ maxmove)<=19 AND ((@move * 100) / @ maxmove)>=10) {#pcol lightslategray %x5}
#IF (((@move * 100) / @ maxmove)<=9 AND ((@move * 100) / @ maxmove)>=0) {#pcol darkslategray %x5}
|
THIS IS NOT A COMMAND LINE PASTABLE SCRIPT
I deliberately did it this way to make it easier on you to change to suit your needs. I know its probably an overkill script too, but it works, and i havent bothered finding another way of doing it. |
|
_________________ -Demone YoungBlood |
|
|
|
|
|