Color activated triggers

Posted by Adam Petersen on Fri 28 Mar 2003 11:36 PM — 3 posts, 14,905 views.

#0
i cant get it to work so im posting here


I need to make a trigger to go "Drink mana" when my mana number goes yellow.


3338h, 3152m ex-

338h is health
3152m is mana

they can be green yellow or red depending on the number

please help me get it to work
Australia Forum Administrator #1
You can make a colour-activated trigger, but it matches on the first character of the matching text, in this case the hp and not the mana.

The simple solution would be to call a small script that simply decides to do it based on the number of mana points, rather than the colour, and probably do something like disable the trigger and set a timer to re-enable it in 5 seconds, so you don't drink the potion too many times in quick succession.

eg. something like this:


<triggers>
  <trigger
   enabled="y"
   match="*h, *m ex-"
   name="CheckPrompt"
   script="DoPrompt"
   sequence="100"
  >
  </trigger>
</triggers>


The script subroutines you would need are:


sub DoPrompt (name, line, wildcards)
dim count
  count = CInt (wildcards (2))  ' mana points
  if count < 2000 then
     world.Send "drink mana"
     world.EnableTrigger "CheckPrompt", 0
     world.addtimer "prompt_timer", 0, 0, 5, "", 1 + 4 + 1024 + 16384, "PromptTimer"
  end if
end sub

sub PromptTimer (name)
    world.EnableTrigger "CheckPrompt", 1
end sub



#2
umm,yeah i was more hoping for sometihng simple because i have no idea how do do that, i dont understand, im challenged in that area. heh, sorry

I use version 3.20 if that makes any difference either, if you could explain step by step how to put that into place or have a simpler way that wouold be great! thanks