Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 144

PostPosted: Sat Feb 12, 2022 2:26 am   

HUD trigger that may or may not include data initially
 
The mud I play allows us to customize our hpbar based on the guild we are in...

out of combat
Code:
HP: 1914/952 | SP: 378/336 | E: 
 C: 100.00% | F:   0.00% | D: 1
   | -n- |   0% |  69.73%


This is out of combat and upon first login after a reboot. the 1st line in-combat would show E: ##% for enemy hp status... out of combat it's just as you see above.
getting a single trigger to recognize either state with or without the ##% and able to capture the numerical value for a gauge...

3rd line has the blank space before the | which I have yet to toggle my defenses so they do not show 'yet' again as above any way to recognize either state? and atm my defenses would appear as "sD" while active.

in-combat
Code:
HP: 1914/952 | SP: 378/336 | E:  76%
 C: 100.00% | F:   0.00% | D: 1
 sD | -n- |   0% |  69.73%


I know it can be done with regex but I am trying to not mix and match zscript and regex too much...
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 144

PostPosted: Sat Feb 12, 2022 11:06 pm   
 
My solution so far... functional but just feels dirty lol.

Code:
<trigger name="HUD_1" priority="330" id="33">
  <pattern><![CDATA[^HP:%s&{HUD.HP}/&{HUD.MaxHP}%s|%sSP:%s&{HUD.SP}/&{HUD.MaxSP}%s|%sE:%s&{HUD.enemyStatus}$]]></pattern>
  <value>//HUD.HP=%1
//HUD.MaxHP=%2
//HUD.SP=%3
//HUD.MaxSP=%4
//HUD.enemyStatus=%5

#GAG
//#SUB ""</value>
  <trigger>
    <pattern>^%sC:%s&amp;{HUD.C}~%%s|%sF:%s&amp;{HUD.F}~%%s|%sD:%s&amp;{HUD.D}%s$</pattern>
    <value>#GAG
//#SUB ""</value>
  </trigger>
  <trigger>
    <pattern><![CDATA[^%s&{HUD.WIP}%s|%s~-&{HUD.Mode}~-%s|%s&{HUD.Charge}~%%s|%s&{HUD.GTN}$]]></pattern>
    <value>#GAG
//#SUB ""</value>
  </trigger>
</trigger>
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4525
Location: Pensacola, FL, USA

PostPosted: Fri Feb 18, 2022 12:25 pm   
 
There is a simple way to account for optional text in a given trigger pattern.

I tend to use this to account for the difference between first and third person perspectives, which is usually just some words are plural and others aren't.

#TR {%w launch{es|} an attack on} {do something}

It's all down to using an anonymous variable with a null member: {es|}
_________________
Discord: Shalimar#3679
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 144

PostPosted: Sat Feb 19, 2022 4:34 am   
 
so if I am following your here


There are three obvious exits: n, s, e
There is one obvious exit: w

would be ...
#TR {There {is|are} %w obvious exit{s|}: *} {do something}
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4525
Location: Pensacola, FL, USA

PostPosted: Wed Feb 23, 2022 5:13 pm   
 
Correct.
_________________
Discord: Shalimar#3679
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net