get the guild of player

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Ajoir
Posts: 32
Joined: Mon May 30, 2011 1:29 pm

get the guild of player

#1 Post by Ajoir » Sat Dec 15, 2012 3:41 am

for access to name player, the variable is player.Name. For access the level of player, the variable is player.Level. What variable is used for access to guild of player? I try player.Guild, but don't work for me. Thank you in advace.

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

Re: get the guild of player

#2 Post by lisa » Sat Dec 15, 2012 4:39 am

There is none, you would need to use an ingame function of some kind to get the guild info.
Only one I can think of at the moment is AskPlayerInfo("charname")

Needless to say guild of a player is more complicated than just doing player.Name, do you really need it?
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: get the guild of player

#3 Post by rock5 » Sat Dec 15, 2012 6:45 am

If I remember correctly AskPlayerInfo("charname") only prints to the screen which is pretty useless. I know you needed to use it for gmmonitor but if all the user wants is the players guild name they can use GetGuildInfo(). That's what I used in the AT script. So

Code: Select all

GuildName = RoMScript("GetGuildInfo()")
If you need more information about your guild, that function does return more values.

Code: Select all

		local guildName, leaderName, bRecruit, alreadyCreate, 
		MaxMemberCount, Score, GuildNote, Introduce,
		isLeader, isBBSEnable, isOpenGuild, Level, IsOwnHouse, IsOpenVisit = GetGuildInfo();
I'll leave you to figure out what they all mean if you need them.
  • 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

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

Re: get the guild of player

#4 Post by lisa » Sat Dec 15, 2012 7:58 am

Ahh yes I was assuming they wanted guild of a different character, not the character they were logged on to.
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

Ajoir
Posts: 32
Joined: Mon May 30, 2011 1:29 pm

Re: get the guild of player

#5 Post by Ajoir » Sat Dec 15, 2012 4:28 pm

Thank your very much for your fast answer. I´ll try apply your solutions.

Ajoir
Posts: 32
Joined: Mon May 30, 2011 1:29 pm

Re: get the guild of player

#6 Post by Ajoir » Sat Dec 15, 2012 9:41 pm

Hi again. I found what i was looking. The function what i want is: "UnitIsInMyGuild= Returns whether a unit is in the player's guild". Try the code:

Code: Select all

help="object";  --object was the name of the object.
	if (RoMScript ("UnitIsInMyGuild ("..help..")")) then
	     print("GREAT!");
	end
But give me an error. I think return a nill value, but i´m not sure (IGF: [STRING "LOCAL A={UnitIsInMyGuild (object)} return a"]:1: attempt to call global 'UnitIsInMyGuild' (a nil value). May be that this function isn´t implemented in rombot, or some thing similar.

I want add this code an a function similar of the created by lisa GM:detection, and give an alarm to me if someone of my guild its near. Could you help me, please? thank you in advance

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

Re: get the guild of player

#7 Post by lisa » Sat Dec 15, 2012 10:14 pm

lol I was right, you do want the guild of another character.

Well you will need to add in the code yourself as I don't want the GM monitor to detect other guild members.

So basically you want to add in another check in the userfunction for if your guild name is posted with the AskPlayerInfo that it does. Gm monitor only does this when whispered, so basically you will need to add in your own funtion or just make a new userfunction for yourself.

Code: Select all

	local obj = nil;
	local objectList = CObjectList();
	objectList:update();
	for i = 0,objectList:size() do
		obj = objectList:getObject(i);
		if( obj.Type == PT_PLAYER ) then

EventMonitorStart("GuildDetect", "CHAT_MSG_SYSTEM");
sendMacro("AskPlayerInfo(\'"..obj.Name.."\');")
yrest(1000)
local time, moreToCome, msg = EventMonitorCheck("GuildDetect", "1")
if msg ~= nil then
if string.find(msg,"Addyourguildnamehere") then
if playalarm then playalarm() playalarm() end
-add what ever else you want to do, like logout
end
end
end
end
This is very basic, you should really add the obj.Name to a table so it only calls it once and not repeatedly, plus some tweaking here and there.

Have fun
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

Ajoir
Posts: 32
Joined: Mon May 30, 2011 1:29 pm

Re: get the guild of player

#8 Post by Ajoir » Sat Dec 15, 2012 11:45 pm

you are really fast!!.

I add your code, and work prefectly. if I had thought a little more, i would have found the solution too, because I had already used the "askplayerinfo" and the "EventMonitorCheck" in other times. Thank you very much for your help.

I still have a little doubt. Is it better to add the "EventMonitorStop" at the end, or really does not affect performance?

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

Re: get the guild of player

#9 Post by lisa » Sun Dec 16, 2012 12:10 am

Ajoir wrote:I still have a little doubt. Is it better to add the "EventMonitorStop" at the end, or really does not affect performance?
probably best to add it at end,
you see the addon itself will continue monitoring the guild messages long after you stop botting, basically until the game is fully exited it will continue to monitor guild chat.
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

Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests