hit % calculator

Have a question about which MUD client works best with SI? Looking for a free app that lets you log in from your phone? Need help with a complicated script? This is the place.
Creon
Citizen of Archai
Posts: 275
Joined: Sun Dec 22, 2013 9:22 am

hit % calculator

Post by Creon »

Wondering if anyone has a plugin that can track the % of how often you land strikes and how often your hit.
User avatar
Xiija
Citizen of Archai
Posts: 405
Joined: Wed Jul 23, 2014 6:55 pm
Contact:

Re: hit % calculator

Post by Xiija »

i made a parry etc kind of one for Aedin, mebbe someone can revamp it for hits...
the part to calc percentages looks like so...
Note("Percentage parried: " .. ((GetVariable("parries")/GetVariable("Attacks"))*100) .. "%")
_________________________________________________________________________

Code: Select all

This can be tweaked for any thyng...hits parry, evade..etc
Copy and then open trigger thyng on Mush and choose the Paste button
Copy each one seperate-ly

1...attack counter
__________________________________
<triggers>
<trigger
enabled="y"
expand_variables="y"
match="^The (.*?) attacks you with (.*?)$"
regexp="y"
send_to="12"
sequence="100"
>
<send>SetVariable("Attacks",(GetVariable("Attacks") + 1))
Note("ttl-Attacks: " .. GetVariable("Attacks"))</send>
</trigger>
</triggers>
___________________
2. ..parry counter...
_______________________

<triggers>
<trigger
enabled="y"
expand_variables="y"
match="^(.*?), but you parry the blow with your (.*?)$"
regexp="y"
send_to="12"
sequence="100"
>
<send>SetVariable("Parries",(GetVariable("Parries") + 1))
SetVariable("Attacks",(GetVariable("Attacks") + 1))
Note("ttl-Attacks: " .. GetVariable("Attacks"))
Note("Parries: " .. GetVariable("Parries"))
Note("Percentage parried: " .. ((GetVariable("parries")/GetVariable("Attacks"))*100) .. "%")</send>
</trigger>
</triggers>

____________________


and aliases....sc (show counter) and zc..(zero counter)
open Alias thyng on Mush and choose Paste button
________________________
Alias1. sc...show counter
_______________________________

<aliases>
<alias
match="sc"
enabled="y"
expand_variables="y"
send_to="12"
sequence="100"
>
<send>Note("Attacks: " .. GetVariable("Attacks"))
Note("Parries: " .. GetVariable("Parries"))
Note("Percentage parried: " .. ((GetVariable("parries")/GetVariable("Attacks"))*100) .. "%")</send>
</alias>
</aliases>
______________________________
Alias 2. zc..zero counter
____________________

<aliases>
<alias
match="zc"
enabled="y"
expand_variables="y"
send_to="12"
sequence="100"
>
<send>Note("Zeroing counters")
SetVariable("Attacks","0")
SetVariable("Parries","0")
Note("Attacks: " .. GetVariable("Attacks"))
Note("Parries: " .. GetVariable("Parries"))

</send>
</alias>
</aliases>

_____________
 You should type ...zc.... to set all counters before first use
 yell if ya need help..
Image
Creon
Citizen of Archai
Posts: 275
Joined: Sun Dec 22, 2013 9:22 am

Re: hit % calculator

Post by Creon »

Thanks a lot I appreciate it!
User avatar
RPGer
Citizen of Archai
Posts: 175
Joined: Sat Aug 15, 2015 4:40 pm
Location: USA

Re: hit % calculator

Post by RPGer »

Decided to work this up for ranged weapons.
You always want to start with zc to initialize it.
Three triggers and two aliases.

So it only picks your attacks:

Code: Select all

<triggers>
  <trigger
   enabled="y"
   match="You fire*"
   send_to="12"
   sequence="100"
  >
  <send>
EnableTrigger ("hit_counts", true)
</send>
  </trigger>
</triggers>
Counts the various types of hits or miss:

Code: Select all

<triggers>
  <trigger
   match="^The attack (.+)"
   name="hit_counts"
   regexp="y"
   send_to="12"
   sequence="50"
  >
  <send>
  if "%1" == "misses." then
    SetVariable("Misses",(GetVariable("Misses") + 1))
  elseif "%1" == "is a mild prick." then
    SetVariable("Mildat",(GetVariable("Mildat") + 1))
  elseif "%1" == "is a minor cut." then
    SetVariable("Minorat",(GetVariable("Minorat") + 1))
  elseif "%1" == "is a decent strike." then
    SetVariable("Decentat",(GetVariable("Decentat") + 1))
  elseif "%1" == "is a solid strike." then
    SetVariable("Solidat",(GetVariable("Solidat") + 1))
  elseif "%1" == "is a piercing strike." then
    SetVariable("Pierceat",(GetVariable("Pierceat") + 1))
  else
    SetVariable("Gashat",(GetVariable("Gashat") + 1))
  end --if
  SetVariable("AttackTot",(GetVariable("AttackTot") + 1))
  EnableTrigger ("hit_counts", false)
  </send>
  </trigger>
</triggers>
Counts when an enemy dodges/blocks/parries your attack and counts it as an attack.(I call it a thwart)

Code: Select all

<triggers>
  <trigger
   custom_colour="17"
   enabled="y"
   match="(dodges your|blocks your|parries your)"
   name="thwart_counts"
   regexp="y"
   send_to="12"
   sequence="50"
   other_back_colour="darkorange"
  >
  <send>
  SetVariable("Thwarts",(GetVariable("Thwarts") + 1))
  SetVariable("AttackTot",(GetVariable("AttackTot") + 1))
  </send>
  </trigger>
</triggers>
Alias to see the count- sc
it shows percent missed.

Code: Select all

<aliases>
  <alias
   match="sc"
   enabled="y"
   expand_variables="y"
   send_to="12"
   sequence="100"
  >
  <send>
Note("Total Attacks: " .. GetVariable("AttackTot"))
Note("Misses: " .. GetVariable("Misses"))
Note("Percentage missed: " .. ((GetVariable("Misses")/GetVariable("AttackTot"))*100) .. "%")
Note("Mild Pricks: " .. GetVariable("Mildat"))
Note("Minor: " .. GetVariable("Minorat"))
Note("Decent: " .. GetVariable("Decentat"))
Note("Solid: " .. GetVariable("Solidat"))
Note("Pierces: " .. GetVariable("Pierceat"))
Note("Gashes: " .. GetVariable("Gashat"))
Note("Thwarts: " .. GetVariable("Thwarts"))

</send>
  </alias>
</aliases>
Alias to clear or zero the counter- zc

Code: Select all

<aliases>
  <alias
   match="zc"
   enabled="y"
   expand_variables="y"
   send_to="12"
   sequence="100"
  >
  <send>Note("Zeroing counters")
SetVariable("AttackTot","0")
SetVariable("Misses","0")
SetVariable("Mildat","0")
SetVariable("Minorat","0")
SetVariable("Decentat","0")
SetVariable("Solidat","0")
SetVariable("Pierceat","0")
SetVariable("Gashat","0")
SetVariable("Thwarts","0")
EnableTrigger ("hit_counts", false)

</send>
  </alias>
</aliases>
It does not distinguish between normal bow attack and careful shot attack.
User avatar
RPGer
Citizen of Archai
Posts: 175
Joined: Sat Aug 15, 2015 4:40 pm
Location: USA

Re: hit % calculator

Post by RPGer »

Edit: Was able to resolve the Block issues and worked out multi-line trigger. I still am not real good with regexpressions though.

I've been tweaking this today and have sorted some things out.
I changed the percents to hits instead of misses and formatted the numbers to two decimal places.
Formatted the information output also.

TotalAttacks: 59 Misses: 3 HitPercent: 94.92%
Pricks: 2 Minor: 16 Decent: 13 Solid: 14 Pierce: 2 Crit: 0 Thwarted: 9
Session totals:
Attacks: 59 Misses: 3 Thwarts: 9 PercentGoodHits: 94.92% PercentDamageHits: 79.66%

The Thwarted catagory is when you are dodged, blocked, or parried.
Session totals allow you to reset all your hits when ever you like but still retain an overall count on attacks an misses.

I have not been able to test being parried yet.

Always start by clearing all variables zc and zcz before you start counting.

First trigger- listens for you to make an attack and catches the attack result.

Code: Select all

<triggers>
  <trigger
   enabled="y"
   lines_to_match="2"
   match="(You fire )(.*?)\sThe attack (.+)\Z"
   multi_line="y"
   name="new_shot"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>if "%3" == "misses." then
    SetVariable("Misses",(GetVariable("Misses") + 1))
    SetVariable("Misstot",(GetVariable("Misstot") + 1))
  elseif "%3" == "is a mild prick." then
    SetVariable("Mildat",(GetVariable("Mildat") + 1))
  elseif "%3" == "is a minor cut." then
    SetVariable("Minorat",(GetVariable("Minorat") + 1))
  elseif "%3" == "is a decent strike." then
    SetVariable("Decentat",(GetVariable("Decentat") + 1))
  elseif "%3" == "is a solid strike." then
    SetVariable("Solidat",(GetVariable("Solidat") + 1))
  elseif "%3" == "is a piercing strike." then
    SetVariable("Pierceat",(GetVariable("Pierceat") + 1))
  elseif "%3" == "is a severe gash." then
    SetVariable("Gashat",(GetVariable("Gashat") + 1))
  elseif "%3" == "is a critical puncture." then
    SetVariable("Critat",(GetVariable("Critat") + 1))
  else
    SetVariable("Misses",(GetVariable("Misses") + 1))
    SetVariable("Misstot",(GetVariable("Misstot") + 1))
  end --if
  SetVariable("AttackTot",(GetVariable("AttackTot") + 1))
  SetVariable("GrandTot",(GetVariable("GrandTot") + 1))</send>
  </trigger>
</triggers>
Second trigger- catches when you are blocked. Sometimes you still hit. So this will help decide if it was affective or not.

Code: Select all

<triggers>
  <trigger
   enabled="y"
   group="ChkBlock"
   lines_to_match="2"
   match="(blocks your attack)(.*?)\s\[Delay\: 4\.0 sec\.\]\Z"
   multi_line="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>
  SetVariable("Thwarts",(GetVariable("Thwarts") + 1))
  SetVariable("AttackTot",(GetVariable("AttackTot") + 1))
  SetVariable("Thwarttot",(GetVariable("Thwarttot") + 1))
  SetVariable("GrandTot",(GetVariable("GrandTot") + 1))</send>
  </trigger>
</triggers>
Third trigger- Catches when you are dodged or parried.

Code: Select all

<triggers>
  <trigger
   custom_colour="17"
   enabled="y"
   match="(dodges your|parries your)"
   name="thwart_counts"
   regexp="y"
   send_to="12"
   sequence="50"
   other_back_colour="darkorange"
  >
  <send>
  SetVariable("Thwarts",(GetVariable("Thwarts") + 1))
  SetVariable("AttackTot",(GetVariable("AttackTot") + 1))
  SetVariable("Thwarttot",(GetVariable("Thwarttot") + 1))
  SetVariable("GrandTot",(GetVariable("GrandTot") + 1))
  </send>
  </trigger>
</triggers>
First Alias- sc
This will show all results and percentages

Code: Select all

<aliases>
  <alias
   match="sc"
   enabled="y"
   expand_variables="y"
   send_to="12"
   sequence="100"
  >
  <send>
local fpercnt = string.format ("%.2f",100-(GetVariable("Misses")/GetVariable("AttackTot"))*100)
Note("TotalAttacks: " .. GetVariable("AttackTot") .. "   Misses: " .. GetVariable("Misses") .. "   HitPercent: " .. fpercnt .. "%")
Note("Pricks: " .. GetVariable("Mildat") .. "  Minor: " .. GetVariable("Minorat") .. "  Decent: " .. GetVariable("Decentat") .. "  Solid: " .. GetVariable("Solidat") .. "  Pierce: " .. GetVariable("Pierceat") .. "  Gash: " .. GetVariable("Gashat") .. "  Crit: " .. GetVariable("Critat") .. "  Thwarted: " .. GetVariable("Thwarts"))
local percnt = string.format ("%.2f",100-(GetVariable("Misstot")/GetVariable("GrandTot"))*100)
local dpercnt = string.format ("%.2f",100-((GetVariable("Misstot")+GetVariable("Thwarttot"))/GetVariable("GrandTot"))*100)
Note("Session totals:")
Note("Attacks: " .. GetVariable("GrandTot") .. "  Misses: " .. GetVariable("MissTot") .. "  Thwarts: " .. GetVariable("Thwarttot") .. "  PercentGoodHits: " .. percnt .. "%" .. "  PercentDamageHits: " .. dpercnt .. "%")</send>
  </alias>
</aliases>
Second Alias- zc
This will clear all results but preserves the session variables.

Code: Select all

<aliases>
  <alias
   match="zc"
   enabled="y"
   expand_variables="y"
   send_to="12"
   sequence="100"
  >
  <send>Note("Zeroing counters")
SetVariable("AttackTot","0")
SetVariable("Misses","0")
SetVariable("Mildat","0")
SetVariable("Minorat","0")
SetVariable("Decentat","0")
SetVariable("Solidat","0")
SetVariable("Pierceat","0")
SetVariable("Gashat","0")
SetVariable("Critat","0")
SetVariable("Thwarts","0")
EnableTrigger ("hit_counts", false)

</send>
  </alias>
</aliases>
Third Alias- zcz
This will clear all the session variables.

Code: Select all

<aliases>
  <alias
   match="zcz"
   enabled="y"
   expand_variables="y"
   send_to="12"
   sequence="100"
  >
  <send>Note("Zeroing session counters")
SetVariable("GrandTot","0")
SetVariable("Misstot","0")
SetVariable("Thwarttot","0")
</send>
  </alias>
</aliases>
As this is set up for bows, Careful Shot is not counted seperately. It is treated as a normal shot for the numbers.
This can probably be adapted in many ways for other weapons/types of attacks. We just need to know what your attack messages are to
be able to match them, and the different types of hits done (i.e. minor cut, severe gash, etc.).
User avatar
Kody_Oakborne
Citizen of Archai
Posts: 209
Joined: Tue Apr 22, 2014 1:35 am

Re: hit % calculator

Post by Kody_Oakborne »

Thanks guys. Eabo I definitely appreciate you catering it toward bows. I used to just stare at the screen and plug them into a spreadsheet manually. Talk about hard work. Definitely lets me look at things a little easier. Thanks again.
May the trees guard you, and house you, and guide you.
Kody
User avatar
RPGer
Citizen of Archai
Posts: 175
Joined: Sat Aug 15, 2015 4:40 pm
Location: USA

Re: hit % calculator

Post by RPGer »

You are welcome.
I should update what I listed above. I currently run one that covers all Nat/CC/RC that I could test in one package. I will need to see what differences there are. It still doesn't pick up prayers and spells.

Now if anyone knows how to work this on Mudlet that would be great for others too.

Edit: alright here is my current version. This includes naturals like bite

Code: Select all

------------------------------
The actual counting trigger
-------------------------------
<triggers>
  <trigger
   enabled="y"
   lines_to_match="2"
   match="(You thrust |You attack |You swing |You fire).*?\sThe attack (misses|(.+))\.\Z"
   multi_line="y"
   name="attackCount"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>if "%2" == "misses" then
    SetVariable("Misses",(GetVariable("Misses") + 1))
    SetVariable("Misstot",(GetVariable("Misstot") + 1))
  elseif "%2" == "is a mild prick" then
    SetVariable("Mildat",(GetVariable("Mildat") + 1))
  elseif "%2" == "is a mild scratch" then
    SetVariable("Mildat",(GetVariable("Mildat") + 1))
  elseif "%2" == "is a minor cut" then
    SetVariable("Minorat",(GetVariable("Minorat") + 1))
  elseif "%2" == "is a glancing blow" then
    SetVariable("Minorat",(GetVariable("Minorat") + 1))
  elseif "%2" == "is a grazing cut" then
    SetVariable("Minorat",(GetVariable("Minorat") + 1))
  elseif "%2" == "is a decent strike" then
    SetVariable("Decentat",(GetVariable("Decentat") + 1))
  elseif "%2" == "is a decent slice" then
    SetVariable("Decentat",(GetVariable("Decentat") + 1))
  elseif "%2" == "is a solid strike" then
    SetVariable("Solidat",(GetVariable("Solidat") + 1))
  elseif "%2" == "is a solid swing" then
    SetVariable("Solidat",(GetVariable("Solidat") + 1))
  elseif "%2" == "is a piercing strike" then
    SetVariable("Pierceat",(GetVariable("Pierceat") + 1))
  elseif "%2" == "is a powerful bash" then
    SetVariable("Pierceat",(GetVariable("Pierceat") + 1))
  elseif "%2" == "is a powerful slash" then
    SetVariable("Pierceat",(GetVariable("Pierceat") + 1))
  elseif "%2" == "is a severe gash" then
    SetVariable("Gashat",(GetVariable("Gashat") + 1))
  elseif "%2" == "is a severe laceration" then
    SetVariable("Gashat",(GetVariable("Gashat") + 1))
  elseif "%2" == "is a severe crunch" then
    SetVariable("Gashat",(GetVariable("Gashat") + 1))
  elseif "%2" == "is a critical puncture" then
    SetVariable("Critat",(GetVariable("Critat") + 1))
  elseif "%2" == "is a critical strike" then
    SetVariable("Critat",(GetVariable("Critat") + 1))
  elseif "%2" == "is a critical blow" then
    SetVariable("Critat",(GetVariable("Critat") + 1))
  else
    SetVariable("Misses",(GetVariable("Misses") + 1))
    SetVariable("Misstot",(GetVariable("Misstot") + 1))
  end --if
  SetVariable("AttackTot",(GetVariable("AttackTot") + 1))
  SetVariable("GrandTot",(GetVariable("GrandTot") + 1))</send>
  </trigger>
</triggers>

-------------------------------
Catch the dodges and parries
--------------------------------
<triggers>
  <trigger
   enabled="y"
   match="(dodges your|parries your)"
   name="thwart_counts"
   regexp="y"
   send_to="12"
   sequence="50"
   other_back_colour="darkorange"
  >
  <send>
  SetVariable("Thwarts",(GetVariable("Thwarts") + 1))
  SetVariable("AttackTot",(GetVariable("AttackTot") + 1))
  SetVariable("Thwarttot",(GetVariable("Thwarttot") + 1))
  SetVariable("GrandTot",(GetVariable("GrandTot") + 1))
  </send>
  </trigger>
</triggers>

----------------------------------------
Catch the blocks
----------------------------------------

<triggers>
  <trigger
   enabled="y"
   group="ChkBlock"
   lines_to_match="2"
   match="(blocks your attack)(.*?)\s\[Delay\: 4\.0 sec\.\]\Z"
   multi_line="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>Note("it was blocked")
  SetVariable("Thwarts",(GetVariable("Thwarts") + 1))
  SetVariable("AttackTot",(GetVariable("AttackTot") + 1))
  SetVariable("Thwarttot",(GetVariable("Thwarttot") + 1))
  SetVariable("GrandTot",(GetVariable("GrandTot") + 1))</send>
  </trigger>
</triggers>

---------------------------------------
Alias to clear the variables
---------------------------------------

<aliases>
  <alias
   match="zc"
   enabled="y"
   expand_variables="y"
   send_to="12"
   sequence="100"
  >
  <send>Note("Zeroing counters")
SetVariable("AttackTot","0")
SetVariable("Misses","0")
SetVariable("Mildat","0")
SetVariable("Minorat","0")
SetVariable("Decentat","0")
SetVariable("Solidat","0")
SetVariable("Pierceat","0")
SetVariable("Gashat","0")
SetVariable("Critat","0")
SetVariable("Thwarts","0")
EnableTrigger ("hit_counts", false)

</send>
  </alias>
</aliases>

-------------------------------------------
Alias to clear the grand total counters
----------------------------------------------

<aliases>
  <alias
   match="zcz"
   enabled="y"
   expand_variables="y"
   send_to="12"
   sequence="100"
  >
  <send>Note("Zeroing session counters")
SetVariable("GrandTot","0")
SetVariable("Misstot","0")
SetVariable("Thwarttot","0")
</send>
  </alias>
</aliases>

---------------------------------------------
Alias to see the count
---------------------------------------------

<aliases>
  <alias
   match="sc"
   enabled="y"
   expand_variables="y"
   send_to="12"
   sequence="100"
  >
  <send>
local fpercnt = string.format ("%.2f",100-(GetVariable("Misses")/GetVariable("AttackTot"))*100)
Note("TotalAttacks: " .. GetVariable("AttackTot") .. "   Misses: " .. GetVariable("Misses") .. "   HitPercent: " .. fpercnt .. "%")
Note("Pricks: " .. GetVariable("Mildat") .. "  Minor: " .. GetVariable("Minorat") .. "  Decent: " .. GetVariable("Decentat") .. "  Solid: " .. GetVariable("Solidat") .. "  Pierce: " .. GetVariable("Pierceat") .. "  Gash: " .. GetVariable("Gashat") .. "  Crit: " .. GetVariable("Critat") .. "  Thwarted: " .. GetVariable("Thwarts"))
local percnt = string.format ("%.2f",100-(GetVariable("Misstot")/GetVariable("GrandTot"))*100)
local dpercnt = string.format ("%.2f",100-((GetVariable("Misstot")+GetVariable("Thwarttot"))/GetVariable("GrandTot"))*100)
Note("Session totals:")
Note("Attacks: " .. GetVariable("GrandTot") .. "  Misses: " .. GetVariable("MissTot") .. "  Thwarts: " .. GetVariable("Thwarttot") .. "  PercentGoodHits: " .. percnt .. "%" .. "  PercentDamageHits: " .. dpercnt .. "%")</send>
  </alias>
</aliases>
If you find any attack types not being caught, speak up.
User avatar
Kody_Oakborne
Citizen of Archai
Posts: 209
Joined: Tue Apr 22, 2014 1:35 am

Re: hit % calculator

Post by Kody_Oakborne »

Called shots that are blocked aren't going to be counted based on your formatting. I'm going to change it to this.

Code: Select all

<triggers>
  <trigger
   enabled="y"
   group="ChkBlock"
   lines_to_match="2"
   match="(blocks your attack)(.*?)\s\[Delay\: (4|6)\.0 sec\.\]\Z"
   multi_line="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>Note("it was blocked")
  SetVariable("Thwarts",(GetVariable("Thwarts") + 1))
  SetVariable("AttackTot",(GetVariable("AttackTot") + 1))
  SetVariable("Thwarttot",(GetVariable("Thwarttot") + 1))
  SetVariable("GrandTot",(GetVariable("GrandTot") + 1))</send>
  </trigger>
</triggers>
May the trees guard you, and house you, and guide you.
Kody
User avatar
Kody_Oakborne
Citizen of Archai
Posts: 209
Joined: Tue Apr 22, 2014 1:35 am

Re: hit % calculator

Post by Kody_Oakborne »

This seems to be broken for me.

Code: Select all

<triggers>
  <trigger
   enabled="y"
   group="Hit Counter"
   lines_to_match="2"
   match="(You thrust |You attack |You swing |You fire).*?\sThe attack (misses|(.+))\.\Z"
   multi_line="y"
   name="attackCount"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>if "%2" == "misses" then
    SetVariable("Misses",(GetVariable("Misses") + 1))
    SetVariable("Misstot",(GetVariable("Misstot") + 1))
  elseif "%2" == "is a mild prick" then
    SetVariable("Mildat",(GetVariable("Mildat") + 1))
  elseif "%2" == "is a mild scratch" then
    SetVariable("Mildat",(GetVariable("Mildat") + 1))
  elseif "%2" == "is a minor cut" then
    SetVariable("Minorat",(GetVariable("Minorat") + 1))
  elseif "%2" == "is a glancing blow" then
    SetVariable("Minorat",(GetVariable("Minorat") + 1))
  elseif "%2" == "is a grazing cut" then
    SetVariable("Minorat",(GetVariable("Minorat") + 1))
  elseif "%2" == "is a decent strike" then
    SetVariable("Decentat",(GetVariable("Decentat") + 1))
  elseif "%2" == "is a decent slice" then
    SetVariable("Decentat",(GetVariable("Decentat") + 1))
  elseif "%2" == "is a solid strike" then
    SetVariable("Solidat",(GetVariable("Solidat") + 1))
  elseif "%2" == "is a solid swing" then
    SetVariable("Solidat",(GetVariable("Solidat") + 1))
  elseif "%2" == "is a piercing strike" then
    SetVariable("Pierceat",(GetVariable("Pierceat") + 1))
  elseif "%2" == "is a powerful bash" then
    SetVariable("Pierceat",(GetVariable("Pierceat") + 1))
  elseif "%2" == "is a powerful slash" then
    SetVariable("Pierceat",(GetVariable("Pierceat") + 1))
  elseif "%2" == "is a severe gash" then
    SetVariable("Gashat",(GetVariable("Gashat") + 1))
  elseif "%2" == "is a severe laceration" then
    SetVariable("Gashat",(GetVariable("Gashat") + 1))
  elseif "%2" == "is a severe crunch" then
    SetVariable("Gashat",(GetVariable("Gashat") + 1))
  elseif "%2" == "is a critical puncture" then
    SetVariable("Critat",(GetVariable("Critat") + 1))
  elseif "%2" == "is a critical strike" then
    SetVariable("Critat",(GetVariable("Critat") + 1))
  elseif "%2" == "is a critical blow" then
    SetVariable("Critat",(GetVariable("Critat") + 1))
  else
    SetVariable("Misses",(GetVariable("Misses") + 1))
    SetVariable("Misstot",(GetVariable("Misstot") + 1))
  end --if
  SetVariable("AttackTot",(GetVariable("AttackTot") + 1))
  SetVariable("GrandTot",(GetVariable("GrandTot") + 1))</send>
  </trigger>
</triggers>
First issue I see is the wild card .*? being left without closing it off (.*?) in the trigger. This would also shift the %2 to %3 to grab the misses/hits. After correcting that, I'm still getting a MushClient -CRASHING- error saying there's an unknown symbol somewhere in the code. I can't find it, but I'll keep looking!
Error number: 0
Event: Compile error
Description: [string "Trigger: attackCount"]:2: unexpected symbol near ' '
Called by: Immediate execution
I've torn it all out, built it back up, can't seem to get the new one working. Tried to put the old one back in, getting the same concept of error now. I didn't edit anything before I started getting the errors. :(
May the trees guard you, and house you, and guide you.
Kody
User avatar
Kody_Oakborne
Citizen of Archai
Posts: 209
Joined: Tue Apr 22, 2014 1:35 am

Re: hit % calculator

Post by Kody_Oakborne »

Okay, so... I had to take out ALL of those spaces to make it work. Here's what I came up with. No errors so far.

Code: Select all

<triggers>
  <trigger
   enabled="y"
   group="Hit Counter"
   lines_to_match="2"
   match="(You fire |You attack |You thrust |You swing )(.*?)\sThe attack (.+)\Z"
   multi_line="y"
   name="AttackCount"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>if "%3" == "misses." then
SetVariable("Misses",(GetVariable("Misses") + 1))
SetVariable("Misstot",(GetVariable("Misstot") + 1))
elseif "%3" == "is a mild prick." then
SetVariable("Mildat",(GetVariable("Mildat") + 1))
elseif "%3" == "is a mild scratch." then
SetVariable("Mildat",(GetVariable("Mildat") + 1))
elseif "%3" == "is a minor cut." then
SetVariable("Minorat",(GetVariable("Minorat") + 1))
elseif "%3" == "is a glancing blow." then
SetVariable("Minorat",(GetVariable("Minorat") + 1))
elseif "%3" == "is a grazing cut." then
SetVariable("Minorat",(GetVariable("Minorat") + 1))
elseif "%3" == "is a decent strike." then
SetVariable("Decentat",(GetVariable("Decentat") + 1))
elseif "%3" == "is a decent slice." then
SetVariable("Decentat",(GetVariable("Decentat") + 1))
elseif "%3" == "is a solid strike." then
SetVariable("Solidat",(GetVariable("Solidat") + 1))
elseif "%3" == "is a solid swing." then
SetVariable("Solidat",(GetVariable("Solidat") + 1))
elseif "%3" == "is a piercing strike." then
SetVariable("Pierceat",(GetVariable("Pierceat") + 1))
elseif "%3" == "is a powerful bash." then
SetVariable("Pierceat",(GetVariable("Pierceat") + 1))
elseif "%3" == "is a powerful slash." then
SetVariable("Pierceat",(GetVariable("Pierceat") + 1))
elseif "%3" == "is a severe gash." then
SetVariable("Gashat",(GetVariable("Gashat") + 1))
elseif "%3" == "is a severe laceration." then
SetVariable("Gashat",(GetVariable("Gashat") + 1))
elseif "%3" == "is a severe crunch." then
SetVariable("Gashat",(GetVariable("Gashat") + 1))
elseif "%3" == "is a critical puncture." then
SetVariable("Critat",(GetVariable("Critat") + 1))
elseif "%3" == "is a critical strike." then
SetVariable("Critat",(GetVariable("Critat") + 1))
elseif "%3" == "is a critical blow." then
SetVariable("Critat",(GetVariable("Critat") + 1))
else
SetVariable("Misses",(GetVariable("Misses") + 1))
SetVariable("Misstot",(GetVariable("Misstot") + 1))
end --if
SetVariable("AttackTot",(GetVariable("AttackTot") + 1))
SetVariable("GrandTot",(GetVariable("GrandTot") + 1))</send>
  </trigger>
</triggers>
Was there a reason you changed the format when you added the swings/attacks/thrusts? I changed the format back to include the punctuation, and deleted the wildcard specific inclusion of "misses" since (.+) can catch it just as well. Let me know if there was a specific reason behind this, I'm not really too well versed in LUA.
May the trees guard you, and house you, and guide you.
Kody
Post Reply