rereaded the thread and tried the suggested:
"Good Mage" working as intended
bugged mage:
I have no clue, why the "bugged mage" does not reply the right full name of the spell, nor how to circumvent the problem within my lem.
[CODE title="ChainDS"]---@type Mq
---@type ImGui
local mq = require('mq')
local Spellname=''
local bPetAttack=false
-- if XTarNr == 0 then no targeting shall be needed
-- important to make this work: insert the slot in XTargetWindow where the Tank resides who shell get the ds'es
local XTarNr = 11 -- ATTN: set your Tank to a specific Xtended Target Slot and insert number here
local XtarGATNr = 13 -- Attn: set "Group Assist Target" Xtarget Number here, if you want pet assist; set 0 if no Petassist wanted
local dsSpells = {
MAG={name='Scorching Skin Rk. II',type='spell'},
DRU={name='Daggerthorn',type='spell'}
}
local function StopDPS()
mq.cmd('/squelch /mqp on')
mq.delay(10)
if mq.TLO.Me.Class.ShortName() == 'BRD' then
mq.cmd('/squelch /twist off')
mq.delay(10)
mq.cmd('/squelch /stopsong')
mq.delay(10)
end
--mq.cmd('/attack off')
--mq.delay(10)
mq.cmd('/squelch /boxr pause')
mq.delay(10)
while mq.TLO.Me.Casting.ID() do
mq.delay(100)
end
end
local function ResumeDPS()
mq.cmd('/squelch /mqp off')
mq.delay(10)
if mq.TLO.Me.Class.ShortName() == 'BRD' then
mq.cmd('/squelch /twist on')
mq.delay(10)
end
mq.cmd('/squelch /boxr unpause')
mq.delay(10)
end
local function on_load()
local dsSpell = dsSpells[mq.TLO.Me.Class.ShortName()]
Spellname = mq.TLO.Spell(tostring(dsSpell.name)).RankName()
if dsSpell and dsSpell.type == 'spell' and XTarNr > 0 then
if mq.TLO.Me.Gem(Spellname)() > 0 then return end -- Should be memmed already
StopDPS()
print('memming spell "%s"', Spellname)
mq.cmdf('/memspell 13 "%s"', Spellname)
mq.delay('4s')
mq.TLO.Window('SpellBookWnd').DoClose()
ResumeDPS()
end
end
---@return boolean @Returns true if the action should fire, otherwise false.
local function condition()
---@diagnostic disable-next-line: undefined-field
if mq.TLO.XAssist.XTFullHaterCount() > 0 then return true end
return true
--return mq.TLO.Me.Combat() --or XTarget
end
local function target_Tank()
if XTarNr > 0 then
mq.cmdf('/squelch /xtar %i', XTarNr)
mq.delay(20)
end
end
local function petAssist()
if XtarGATNr > 0 then
mq.cmdf('/squelch /xtar %i', XtarGATNr)
mq.delay(20)
mq.cmd('/squelch /pet attack')
mq.delay(20)
end
end
local function cast(spell)
--print('casting ', spell.RankName())
mq.cmdf('/cast %s', spell.RankName())
mq.delay(20)
mq.doevents()
---@diagnostic disable-next-line: undefined-field
mq.delay(20+mq.TLO.Me.CastTimeLeft.Raw())
-- mq.delay(20+mq.TLO.Spell(spell).MyCastTime.Raw)
end
local function use_aa(aa)
mq.cmdf('/alt activate %s', aa.ID())
mq.delay(20)
mq.doevents()
---@diagnostic disable-next-line: undefined-field
mq.delay(20+mq.TLO.Me.CastTimeLeft.Raw())
end
local function ds_ready(ds)
if ds.type == 'spell' then
return mq.TLO.Me.SpellReady(Spellname) and not mq.TLO.Me.Casting()
elseif ds.type == 'aa' then
return mq.TLO.Me.AltAbilityReady(tostring(ds.name)) and not mq.TLO.Me.Casting()
end
end
local function action()
local my_class = mq.TLO.Me.Class.ShortName()
local ds = dsSpells[my_class]
-- if ds ability isn't ready, return
if not ds then
print('no ds found for my class')
return
end
if my_class ~= 'BRD' and not ds_ready(ds) then return end
StopDPS()
--print('targeting tank')
target_Tank()
if ds.type == 'spell' then
cast(mq.TLO.Spell(ds.name))
else
use_aa(mq.TLO.Me.AltAbility(ds.name))
end
petAssist()
while mq.TLO.Me.Casting() do
mq.doevents()
mq.delay(50)
end
ResumeDPS()
end
return {onload=on_load, condfunc=condition, actionfunc=action}[/CODE]
I have Issues within the function: "on_load()" as this lem will unmemm slot 13 attempting to mem the 'scorching skin' without "RK. II".