Auto welcome addon for guildmembers

Additional botting resources. Addons may be either for the game itself or for the RoM bot.
Forum rules
Only post additional bot resources here. Please do not ask unrelated questions.
Post Reply
Message
Author
User avatar
Questionmark
Posts: 31
Joined: Mon Apr 11, 2011 3:06 am

Auto welcome addon for guildmembers

#1 Post by Questionmark » Thu May 12, 2011 3:43 pm

The addon I'm trying to make is for welcoming guildmembers when they come online. The follwing is what I've got so far, it's not working. Therefor I would like some help, since this is my first addon. I've modified addons before, but my knowledge of addon is limited (for now).

WelcomeGuildmember.toc

Code: Select all

## Title: Welcome Guildmember
## Version: 0.1
## Notes: Welcomes guildmembers who come online
## Author: Questionmark

WelcomeGuildmember.xml
WelcomeGuildmember.xml

Code: Select all

<Ui xmlns="http://www.extreme-x.net/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.extreme-x.net/UI.xsd">
	<Script file="WelcomeGuildmember.lua"/>
	<Frame hidden="true">
		<Scripts>
			<OnLoad>
				WelcomeGuildmember_OnLoad(this);
			</OnLoad>
			<OnEvent>
				WelcomeGuildmember_OnEvent(this, event);
			</OnEvent>
		</Scripts>
	</Frame>
</Ui>
WelcomeGuildmember.lua

Code: Select all

function WelcomeGuildmember_OnLoad(this)
	self:RegisterEvent("CHAT_MSG_GUILD");
	DEFAULT_CHAT_FRAME:AddMessage("Welcome Guildmember v0.1 loaded.",102,153,204);
end

function WelcomeGuildmember_OnEvent(this, event)
	if event == "CHAT_MSG_GUILD" then
		local online = string.lower(arg1);
		local name = string.lower(arg4);
		if (string.find(online, " is online") ~= nil) then
			SendChatMessage("hi " .. name, "GUILD");
		end
	end
end

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Auto welcome addon for guildmembers

#2 Post by lisa » Thu May 12, 2011 9:34 pm

Id probably suguest having it monitor guild chat looking for "is online", trouble is the message isn't from an actual person it just comes up as from [GUILD] so you would need to get what ever is written previous to what you are monitoring for.
I don't know much when it comes to the %d and so on.
What you want though is to monitor for "%c is online" and then print("hi %c")
Obviously %c is wrong.

online messages come up as
[GUILD] : Blahblah is online.

actual chat from guild members comes up as
[GUILD] [Blahblah]: I rock.

So checking for arg4 for the name won't work.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Auto welcome addon for guildmembers

#3 Post by rock5 » Fri May 13, 2011 1:44 am

I can confirm the guild message about a member coming online or going offline only has a value for arg1. You might be able to parse the message but the name is collored so it's not so straight forward.

Let me see... Try this

Code: Select all

function WelcomeGuildmember_OnEvent(this, event)
   if event == "CHAT_MSG_GUILD" then
		local name, online = string.match(arg1, "|c%x%x%x%x%x%x%x%x (%w*)|r is (%w*)")
		if online == "online" then
			SendChatMessage("hi " .. name, "GUILD");
		end
   end
end
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 4 guests