WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Execute slash cmd/Function from another addon (https://www.wowinterface.com/forums/showthread.php?t=17982)

Scale 08-31-08 04:03 AM

Execute slash cmd/Function from another addon
 
I would like to either run the slash command from my addon:
"/aguf raid raidset 1"

Or the LUA command inside aguf:
aUF:setVisibilityOption(CurrentRaidSet, 1)

Is this possible?

Thanks!

Mera 09-01-08 01:22 PM

sure you just have to copy paste where you need the function

aUF:setVisibilityOption(CurrentRaidSet, 1)

it will recognize it even in your addon because aUF is a global table.

Scale 09-01-08 04:35 PM

Quote:

Originally Posted by Mera_LaCroisadeEcarlate (Post 100943)
sure you just have to copy paste where you need the function

aUF:setVisibilityOption(CurrentRaidSet, 1)

it will recognize it even in your addon because aUF is a global table.

So if i understand i just have to copy:

aUF:setVisibilityOption(CurrentRaidSet, 1)

And paste it where i need it, but then when i run it:

attempt to call method 'setVisibilityOption' (a nil value)

Mera 09-02-08 03:09 AM

Quote:

Originally Posted by Scale (Post 100951)
So if i understand i just have to copy:

aUF:setVisibilityOption(CurrentRaidSet, 1)

And paste it where i need it, but then when i run it:

attempt to call method 'setVisibilityOption' (a nil value)

I have got a look at ag source and you wont be able to use SetVisibility or I don't see the trick to do it because this is not aUF:SetVisibility which is set but

Code:

local function setVisibilityOption(option, value)
this is a local function and not global so you cannot call it outside the addon, you will have to write another function that is doing the same thing than the auf one, it's calling SetVisibility() auf api which this one is global

Code:

function aUF.classes.aUFgroup.prototype:SetVisibility()
self:UpdateRaidSet()
if self.database.Hidden == true
or self.database.Exists == false
or (not (self.raidSetVisible) and self.type == "raid")
or (self.type == "raid" and aUF.db.profile.units.raid.HideFrame == true)
or (self.type == "party" and (aUF.db.profile.units.party.HideFrame == true or (aUF.db.profile.RaidHideParty and UnitInRaid("player")) ))
or (self.type == "partypet" and (aUF.db.profile.units.partypet.HideFrame == true or (aUF.db.profile.RaidHideParty and UnitInRaid("player")) )) then
  self.header:Hide()
  self.anchor:Hide()
  else
    self.header:Show()
  end
end

and can be called, it's not that easy to use addons functions from source directly so if you are really not fine with addon, better to start understanding from scratch


All times are GMT -6. The time now is 11:56 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI