Dynamic Prompt Line Colorizer... Enclosed in only 1 trigger!!!

Posted by Onoitsu2 on Tue 09 May 2006 03:29 PM — 4 posts, 18,427 views.

USA #0
This is for Aardwolf, but can simply be altered to work on virtually any type of mud.
this is my prompt style as defined in the game:
<%h/%Hhp %m/%Mmn %v/%Vmv %Xtnl Gold: %g>%c


it is shown as:
<1767/1767hp 1682/1682mn 1408/1408mv 803tnl Gold: 999>
with a CR at the end

this basically omits the original promptline, then does a DoAfterSpecial 0.1, AnsiNote ""WHATEVER HERE"", 12

the if statements set up the color change based upon the percentage of current life divided by total life you have, which is set to, 50% and less, AND 33% and less to check the colors.

included an if statement for mn (mana) as well but you can do one for ANYTHING you can match and compare.

You can even hardcode in a value for gold you want to be warned about, such as you need so much gold to be resurected with all your items, well then set the needed gold (max) value to double what you need (for starters, you can slowly work value down after you do the math to attain 50% and 33% still being more than what you need) so that it warns when you are getting low on gold to be resurected with, BUT you still do have enough to be resurected.

Code for it is to follow ... enjoy :)


Laterzzz,
Onoitsu2
Amended on Tue 09 May 2006 09:33 PM by Nick Gammon
USA #1

<triggers>
  <trigger
   enabled="y"
   group="prompt_scripts"
   match="^\&lt;(.*?)\/(.*?)hp (.*?)\/(.*?)mn (.*?)\/(.*?)mv (.*?)tnl Gold\: (.*?)\&gt;$"
   omit_from_output="y"
   regexp="y"
   send_to="12"
   sequence="1"
  >
  <send>dim hp, mn
if ("%1" / "%2") &lt; 0.51 then
  if ("%1" / "%2") &lt; 0.34 then
    hp = 31
  else
    hp = 33
  end if
else
  hp = 32
end if

if ("%3" / "%4") &lt; 0.51 then
  if ("%3" / "%4") &lt; 0.31 then
    mn = 31
  else
    mn = 33
  end if
else
  mn = 36
end if
world.doafterspecial 0.1, "world.ansinote ansi(1) &amp; ansi(37) &amp; ""\&lt;"" &amp; ansi(0) &amp; ansi(1) &amp; ansi(hp) &amp; ""%1"" &amp; ansi(32) &amp; ""\/%2hp "" &amp; ansi(mn) &amp; ""%3"" &amp; ansi(36) &amp; ""\/%4mn "" &amp; ansi(37) &amp; ""%5\/%6mv "" &amp; ansi(35) &amp; ""%7tnl  "" &amp; ansi(33) &amp; ""Gold: %8"" &amp; ansi(1) &amp; ansi(37) &amp; ""\&gt;""", 12</send>
  </trigger>
</triggers>
Australia Forum Administrator #2
Thanks for contributing that!

I have split your post into two parts, as in my browser the lengthy script line also made your explanation hard to read.
USA #3
lol no prob Nick I love MUSHclient, it is an awsome program, and anything, and I do mean anything that I can contribute will be posted.

and ya I loaded this topic and was wondering why it was split, as I did not remember the code tag doing that previously... Yes it is easier to read now ...

Laterzzz,
Onoitsu2