#Using sibling or parent functions defined in init

25 messages · Page 1 of 1 (latest)

random agate
#

How can I access sibling functions defined on init? Eg

Parent -> Child A, Child B

Child B defines:

aura_env.fn = function(a) then
  print(a)
end

Child A wants to use (in it's on-show):

local b = 123 + 456
aura_env.fn(b)

When I check Parent init code it says to not edit those, but it's there. Regardless - I'd imagine children can use methods that are defined in parent's init (in parent's init I can see everything from Child A and Child B init).

#

Using sibling or parent functions defined in init

teal orbit
#

There is no inheritance, there is no parent

random agate
#

Does that mean there is no way to have shared utility functions? eg

local getSpellCd = function (spell)
  local s, d, e = GetSpellCooldown(spell)
  return s + d - GetTime()
end

local getBuffDuration = function (spell, target) 
  local ts = select(6, AuraUtil.FindAuraByName(spell, target)) or 0
  return ts - GetTime()
end
teal orbit
#

Why do you have those in custom code

random agate
#

Where would be a correct place to have them?

teal orbit
#

Default triggers

random agate
#

do you mean triggers->custom trigger? 🤔

teal orbit
#

No, I mean default

#

Considering you’re very new to WA, what exactly are you aiming to achieve

random agate
#

I know code; I don't know graphic interface of WA (yet) and how all the inner workings work.

I want util functions to be defined in 1 place and accessible to all my custom little WAs I make in the future. I would have though that was possible by putting them either in parent, or in a child (eg called utils that only holds the global functions)

#

the functions above are just an example, obviously it would be eg

aura_env.getSpellCd = function (spell)
  local s, d, e = GetSpellCooldown(spell)
  return s + d - GetTime()
end
teal orbit
#

There are no parent child relationship in WA

random agate
#

right; got that

#

what's a default trigger though?

teal orbit
#

UI

random agate
#

I only see Trigger; Trigger Combination settings and then specific triggers (ie 1 2 3...)

teal orbit
#

The trigger you make in the UI will carry all that information

random agate
#

I just didn't understand the terminology used - "Default" Trigger

#

did you mean just Trigger 1?

teal orbit
#

Any trigger made in UI

#

There’s no need for custom code in majority of cases, built-in triggers (default triggers) and conditions should solve vast majority of your needs

random agate
#

fair enough. I suppose the examples I've posted are a bit bad because those things can be achieved through the UI for sure I assume. They are a part of more complex logic though... Eg let's say you want to implement rotation-prediction. To determine next spell you need cooldowns, debuffs, buffs, etc - in code, to determine the next optimal spell etc

teal orbit
#

Dont do rotation helpers in WA

#

There are dedicated addons for that