
Originally Posted by
Sechs
After several changes, this is the final code I created
Code:
------------------------------------
-- Adherent Buffs v 1.0
-- Last update 10/02/2015 00:20
------------------------------------
-- Just type "//gs c adbuffs" into the chat line and the addon will write a party chat with the name, job and buff of the target, if it's an Adherent.
adherent_maps = {['Steadfast Adherent']="PLD, DEF+", ['Furtive Adherent']="WHM, MDB+", ['Occult Adherent']="WAR, EVA+",
['Fleet Adherent']="WAR, Haste+", ['Brawny Adherent']="DRK, ATK+", ['Martial Adherent']="DRK,Regain+",
['Honed Adherent']="RDM, Fast Cast+", ['Insidious Adherent']="RDM, MEVA+", ['Hexbreaking Adherent']="BLM, MAB+"}
function self_command(command)
if command == 'adbuffs' then
local name = player.target.name
if adherent_maps[name] then
send_command('input /p '..name..' buff is ==> '..adherent_maps[name]..'')
else
add_to_chat(053,' ***** Target is not an Adherent *****')
end
end
end
It's a stand alone Gearswap Lua.
I then "include" it into another job lua, and just type the command or bind it to a hotkey/macro.
It works perfectly.
I'd just love to learn how to turn that into a standalone addon, give it settings (like enabling people to customize the output channel, atm it's just "/p " and you cannot change it) and allow other people to use it (some people in my LS were interested).
It's just that I don't know how to do it and I don't know where to find documentation to learn about it.
I assume that a lot of things must be "logically" the same but performed with different commands, since some of the parameters/commands I used in that simple lua are Gearswap related, and not luacore related, correct?
First I'd love to delve a bit further in into the world of Lua addon development. If I find out it's too complicated for me, then I'll likely resort to change it into a script like you suggested

This is untested, but it would be something like this to be an addon.
Commands would be:
//ab reload
//ab unload
//ab chatmode party
//ab chatmode linkshell
//ab chatmode shout
//ab chatmode say
//ab announce
or
//adherentbuffs reload
//adherentbuffs unload
//adherentbuffs chatmode party
//adherentbuffs chatmode linkshell
//adherentbuffs chatmode shout
//adherentbuffs chatmode say
//adherentbuffs announce
Code:
config = require ('config')
_addon.name = 'AdherentBuffs'
_addon.author = 'Sechs'
_addon.version = '1.00'
_addon.commands = {'adherentbuffs','ab'}
defaults = T{}
--this can be say / party / linkshell / shout
defaults.announcemode = 'party'
settings = config.load(defaults)
adherent_maps = {['Steadfast Adherent']="PLD, DEF+", ['Furtive Adherent']="WHM, MDB+", ['Occult Adherent']="WAR, EVA+",
['Fleet Adherent']="WAR, Haste+", ['Brawny Adherent']="DRK, ATK+", ['Martial Adherent']="DRK,Regain+",
['Honed Adherent']="RDM, Fast Cast+", ['Insidious Adherent']="RDM, MEVA+", ['Hexbreaking Adherent']="BLM, MAB+"}
chatmodes = S{
'party',
'linkshell',
'shout',
'say'
}
windower.register_event('addon command', function (command,...)
command = command and command:lower() or 'help'
local args = T{...}
if command == 'reload' then
windower.send_command('lua unload AdherentBuffs; lua load AdherentBuffs')
elseif command == 'unload' then
windower.send_command('lua unload AdherentBuffs')
elseif command == 'chatmode' then
if chatmodes:contains(args[1]) then
add_to_chat(053,' ***** Chat Mode Changed to '..args[1]..' *****')
settings.announcemode = args[1]
config.save(settings)
else
add_to_chat(053,' ***** '..args[1]..' is not a valid chat mode *****')
end
elseif command == 'announce' then
local name = windower.ffxi.get_mob_by_target('t').name
if adherent_maps[name] then
send_command('input /'..settings.announcemode..' '..name..' buff is ==> '..adherent_maps[name]..'')
else
add_to_chat(053,' ***** Target is not an Adherent *****')
end
end
end)