Is there no way to dump data into /say?

I’m trying to use the chatlog to aggregate data about herb/mine nodes (after I have a txt file I can push it through a python script and get an array) but it doesn’t look like I can /say X, Y, Z. Is this right or am I just looking in the wrong spots?

I’m using .townlong -yak .com/framexml/live/Blizzard_APIDocumentation and a couple of other guides.

You would have to create an addon to save any data to disk. The addon could have a slash command(s) to do things like start/stop data collection.

https://warcraft.wiki.gg/wiki/SavedVariables

1 Like

I’m trying to avoid that if I can. I’m worried it’ll be a massive pita to translate that file into something I can mine. On the other hand a python script that squirts out an array from a plain text file would take me like 15 minutes to write and debug.

I swear I’ve seen addons say things in chat before. Stuff like I’ve interrupted so-and-so’s blah.

Maybe a way to pair it up with a macro? I press a button and it outputs the information I want to collect.

Well I’ll look into it more. Hopefully I don’t have to just alt tab every 20 seconds and dump info into a spreadsheet.

It’s unclear what you are trying to do from what you have said.

Addons can send to chat in a restricted manner.
https://warcraft.wiki.gg/wiki/API_SendChatMessage

You can’t use Python (or anything other than lua) to create addons.
Addons, macros can’t write to disk other than throught the SavedVariables system. Doing that you would get you a plain text file which (after logging out) could be read using Python.

Once again, no idea the full scope of what you are trying to do so I can be of limited help here.

1 Like

Let me be more specific,

I’m interested in a few specific, CHAT_MSG_SKILL, and CHAT_MSG_LOOT event tags. Outputing both into a chat channel lets me collect information about them into a text file using the built in chatlog. The text file goes into a python script. Into a pandas array and I can break it down and model the information. (That’s what I really want.) So, the confusing part I think is that, 90% of what I want to do is outside of wow.

I just want to automate data collection if I can because that’s the time consuming part.

It’s fine if I can’t automate it completely, like pressing a button after looting a node to output the information would be great. (But it doesn’t look like I can do that either.)

SendChatMessage might work I guess it depends on what it will accept for a string.

You could have an addon as simple as

local Player
local function LogEvent(event, ...)
	tinsert(Blitzvogel_DATA[Player], { time=GetTime(), event=event, playload = {...}, })
end

local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_LOGIN")
f:SetScript("OnEvent", function(self, event, ...)
	Player = UnitName("player") .. "-" .. GetRealmName()
	Blitzvogel_DATA = Blitzvogel_DATA or {}
	Blitzvogel_DATA[Player] = Blitzvogel_DATA[Player] or {}

	hooksecurefunc("ChatFrame_OnEvent", function(self, event, ...)
		if event == "CHAT_MSG_SKILL" then
			LogEvent(event, ...)
-- or maybe something different
		elseif event == "CHAT_MSG_LOOT" or event == "CHAT_MSG_CURRENCY" then
			LogEvent(event, ...)
-- or maybe something different
		end
	end)
end)

and end up with a SavedVariables file (on logout) looking like:

Blitzvogel_DATA = {
	["Blitzvogel-Azjol-Nerub"] = {
		[1] = {
			["playload"] = {
				"You receive currency: |cffffffff|Hcurrency:2778:0|h[Bronze]|h|rx2",
				"",
				"",
				"",
				"",
				"",
				0,
				0,
				"",
				0,
				33,
				[1] = nil,
				0,
				false,
				false,
				false,
				false,
			},
			["time"] = 82961.849,
			["event"] = "CHAT_MSG_CURRENCY",
		},
		[2] = {
			["playload"] = {
				"You receive loot: |cff1eff00|Hitem:220367::::::::13:64:::::::::|h[Chipped Stalwart Pearl]|h|r",
				"Akala-AzjolNerub",
				"",
				"",
				"Akala-AzjolNerub",
				"",
				0,
				0,
				"",
				0,
				37,
				"Player-121-0ACC1109",
				0,
				false,
				false,
				false,
				false,
			},
			["time"] = 82983.791,
			["event"] = "CHAT_MSG_LOOT",
		},
	},
}

Which has a timestamp, event name and payload information for your Python script to process.

2 Likes

Sure I guess but it still just seems easier to collect it out of the chatlog if I can. (Like the regex expressions will be simpler with the chatlog case.)

I’m interested in tuples like,

(x_y_location, relevant_prof_skill_#, relevant_prof_skill_points, t1_r1_loot_#,t1_r2_loot_#,t1_r3_loot_#,…tn_r3_loot_#)

(not all of these columns are required)

Since I want each tuple to be associated with a single farming event I have to truncate the timestamps down to (probably) the second then associate everything with that unique timestamp which is relevant to the tuple. The chatlog should do that by default at the least.

EDIT: TLDR; It should work with the saved variables but it looks harder to implement.

You could change the addon to something like:

local Player
local function LogEvent(event, ...)
	SendChatMessage("Process, " ..event .. ", something1, something2", "WHISPER", nil, Player)
end

local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_LOGIN")
f:SetScript("OnEvent", function(self, event, ...)
	Player = UnitName("player")
	hooksecurefunc("ChatFrame_OnEvent", function(self, event, ...)
		if event == "CHAT_MSG_SKILL" then
			LogEvent(event, ...)
-- or maybe something different
		elseif event == "CHAT_MSG_LOOT" or event == "CHAT_MSG_CURRENCY" then
			LogEvent(event, ...)
-- or maybe something different
		end
	end)
end)

Which would end up in a chatlog of

6/15 06:43:37.377  Twinspire Taskmaster dies, you gain 82 experience.
6/15 06:43:40.158  You receive loot: Thread of Stamina
6/15 06:43:40.549  To XXX-AzjolNerub: Process, CHAT_MSG_LOOT, something1, something2
6/15 06:43:40.891  XXX-AzjolNerub whispers: Process, CHAT_MSG_LOOT, something1, something2
6/15 06:43:41.215  You receive currency: Bronzex1
6/15 06:43:41.708  To XXX-AzjolNerub: Process, CHAT_MSG_CURRENCY, something1, something2
6/15 06:43:42.025  XXX-AzjolNerub whispers: Process, CHAT_MSG_CURRENCY, something1, something2

Your LogEvent could spit out information depending on chat event or … It’s up to your imagination.

Your Python script would have to find lines in the chat log with the message portion starting with “Process” (or whatever you design).

Uglier in my estimation (not to mention having whispers firing off all over the place) but each to their own.

2 Likes

I missed it but there are ways of making time signatures more manageable

https://warcraft.wiki.gg/wiki/API_time
https://warcraft.wiki.gg/wiki/API_date
etc.

In the first example, the PayLoad entries directly related to the order from each event eg. CHAT_MSG_LOOT
https://warcraft.wiki.gg/wiki/CHAT_MSG_LOOT
so your addon could write them into the SV output as their name=value pairs.

I’m certainly not putting up “refined” examples.

2 Likes

Well I had time to think more about it. If there’s issues with the timestamps then I’ll get worthless data set. I need to be 100% certain that the data points are associated with exactly one node collection event. That’s so important that it’s basically the only thing that matters. (Saved variable or chat log both work fine honestly edit:as long as they preserve that information.)

Actually I think this will work pretty well. You’re lead in function takes a tuple as input so I can dump information through there.

local function LogEvent(event, ...)
	SendChatMessage("Process, " ..event .. ", 4_TradeSkillUI.GetBaseProfessionInfo(skillLevel),
5_TradeSkillUI.GetBaseProfessionInfo(skillLevel),
"WHISPER", nil, Player)

(The syntax might be wrong but I can’t check LUAs documentation right now since their servers down.)

And you’d get outputs like,

6/15 06:43:40.891  XXX-AzjolNerub whispers: Process, CHAT_MSG_LOOT, 67, 100

Where CHAT_MSG_LOOT is some string I’ll need to decode.

Do you know if there’s a way to insert a dummy code at the start and end of the functions output? (This might make things easier but IMO isn’t needed.) (EDIT: Oh, I misunderstood the original maybe. Process marks the start so you add in something at the end to tag the end of the string.)

I’d just need to figure out how to pull information on from the profession UI (perception and what not.)

This here from the CHAT_MSG_LOOT documentation,

"You receive loot: |cffffffff|Hitem:2589::::::::20:257::::::|h[Linen Cloth]|h|rx2.

is literally just the loot message you get in the chat window right? Like there’s a code for the item number, the color it should displayed in (I guess) the items name and how many you got. Is that all right?

“Process” marks each chat log line with information from the function to differentiate from chat logged from other sources… like chatting (“Process” should probably be something distinctive but you know what works for you). A new log is created each time you start logging so you would know the first one.

As for hyperlinks:
https://warcraft.wiki.gg/wiki/Hyperlinks

You would probably get more precise information logging direct to SavedVariables cutting you the “middle person” but… The timestamps in chat would be created using the same api statements available to your addon.

I figured it out a bit late but I think I understand.

Well so the issue that I didn’t think of before is that I’d get multiple lines of messages about loot from a single node event and those need to be bundled together but it won’t be like it has to with just this set up. For example I’d get something like,

Process, Serevite Ore x2, End Process
Process, Rousing Earth x7, End Process

and so on, while mining just a single node. BUT, I’d need output that looks like,

Process,
Serevite Ore x2
Rousing Earth x7
End Process

Well I guess there’s an obvious solution using the chatlog. You’d use a pair of macros one just /say START_NODE, and the other just /say END_NODE and key it in for every node. That gives you the extra bit of filtering out uninteresting information like gold looted.

There might still be a way to do it though. You’d need something like,

A CHAT_MSG_OPENING event triggers a loop of CHAT_MSG_LOOT outputs that goes for 1-2 seconds (probably less).

If you do it through the chatlog you’d stick in start/stop messages.

I’m not sure how the saved variable file would work though. You’d need every event related to the initial trigger to be stored in a single event’s section (IDK if it works like that.)

I also can’t check LUAs documentation right now since it’s still offline (ffs) so I don’t know if I can loop over a subset of actions for a few tenths of a second (I’d assume so though).

Sure but like I don’t think the extra information matters for this project. I’m only interested in back calculating the family of functions their using for their distributions of reagents which drop from harvestable nodes. For that I need a lot of values drawn from a very small specific feature space. (But it’s probably only slightly more annoying to filter out the extra stuff.)

Hopefully LUAs stuff is back up tomorrow or I’ll have to do more research I guess.