Interesting concept but... need help.

Post Reply
noblestone
Posts: 154
Joined: Sun Jul 29, 2012 6:50 am

Interesting concept but... need help.

Post by noblestone »

Code: [show] | [select all] lua
^ ?\d+\| {0,2}\d+ \w+ {1,2}(\w+) +(?:Stand|Sleep|Rest|Fight|STUN!|DROWN) -?\d+/-?\d+ +-?\d+/-?\d+ +-?\d+/-?\d+ +\d+ +(?:-?\d+|\?\?\?\?\?)$
Set as perl regex and below is:

selectCurrentLine()
copy()
appendBuffer("GroupConsole")
deleteLine()

Outcome is:

1|737 Lord Wolthu Sleep 40009/40009 6607/6607 35827/35827 866 1000

How do I weed it out, I only want to capture and show in miniconsole, Name, 40009/40009, and 866

Ideas?

Thanks

User avatar
SlySven
Posts: 974
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Interesting concept but... need help.

Post by SlySven »

Have a play on the Regex 101 website, I think '('...')' around "capture groups" (bits you want that are returned in matches[2+] (the entire line is in matches[1] IIRC) might be of use here...

noblestone
Posts: 154
Joined: Sun Jul 29, 2012 6:50 am

Re: Interesting concept but... need help.

Post by noblestone »

That I know but where to put the matches in box below like :

selectCurrentLine()
copy()
appendBuffer("GroupConsole")
deleteLine()

That is my question. Thanks

User avatar
SlySven
Posts: 974
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Interesting concept but... need help.

Post by SlySven »

Humm, can you get a few more lines that ARE to match - I am having some difficulty picking through which bits are not essential but may appear in lines that are to match. (Advanced PCRE stuff is a little outside of my current experience-set at the moment - but I am learning all the time...!)

I wonder if you can use:

selectCaptureGroup(...)
copy()
appendBuffer("GroupConsole")

several times to grab each bit of the line and then copy that bit across to the sub-console before you use the deleteLine()?

noblestone
Posts: 154
Joined: Sun Jul 29, 2012 6:50 am

Re: Interesting concept but... need help.

Post by noblestone »

-------------------------------------------------------------------------------
##| Level Name Pos HitPoints ManaPoints MovePoints TNL Align
-------------------------------------------------------------------------------
1|999 Lord Xuyr Stand 51104/51104 7283/7283 24474/25084 519 1000
2|588 Lord Annihylate Sleep 7123/7123 30891/33669 7808/8520 1046 -1000
3|200 Lord Kiron Sleep 10343/10343 19254/19254 9344/9344 977 1000
4| 21 Lord Drwho Sleep 38433/38433 1080/1080 23805/23805 46 1000
5|999 Lord Caree Stand 17006/17006 66974/66974 16711/16711 668 -1000
6|999 Lord Tulpen Stand 21845/22035 111443/111584 47885/48014 1029 1000
7|740 Lord Wolthu Sleep 40038/40038 6616/6616 35856/35856 638 1000
8|999 Lord Aijimo Sleep 14400/14400 37096/37096 10613/10613 626 1000

noblestone
Posts: 154
Joined: Sun Jul 29, 2012 6:50 am

Re: Interesting concept but... need help.

Post by noblestone »

BUMP :)

Drevarr
Posts: 41
Joined: Tue Aug 06, 2013 12:07 am
Location: GA, USA

Re: Interesting concept but... need help.

Post by Drevarr »

Insert capture groups in your regex to align with your desired variables, then build a string from the matches and echo the string to the miniConsole.

myExample:
Code: [show] | [select all] lua

local Hps=tonumber(matches[4])
local Mvs=tonumber(matches[5])
local Name=matches[2]
local CharClass=matches[3]
SetHPcolor()
SetMVcolor()

GUI.Box3Mini:decho(string.format("\n"..HPcolor.."%4s  "..MVcolor.."%4s  "..RGB.W.."%-30s  %-16s", Hps, Mvs, Name, CharClass))

Post Reply