First off thank you Mr Gammon for all your contributions to this space. I'm really enjoying applying my chosen career's computer science skills to telnet text based DnD gaming from my childhood in the 90s.
I have a working prompt trigger which can capture any numeric value from my prompt, but returns nil for any matched segment that is a string instead of a number.
Trigger:
example prompt values that the MUD displays which fire my trigger.
when fighting ("cprompt"):
when not fighting (normal "prompt")
%1 and %3-8 work great and return the expected numbers when I output them with Note().
%2 is always nil when in combat, and properly shows the numeric exp value when not in combat
I originally was using "WAR" and "Peace" instead of 1 and 0 for the %1 value in my prompt and cprompt definitions, but they were also always nil until I changed them to numeric. I can't changed the target enemy condition format to a numeric value because that's not an option the MUD offers. How can I tweak trigger definition to capture strings?
Note this behavior was the same before I converted it to regex, when using * * */* */* */* syntax. I just thought full regex might fix it. It doesn't work any worse as regex though.
Further, pasting my exact regex and example prompt strings into https://regex101.com/ result in proper matching of the second group (the string). I'm sure it's some difference between regex version/support that I can't seem to glean from reading others posts and the docs.
Thank you in advance for reading my wall-o-text!
-Crunk
I have a working prompt trigger which can capture any numeric value from my prompt, but returns nil for any matched segment that is a string instead of a number.
Trigger:
<triggers>
<trigger
enabled="y"
expand_variables="y"
group="prompt"
ignore_case="y"
match="^\<\{(.*?)\} \[(.*)\] \[(.*?)\/(.*?)hp (.*?)\/(.*?)m (.*?)\/(.*?)mv\]\>(.*)$"
name="prompt"
regexp="y"
send_to="12"
sequence="100"
>
<send>if %1 == 1 then
Fighting = 1
TargetHealth = %2
curHP = %3
maxHP = %4
curM = %5
maxM = %6
curMV = %7
maxMV = %8
Note ("mob condition:")
Note (%2)
elseif %1 == 0 then
Fighting = 0
TargetHealth = "NA"
curXP = %2
curHP = %3
maxHP = %4
curM = %5
maxM = %6
curMV = %7
maxMV = %8
end -- if
</send>
</trigger>
</triggers>
example prompt values that the MUD displays which fire my trigger.
when fighting ("cprompt"):
<{1} [Injured] [103132/100085hp 98005/98005m 99805/99805mv]>
when not fighting (normal "prompt")
<{0} [1165429] [102779/100085hp 98005/98005m 99805/99805mv]>
%1 and %3-8 work great and return the expected numbers when I output them with Note().
%2 is always nil when in combat, and properly shows the numeric exp value when not in combat
I originally was using "WAR" and "Peace" instead of 1 and 0 for the %1 value in my prompt and cprompt definitions, but they were also always nil until I changed them to numeric. I can't changed the target enemy condition format to a numeric value because that's not an option the MUD offers. How can I tweak trigger definition to capture strings?
Note this behavior was the same before I converted it to regex, when using * * */* */* */* syntax. I just thought full regex might fix it. It doesn't work any worse as regex though.
Further, pasting my exact regex and example prompt strings into https://regex101.com/ result in proper matching of the second group (the string). I'm sure it's some difference between regex version/support that I can't seem to glean from reading others posts and the docs.
Thank you in advance for reading my wall-o-text!
-Crunk