Logging Status (HP) Variables

Share your scripts and packages with other Mudlet users.
Post Reply
beckham894
Posts: 2
Joined: Thu Aug 30, 2018 2:07 pm

Logging Status (HP) Variables

Post by beckham894 » Thu Aug 30, 2018 2:34 pm

Hi all, I am new to Mudlet, I used to use cMud and I am Hong Konger, so bare with me for some Chinese character

I am starting to build my own trigger set, but I am struck with the first trigger.
I use to log my status , i.e hp or mp, as variables and it is kind of core to my trigger set

And in my mud the HP status look something like this. (some chinese characters ahead)

Code: Select all

氣  : 8540/ 8540 (100%)    內力: 15000 / 15000 (+0)
**you can consider 氣 as hp, 內力 as mp
in cMud I can set up pattern sth like that:

Code: Select all

氣%s:%s(%d)%s/%s(%d)%s~((%d)~%~)%s內力%s:%s(%d)%s/%s(%d)%s~(~+(%d)~)
and it will log my current hp (8500), max hp (8500), current mp (15000) & max mp (15000)

I couldn't do that in Mudlet tho, I have already read the wiki and manual. From there I learnt I can use Perl Regex to log variables
So I convert my trigger pattern like this:

Code: Select all

氣(.*):(.*)(\d+)(.*)/(.*)(\d+)(.*)((\d+)%)(.*)內力(.*):(.*)(\d+)(.*)/(.*)(\d+)(.*)([+](\d+)(.*))
it fired, but I couldn't log the variable that i wanted, i check by display(matches), it shows below:

Code: Select all

  "氣  : 8540/ 8540 (100%)    內力: 15000 / 15000 (+0)",
  "  ",
  " 854",
  "0",
  "",
  " 8540 (1",
  "0",
  "",
  "0%",
  "0",
  ")    ",
  "",
  " 1500",
  "0",
  " ",
  " 1500",
  "0",
  " (",
  "+0)",
  "0",
  ")"
I tried perl regex but it really getting me nowhere, that is the only pattern i can get the trigger fired...
How should I log my status properly?
Many thanks.

beckham894
Posts: 2
Joined: Thu Aug 30, 2018 2:07 pm

Re: Logging Status (HP) Variables

Post by beckham894 » Thu Aug 30, 2018 3:01 pm

got the answer from discord, many thanks to @Vadi

Code: Select all

氣 *: (\d+)/ (\d+) *\(\d+%\) *內力: (\d+) / (\d+)( \([+](\d+)\))?

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest