Page 1 of 1

Detect Auto Accept Invitations Addon?

Posted: Thu Mar 14, 2013 7:08 am
by noobbotter
how would I detect if the client has the Auto Accept Invitations addon installed? Thanks.

Re: Detect Auto Accept Invitations Addon?

Posted: Thu Mar 14, 2013 8:09 am
by kuripot
noobbotter wrote:how would I detect if the client has the Auto Accept Invitations addon installed? Thanks.
/aai if no menu appear.. not installed

Re: Detect Auto Accept Invitations Addon?

Posted: Thu Mar 14, 2013 8:16 am
by noobbotter
I knew that, lol.

I meant, if writing a script for a dailies quest, I want to detect if the client running the script has the aai addon. If the addon is not installed then it will run a function I have to detect the invite and accept it. If the client has the addon, then it wouldn't need to run my function and instead, it would just do an "/aai on" to ensure it's turned on to auto accept the invite.

Re: Detect Auto Accept Invitations Addon?

Posted: Thu Mar 14, 2013 11:57 am
by rock5
Just check for the existence of one of it's functions or variables.

Eg.

Code: Select all

if RoMScript("functionname ~= nil") then -- The function exists
   ...
Have a look in the addons lua files and pick something to check. The only limitation is that is has to be something that isn't declared as local.

Re: Detect Auto Accept Invitations Addon?

Posted: Thu Mar 14, 2013 12:22 pm
by noobbotter
Exactly what I was looking for. Thanks Rock. I'll try that tonight when I get home.

Re: Detect Auto Accept Invitations Addon?

Posted: Thu Mar 14, 2013 5:26 pm
by noobbotter
I used if RoMScript("aai ~= nil") then and at first it seemed good. Returned true with it installed, but then I moved the addon out of my addons folder and ran ReloadUI() and it still returns it true. I then tried changing it up and got it working. Here's what I tested with:

Code: Select all

	if RoMScript("aai") ~= nil then 
		local aaiinstalled = true;
		print("aai addon detected");
	else
		local aaiinstalled = false;
		print("aai addon not detected");
	end	 
I verified it with both the addon installed and not installed and it worked as expected.

Re: Detect Auto Accept Invitations Addon?

Posted: Thu Mar 14, 2013 11:29 pm
by rock5
If you intend to use the variable aaiinstalled, you shouldn't declare it local inside the 'if' statement. Should be

Code: Select all

   local aaiinstalled
   if RoMScript("aai") ~= nil then
      aaiinstalled = true;
      print("aai addon detected");
   else
      aaiinstalled = false;
      print("aai addon not detected");
   end