Go Back   WowAce Forums > General > Lua Code Discussion
Lua Code Discussion You scared? Terrified. Mortified. Petrified. Stupefied... by [coding].

Reply
 
Thread Tools
Old 02-06-2012   #1
phillydave
Newbie
 
Join Date: Jul 2009
Posts: 6
Default chat_msg_loot

frame:RegisterEvent("CHAT_MSG_LOOT")

frame:SetScript("OnEvent", function(self, event, ...)


In the function that followed this I am taking only messages that concern
loot being received and putting them in another chat window, a loot window.

I discard roll messages and other assorted crapola and do nothing with them.

I expected my loot window to only have messages concerning loot received.

That is exactly what I got.

However, since I did literally nothing will all other messages on this event, even the main chat window, that normally tells you all about stupid rolling information no longer contained roll information, except of course the loot received messages.

I posit that the normal chat_loot_msg handler that I must be overwriting would do that.

Please don't ask for my bad embarrassing code, it is merely implementation of exactly what I describe here.

psuedo version

if (received_flag) then
send message to window3
else
do nothing
endif

The question I am asking is does my included code for registering this function as chat_loot_msg event handler overwrite the normal code that
would send those roll messages to the primary chat window?

Thanks in advance. =)
phillydave is offline   Reply With Quote
Old 02-06-2012   #2
Farmbuyer
Amazing Member
 
Farmbuyer's Avatar
 
Join Date: Feb 2005
Posts: 1,110
Default Re: chat_msg_loot

It depends on what 'frame' is. One that you created, or one of the existing ChatFrameN windows?
__________________
In wizardry, one must often be willing to consider serendipitous events as unqualified successes. -Vaarsuvius
Farmbuyer is offline   Reply With Quote
Old 02-06-2012   #3
Phanx
Seal Cub Clubbing Club
 
Phanx's Avatar
 
Join Date: May 2005
Location: United States
Posts: 8,162
Default Re: chat_msg_loot

Quote:
Originally Posted by phillydave View Post
Please don't ask for my bad embarrassing code, it is merely implementation of exactly what I describe here.
No matter how bad you think your code is, seeing the real code is always better than seeing some useless pseudocode. Some random crap you typed up to summarize what your code does (or what your code is supposed to do, or what you think your code does, etc.) does not tell anyone anything about what your code really does. If there is something wrong with your code, we need to actually see the code in order to tell you what is wrong. I don't know why so many people don't get this.
__________________
Author/maintainer of Grid, PhanxChat, and many more. | PM me on CurseForge
Troubleshoot an addon | Turn any code into an addon | More addon resources
Need help with your code? Attach or paste your whole, real files.
Please don't PM me about addon bugs, requests, or code help. Post a comment, ticket, or thread instead!
Phanx is offline   Reply With Quote
Old 02-06-2012   #4
phillydave
Newbie
 
Join Date: Jul 2009
Posts: 6
Default Re: chat_msg_loot

Farmbuyer, this line preceded the code I had posted last time.

local frame = CreateFrame("Frame")

frame:RegisterEvent("CHAT_MSG_LOOT")

frame:SetScript("OnEvent", function(self, event, ...)


This frame is my locally created one for my first attempt at designing an addon to accomplish something simple, apparently however I must be simple in more ways than one. The moderator unlike Jimmy Stewart in Harvey prefers smart to pleasant. Wish I was either.



Thank you however for seeing I was not asking about the implementation or functionality of my "missing" function.


As to your question, the frame is one I created.
phillydave is offline   Reply With Quote
Old 02-06-2012   #5
Ketho
Senior Member
 
Ketho's Avatar
 
Join Date: Dec 2008
Location: The Netherlands
Posts: 258
Default Re: chat_msg_loot

.. can you please put all of your code in Code-tags?

like,
Code:
I love bunnies
__________________
Ketho is offline   Reply With Quote
Old 02-06-2012   #6
Lombra
Senior Member
 
Lombra's Avatar
 
Join Date: Jan 2006
Location: Sweden
Posts: 410
Default Re: chat_msg_loot

Well, I'm going to have to go with Phanx. Based on your description and pseudo code; no, what you're saying is not what is happening. That, or this unexpected behaviour is not actually related to your code. No one will be able to tell you anything else, I'm afraid.

If you don't care for comments about bad code formatting and/or habits, that's fine. People may or may not disregard that per your request, but like Phanx said, we need to know exactly what you're doing, not just what you think you're doing.

To answer your question; no, making a new frame and registering a chat event will not affect other chat frames.
__________________
Grab your sword and fight the Horde!

Shattered Hand-EU
Lombra is offline   Reply With Quote
Old 02-06-2012   #7
phillydave
Newbie
 
Join Date: Jul 2009
Posts: 6
Default Re: chat_msg_loot

Lombra,

Thank you so much for your take on my question. I appreciate your and Phanx's take on that nature of my query and will think long on it.

Your answer at the end matches what I already I had heard from some other authors who weirdly did not require or care about seeing a properly formatted, sorry Ketho, version of that function, they said I had not posited a query that necessitated evaluating that code. I think it more likely after reading the responses here that my question does require what you request. I shall be back often with better questions.

Again, thanks.

Last edited by phillydave; 02-06-2012 at 05:07 PM.
phillydave is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:52 PM.