How to capture and store data (and view it via an alias)?

Vooku
Posts: 72
Joined: Sun Aug 21, 2016 2:42 pm

Re: How to capture and store data (and view it via an alias)?

Post by Vooku »

^(.+) sold to ([A-Z][W'-]+) for (\d+) platinum!

Another thing I'm seeing is that newer entries won't sort on date. It looks like some of the entries are saving in a different order. Could that be causing that issue?

Vooku
Posts: 72
Joined: Sun Aug 21, 2016 2:42 pm

Re: How to capture and store data (and view it via an alias)?

Post by Vooku »

Here is the auction_data file...
Attachments
auction_data.lua
(29.16 KiB) Downloaded 124 times

Jor'Mox
Posts: 1101
Joined: Wed Apr 03, 2013 2:19 am

Re: How to capture and store data (and view it via an alias)?

Post by Jor'Mox »

So, change your trigger pattern to this: (Auction: .+) sold to ([A-Z][\w'-]+) for (\d+) platinum!

OR, if you wanted the "Auction: " part to be excluded from the item names, use this pattern: Auction: (.+) sold to ([A-Z][\w'-]+) for (\d+) platinum!

Right now, date sorting will be a bit weird, as it is just sorted as a string. Meaning that since A is before J, August will be before July. We can fix that, but if there is some other issue we should address that first.

Edit: There, fixed the patterns.
Last edited by Jor'Mox on Thu Aug 09, 2018 3:00 am, edited 1 time in total.

Vooku
Posts: 72
Joined: Sun Aug 21, 2016 2:42 pm

Re: How to capture and store data (and view it via an alias)?

Post by Vooku »

Thanks much. I'll make the changes to the trigger when I get home. At work now and hard to do much on my iphone.

Vooku
Posts: 72
Joined: Sun Aug 21, 2016 2:42 pm

Re: How to capture and store data (and view it via an alias)?

Post by Vooku »

I can't get either trigger to capture now. Using...
----------------------------------------------------------------------
Pattern: ^(.+) sold to ([A-Z][W'-]+) for (\d+) platinum!
Code: [show] | [select all] lua
add_auction_data(matches[2],matches[4],matches[3])

cecho("\n<red>[Capturing Auction Data...]\n")
----------------------------------------------------------------------

I'm not getting the cecho at all now so nothing is getting added to the table. No errors either.

Vooku
Posts: 72
Joined: Sun Aug 21, 2016 2:42 pm

Re: How to capture and store data (and view it via an alias)?

Post by Vooku »

Ok.. figured out why it wasn't capturing. The pattern... went back to the original one you posted and it works.

^(.+) sold to ([A-Z][\w'-]+) for (\d+) platinum!

Didn't like the [W'-]... [\w'-] is good.

Jor'Mox
Posts: 1101
Joined: Wed Apr 03, 2013 2:19 am

Re: How to capture and store data (and view it via an alias)?

Post by Jor'Mox »

Yeah, \w is a stand in for all letters, numbers, and the underscore. W is just an upper case w. So you would have only matched names that consisted of any starting letter followed by any number of uppercase Ws, apostrophes, and hyphens, but nothing else.

Something must have happened when I typed it out...sorry for the typo.

Edit: oh, I see now. I just copied what you posted above, and changed the part I was looking at. Didn’t bother to double check the rest of it.

Vooku
Posts: 72
Joined: Sun Aug 21, 2016 2:42 pm

Re: How to capture and store data (and view it via an alias)?

Post by Vooku »

Thanks. Is there a web site that describes what the different parts do? Like the '+' and '*' and [A-Z], etc.?

Jor'Mox
Posts: 1101
Joined: Wed Apr 03, 2013 2:19 am

Re: How to capture and store data (and view it via an alias)?

Post by Jor'Mox »

You can probably search for a Regex primer. But I can also give a very quick rundown of the basics.

. = any character
\d = any number
\w = any letter or number or underscore
\s = any whitespace character
+ = matches 1 or more of the preceeding character or group
* = matches 0 or more of the preceeding character or group
? = matches 0 or 1 of the preceeding character or group
^ = the beginning of a line
$ = the end of a line
[] = matches a combination of anything inside the brackets
() = captures whatever is inside the parentheses
- = when inside square brackets and between two characters, this represents all the characters between them (so a-z is all lower case letters, for example)

Vooku
Posts: 72
Joined: Sun Aug 21, 2016 2:42 pm

Re: How to capture and store data (and view it via an alias)?

Post by Vooku »

Thanks! That helps a lot. With everything working good how would I go about 'fixing' the sort by date?

Also, would it be difficult to not have it add duplicates with the same item name and price?

Post Reply