Page 1 of 1

Is posible to make a macro to react automatically on chat?

Posted: Sat May 07, 2011 10:15 am
by Uglich
Hello.

I was wondering if it's posible to make a macro to say "me" when one of your guildies link a card in the guild chat.
(in my guild, if you get a card you don't want, usually you have to link it, and the first one who says "me" gets it.)

I'm not sure it its posible, and I have no idea how to make it.
Thank you, and sorry about my english.

Re: Is posible to make a macro to react automatically on cha

Posted: Sat May 07, 2011 3:23 pm
by Administrator
That should be done in an addon.

Re: Is posible to make a macro to react automatically on cha

Posted: Sat May 07, 2011 9:48 pm
by Uglich
OK, but now I need to learn how to make an addon.
Do you know any guide or can you give me any hints to start making it?

Edited:

I was searching for addons who "search" the chat and find this one:
Chat Monitor http://rom.curse.com/downloads/rom-addo ... nitor.aspx

"ChatMonitor is an Addon that looks for userdefined keywords in the chat and plays an acoustic signal."

Is posble to modify this addon to say "Me" instead of playing a sound when it finds the keyword?

Thanks

Re: Is posible to make a macro to react automatically on cha

Posted: Sat May 07, 2011 10:17 pm
by rock5
The rom wiki has a tutorial that covers just about every thing you need.
http://www.theromwiki.com/Addon_Tutorial

Read all the way down to the 'events' section. You'll need that too, to monitor chat events.

Re: Is posible to make a macro to react automatically on cha

Posted: Sun May 08, 2011 1:58 am
by lisa
Your going to a lot of effort just to be the first to post me in guild, So your saying you want the card regardless of if you have it already?

Re: Is posible to make a macro to react automatically on cha

Posted: Tue May 10, 2011 11:21 am
by Uglich
lisa wrote:Your going to a lot of effort just to be the first to post me in guild, So your saying you want the card regardless of if you have it already?
Hello.
About your question, yes, I have some alters and they usually don't have the cards posted on guild.

Now, without any addon to it, I try to say me before check if I have the card or not. And I'm sure other guild members do the same.

I'm trying to change other addons to make it, but for the moment, it doesn't work.

Edit:

Hello again.
I make some progress modifiying the ChatMonitor addon.
Now, instead of playing a sound when find the keyword, the addon says what I want in the DEFAULT_CHAT_FRAME

Code: Select all

DEFAULT_CHAT_FRAME:AddMessage("Hello World!");
How can I "say" it in the Say channel, Zone channel, guild channel,...?

Thank you.

Re: Is posible to make a macro to react automatically on cha

Posted: Tue May 10, 2011 8:14 pm
by rock5

Re: Is posible to make a macro to react automatically on cha

Posted: Wed May 11, 2011 10:00 am
by OneofMany
If you manage to finish this script. I'll be willing to translate it from english to dutch if you like.

Keep up the good work :)

Re: Is posible to make a macro to react automatically on cha

Posted: Wed May 11, 2011 4:24 pm
by Questionmark
OneofMany wrote:If you manage to finish this script. I'll be willing to translate it from english to dutch if you like.

Keep up the good work :)
Could you post the code please? I'm interested in autoresponse. I want to make a script that greets my guildies when they log on and I would like to use your script as reference.

Re: Is posible to make a macro to react automatically on cha

Posted: Thu May 12, 2011 11:33 am
by Uglich
Hello, and thank you Rock5 for the API.

The script is based on the ChatMonitor Addon (99%) I just changed the lines where it "calls" to play a sound, and changed it to a fixed word in a fixed chat.
I couldn't talk to the addon creator, so if he/she is bother whith my changes, please contact me and I'll remove it.

Original Addon could be found here:
http://rom.curse.com/downloads/rom-addo ... nitor.aspx
It's Localized to English and Deutsch.

My changes are made in a small part of the lua code, the one who check's the chat. Lines 416 to 464, specifically in line 458.

Code: Select all

-----------Check Chat ------------------
function ChatMonitor.Chat(event,this)
	if(ChatMonitor.isChatMonitorInitialized) then
		local docheck = false;
		if(event == "CHAT_MSG_SAY" and ChatMonitor_Settings[ChatMonitor.playerName]["SayChatCheck"]) then
			docheck = true;    
		elseif(event == "CHAT_MSG_ZONE" and ChatMonitor_Settings[ChatMonitor.playerName]["ZoneChatCheck"]) then
			docheck = true; 
		elseif(event == "CHAT_MSG_GUILD" and ChatMonitor_Settings[ChatMonitor.playerName]["GuildChatCheck"]) then
			docheck = true;                                                             
		elseif(event == "CHAT_MSG_YELL" and ChatMonitor_Settings[ChatMonitor.playerName]["YellChatCheck"]) then
			docheck = true;
		end
		if (docheck) then
			local var = string.lower(arg1);
  
  			if(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWordCheck1"] and (ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord1"] ~= nil or ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord1"] ~= "")) then
  				if(string.find(var,string.lower(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord1"])) ~= nil) then
    				PlaySoundByPath("Interface/AddOns/ChatMonitor/Sound/"..ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord1Sound"]..".mp3");
    				ChatMonitor.WarningText(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord1"]);
  				end
  			end 
  			if(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWordCheck2"] and (ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord2"] ~= nil or ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord2"] ~= "")) then
  				if(string.find(var,string.lower(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord2"])) ~= nil) then
					PlaySoundByPath("Interface/AddOns/ChatMonitor/Sound/"..ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord1Sound"]..".mp3");	
    				ChatMonitor.WarningText(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord2"]); 
  				end
  			end   
  			if(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWordCheck3"] and (ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord3"] ~= nil or ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord3"] ~= "")) then
  				if(string.find(var,string.lower(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord3"])) ~= nil) then
    				SendChatMessage("Addon funcionando 3", "ZONE");
    				ChatMonitor.WarningText(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord3"]);
  				end
  			end
  			if(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWordCheck4"] and (ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord4"] ~= nil or ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord4"] ~= "")) then
  				if(string.find(var,string.lower(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord4"])) ~= nil) then
    				SendChatMessage("Addon funcionando 4", "SAY");
    				ChatMonitor.WarningText(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord4"]);
  				end
  			end
  			if(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWordCheck5"] and (ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord5"] ~= nil or ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord5"] ~= "")) then
  				if(string.find(var,string.lower(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord5"])) ~= nil) then
    				SendChatMessage("yo", "GUILD");
    				ChatMonitor.WarningText(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord5"]);
  				end
  			end
  		end
  	end
end
I just changed the code for the "keyword5" (at least by the moment).
For my purpose it's enough.

I would like to make some other changes, like insert more boxes to select what to say, and the chanel to say it. (boxes like the ones to select the keywords), but I don't know how to make it, and this seems to be very difficult to me.

I hope someone could find this intesesting.

Thank you.

Re: Is posible to make a macro to react automatically on cha

Posted: Sat May 14, 2011 9:29 am
by Uglich
Doublepost because code has a big improvement.

Hello, I've changing a bit this code, and now it's a little bit usefull.
The changes were made in the Check Chat section (the rest still like the original one).

Now, you can "say" in the channel set in "keyword 3" the content writen in "keyword 4", when the "keyword5" is find in the chat who is being monitorized by the addon.

¿Quite confusing ? It's so simple. This picture sould help.
Image

The "play sound" part is disables for keyword3, 4 and 5.

Code: Select all

-----------Check Chat ------------------
function ChatMonitor.Chat(event,this)
	if(ChatMonitor.isChatMonitorInitialized) then
		local docheck = false;
		if(event == "CHAT_MSG_SAY" and ChatMonitor_Settings[ChatMonitor.playerName]["SayChatCheck"]) then
			docheck = true;    
		elseif(event == "CHAT_MSG_ZONE" and ChatMonitor_Settings[ChatMonitor.playerName]["ZoneChatCheck"]) then
			docheck = true; 
		elseif(event == "CHAT_MSG_GUILD" and ChatMonitor_Settings[ChatMonitor.playerName]["GuildChatCheck"]) then
			docheck = true;                                                             
		elseif(event == "CHAT_MSG_YELL" and ChatMonitor_Settings[ChatMonitor.playerName]["YellChatCheck"]) then
			docheck = true;
		end
		if (docheck) then
			local var = string.lower(arg1);
  
  			if(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWordCheck1"] and (ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord1"] ~= nil or ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord1"] ~= "")) then
  				if(string.find(var,string.lower(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord1"])) ~= nil) then
    				PlaySoundByPath("Interface/AddOns/ChatMonitor/Sound/"..ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord1Sound"]..".mp3");
    				ChatMonitor.WarningText(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord1"]);
  				end
  			end 
  			if(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWordCheck2"] and (ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord2"] ~= nil or ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord2"] ~= "")) then
  				if(string.find(var,string.lower(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord2"])) ~= nil) then
					PlaySoundByPath("Interface/AddOns/ChatMonitor/Sound/"..ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord2Sound"]..".mp3");	
    				ChatMonitor.WarningText(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord2"]); 
  				end
  			end   
  			if(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWordCheck3"] and (ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord3"] ~= nil or ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord3"] ~= "")) then
  				if(string.find(var,string.lower(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord3"])) ~= nil) then
    				PlaySoundByPath("Interface/AddOns/ChatMonitor/Sound/"..ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord3Sound"]..".mp3");
    				ChatMonitor.WarningText(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord3"]);
  				end
  			end
  			if(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWordCheck4"] and (ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord4"] ~= nil or ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord4"] ~= "")) then
  				if(string.find(var,string.lower(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord4"])) ~= nil) then
    				PlaySoundByPath("Interface/AddOns/ChatMonitor/Sound/"..ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord4Sound"]..".mp3");
    				ChatMonitor.WarningText(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord4"]);
  				end
  			end
  			if(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWordCheck5"] and (ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord5"] ~= nil or ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord5"] ~= "")) then
  				if(string.find(var,string.lower(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord5"])) ~= nil) then
    				SendChatMessage(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord4"], ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord3"]);
    				ChatMonitor.WarningText(ChatMonitor_Settings[ChatMonitor.playerName]["KeyWord5"]);
  				end
  			end
  		end
  	end
end
Now, I need to modify the GUI, but this part is too difficult for me, i don't know what's the first thing to do...
If someone want to do it, feel free to do.

Re: Is posible to make a macro to react automatically on cha

Posted: Sun May 15, 2011 2:37 am
by lisa
I can appreciate the amount of time and effort you've put in so far but if you don't mind a little critism I think you might be doing this the hard way.

If it was me I would look at either adding in another check (tick option) or just alter the one that says show keyword on screen which basically just flashes the keyword in the middle of your screen which is kinda useless in my opinion.

I would be looking at something like this myself.

in the language file in locales folder alter, this is english version

Code: Select all

	["SHOWTEXTCHECK"] = "Guild Greeting",
in chatmonitor.lua add this at the start of the ---check chat---- line 416

Code: Select all

if(ChatMonitor_Settings[ChatMonitor.playerName]["ShowTextCheck"]) then
        local var = string.lower(arg1);
if event == "CHAT_MSG_GUILD" then
if(string.find(var,string.lower("is online")) ~= nil) then
SendChatMessage("Hi there", "GUILD")
end
end
end
you can also delete the sections with
-----------show WarningText-----------
and
-----------fade WarningText-----------

which will basically make you sai "Hi there". anytime you see "is online" in guild chat. aslong as that tick for the now named Guild Greeting is ticked. Obviously this can be altered to be a more personal greeting by including the characters name but hopefully this gives you a start point for an easy solution to what you want.

I attached the altered file that I mentioned to give you an idea.

Edit-- I forgot what your original idea was and got stuck on the autoreply for entering guild, my bad. I attached new files with the 5th spot having user input for replying. It is set to only reply post in guild but you get the idea.

Totally up to you now to do the rest, I just got you started =)