LUA Prompt Trigger I Use

Posted by Onoitsu2 on Sat 09 Dec 2006 06:14 AM — 1 posts, 10,502 views.

USA #0
I use this Trigger on Aardwolf, to make a single line prompt and battle prompt into a multi-line one, that dynamically colors itself, and provides a percentage of HP and MN, and a colored difference in HP (i.e. +5 = Green, - 15 = RED), Also displays enemy percent diferences, and GOLD, as there are several mobs that are "thieves", and "spill your purse".

Prompt it will work on looks like this...
Quote:
<1000/1000hps 2000/2000mps 1500/1500mvs 500xptnl Gold: 1000>

<%h/%Hhps %m/%Mmps %v/%Vmvs %Xxptnl Gold: %g>%c


BPrompt looks like this...
Quote:
<1000/1000hps 2000/2000mps 1500/1500mvs 500xptnl Gold: 1000 Enemy: 100%>

<%h/%Hhps %m/%Mmps %v/%Vmvs %Xxptnl Gold: %g %b>%c


Hope this can and will be useful to some. :)

Quote:
<triggers>
  <trigger
   enabled="y"
   ignore_case="y"
   match="^\&lt;([-]?\d{1,})\/(\d{1,})hps\s([-]?\d+)\/(\d+)mps\s([-]?\d+)\/(\d+)mvs\s(\d{1,})xptnl\sGold\:\s(\d{1,})(\s{2}Enemy\: ([-]?\d{1,3})\%)?\&gt;"
   name="ULTIMATE_PROMPT"
   omit_from_output="y"
   regexp="y"
   send_to="12"
   sequence="1"
  >
  <send>
hppct = math.floor((tonumber("%1")/tonumber("%2")) * 100)
hp = tonumber("%1")
hp_old = tonumber(GetVariable("hp"))
mppct = math.floor((tonumber("%3")/tonumber("%4")) * 100)
mvpct = math.floor((tonumber("%5")/tonumber("%6")) * 100)
exp = tonumber("%7")
gold = tonumber("%8")
gold_old = tonumber(GetVariable("gold"))
enemypct = tonumber("%&lt;10&gt;")
enemy_old = tonumber(GetVariable("enemy"))

hp_low = 50
hp_danger = 25

mp_low = 33
mp_danger = 10

mv_low = 33
mv_danger = 10

exp_watch = 200

gold_watch = 150000

enemy_low = 40
enemy_dead = 10

enemy = 1


function Battle()
ColourNote("white","black","&lt;",hpcolor,"black","%1/%2hps ",mpcolor,"black","%3/%4mps ",mvcolor,"black","%5/%6mvs ",expcolor,"black","%7xptnl ",goldcolor,goldback,"Gold: %8",enemycolor,"black","  Enemy: %&lt;10&gt;\%","white","black","&gt;")
HPs()
Enemy()
end -- function

function NoEnemy()
ColourNote("white","black","&lt;",hpcolor,"black","%1/%2hps ",mpcolor,"black","%3/%4mps ",mvcolor,"black","%5/%6mvs ",expcolor,"black","%7xptnl ",goldcolor,goldback,"Gold: %8","white","black","&gt;")
HPs()
end -- function

function HPs()
if hp_old ~= nil and hp &lt; hp_old then
  hp_dif = math.abs(hp - hp_old)
  ColourNote("limegreen","black","Health: " .. hppct .. "%","red","black","  -" .. hp_dif)
elseif hp_old ~= nil  and hp &gt; hp_old then
  hp_dif = math.abs(hp_old - hp)
  ColourNote("limegreen","black","Health: " .. hppct .. "%","green","black","  +" .. hp_dif)
else
  ColourNote("limegreen","black","Health: " .. hppct .. "%")
end -- if
Mana()
end -- function

function Mana()
ColourNote("darkturquoise","black","Mana:   " .. mppct .. "%")
Gold()
end -- function

function Gold()
if gold_old ~= nil then
  if gold &lt; gold_old then
    gold_dif = math.abs(gold - gold_old)
    ColourNote("gold","black","Gold:   ","red","black","-" .. gold_dif)
  elseif gold &gt; gold_old then
    gold_dif = math.abs(gold_old - gold)
    ColourNote("gold","black","Gold:   ","green","black","+" .. gold_dif)
  end -- if
end -- if
end -- function

function Enemy()
if enemy_old ~= nil and enemypct ~= nil then
  if enemypct &lt; enemy_old then
    enemy_dif = math.abs(enemypct - enemy_old)
    ColourNote("plum","black","Enemy:  ","red","black","-" .. enemy_dif .. "%")
  elseif enemypct &gt; enemy_old then
    enemy_dif = math.abs(enemy_old - enemypct)
    ColourNote("plum","black","Enemy:  ","green","black","+" .. enemy_dif .. "%")
  end -- if
end -- if
end -- function

if hppct &lt;= hp_danger then
  hpcolor = "orangered"
elseif hppct &gt; hp_danger and hppct &lt;= hp_low then
  hpcolor = "yellow"
else
  hpcolor = "lime"
end -- if

if mppct &lt;= mp_danger then
  mpcolor = "orangered"
elseif mppct &gt; mp_danger and mppct &lt;= mp_low then
  mpcolor = "yellow"
else
  mpcolor = "paleturquoise"
end -- if

if mvpct &lt;= mv_danger then
  mvcolor = "orangered"
elseif mvpct &gt; mv_danger and mvpct &lt;= mv_low then
  mvcolor = "yellow"
else
  mvcolor = "darkorange"
end -- if

if exp &lt;= exp_watch then
  expcolor = "cyan"
else
  expcolor = "plum"
end -- if

if gold &gt;= gold_watch then
  goldcolor = "black"
  goldback = "gold"
else
  goldcolor = "gold"
  goldback = "black"
end -- if

if enemypct ~= nil then
  if enemypct &lt;= enemy_dead then
    enemycolor = "red"
  elseif enemypct &gt; enemy_dead and enemypct &lt;= enemy_low then
    enemycolor = "yellow"
  else
    enemycolor = "lime"
  end -- if
end -- if

if enemypct ~= nil then
DoAfterSpecial(0.1,'Battle()',12)
else
DoAfterSpecial(0.1,'NoEnemy()',12)
enemy = 0
end -- if

SetVariable("gold","%8")
SetVariable("hp",hp)
if enemy == 0 then
SetVariable("enemy",100)
elseif enemypct ~= nil then
SetVariable("enemy",enemypct)
end -- if</send>
  </trigger>
</triggers>