|
Solved: GS Automatic Aurorastorm Notifier
By RolandJ 2015-12-03 23:23:02
Hello guys,
I would like to include a feature in my whm.lua that, when a cure spell is cast, checks to see if the spell Aurorastorm is active. Furthermore, if the check comes back false, I would like for it to print onto my screen a notice. Such a notice could be a line of text that reads "Aurorastorm currently inactive.". It would be even nicer if it could give a subtle sound effect to go along with the notice - though perhaps now I am wandering into the realm of unrealistic requests.
I will look into how to accomplish this while waiting for a response. If anyone has the know-how to accomplish this please help.
Thanks guys,
Roland
PROGRESS UPDATE: Solved
Thanks to multiple contributions from Vow, Braden, and Conagh, I have been able to build the code for this feature to include in my WHM.lua. A thanks also goes out to Draylo for pointing out ingame where in my lua to put the code.
Here is the code - you might notice that it needs to be contained within the precast function in your lua. That's where it is in mine, at least. Code function job_precast(spell, action, spellMap, eventArgs)
if map == 'Cure' and player.sub_job == "SCH" and not buffactive.Aurorastorm then
add_to_chat(123,'Aurorastorm not active.')
windower.play_sound('C:/Program Files (x86)/Windower4/addons/GearSwap/data/wav/Chime.wav')
end
if map == 'Curaga' and player.sub_job == "SCH" and not buffactive.Aurorastorm then
add_to_chat(123,'Aurorastorm not active.')
windower.play_sound('C:/Program Files (x86)/Windower4/addons/GearSwap/data/wav/Chime.wav')
end
end
You will also need to either add a folder named "wav" in your '...\Windower4\addons\GearSwap\data\' folder and put a .wav file named Chime within or create your own folder and name your own .wav in a location of your choosing and manipulate the code to point to your folder and your .wav.
Thank you for taking a look, I hope some people find this helpful.
Thank you all who helped!
Kind Regards,
Roland
[+]
By RolandJ 2015-12-04 02:01:22
Ok, so far I've come up with...
if spell.english == 'Cure' and buffinactive.aurorastorm then
add_to_chat(123,'Aurorastorm not active.')
end
I borrowed the framework of that code from Mote-Include.lua's job file message. I am expecting that I might need to expand 'Cure' into another phrase that will be able to catch all of the cure variations or rather just include them all separated by commas - for now I'm just leaving it as 'Cure' until I am able to test it further while ingame.
The main problem impeding my testing right now is that when I tried putting that code in a few different places of my whm.lua it has caused the .lua to become unloadable ingame each time.
Also, is buffinactive the correct opposite of buffactive in this code language? I've found buffactive used in some strings of code but I've not come across a string of code that specifically looks for a buff that is not currently up. Maybe I'll find one soon to verify that I'm using the right coding.
Back to the books...
Leviathan.Vow
Server: Leviathan
Game: FFXI
Posts: 125
By Leviathan.Vow 2015-12-04 04:06:27
Code
include('Mote-Mappings.lua') -- this is a file written by Motenten that includes, among other things, a large-ish table named spell_maps. The table maps similar spells to a common name. e.g. ['Cure V'] = 'Cure', ['Curaga III'] = 'Curaga', etc.
function precast(spell)
local map = spell_maps[spell.en]
if map == 'Cure' and not buffactive.Aurorastorm then
add_to_chat(123,'Aurorastorm not active.')
windower.play_sound(path) -- path is the path to the file, which must be in wav format.
end
end
buffactive is a table created by gearswap and updated every time your buffs change. Its keys are the written names (with and without capital letters) and buff ids of the buffs you currently have active, and its values are numbers corresponding to how many of each buff you have active (Protect/Shell will always be 1 if you have the buff, while March may be 2 if you have both marches). Gearswap does not create a 'buffinactive' table.
Looking up a buff that you do not have active results in nil.
In Lua, so if you need to work with the opposite of a value (checking if a buff is not active) is the appropriate syntax.
The error you probably received was likely something along the lines of attempting to index a nil value: 'buffinactive'. Since buffinactive is undefined, the value is nil. Attempting to lookup a value in nil causes the error. The errors printed in the console will usually be clear enough to figure out what's wrong.
[+]
By RolandJ 2015-12-04 13:37:46
Thank you very much, Vow! That is very helpful and my testing can now continue - that code will load ingame.
I am running into the following errors
If I use Code if map == 'Cure' and not buffactive.Aurorastorm then then the feature works perfectly for non-curaga cures but it leaves out functionality for curagas.
and if I use Code if map == 'Cure' or 'Curaga' and not buffactive.Aurorastorm then then cure spells(non-curaga) trip this message to print onscreen whether aurorastorm is active or not, whereas the curaga-notification function stays intact and working as intended.
I have also tried ('cure','curaga') and {'cure','curaga'} and 'cure','curaga' but those did not work, either. I am considering of making a second string of code for curaga unless I find a way to combine them both into the same line.
I am also having trouble getting the sound to play. I have currently tried Code windower.play_sound(C:\Program Files(x86)\Windower4\addons\GearSwap\data\wav\Chime.wav) and that results in the lua become unloadable ingame and an error message reading "WHM.lua:377: '<name>' expected near '\'".
I also tried using Code windower.play_sound(Chime.wav) and moving the file into my char's folder but that results in printing a console message reading "WHM.lua:377: attempt to index global 'Chime' (a nil value)" each time I cast cure.
I am not sure how to get past that. I'm not sure what '<name>' being expected means, either. I'll keep looking, though.
Thanks again for reading.
Sylph.Braden
Server: Sylph
Game: FFXI
Posts: 397
By Sylph.Braden 2015-12-04 13:46:43
Try this:
windower.play_sound('C:/Program Files(x86)/Windower4/addons/GearSwap/data/wav/Chime.wav')
[+]
By RolandJ 2015-12-04 14:03:38
Thanks, Braden! That removed some of the errors.
I tried Code windower.play_sound('C:\Program Files(x86)\Windower4\addons\GearSwap\data\wav\Chime.wav') the difference being that the path is now surrounded in ''s. It now becomes loadable ingame and no error message plays on cure casting but the sound file does not play, either.
Using windower.play_sound('Chime.wav') also produces the same effect; no error message nor sound played.
I have the sound files located in the path above and also one within my character's gs folder. Do I need to move it somewhere else or is the location not the current problem?
Inlcuding the following in my whm.lua's precast fuction results in all cure and curaga tiers printing this message onscreen if aurorastorm is not active. Code if map == 'Cure' and not buffactive.Aurorastorm then
add_to_chat(123,'Aurorastorm not active.')
end
if map == 'Curaga' and not buffactive.Aurorastorm then
add_to_chat(123,'Aurorastorm not active.')
end
So now I just need to get the sound to play and I should have this sorted out. I still don't know how to combine cure and curaga into the same line but I've circumvented that for now by creating two different strings of code; one for cure and a separate one for curaga. It is not ideal and hopefully I can combine them into the same line eventually.
Thanks for all the help so far, guys!
Cerberus.Conagh
Server: Cerberus
Game: FFXI
Posts: 3189
By Cerberus.Conagh 2015-12-04 15:21:36
Thanks, Braden! That removed some of the errors.
I tried Code windower.play_sound('C:\Program Files(x86)\Windower4\addons\GearSwap\data\wav\Chime.wav') the difference being that the path is now surrounded in ''s. It now becomes loadable ingame and no error message plays on cure casting but the sound file does not play, either.
Using windower.play_sound('Chime.wav') also produces the same effect; no error message nor sound played.
I have the sound files located in the path above and also one within my character's gs folder. Do I need to move it somewhere else or is the location not the current problem?
Inlcuding the following in my whm.lua's precast fuction results in all cure and curaga tiers printing this message onscreen if aurorastorm is not active. Code if map == 'Cure' and not buffactive.Aurorastorm then
add_to_chat(123,'Aurorastorm not active.')
end
if map == 'Curaga' and not buffactive.Aurorastorm then
add_to_chat(123,'Aurorastorm not active.')
end
So now I just need to get the sound to play and I should have this sorted out. I still don't know how to combine cure and curaga into the same line but I've circumvented that for now by creating two different strings of code; one for cure and a separate one for curaga. It is not ideal and hopefully I can combine them into the same line eventually.
Thanks for all the help so far, guys!
Code Cures = S{'Cure','Cure II','Cure III','Cure IV','Cure V','Cure VI'}
Just add Curaga's in there.
Code if Cures:contains(spell.name) and not buffactive.Aurorastorm then
add_to_chat(123,'Aurorastorm not active.')
send_command('@input /echo <se.9> Weather Isn't up, sort it out!')
end
You can do it in one line that way, in terms of getting a sound to work it shouldn't be an issue however you can do this instead ~
[+]
Leviathan.Vow
Server: Leviathan
Game: FFXI
Posts: 125
By Leviathan.Vow 2015-12-04 16:54:24
I tried Code windower.play_sound('C:\Program Files(x86)\Windower4\addons\GearSwap\data\wav\Chime.wav') Code 'C:\Program Files(x86)\Windower4\addons\GearSwap\data\wav\Chime.wav' -- a string
C:\Program Files(x86)\Windower4\addons\GearSwap\data\wav\Chime.wav -- garbled nonsense
The quotes make a big difference! The problem now is that the backslash is an escape character. It tells Lua that the next character(s) in the string should be interpreted differently (e.g. \n creates a newline).
To correct the problem, either escape the escape character (replace \ with \\, which tells Lua that \ should not be interpreted as the escape character), or replace the backslashes with forward slashes (the better solution).
Quote: I still don't know how to combine cure and curaga into the same line but I've circumvented that for now by creating two different strings of code; one for cure and a separate one for curaga. Code if map == 'Cure' or map == 'Curaga' then ... Your previous attempt (if map == 'Cure' or 'Curaga' ...) failed for the following reason: Code map == 'Cure' -- This is a single boolean condition.
map == 'Cure' or 'Curaga' -- This is two separate boolean conditions compared with a logical operator.
The second condition is simply 'Curaga' (i.e. if 'Curaga' then ...) which always evaluates to true, as anything that is not false or nil evaluates to true in Lua. The statement will always run since is true.
One common shortcut for a long string of conditions that compare the same value Code if a == 1 or a == 2 or a == 3 or ... is to toss all of the possibilities into a table and check if the value is in the table. You may choose not to predefine the table: Code if S({1,2,3,4,...}):contains(value) then ... -- S is a function from windower's libraries (/addons/libs/sets.lua)
--Using T instead of S will probably be quicker for small tables, but the difference is trivial either way.
It's essentially a trivial loss of efficiency for a minor gain in readability.
You can use Conag's solution, or a number of others. The advantage to using Motenten's maps is that you skip out on a lot of typing.
This is a really good site for learning Lua: http://lua-users.org/wiki/TutorialDirectory
Lua has very few built in libraries, so it's very quick to learn.
[+]
By RolandJ 2015-12-04 17:28:38
Thank you for those two great replies! I have been able to progress the code to a state that I am pleased with and happy to implement!
I am now using Code if map == 'Cure' and player.sub_job == "SCH" and not buffactive.Aurorastorm then
add_to_chat(123,'Aurorastorm not active.')
windower.play_sound('C:\\Program Files (x86)\\Windower4\\addons\\GearSwap\\data\\wav\\Chime.wav')
end
if map == 'Curaga' and player.sub_job == "SCH" and not buffactive.Aurorastorm then
add_to_chat(123,'Aurorastorm not active.')
windower.play_sound('C:\\Program Files (x86)\\Windower4\\addons\\GearSwap\\data\\wav\\Chime.wav')
end
Thank you Conagh for the cures:contains code. The only reason I did not use it is because I'm too much of an amateur to figure it out ^^;.
Thank you Vow for explaining the backslash conflict and explaining the tables. Using the tables method seems to be above my understanding at the moment so I am just using the earlier code that managed to work for me.
Thanks guys! I'll update the original post with the code and we can consider this finished with potential updates in the future(code simplifications). ^^
Necro Bump Detected!
[101 days between previous and next post]
By cocl 2016-03-14 08:27:16
I hate to necro a 3 month old thread but I tried including RolandJ's code in my gearswap but it is not working for me. I'm not sure I put it in the right spot or not but if anyone would be so kind as to take a look for me I would greatly appreciate it. Code -------------------------------------------------------------------------------------------------------------------
-- Initialization function that defines sets and variables to be used.
-------------------------------------------------------------------------------------------------------------------
-- IMPORTANT: Make sure to also get the Mote-Include.lua file (and its supplementary files) to go with this.
-- Initialization function for this job file.
function get_sets()
mote_include_version = 2
-- Load and initialize the include file.
include('Mote-Mappings.lua')
include('Mote-Include.lua')
include('organizer-lib')
end
-- Setup vars that are user-independent.
function job_setup()
state.Buff['Afflatus Solace'] = buffactive['Afflatus Solace'] or false
state.Buff['Afflatus Misery'] = buffactive['Afflatus Misery'] or false
end
-- Setup vars that are user-dependent. Can override this function in a sidecar file.
function user_setup()
-- Options: Override default values
options.OffenseModes = {'None', 'Normal'}
options.DefenseModes = {'Normal'}
options.WeaponskillModes = {'Normal'}
options.CastingModes = {'Normal', 'Resistant', 'Dire'}
options.IdleModes = {'Normal', 'PDT'}
options.RestingModes = {'Normal'}
options.PhysicalDefenseModes = {'PDT'}
options.MagicalDefenseModes = {'MDT'}
state.OffenseMode = 'None'
select_default_macro_book()
Cures = S{'Cure','Cure II','Cure III','Cure IV','Cure V','Cure VI'}
end
-- Define sets and vars used by this job file.
function init_gear_sets()
--------------------------------------
-- Start defining the sets
--------------------------------------
-- Precast Sets
-- Fast cast sets for spells
sets.precast.FC = {
main="Marin Staff +1",
sub="Benthos Grip",
ammo="Impatiens",
head="Nahtirah Hat",
body="Anhur Robe",
hands={ name="Gende. Gages +1", augments={'Phys. dmg. taken -1%','"Cure" spellcasting time -1%',}},
legs={ name="Artsieq Hose", augments={'MP+30','Mag. Acc.+20','MND+7',}},
feet="Regal Pumps +1",
neck="Orison Locket",
waist="Witful Belt",
left_ear="Enchntr. Earring +1",
right_ear="Loquac. Earring",
left_ring="Prolix Ring",
right_ring="Weather. Ring",
back="Swith Cape +1",
}
sets.precast.FC['Enhancing Magic'] = set_combine(sets.precast.FC, {waist="Siegel Sash"})
sets.precast.FC.Stoneskin = set_combine(sets.precast.FC['Enhancing Magic'], {head="Umuthi Hat"})
sets.precast.FC['Healing Magic'] = set_combine(sets.precast.FC, {legs="Ebers Pantaloons +1"})
sets.precast.FC.StatusRemoval = sets.precast.FC['Healing Magic']
sets.precast.FC.Cure = set_combine(sets.precast.FC['Healing Magic'], {
main="Ababinili +1",
sub="Benthos Grip",
ammo="Impatiens",
head="Nahtirah Hat",
body="Heka's Kalasiris",
hands={ name="Gende. Gages +1", augments={'Phys. dmg. taken -1%','"Cure" spellcasting time -1%',}},
legs="Ebers Pant. +1",
feet={ name="Vanya Clogs", augments={'System: 2 ID: 124 Val: 4','System: 2 ID: 123 Val: 14','System: 2 ID: 177 Val: 5',}},
neck="Orison Locket",
waist="Witful Belt",
left_ear="Nourish. Earring +1",
right_ear="Nourish. Earring",
left_ring="Prolix Ring",
right_ring="Weather. Ring",
back="Ogapepo Cape",
})
sets.precast.FC.Curaga = sets.precast.FC.Cure
-- Precast sets to enhance JAs
sets.precast.JA.Benediction = {body="Piety Briault"}
-- Waltz set (chr and vit)
sets.precast.Waltz = {
head="Nahtirah Hat",ear1="Roundel Earring",
body="Vanir Cotehardie",hands="Yaoyotl Gloves",
back="Refraction Cape",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
-- Weaponskill sets
-- Default set for any weaponskill that isn't any more specifically defined
gear.default.weaponskill_neck = "Asperity Necklace"
gear.default.weaponskill_waist = ""
sets.precast.WS = {
head="Nahtirah Hat",neck=gear.ElementalGorget,ear1="Bladeborn Earring",ear2="Steelflash Earring",
body="Vanir Cotehardie",hands="Yaoyotl Gloves",ring1="Rajas Ring",ring2="K'ayres Ring",
back="Refraction Cape",waist=gear.ElementalBelt,legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
sets.precast.WS['Flash Nova'] = {
head="Nahtirah Hat",neck="Stoicheion Medal",ear1="Friomisi Earring",ear2="Hecate's Earring",
body="Vanir Cotehardie",hands="Yaoyotl Gloves",ring1="Rajas Ring",ring2="Strendu Ring",}
-- Midcast Sets
sets.midcast.FastRecast = {
main="Marin Staff +1",
sub="Benthos Grip",
ammo="Impatiens",
head="Nahtirah Hat",
body="Anhur Robe",
hands={ name="Gende. Gages +1", augments={'Phys. dmg. taken -1%','"Cure" spellcasting time -1%',}},
legs={ name="Artsieq Hose", augments={'MP+30','Mag. Acc.+20','MND+7',}},
feet="Regal Pumps +1",
neck="Orison Locket",
waist="Witful Belt",
left_ear="Enchntr. Earring +1",
right_ear="Loquac. Earring",
left_ring="Prolix Ring",
right_ring="Weather. Ring",
back="Swith Cape +1",
}
-- Cure sets
gear.default.obi_waist = "Goading Belt"
gear.default.obi_back = "Twilight Cape"
sets.midcast.CureSolace = {
main={ name="Queller Rod", augments={'Healing magic skill +15','System: 2 ID: 124 Val: 9','System: 2 ID: 123 Val: 6',}},
sub="Sors Shield",
ammo="Oreiad's Tathlum",
head={ name="Gende. Caubeen +1", augments={'Phys. dmg. taken -1%','"Cure" potency +6%',}},
body="Ebers Bliaud +1",
hands="Theo. Mitts +1",
legs="Ebers Pant. +1",
feet={ name="Vanya Clogs", augments={'System: 2 ID: 124 Val: 4','System: 2 ID: 123 Val: 14','System: 2 ID: 177 Val: 5',}},
neck="Colossus's Torque",
waist="Bishop's Sash",
left_ear="Nourish. Earring +1",
right_ear="Beatific Earring",
left_ring="Sirona's Ring",
right_ring="Haoma's Ring",
back="Tempered cape +1",
}
sets.midcast.Cure = {
main={ name="Queller Rod", augments={'Healing magic skill +15','System: 2 ID: 124 Val: 9','System: 2 ID: 123 Val: 6',}},
sub="Sors Shield",
ammo="Oreiad's Tathlum",
head={ name="Gende. Caubeen +1", augments={'Phys. dmg. taken -1%','"Cure" potency +6%',}},
body="Ebers Bliaud +1",
hands="Theo. Mitts +1",
legs="Ebers Pant. +1",
feet={ name="Vanya Clogs", augments={'System: 2 ID: 124 Val: 4','System: 2 ID: 123 Val: 14','System: 2 ID: 177 Val: 5',}},
neck="Colossus's Torque",
waist="Bishop's Sash",
left_ear="Nourish. Earring +1",
right_ear="Beatific Earring",
left_ring="Sirona's Ring",
right_ring="Haoma's Ring",
back="Tempered cape +1",
}
sets.midcast.Curaga = {
main={ name="Queller Rod", augments={'Healing magic skill +15','System: 2 ID: 124 Val: 9','System: 2 ID: 123 Val: 6',}},
sub="Sors Shield",
ammo="Oreiad's Tathlum",
head={ name="Gende. Caubeen +1", augments={'Phys. dmg. taken -1%','"Cure" potency +6%',}},
body="Ebers bliaud +1",
hands="Theo. Mitts +1",
legs="Ebers Pant. +1",
feet={ name="Vanya Clogs", augments={'System: 2 ID: 124 Val: 4','System: 2 ID: 123 Val: 14','System: 2 ID: 177 Val: 5',}},
neck="Colossus's Torque",
waist="Bishop's Sash",
left_ear="Nourish. Earring +1",
right_ear="Beatific Earring",
left_ring="Sirona's Ring",
right_ring="Haoma's Ring",
back="Tempered cape +1",
}
sets.midcast.CureMelee = {main="Tamaxchi",sub="sors Shield",ammo="kalboron stone",
head="Gendewitha Caubeen",neck="nuna gorget +1",ear1="novia Earring",ear2="beatific Earring",
body="Orison Bliaud +2",hands="yaoyotl gloves",ring1="sirona's Ring",ring2="haoma's Ring",
back="pahtli Cape",waist=gear.ElementalObi,legs="Orison Pantaloons +2",feet="Piety Duckbills +1"}
sets.midcast.Cursna = {main="yagrush",sub="Genbu's Shield",
head="Orison Cap +2",neck="Malison Medallion",
body="ebers briault +1",hands="Hieros Mittens",ring1="haoma's Ring",ring2="haoma's Ring",
back="Mending Cape",waist="Goading Belt",legs="Ebers pantaloons +1",feet="Gendewitha Galoshes +1"}
sets.midcast.StatusRemoval = {main="yagrush",sub="sors shield",ammo="impatiens",
head="haruspex hat +1",neck="orison locket",ear1="henchanter Earring +1",ear2="loquacious Earring",
body="vanir cotehardie",hands="theopany mitts +1",ring1="prolix Ring",ring2="weatherspoon Ring",
back="swith cape +1",waist="ninurta's sash",legs="ebers pantaloons +1",feet="regal pumps +1"}
-- 110 total Enhancing Magic Skill; caps even without Light Arts
sets.midcast['Enhancing Magic'] = {
main="Beneficus",
sub={ name="Genbu's Shield", augments={'"Cure" potency +3%','"Cure" spellcasting time -8%','Wind resistance+9',}},
ammo="Vanir Battery",
head="Umuthi Hat",
body="Anhur Robe",
hands="Dynasty Mitts",
legs={ name="Piety Pantaln. +1", augments={'Enhances "Shellra V" effect',}},
feet="Orsn. Duckbills +2",
neck="Colossus's Torque",
waist="Olympus Sash",
left_ear="Andoaa Earring",
right_ear={ name="Moonshade Earring", augments={'MP+25','Latent effect: "Refresh"+1',}},
left_ring="Prolix Ring",
right_ring="Weather. Ring",
back="Merciful Cape",
}
sets.midcast.Stoneskin = {
head="Nahtirah Hat",neck="Orison Locket",ear2="Loquacious Earring",
body="Vanir Cotehardie",hands="Dynasty Mitts",
back="Swith Cape +1",waist="Siegel Sash",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
sets.midcast.Auspice = {hands="Dynasty Mitts",feet="Orison Duckbills +2"}
sets.midcast.BarElement = {
main="Beneficus",
sub={ name="Genbu's Shield", augments={'"Cure" potency +3%','"Cure" spellcasting time -8%','Wind resistance+9',}},
ammo="Vanir Battery",
head="Orison Cap +2",
body="ebers bliaud +1",
hands="Orison Mitts +2",
legs={ name="Piety Pantaln. +1", augments={'Enhances "Shellra V" effect',}},
feet="Orsn. Duckbills +2",
neck="Colossus's Torque",
waist="Olympus Sash",
left_ear="Andoaa Earring",
right_ear={ name="Moonshade Earring", augments={'MP+25','Latent effect: "Refresh"+1',}},
left_ring="Prolix Ring",
right_ring="Weather. Ring",
back="Merciful Cape",
}
sets.midcast.Regen = {main="Bolelabunga",sub="Genbu's Shield",
body="Piety Briault +1",hands="Orison Mitts +2",
legs="Theophany Pantaloons"}
sets.midcast.Protectra = {ring1="Sheltered Ring",feet="Piety Duckbills +1"}
sets.midcast.Shellra = {ring1="Sheltered Ring",legs="Piety Pantaloons +1"}
sets.midcast['Divine Magic'] = {
main="Marin Staff +1",
sub="Elder's Grip +1",
ammo="Ghastly Tathlum",
head={ name="Helios Band", augments={'Mag. Acc.+20 "Mag.Atk.Bns."+20','"Occult Acumen"+10','INT+10',}},
body={ name="Witching Robe", augments={'MP+45','Mag. Acc.+14','"Mag.Atk.Bns."+14',}},
hands={ name="Helios Gloves", augments={'Mag. Acc.+18 "Mag.Atk.Bns."+18','"Occult Acumen"+3','INT+9',}},
legs={ name="Lengo Pants", augments={'INT+8','Mag. Acc.+14','"Mag.Atk.Bns."+13',}},
feet={ name="Helios Boots", augments={'"Mag.Atk.Bns."+25','"Fast Cast"+5','INT+4 MND+4',}},
neck="Eddy Necklace",
waist="Othila Sash",
left_ear="Friomisi Earring",
right_ear="Hecate's Earring",
left_ring="Fenrir Ring +1",
right_ring="Fenrir Ring +1",
back="Toro Cape",
}
sets.midcast['Dark Magic'] = {main="ngqoqwanb", sub="mephitis grip",
head="Nahtirah Hat",neck="Aesir Torque",ear1="Psystorm Earring",ear2="Lifestorm Earring",
body="Vanir Cotehardie",hands="Yaoyotl Gloves",ring1="Strendu Ring",ring2="Sangoma Ring",
back="Refraction Cape",waist="Demonry Sash",legs="Bokwus Slops",feet="Piety Duckbills +1"}
-- Custom spell classes
sets.midcast.MndEnfeebles = {
main={ name="Twebuliij", augments={'MP+60','Mag. Acc.+15','MND+12',}},
sub="Benthos Grip",
ammo="Oreiad's Tathlum",
head={ name="Artsieq Hat", augments={'MP+30','Mag. Acc.+20','MND+7',}},
body="Vanir Cotehardie",
hands="Lurid Mitts",
legs={ name="Artsieq Hose", augments={'MP+30','Mag. Acc.+20','MND+7',}},
feet={ name="Piety Duckbills +1", augments={'Enhances "Protectra V" effect',}},
neck="Nuna Gorget +1",
waist="Cascade Belt",
left_ear="Lifestorm Earring",
right_ear="Psystorm Earring",
left_ring="Levia. Ring +1",
right_ring="Levia. Ring +1",
back="Merciful Cape",
}
sets.midcast.IntEnfeebles = {
main={ name="Twebuliij", augments={'MP+60','Mag. Acc.+15','MND+12',}},
sub="Benthos Grip",
ammo="Oreiad's Tathlum",
head={ name="Artsieq Hat", augments={'MP+30','Mag. Acc.+20','MND+7',}},
body="Vanir Cotehardie",
hands="Lurid Mitts",
legs={ name="Artsieq Hose", augments={'MP+30','Mag. Acc.+20','MND+7',}},
feet={ name="Piety Duckbills +1", augments={'Enhances "Protectra V" effect',}},
neck="Imbodla Necklace",
waist="Ovate Rope",
left_ear="Lifestorm Earring",
right_ear="Psystorm Earring",
left_ring="Levia. Ring +1",
right_ring="Levia. Ring +1",
back="Merciful Cape",
}
-- Sets to return to when not performing an action.
-- Resting sets
sets.resting = {main=gear.Staff.HMP,
body="Gendewitha Bliaut",hands="Serpentes Cuffs",
waist="Austerity Belt",legs="Nares Trews",feet="Chelona Boots +1"}
-- Idle sets (default idle set not needed since the other three are defined, but leaving for testing purposes)
sets.idle = {
main="Bolelabunga",
sub={ name="Genbu's Shield", augments={'"Cure" potency +3%','"Cure" spellcasting time -8%','Wind resistance+9',}},
ammo="Vanir Battery",
body="Respite Cloak",
hands="Serpentes Cuffs",
legs="Assid. Pants +1",
feet="Serpentes Sabots",
neck="Twilight Torque",
waist="Slipor Sash",
left_ear="Ethereal Earring",
right_ear="moonshade Earring",
left_ring="Paguroidea Ring",
right_ring="Sheltered Ring",
back="Shadow Mantle",}
sets.idle.PDT = {main="owleyes", sub="Genbu's Shield",ammo="sihirik",
head="wivre hairpin",neck="twilight torque",ear1="ethereal Earring",ear2="Loquacious Earring",
body="gendewitha bliaut",hands="Serpentes Cuffs",ring1="dark Ring",ring2="dark Ring",
back="shadow mantle",waist="slipor sash",legs="Nares Trews",feet="serpentes sabots"}
sets.idle.Town = {
main="Bolelabunga",
sub={ name="Genbu's Shield", augments={'"Cure" potency +3%','"Cure" spellcasting time -8%','Wind resistance+9',}},
ammo="Vanir Battery",
body="Respite Cloak",
hands="Serpentes Cuffs",
legs="Assid. Pants +1",
feet="Serpentes Sabots",
neck="Twilight Torque",
waist="Slipor Sash",
left_ear="Ethereal Earring",
right_ear="moonshade Earring",
left_ring="Paguroidea Ring",
right_ring="Sheltered Ring",
back="Shadow Mantle",
}
sets.idle.Weak = {
main="Bolelabunga",
sub={ name="Genbu's Shield", augments={'"Cure" potency +3%','"Cure" spellcasting time -8%','Wind resistance+9',}},
ammo="Vanir Battery",
body="Respite Cloak",
hands="Serpentes Cuffs",
legs="Assid. Pants +1",
feet="Serpentes Sabots",
neck="Twilight Torque",
waist="Slipor Sash",
left_ear="Ethereal Earring",
right_ear="moonshade Earring",
left_ring="Paguroidea Ring",
right_ring="Sheltered Ring",
back="Shadow Mantle",
}
-- Defense sets
sets.defense.PDT = {main=gear.Staff.PDT,sub="Achaq Grip",
head="Gendewitha Caubeen",neck="Twilight Torque",
body="Gendewitha Bliaut",hands="Gendewitha Gages",ring1="Defending Ring",ring2=gear.DarkRing.physical,
back="Umbra Cape",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
sets.defense.MDT = {main=gear.Staff.PDT,sub="Achaq Grip",
head="Nahtirah Hat",neck="Twilight Torque",
body="Vanir Cotehardie",hands="Yaoyotl Gloves",ring1="Defending Ring",ring2="Shadow Ring",
back="Tuilha Cape",legs="Bokwus Slops",feet="Gendewitha Galoshes"}
sets.Kiting = {feet="Herald's Gaiters"}
sets.latent_refresh = {waist="Fucho-no-obi"}
-- Engaged sets
-- Variations for TP weapon and (optional) offense/defense modes. Code will fall back on previous
-- sets if more refined versions aren't defined.
-- If you create a set with both offense and defense modes, the offense mode should be first.
-- EG: sets.engaged.Dagger.Accuracy.Evasion
-- Basic set for if no TP weapon is defined.
sets.engaged = {
head="Nahtirah Hat",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
body="Vanir Cotehardie",hands="Dynasty Mitts",ring1="Rajas Ring",ring2="K'ayres Ring",
back="Umbra Cape",waist="Goading Belt",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
-- Buff sets: Gear that needs to be worn to actively enhance a current player buff.
sets.buff['Divine Caress'] = {hands="Orison Mitts +2",back="Mending Cape"}
end
-------------------------------------------------------------------------------------------------------------------
-- Job-specific hooks that are called to process player actions at specific points in time.
-------------------------------------------------------------------------------------------------------------------
-- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
-- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
function job_precast(spell, action, spellMap, eventArgs)
if map == 'Cure' and player.sub_job == "SCH" and not buffactive.Aurorastorm then
add_to_chat(123,'Aurorastorm not active.')
windower.play_sound(windower.addon_path..'wav/Chime.wav')
end
if map == 'Curaga' and player.sub_job == "SCH" and not buffactive.Aurorastorm then
add_to_chat(123,'Aurorastorm not active.')
windower.play_sound(windower.addon_path..'wav/Chime.wav')
end
end
function job_precast(spell, action, spellMap, eventArgs)
if spell.english == "Paralyna" and buffactive.Paralyzed then
eventArgs.handled = true
end
if spell.skill == 'Healing Magic' then
gear.default.obi_back = "Mending Cape"
else
gear.default.obi_back = "Toro Cape"
end
end
function job_precast(spell, action, spellMap, eventArgs)
if state.Buff[spell.english] ~= nil then
state.Buff[spell.english] = true
end
end
function job_post_midcast(spell, action, spellMap, eventArgs)
-- Apply Divine Caress boosting items as highest priority over other gear, if applicable.
if spellMap == 'StatusRemoval' and buffactive['Divine Caress'] then
equip(sets.buff['Divine Caress'])
end
end
-- Return true if we handled the aftercast work. Otherwise it will fall back
-- to the general aftercast() code in Mote-Include.
function job_aftercast(spell, action, spellMap, eventArgs)
if state.Buff[spell.english] ~= nil then
state.Buff[spell.english] = not spell.interrupted or buffactive[spell.english]
end
end
-------------------------------------------------------------------------------------------------------------------
-- Customization hooks for idle and melee sets, after they've been automatically constructed.
-------------------------------------------------------------------------------------------------------------------
-- Custom spell mapping.
function job_get_spell_map(spell, default_spell_map)
if spell.action_type == 'Magic' then
if (default_spell_map == 'Cure' or default_spell_map == 'Curaga') and player.status == 'Engaged' then
return "CureMelee"
elseif default_spell_map == 'Cure' and state.Buff['Afflatus Solace'] then
return "CureSolace"
elseif spell.skill == "Enfeebling Magic" then
if spell.type == "WhiteMagic" then
return "MndEnfeebles"
else
return "IntEnfeebles"
end
end
end
end
function customize_idle_set(idleSet)
if player.mpp < 51 then
idleSet = set_combine(idleSet, sets.latent_refresh)
end
return idleSet
end
-------------------------------------------------------------------------------------------------------------------
-- General hooks for other events.
-------------------------------------------------------------------------------------------------------------------
-- Called when a player gains or loses a buff.
-- buff == buff gained or lost
-- gain == true if the buff was gained, false if it was lost.
function job_buff_change(buff, gain)
if state.Buff[buff] ~= nil then
state.Buff[buff] = gain
end
end
-------------------------------------------------------------------------------------------------------------------
-- User code that supplements self-commands.
-------------------------------------------------------------------------------------------------------------------
-- Called by the 'update' self-command.
function job_update(cmdParams, eventArgs)
if cmdParams[1] == 'user' and not areas.Cities:contains(world.area) then
local needsArts =
player.sub_job:lower() == 'sch' and
not buffactive['Light Arts'] and
not buffactive['Addendum: White'] and
not buffactive['Dark Arts'] and
not buffactive['Addendum: Black']
if not buffactive['Afflatus Solace'] and not buffactive['Afflatus Misery'] then
if needsArts then
send_command('@input /ja "Afflatus Solace" <me>;wait 1.2;input /ja "Light Arts" <me>')
else
send_command('@input /ja "Afflatus Solace" <me>')
end
end
end
end
-- Handle notifications of general user state change.
function job_state_change(stateField, newValue, oldValue)
if stateField == 'OffenseMode' then
if newValue == 'Normal' then
disable('main','sub')
else
enable('main','sub')
end
elseif stateField == 'Reset' then
if state.OffenseMode == 'None' then
enable('main','sub')
end
end
end
-- Function to display the current relevant user state when doing an update.
-- Return true if display was handled, and you don't want the default info shown.
function display_current_job_state(eventArgs)
local defenseString = ''
if state.Defense.Active then
local defMode = state.Defense.PhysicalMode
if state.Defense.Type == 'Magical' then
defMode = state.Defense.MagicalMode
end
defenseString = 'Defense: '..state.Defense.Type..' '..defMode..', '
end
local meleeString = ''
if state.OffenseMode == 'Normal' then
meleeString = 'Melee: Weapons locked, '
end
add_to_chat(122,'Casting ['..state.CastingMode..'], '..meleeString..'Idle ['..state.IdleMode..'], '..defenseString..
'Kiting: '..on_off_names[state.Kiting])
eventArgs.handled = true
end
-------------------------------------------------------------------------------------------------------------------
-- Utility functions specific to this job.
-------------------------------------------------------------------------------------------------------------------
-- Select default macro book on initial load or subjob change.
function select_default_macro_book()
-- Default macro set/book
set_macro_page(4, 14)
Bahamut.Ayasha
Server: Bahamut
Game: FFXI
Posts: 89
By Bahamut.Ayasha 2016-03-14 13:28:15
The variable 'map' in your job_precast function is undefined. Change the code block to read:
Code
function job_precast(spell, action, spellMap, eventArgs)
local map = spell_maps[spell.en]
if map == 'Cure' and player.sub_job == "SCH" and not buffactive.Aurorastorm then
add_to_chat(123,'Aurorastorm not active.')
windower.play_sound(windower.addon_path..'wav/Chime.wav')
end
if map == 'Curaga' and player.sub_job == "SCH" and not buffactive.Aurorastorm then
add_to_chat(123,'Aurorastorm not active.')
windower.play_sound(windower.addon_path..'wav/Chime.wav')
end
end
This should fix your problem.
By cocl 2016-03-14 15:21:18
Thank you for the reply. I have tried to include that portion of code and it still does not work. No text is even coming up or anything.
Bahamut.Ayasha
Server: Bahamut
Game: FFXI
Posts: 89
By Bahamut.Ayasha 2016-03-15 00:03:57
Ah OK, I figured out the issue that I missed before. You have 3 different job_precast functions defined. I'm not a magician with LUA, but I'm fairly sure that it will just redefine the function every time it reads it in a linear fashion (final function read, final definition of the function).
I modified your .lua to include the code in the proper spot, and commented out the extraneous third function that essentially says "if state.Buff['yadda'] is true, then state.Buff['yadda'] is true". As far as I know, it should not be necessary.
Code
-------------------------------------------------------------------------------------------------------------------
-- Initialization function that defines sets and variables to be used.
-------------------------------------------------------------------------------------------------------------------
-- IMPORTANT: Make sure to also get the Mote-Include.lua file (and its supplementary files) to go with this.
-- Initialization function for this job file.
function get_sets()
mote_include_version = 2
-- Load and initialize the include file.
include('Mote-Mappings.lua')
include('Mote-Include.lua')
include('organizer-lib')
end
-- Setup vars that are user-independent.
function job_setup()
state.Buff['Afflatus Solace'] = buffactive['Afflatus Solace'] or false
state.Buff['Afflatus Misery'] = buffactive['Afflatus Misery'] or false
end
-- Setup vars that are user-dependent. Can override this function in a sidecar file.
function user_setup()
-- Options: Override default values
options.OffenseModes = {'None', 'Normal'}
options.DefenseModes = {'Normal'}
options.WeaponskillModes = {'Normal'}
options.CastingModes = {'Normal', 'Resistant', 'Dire'}
options.IdleModes = {'Normal', 'PDT'}
options.RestingModes = {'Normal'}
options.PhysicalDefenseModes = {'PDT'}
options.MagicalDefenseModes = {'MDT'}
state.OffenseMode = 'None'
select_default_macro_book()
Cures = S{'Cure','Cure II','Cure III','Cure IV','Cure V','Cure VI'}
end
-- Define sets and vars used by this job file.
function init_gear_sets()
--------------------------------------
-- Start defining the sets
--------------------------------------
-- Precast Sets
-- Fast cast sets for spells
sets.precast.FC = {
main="Marin Staff +1",
sub="Benthos Grip",
ammo="Impatiens",
head="Nahtirah Hat",
body="Anhur Robe",
hands={ name="Gende. Gages +1", augments={'Phys. dmg. taken -1%','"Cure" spellcasting time -1%',}},
legs={ name="Artsieq Hose", augments={'MP+30','Mag. Acc.+20','MND+7',}},
feet="Regal Pumps +1",
neck="Orison Locket",
waist="Witful Belt",
left_ear="Enchntr. Earring +1",
right_ear="Loquac. Earring",
left_ring="Prolix Ring",
right_ring="Weather. Ring",
back="Swith Cape +1",
}
sets.precast.FC['Enhancing Magic'] = set_combine(sets.precast.FC, {waist="Siegel Sash"})
sets.precast.FC.Stoneskin = set_combine(sets.precast.FC['Enhancing Magic'], {head="Umuthi Hat"})
sets.precast.FC['Healing Magic'] = set_combine(sets.precast.FC, {legs="Ebers Pantaloons +1"})
sets.precast.FC.StatusRemoval = sets.precast.FC['Healing Magic']
sets.precast.FC.Cure = set_combine(sets.precast.FC['Healing Magic'], {
main="Ababinili +1",
sub="Benthos Grip",
ammo="Impatiens",
head="Nahtirah Hat",
body="Heka's Kalasiris",
hands={ name="Gende. Gages +1", augments={'Phys. dmg. taken -1%','"Cure" spellcasting time -1%',}},
legs="Ebers Pant. +1",
feet={ name="Vanya Clogs", augments={'System: 2 ID: 124 Val: 4','System: 2 ID: 123 Val: 14','System: 2 ID: 177 Val: 5',}},
neck="Orison Locket",
waist="Witful Belt",
left_ear="Nourish. Earring +1",
right_ear="Nourish. Earring",
left_ring="Prolix Ring",
right_ring="Weather. Ring",
back="Ogapepo Cape",
})
sets.precast.FC.Curaga = sets.precast.FC.Cure
-- Precast sets to enhance JAs
sets.precast.JA.Benediction = {body="Piety Briault"}
-- Waltz set (chr and vit)
sets.precast.Waltz = {
head="Nahtirah Hat",ear1="Roundel Earring",
body="Vanir Cotehardie",hands="Yaoyotl Gloves",
back="Refraction Cape",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
-- Weaponskill sets
-- Default set for any weaponskill that isn't any more specifically defined
gear.default.weaponskill_neck = "Asperity Necklace"
gear.default.weaponskill_waist = ""
sets.precast.WS = {
head="Nahtirah Hat",neck=gear.ElementalGorget,ear1="Bladeborn Earring",ear2="Steelflash Earring",
body="Vanir Cotehardie",hands="Yaoyotl Gloves",ring1="Rajas Ring",ring2="K'ayres Ring",
back="Refraction Cape",waist=gear.ElementalBelt,legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
sets.precast.WS['Flash Nova'] = {
head="Nahtirah Hat",neck="Stoicheion Medal",ear1="Friomisi Earring",ear2="Hecate's Earring",
body="Vanir Cotehardie",hands="Yaoyotl Gloves",ring1="Rajas Ring",ring2="Strendu Ring",}
-- Midcast Sets
sets.midcast.FastRecast = {
main="Marin Staff +1",
sub="Benthos Grip",
ammo="Impatiens",
head="Nahtirah Hat",
body="Anhur Robe",
hands={ name="Gende. Gages +1", augments={'Phys. dmg. taken -1%','"Cure" spellcasting time -1%',}},
legs={ name="Artsieq Hose", augments={'MP+30','Mag. Acc.+20','MND+7',}},
feet="Regal Pumps +1",
neck="Orison Locket",
waist="Witful Belt",
left_ear="Enchntr. Earring +1",
right_ear="Loquac. Earring",
left_ring="Prolix Ring",
right_ring="Weather. Ring",
back="Swith Cape +1",
}
-- Cure sets
gear.default.obi_waist = "Goading Belt"
gear.default.obi_back = "Twilight Cape"
sets.midcast.CureSolace = {
main={ name="Queller Rod", augments={'Healing magic skill +15','System: 2 ID: 124 Val: 9','System: 2 ID: 123 Val: 6',}},
sub="Sors Shield",
ammo="Oreiad's Tathlum",
head={ name="Gende. Caubeen +1", augments={'Phys. dmg. taken -1%','"Cure" potency +6%',}},
body="Ebers Bliaud +1",
hands="Theo. Mitts +1",
legs="Ebers Pant. +1",
feet={ name="Vanya Clogs", augments={'System: 2 ID: 124 Val: 4','System: 2 ID: 123 Val: 14','System: 2 ID: 177 Val: 5',}},
neck="Colossus's Torque",
waist="Bishop's Sash",
left_ear="Nourish. Earring +1",
right_ear="Beatific Earring",
left_ring="Sirona's Ring",
right_ring="Haoma's Ring",
back="Tempered cape +1",
}
sets.midcast.Cure = {
main={ name="Queller Rod", augments={'Healing magic skill +15','System: 2 ID: 124 Val: 9','System: 2 ID: 123 Val: 6',}},
sub="Sors Shield",
ammo="Oreiad's Tathlum",
head={ name="Gende. Caubeen +1", augments={'Phys. dmg. taken -1%','"Cure" potency +6%',}},
body="Ebers Bliaud +1",
hands="Theo. Mitts +1",
legs="Ebers Pant. +1",
feet={ name="Vanya Clogs", augments={'System: 2 ID: 124 Val: 4','System: 2 ID: 123 Val: 14','System: 2 ID: 177 Val: 5',}},
neck="Colossus's Torque",
waist="Bishop's Sash",
left_ear="Nourish. Earring +1",
right_ear="Beatific Earring",
left_ring="Sirona's Ring",
right_ring="Haoma's Ring",
back="Tempered cape +1",
}
sets.midcast.Curaga = {
main={ name="Queller Rod", augments={'Healing magic skill +15','System: 2 ID: 124 Val: 9','System: 2 ID: 123 Val: 6',}},
sub="Sors Shield",
ammo="Oreiad's Tathlum",
head={ name="Gende. Caubeen +1", augments={'Phys. dmg. taken -1%','"Cure" potency +6%',}},
body="Ebers bliaud +1",
hands="Theo. Mitts +1",
legs="Ebers Pant. +1",
feet={ name="Vanya Clogs", augments={'System: 2 ID: 124 Val: 4','System: 2 ID: 123 Val: 14','System: 2 ID: 177 Val: 5',}},
neck="Colossus's Torque",
waist="Bishop's Sash",
left_ear="Nourish. Earring +1",
right_ear="Beatific Earring",
left_ring="Sirona's Ring",
right_ring="Haoma's Ring",
back="Tempered cape +1",
}
sets.midcast.CureMelee = {main="Tamaxchi",sub="sors Shield",ammo="kalboron stone",
head="Gendewitha Caubeen",neck="nuna gorget +1",ear1="novia Earring",ear2="beatific Earring",
body="Orison Bliaud +2",hands="yaoyotl gloves",ring1="sirona's Ring",ring2="haoma's Ring",
back="pahtli Cape",waist=gear.ElementalObi,legs="Orison Pantaloons +2",feet="Piety Duckbills +1"}
sets.midcast.Cursna = {main="yagrush",sub="Genbu's Shield",
head="Orison Cap +2",neck="Malison Medallion",
body="ebers briault +1",hands="Hieros Mittens",ring1="haoma's Ring",ring2="haoma's Ring",
back="Mending Cape",waist="Goading Belt",legs="Ebers pantaloons +1",feet="Gendewitha Galoshes +1"}
sets.midcast.StatusRemoval = {main="yagrush",sub="sors shield",ammo="impatiens",
head="haruspex hat +1",neck="orison locket",ear1="henchanter Earring +1",ear2="loquacious Earring",
body="vanir cotehardie",hands="theopany mitts +1",ring1="prolix Ring",ring2="weatherspoon Ring",
back="swith cape +1",waist="ninurta's sash",legs="ebers pantaloons +1",feet="regal pumps +1"}
-- 110 total Enhancing Magic Skill; caps even without Light Arts
sets.midcast['Enhancing Magic'] = {
main="Beneficus",
sub={ name="Genbu's Shield", augments={'"Cure" potency +3%','"Cure" spellcasting time -8%','Wind resistance+9',}},
ammo="Vanir Battery",
head="Umuthi Hat",
body="Anhur Robe",
hands="Dynasty Mitts",
legs={ name="Piety Pantaln. +1", augments={'Enhances "Shellra V" effect',}},
feet="Orsn. Duckbills +2",
neck="Colossus's Torque",
waist="Olympus Sash",
left_ear="Andoaa Earring",
right_ear={ name="Moonshade Earring", augments={'MP+25','Latent effect: "Refresh"+1',}},
left_ring="Prolix Ring",
right_ring="Weather. Ring",
back="Merciful Cape",
}
sets.midcast.Stoneskin = {
head="Nahtirah Hat",neck="Orison Locket",ear2="Loquacious Earring",
body="Vanir Cotehardie",hands="Dynasty Mitts",
back="Swith Cape +1",waist="Siegel Sash",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
sets.midcast.Auspice = {hands="Dynasty Mitts",feet="Orison Duckbills +2"}
sets.midcast.BarElement = {
main="Beneficus",
sub={ name="Genbu's Shield", augments={'"Cure" potency +3%','"Cure" spellcasting time -8%','Wind resistance+9',}},
ammo="Vanir Battery",
head="Orison Cap +2",
body="ebers bliaud +1",
hands="Orison Mitts +2",
legs={ name="Piety Pantaln. +1", augments={'Enhances "Shellra V" effect',}},
feet="Orsn. Duckbills +2",
neck="Colossus's Torque",
waist="Olympus Sash",
left_ear="Andoaa Earring",
right_ear={ name="Moonshade Earring", augments={'MP+25','Latent effect: "Refresh"+1',}},
left_ring="Prolix Ring",
right_ring="Weather. Ring",
back="Merciful Cape",
}
sets.midcast.Regen = {main="Bolelabunga",sub="Genbu's Shield",
body="Piety Briault +1",hands="Orison Mitts +2",
legs="Theophany Pantaloons"}
sets.midcast.Protectra = {ring1="Sheltered Ring",feet="Piety Duckbills +1"}
sets.midcast.Shellra = {ring1="Sheltered Ring",legs="Piety Pantaloons +1"}
sets.midcast['Divine Magic'] = {
main="Marin Staff +1",
sub="Elder's Grip +1",
ammo="Ghastly Tathlum",
head={ name="Helios Band", augments={'Mag. Acc.+20 "Mag.Atk.Bns."+20','"Occult Acumen"+10','INT+10',}},
body={ name="Witching Robe", augments={'MP+45','Mag. Acc.+14','"Mag.Atk.Bns."+14',}},
hands={ name="Helios Gloves", augments={'Mag. Acc.+18 "Mag.Atk.Bns."+18','"Occult Acumen"+3','INT+9',}},
legs={ name="Lengo Pants", augments={'INT+8','Mag. Acc.+14','"Mag.Atk.Bns."+13',}},
feet={ name="Helios Boots", augments={'"Mag.Atk.Bns."+25','"Fast Cast"+5','INT+4 MND+4',}},
neck="Eddy Necklace",
waist="Othila Sash",
left_ear="Friomisi Earring",
right_ear="Hecate's Earring",
left_ring="Fenrir Ring +1",
right_ring="Fenrir Ring +1",
back="Toro Cape",
}
sets.midcast['Dark Magic'] = {main="ngqoqwanb", sub="mephitis grip",
head="Nahtirah Hat",neck="Aesir Torque",ear1="Psystorm Earring",ear2="Lifestorm Earring",
body="Vanir Cotehardie",hands="Yaoyotl Gloves",ring1="Strendu Ring",ring2="Sangoma Ring",
back="Refraction Cape",waist="Demonry Sash",legs="Bokwus Slops",feet="Piety Duckbills +1"}
-- Custom spell classes
sets.midcast.MndEnfeebles = {
main={ name="Twebuliij", augments={'MP+60','Mag. Acc.+15','MND+12',}},
sub="Benthos Grip",
ammo="Oreiad's Tathlum",
head={ name="Artsieq Hat", augments={'MP+30','Mag. Acc.+20','MND+7',}},
body="Vanir Cotehardie",
hands="Lurid Mitts",
legs={ name="Artsieq Hose", augments={'MP+30','Mag. Acc.+20','MND+7',}},
feet={ name="Piety Duckbills +1", augments={'Enhances "Protectra V" effect',}},
neck="Nuna Gorget +1",
waist="Cascade Belt",
left_ear="Lifestorm Earring",
right_ear="Psystorm Earring",
left_ring="Levia. Ring +1",
right_ring="Levia. Ring +1",
back="Merciful Cape",
}
sets.midcast.IntEnfeebles = {
main={ name="Twebuliij", augments={'MP+60','Mag. Acc.+15','MND+12',}},
sub="Benthos Grip",
ammo="Oreiad's Tathlum",
head={ name="Artsieq Hat", augments={'MP+30','Mag. Acc.+20','MND+7',}},
body="Vanir Cotehardie",
hands="Lurid Mitts",
legs={ name="Artsieq Hose", augments={'MP+30','Mag. Acc.+20','MND+7',}},
feet={ name="Piety Duckbills +1", augments={'Enhances "Protectra V" effect',}},
neck="Imbodla Necklace",
waist="Ovate Rope",
left_ear="Lifestorm Earring",
right_ear="Psystorm Earring",
left_ring="Levia. Ring +1",
right_ring="Levia. Ring +1",
back="Merciful Cape",
}
-- Sets to return to when not performing an action.
-- Resting sets
sets.resting = {main=gear.Staff.HMP,
body="Gendewitha Bliaut",hands="Serpentes Cuffs",
waist="Austerity Belt",legs="Nares Trews",feet="Chelona Boots +1"}
-- Idle sets (default idle set not needed since the other three are defined, but leaving for testing purposes)
sets.idle = {
main="Bolelabunga",
sub={ name="Genbu's Shield", augments={'"Cure" potency +3%','"Cure" spellcasting time -8%','Wind resistance+9',}},
ammo="Vanir Battery",
body="Respite Cloak",
hands="Serpentes Cuffs",
legs="Assid. Pants +1",
feet="Serpentes Sabots",
neck="Twilight Torque",
waist="Slipor Sash",
left_ear="Ethereal Earring",
right_ear="moonshade Earring",
left_ring="Paguroidea Ring",
right_ring="Sheltered Ring",
back="Shadow Mantle",}
sets.idle.PDT = {main="owleyes", sub="Genbu's Shield",ammo="sihirik",
head="wivre hairpin",neck="twilight torque",ear1="ethereal Earring",ear2="Loquacious Earring",
body="gendewitha bliaut",hands="Serpentes Cuffs",ring1="dark Ring",ring2="dark Ring",
back="shadow mantle",waist="slipor sash",legs="Nares Trews",feet="serpentes sabots"}
sets.idle.Town = {
main="Bolelabunga",
sub={ name="Genbu's Shield", augments={'"Cure" potency +3%','"Cure" spellcasting time -8%','Wind resistance+9',}},
ammo="Vanir Battery",
body="Respite Cloak",
hands="Serpentes Cuffs",
legs="Assid. Pants +1",
feet="Serpentes Sabots",
neck="Twilight Torque",
waist="Slipor Sash",
left_ear="Ethereal Earring",
right_ear="moonshade Earring",
left_ring="Paguroidea Ring",
right_ring="Sheltered Ring",
back="Shadow Mantle",
}
sets.idle.Weak = {
main="Bolelabunga",
sub={ name="Genbu's Shield", augments={'"Cure" potency +3%','"Cure" spellcasting time -8%','Wind resistance+9',}},
ammo="Vanir Battery",
body="Respite Cloak",
hands="Serpentes Cuffs",
legs="Assid. Pants +1",
feet="Serpentes Sabots",
neck="Twilight Torque",
waist="Slipor Sash",
left_ear="Ethereal Earring",
right_ear="moonshade Earring",
left_ring="Paguroidea Ring",
right_ring="Sheltered Ring",
back="Shadow Mantle",
}
-- Defense sets
sets.defense.PDT = {main=gear.Staff.PDT,sub="Achaq Grip",
head="Gendewitha Caubeen",neck="Twilight Torque",
body="Gendewitha Bliaut",hands="Gendewitha Gages",ring1="Defending Ring",ring2=gear.DarkRing.physical,
back="Umbra Cape",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
sets.defense.MDT = {main=gear.Staff.PDT,sub="Achaq Grip",
head="Nahtirah Hat",neck="Twilight Torque",
body="Vanir Cotehardie",hands="Yaoyotl Gloves",ring1="Defending Ring",ring2="Shadow Ring",
back="Tuilha Cape",legs="Bokwus Slops",feet="Gendewitha Galoshes"}
sets.Kiting = {feet="Herald's Gaiters"}
sets.latent_refresh = {waist="Fucho-no-obi"}
-- Engaged sets
-- Variations for TP weapon and (optional) offense/defense modes. Code will fall back on previous
-- sets if more refined versions aren't defined.
-- If you create a set with both offense and defense modes, the offense mode should be first.
-- EG: sets.engaged.Dagger.Accuracy.Evasion
-- Basic set for if no TP weapon is defined.
sets.engaged = {
head="Nahtirah Hat",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
body="Vanir Cotehardie",hands="Dynasty Mitts",ring1="Rajas Ring",ring2="K'ayres Ring",
back="Umbra Cape",waist="Goading Belt",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
-- Buff sets: Gear that needs to be worn to actively enhance a current player buff.
sets.buff['Divine Caress'] = {hands="Orison Mitts +2",back="Mending Cape"}
end
-------------------------------------------------------------------------------------------------------------------
-- Job-specific hooks that are called to process player actions at specific points in time.
-------------------------------------------------------------------------------------------------------------------
-- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
-- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
function job_precast(spell, action, spellMap, eventArgs)
local map = spell_maps[spell.en]
if map == 'Cure' and player.sub_job == "SCH" and not buffactive.Aurorastorm then
add_to_chat(123,'Aurorastorm not active.')
windower.play_sound(windower.addon_path..'wav/Chime.wav')
end
if map == 'Curaga' and player.sub_job == "SCH" and not buffactive.Aurorastorm then
add_to_chat(123,'Aurorastorm not active.')
windower.play_sound(windower.addon_path..'wav/Chime.wav')
end
if spell.english == "Paralyna" and buffactive.Paralyzed then
eventArgs.handled = true
end
if spell.skill == 'Healing Magic' then
gear.default.obi_back = "Mending Cape"
else
gear.default.obi_back = "Toro Cape"
end
end
--[[function job_precast(spell, action, spellMap, eventArgs)
if state.Buff[spell.english] ~= nil then
state.Buff[spell.english] = true
end
end]]
function job_post_midcast(spell, action, spellMap, eventArgs)
-- Apply Divine Caress boosting items as highest priority over other gear, if applicable.
if spellMap == 'StatusRemoval' and buffactive['Divine Caress'] then
equip(sets.buff['Divine Caress'])
end
end
-- Return true if we handled the aftercast work. Otherwise it will fall back
-- to the general aftercast() code in Mote-Include.
function job_aftercast(spell, action, spellMap, eventArgs)
if state.Buff[spell.english] ~= nil then
state.Buff[spell.english] = not spell.interrupted or buffactive[spell.english]
end
end
-------------------------------------------------------------------------------------------------------------------
-- Customization hooks for idle and melee sets, after they've been automatically constructed.
-------------------------------------------------------------------------------------------------------------------
-- Custom spell mapping.
function job_get_spell_map(spell, default_spell_map)
if spell.action_type == 'Magic' then
if (default_spell_map == 'Cure' or default_spell_map == 'Curaga') and player.status == 'Engaged' then
return "CureMelee"
elseif default_spell_map == 'Cure' and state.Buff['Afflatus Solace'] then
return "CureSolace"
elseif spell.skill == "Enfeebling Magic" then
if spell.type == "WhiteMagic" then
return "MndEnfeebles"
else
return "IntEnfeebles"
end
end
end
end
function customize_idle_set(idleSet)
if player.mpp < 51 then
idleSet = set_combine(idleSet, sets.latent_refresh)
end
return idleSet
end
-------------------------------------------------------------------------------------------------------------------
-- General hooks for other events.
-------------------------------------------------------------------------------------------------------------------
-- Called when a player gains or loses a buff.
-- buff == buff gained or lost
-- gain == true if the buff was gained, false if it was lost.
function job_buff_change(buff, gain)
if state.Buff[buff] ~= nil then
state.Buff[buff] = gain
end
end
-------------------------------------------------------------------------------------------------------------------
-- User code that supplements self-commands.
-------------------------------------------------------------------------------------------------------------------
-- Called by the 'update' self-command.
function job_update(cmdParams, eventArgs)
if cmdParams[1] == 'user' and not areas.Cities:contains(world.area) then
local needsArts =
player.sub_job:lower() == 'sch' and
not buffactive['Light Arts'] and
not buffactive['Addendum: White'] and
not buffactive['Dark Arts'] and
not buffactive['Addendum: Black']
if not buffactive['Afflatus Solace'] and not buffactive['Afflatus Misery'] then
if needsArts then
send_command('@input /ja "Afflatus Solace" <me>;wait 1.2;input /ja "Light Arts" <me>')
else
send_command('@input /ja "Afflatus Solace" <me>')
end
end
end
end
-- Handle notifications of general user state change.
function job_state_change(stateField, newValue, oldValue)
if stateField == 'OffenseMode' then
if newValue == 'Normal' then
disable('main','sub')
else
enable('main','sub')
end
elseif stateField == 'Reset' then
if state.OffenseMode == 'None' then
enable('main','sub')
end
end
end
-- Function to display the current relevant user state when doing an update.
-- Return true if display was handled, and you don't want the default info shown.
function display_current_job_state(eventArgs)
local defenseString = ''
if state.Defense.Active then
local defMode = state.Defense.PhysicalMode
if state.Defense.Type == 'Magical' then
defMode = state.Defense.MagicalMode
end
defenseString = 'Defense: '..state.Defense.Type..' '..defMode..', '
end
local meleeString = ''
if state.OffenseMode == 'Normal' then
meleeString = 'Melee: Weapons locked, '
end
add_to_chat(122,'Casting ['..state.CastingMode..'], '..meleeString..'Idle ['..state.IdleMode..'], '..defenseString..
'Kiting: '..on_off_names[state.Kiting])
eventArgs.handled = true
end
-------------------------------------------------------------------------------------------------------------------
-- Utility functions specific to this job.
-------------------------------------------------------------------------------------------------------------------
-- Select default macro book on initial load or subjob change.
function select_default_macro_book()
-- Default macro set/book
set_macro_page(4, 14)
end
PM me if there's any issues with this. I've tested it on my side, so hopefully it should work for you.
By cocl 2016-03-15 00:44:09
Ah OK, I figured out the issue that I missed before. You have 3 different job_precast functions defined. I'm not a magician with LUA, but I'm fairly sure that it will just redefine the function every time it reads it in a linear fashion (final function read, final definition of the function).
I modified your .lua to include the code in the proper spot, and commented out the extraneous third function that essentially says "if state.Buff['yadda'] is true, then state.Buff['yadda'] is true". As far as I know, it should not be necessary.
Code
-------------------------------------------------------------------------------------------------------------------
-- Initialization function that defines sets and variables to be used.
-------------------------------------------------------------------------------------------------------------------
-- IMPORTANT: Make sure to also get the Mote-Include.lua file (and its supplementary files) to go with this.
-- Initialization function for this job file.
function get_sets()
mote_include_version = 2
-- Load and initialize the include file.
include('Mote-Mappings.lua')
include('Mote-Include.lua')
include('organizer-lib')
end
-- Setup vars that are user-independent.
function job_setup()
state.Buff['Afflatus Solace'] = buffactive['Afflatus Solace'] or false
state.Buff['Afflatus Misery'] = buffactive['Afflatus Misery'] or false
end
-- Setup vars that are user-dependent. Can override this function in a sidecar file.
function user_setup()
-- Options: Override default values
options.OffenseModes = {'None', 'Normal'}
options.DefenseModes = {'Normal'}
options.WeaponskillModes = {'Normal'}
options.CastingModes = {'Normal', 'Resistant', 'Dire'}
options.IdleModes = {'Normal', 'PDT'}
options.RestingModes = {'Normal'}
options.PhysicalDefenseModes = {'PDT'}
options.MagicalDefenseModes = {'MDT'}
state.OffenseMode = 'None'
select_default_macro_book()
Cures = S{'Cure','Cure II','Cure III','Cure IV','Cure V','Cure VI'}
end
-- Define sets and vars used by this job file.
function init_gear_sets()
--------------------------------------
-- Start defining the sets
--------------------------------------
-- Precast Sets
-- Fast cast sets for spells
sets.precast.FC = {
main="Marin Staff +1",
sub="Benthos Grip",
ammo="Impatiens",
head="Nahtirah Hat",
body="Anhur Robe",
hands={ name="Gende. Gages +1", augments={'Phys. dmg. taken -1%','"Cure" spellcasting time -1%',}},
legs={ name="Artsieq Hose", augments={'MP+30','Mag. Acc.+20','MND+7',}},
feet="Regal Pumps +1",
neck="Orison Locket",
waist="Witful Belt",
left_ear="Enchntr. Earring +1",
right_ear="Loquac. Earring",
left_ring="Prolix Ring",
right_ring="Weather. Ring",
back="Swith Cape +1",
}
sets.precast.FC['Enhancing Magic'] = set_combine(sets.precast.FC, {waist="Siegel Sash"})
sets.precast.FC.Stoneskin = set_combine(sets.precast.FC['Enhancing Magic'], {head="Umuthi Hat"})
sets.precast.FC['Healing Magic'] = set_combine(sets.precast.FC, {legs="Ebers Pantaloons +1"})
sets.precast.FC.StatusRemoval = sets.precast.FC['Healing Magic']
sets.precast.FC.Cure = set_combine(sets.precast.FC['Healing Magic'], {
main="Ababinili +1",
sub="Benthos Grip",
ammo="Impatiens",
head="Nahtirah Hat",
body="Heka's Kalasiris",
hands={ name="Gende. Gages +1", augments={'Phys. dmg. taken -1%','"Cure" spellcasting time -1%',}},
legs="Ebers Pant. +1",
feet={ name="Vanya Clogs", augments={'System: 2 ID: 124 Val: 4','System: 2 ID: 123 Val: 14','System: 2 ID: 177 Val: 5',}},
neck="Orison Locket",
waist="Witful Belt",
left_ear="Nourish. Earring +1",
right_ear="Nourish. Earring",
left_ring="Prolix Ring",
right_ring="Weather. Ring",
back="Ogapepo Cape",
})
sets.precast.FC.Curaga = sets.precast.FC.Cure
-- Precast sets to enhance JAs
sets.precast.JA.Benediction = {body="Piety Briault"}
-- Waltz set (chr and vit)
sets.precast.Waltz = {
head="Nahtirah Hat",ear1="Roundel Earring",
body="Vanir Cotehardie",hands="Yaoyotl Gloves",
back="Refraction Cape",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
-- Weaponskill sets
-- Default set for any weaponskill that isn't any more specifically defined
gear.default.weaponskill_neck = "Asperity Necklace"
gear.default.weaponskill_waist = ""
sets.precast.WS = {
head="Nahtirah Hat",neck=gear.ElementalGorget,ear1="Bladeborn Earring",ear2="Steelflash Earring",
body="Vanir Cotehardie",hands="Yaoyotl Gloves",ring1="Rajas Ring",ring2="K'ayres Ring",
back="Refraction Cape",waist=gear.ElementalBelt,legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
sets.precast.WS['Flash Nova'] = {
head="Nahtirah Hat",neck="Stoicheion Medal",ear1="Friomisi Earring",ear2="Hecate's Earring",
body="Vanir Cotehardie",hands="Yaoyotl Gloves",ring1="Rajas Ring",ring2="Strendu Ring",}
-- Midcast Sets
sets.midcast.FastRecast = {
main="Marin Staff +1",
sub="Benthos Grip",
ammo="Impatiens",
head="Nahtirah Hat",
body="Anhur Robe",
hands={ name="Gende. Gages +1", augments={'Phys. dmg. taken -1%','"Cure" spellcasting time -1%',}},
legs={ name="Artsieq Hose", augments={'MP+30','Mag. Acc.+20','MND+7',}},
feet="Regal Pumps +1",
neck="Orison Locket",
waist="Witful Belt",
left_ear="Enchntr. Earring +1",
right_ear="Loquac. Earring",
left_ring="Prolix Ring",
right_ring="Weather. Ring",
back="Swith Cape +1",
}
-- Cure sets
gear.default.obi_waist = "Goading Belt"
gear.default.obi_back = "Twilight Cape"
sets.midcast.CureSolace = {
main={ name="Queller Rod", augments={'Healing magic skill +15','System: 2 ID: 124 Val: 9','System: 2 ID: 123 Val: 6',}},
sub="Sors Shield",
ammo="Oreiad's Tathlum",
head={ name="Gende. Caubeen +1", augments={'Phys. dmg. taken -1%','"Cure" potency +6%',}},
body="Ebers Bliaud +1",
hands="Theo. Mitts +1",
legs="Ebers Pant. +1",
feet={ name="Vanya Clogs", augments={'System: 2 ID: 124 Val: 4','System: 2 ID: 123 Val: 14','System: 2 ID: 177 Val: 5',}},
neck="Colossus's Torque",
waist="Bishop's Sash",
left_ear="Nourish. Earring +1",
right_ear="Beatific Earring",
left_ring="Sirona's Ring",
right_ring="Haoma's Ring",
back="Tempered cape +1",
}
sets.midcast.Cure = {
main={ name="Queller Rod", augments={'Healing magic skill +15','System: 2 ID: 124 Val: 9','System: 2 ID: 123 Val: 6',}},
sub="Sors Shield",
ammo="Oreiad's Tathlum",
head={ name="Gende. Caubeen +1", augments={'Phys. dmg. taken -1%','"Cure" potency +6%',}},
body="Ebers Bliaud +1",
hands="Theo. Mitts +1",
legs="Ebers Pant. +1",
feet={ name="Vanya Clogs", augments={'System: 2 ID: 124 Val: 4','System: 2 ID: 123 Val: 14','System: 2 ID: 177 Val: 5',}},
neck="Colossus's Torque",
waist="Bishop's Sash",
left_ear="Nourish. Earring +1",
right_ear="Beatific Earring",
left_ring="Sirona's Ring",
right_ring="Haoma's Ring",
back="Tempered cape +1",
}
sets.midcast.Curaga = {
main={ name="Queller Rod", augments={'Healing magic skill +15','System: 2 ID: 124 Val: 9','System: 2 ID: 123 Val: 6',}},
sub="Sors Shield",
ammo="Oreiad's Tathlum",
head={ name="Gende. Caubeen +1", augments={'Phys. dmg. taken -1%','"Cure" potency +6%',}},
body="Ebers bliaud +1",
hands="Theo. Mitts +1",
legs="Ebers Pant. +1",
feet={ name="Vanya Clogs", augments={'System: 2 ID: 124 Val: 4','System: 2 ID: 123 Val: 14','System: 2 ID: 177 Val: 5',}},
neck="Colossus's Torque",
waist="Bishop's Sash",
left_ear="Nourish. Earring +1",
right_ear="Beatific Earring",
left_ring="Sirona's Ring",
right_ring="Haoma's Ring",
back="Tempered cape +1",
}
sets.midcast.CureMelee = {main="Tamaxchi",sub="sors Shield",ammo="kalboron stone",
head="Gendewitha Caubeen",neck="nuna gorget +1",ear1="novia Earring",ear2="beatific Earring",
body="Orison Bliaud +2",hands="yaoyotl gloves",ring1="sirona's Ring",ring2="haoma's Ring",
back="pahtli Cape",waist=gear.ElementalObi,legs="Orison Pantaloons +2",feet="Piety Duckbills +1"}
sets.midcast.Cursna = {main="yagrush",sub="Genbu's Shield",
head="Orison Cap +2",neck="Malison Medallion",
body="ebers briault +1",hands="Hieros Mittens",ring1="haoma's Ring",ring2="haoma's Ring",
back="Mending Cape",waist="Goading Belt",legs="Ebers pantaloons +1",feet="Gendewitha Galoshes +1"}
sets.midcast.StatusRemoval = {main="yagrush",sub="sors shield",ammo="impatiens",
head="haruspex hat +1",neck="orison locket",ear1="henchanter Earring +1",ear2="loquacious Earring",
body="vanir cotehardie",hands="theopany mitts +1",ring1="prolix Ring",ring2="weatherspoon Ring",
back="swith cape +1",waist="ninurta's sash",legs="ebers pantaloons +1",feet="regal pumps +1"}
-- 110 total Enhancing Magic Skill; caps even without Light Arts
sets.midcast['Enhancing Magic'] = {
main="Beneficus",
sub={ name="Genbu's Shield", augments={'"Cure" potency +3%','"Cure" spellcasting time -8%','Wind resistance+9',}},
ammo="Vanir Battery",
head="Umuthi Hat",
body="Anhur Robe",
hands="Dynasty Mitts",
legs={ name="Piety Pantaln. +1", augments={'Enhances "Shellra V" effect',}},
feet="Orsn. Duckbills +2",
neck="Colossus's Torque",
waist="Olympus Sash",
left_ear="Andoaa Earring",
right_ear={ name="Moonshade Earring", augments={'MP+25','Latent effect: "Refresh"+1',}},
left_ring="Prolix Ring",
right_ring="Weather. Ring",
back="Merciful Cape",
}
sets.midcast.Stoneskin = {
head="Nahtirah Hat",neck="Orison Locket",ear2="Loquacious Earring",
body="Vanir Cotehardie",hands="Dynasty Mitts",
back="Swith Cape +1",waist="Siegel Sash",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
sets.midcast.Auspice = {hands="Dynasty Mitts",feet="Orison Duckbills +2"}
sets.midcast.BarElement = {
main="Beneficus",
sub={ name="Genbu's Shield", augments={'"Cure" potency +3%','"Cure" spellcasting time -8%','Wind resistance+9',}},
ammo="Vanir Battery",
head="Orison Cap +2",
body="ebers bliaud +1",
hands="Orison Mitts +2",
legs={ name="Piety Pantaln. +1", augments={'Enhances "Shellra V" effect',}},
feet="Orsn. Duckbills +2",
neck="Colossus's Torque",
waist="Olympus Sash",
left_ear="Andoaa Earring",
right_ear={ name="Moonshade Earring", augments={'MP+25','Latent effect: "Refresh"+1',}},
left_ring="Prolix Ring",
right_ring="Weather. Ring",
back="Merciful Cape",
}
sets.midcast.Regen = {main="Bolelabunga",sub="Genbu's Shield",
body="Piety Briault +1",hands="Orison Mitts +2",
legs="Theophany Pantaloons"}
sets.midcast.Protectra = {ring1="Sheltered Ring",feet="Piety Duckbills +1"}
sets.midcast.Shellra = {ring1="Sheltered Ring",legs="Piety Pantaloons +1"}
sets.midcast['Divine Magic'] = {
main="Marin Staff +1",
sub="Elder's Grip +1",
ammo="Ghastly Tathlum",
head={ name="Helios Band", augments={'Mag. Acc.+20 "Mag.Atk.Bns."+20','"Occult Acumen"+10','INT+10',}},
body={ name="Witching Robe", augments={'MP+45','Mag. Acc.+14','"Mag.Atk.Bns."+14',}},
hands={ name="Helios Gloves", augments={'Mag. Acc.+18 "Mag.Atk.Bns."+18','"Occult Acumen"+3','INT+9',}},
legs={ name="Lengo Pants", augments={'INT+8','Mag. Acc.+14','"Mag.Atk.Bns."+13',}},
feet={ name="Helios Boots", augments={'"Mag.Atk.Bns."+25','"Fast Cast"+5','INT+4 MND+4',}},
neck="Eddy Necklace",
waist="Othila Sash",
left_ear="Friomisi Earring",
right_ear="Hecate's Earring",
left_ring="Fenrir Ring +1",
right_ring="Fenrir Ring +1",
back="Toro Cape",
}
sets.midcast['Dark Magic'] = {main="ngqoqwanb", sub="mephitis grip",
head="Nahtirah Hat",neck="Aesir Torque",ear1="Psystorm Earring",ear2="Lifestorm Earring",
body="Vanir Cotehardie",hands="Yaoyotl Gloves",ring1="Strendu Ring",ring2="Sangoma Ring",
back="Refraction Cape",waist="Demonry Sash",legs="Bokwus Slops",feet="Piety Duckbills +1"}
-- Custom spell classes
sets.midcast.MndEnfeebles = {
main={ name="Twebuliij", augments={'MP+60','Mag. Acc.+15','MND+12',}},
sub="Benthos Grip",
ammo="Oreiad's Tathlum",
head={ name="Artsieq Hat", augments={'MP+30','Mag. Acc.+20','MND+7',}},
body="Vanir Cotehardie",
hands="Lurid Mitts",
legs={ name="Artsieq Hose", augments={'MP+30','Mag. Acc.+20','MND+7',}},
feet={ name="Piety Duckbills +1", augments={'Enhances "Protectra V" effect',}},
neck="Nuna Gorget +1",
waist="Cascade Belt",
left_ear="Lifestorm Earring",
right_ear="Psystorm Earring",
left_ring="Levia. Ring +1",
right_ring="Levia. Ring +1",
back="Merciful Cape",
}
sets.midcast.IntEnfeebles = {
main={ name="Twebuliij", augments={'MP+60','Mag. Acc.+15','MND+12',}},
sub="Benthos Grip",
ammo="Oreiad's Tathlum",
head={ name="Artsieq Hat", augments={'MP+30','Mag. Acc.+20','MND+7',}},
body="Vanir Cotehardie",
hands="Lurid Mitts",
legs={ name="Artsieq Hose", augments={'MP+30','Mag. Acc.+20','MND+7',}},
feet={ name="Piety Duckbills +1", augments={'Enhances "Protectra V" effect',}},
neck="Imbodla Necklace",
waist="Ovate Rope",
left_ear="Lifestorm Earring",
right_ear="Psystorm Earring",
left_ring="Levia. Ring +1",
right_ring="Levia. Ring +1",
back="Merciful Cape",
}
-- Sets to return to when not performing an action.
-- Resting sets
sets.resting = {main=gear.Staff.HMP,
body="Gendewitha Bliaut",hands="Serpentes Cuffs",
waist="Austerity Belt",legs="Nares Trews",feet="Chelona Boots +1"}
-- Idle sets (default idle set not needed since the other three are defined, but leaving for testing purposes)
sets.idle = {
main="Bolelabunga",
sub={ name="Genbu's Shield", augments={'"Cure" potency +3%','"Cure" spellcasting time -8%','Wind resistance+9',}},
ammo="Vanir Battery",
body="Respite Cloak",
hands="Serpentes Cuffs",
legs="Assid. Pants +1",
feet="Serpentes Sabots",
neck="Twilight Torque",
waist="Slipor Sash",
left_ear="Ethereal Earring",
right_ear="moonshade Earring",
left_ring="Paguroidea Ring",
right_ring="Sheltered Ring",
back="Shadow Mantle",}
sets.idle.PDT = {main="owleyes", sub="Genbu's Shield",ammo="sihirik",
head="wivre hairpin",neck="twilight torque",ear1="ethereal Earring",ear2="Loquacious Earring",
body="gendewitha bliaut",hands="Serpentes Cuffs",ring1="dark Ring",ring2="dark Ring",
back="shadow mantle",waist="slipor sash",legs="Nares Trews",feet="serpentes sabots"}
sets.idle.Town = {
main="Bolelabunga",
sub={ name="Genbu's Shield", augments={'"Cure" potency +3%','"Cure" spellcasting time -8%','Wind resistance+9',}},
ammo="Vanir Battery",
body="Respite Cloak",
hands="Serpentes Cuffs",
legs="Assid. Pants +1",
feet="Serpentes Sabots",
neck="Twilight Torque",
waist="Slipor Sash",
left_ear="Ethereal Earring",
right_ear="moonshade Earring",
left_ring="Paguroidea Ring",
right_ring="Sheltered Ring",
back="Shadow Mantle",
}
sets.idle.Weak = {
main="Bolelabunga",
sub={ name="Genbu's Shield", augments={'"Cure" potency +3%','"Cure" spellcasting time -8%','Wind resistance+9',}},
ammo="Vanir Battery",
body="Respite Cloak",
hands="Serpentes Cuffs",
legs="Assid. Pants +1",
feet="Serpentes Sabots",
neck="Twilight Torque",
waist="Slipor Sash",
left_ear="Ethereal Earring",
right_ear="moonshade Earring",
left_ring="Paguroidea Ring",
right_ring="Sheltered Ring",
back="Shadow Mantle",
}
-- Defense sets
sets.defense.PDT = {main=gear.Staff.PDT,sub="Achaq Grip",
head="Gendewitha Caubeen",neck="Twilight Torque",
body="Gendewitha Bliaut",hands="Gendewitha Gages",ring1="Defending Ring",ring2=gear.DarkRing.physical,
back="Umbra Cape",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
sets.defense.MDT = {main=gear.Staff.PDT,sub="Achaq Grip",
head="Nahtirah Hat",neck="Twilight Torque",
body="Vanir Cotehardie",hands="Yaoyotl Gloves",ring1="Defending Ring",ring2="Shadow Ring",
back="Tuilha Cape",legs="Bokwus Slops",feet="Gendewitha Galoshes"}
sets.Kiting = {feet="Herald's Gaiters"}
sets.latent_refresh = {waist="Fucho-no-obi"}
-- Engaged sets
-- Variations for TP weapon and (optional) offense/defense modes. Code will fall back on previous
-- sets if more refined versions aren't defined.
-- If you create a set with both offense and defense modes, the offense mode should be first.
-- EG: sets.engaged.Dagger.Accuracy.Evasion
-- Basic set for if no TP weapon is defined.
sets.engaged = {
head="Nahtirah Hat",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
body="Vanir Cotehardie",hands="Dynasty Mitts",ring1="Rajas Ring",ring2="K'ayres Ring",
back="Umbra Cape",waist="Goading Belt",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
-- Buff sets: Gear that needs to be worn to actively enhance a current player buff.
sets.buff['Divine Caress'] = {hands="Orison Mitts +2",back="Mending Cape"}
end
-------------------------------------------------------------------------------------------------------------------
-- Job-specific hooks that are called to process player actions at specific points in time.
-------------------------------------------------------------------------------------------------------------------
-- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
-- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
function job_precast(spell, action, spellMap, eventArgs)
local map = spell_maps[spell.en]
if map == 'Cure' and player.sub_job == "SCH" and not buffactive.Aurorastorm then
add_to_chat(123,'Aurorastorm not active.')
windower.play_sound(windower.addon_path..'wav/Chime.wav')
end
if map == 'Curaga' and player.sub_job == "SCH" and not buffactive.Aurorastorm then
add_to_chat(123,'Aurorastorm not active.')
windower.play_sound(windower.addon_path..'wav/Chime.wav')
end
if spell.english == "Paralyna" and buffactive.Paralyzed then
eventArgs.handled = true
end
if spell.skill == 'Healing Magic' then
gear.default.obi_back = "Mending Cape"
else
gear.default.obi_back = "Toro Cape"
end
end
--[[function job_precast(spell, action, spellMap, eventArgs)
if state.Buff[spell.english] ~= nil then
state.Buff[spell.english] = true
end
end]]
function job_post_midcast(spell, action, spellMap, eventArgs)
-- Apply Divine Caress boosting items as highest priority over other gear, if applicable.
if spellMap == 'StatusRemoval' and buffactive['Divine Caress'] then
equip(sets.buff['Divine Caress'])
end
end
-- Return true if we handled the aftercast work. Otherwise it will fall back
-- to the general aftercast() code in Mote-Include.
function job_aftercast(spell, action, spellMap, eventArgs)
if state.Buff[spell.english] ~= nil then
state.Buff[spell.english] = not spell.interrupted or buffactive[spell.english]
end
end
-------------------------------------------------------------------------------------------------------------------
-- Customization hooks for idle and melee sets, after they've been automatically constructed.
-------------------------------------------------------------------------------------------------------------------
-- Custom spell mapping.
function job_get_spell_map(spell, default_spell_map)
if spell.action_type == 'Magic' then
if (default_spell_map == 'Cure' or default_spell_map == 'Curaga') and player.status == 'Engaged' then
return "CureMelee"
elseif default_spell_map == 'Cure' and state.Buff['Afflatus Solace'] then
return "CureSolace"
elseif spell.skill == "Enfeebling Magic" then
if spell.type == "WhiteMagic" then
return "MndEnfeebles"
else
return "IntEnfeebles"
end
end
end
end
function customize_idle_set(idleSet)
if player.mpp < 51 then
idleSet = set_combine(idleSet, sets.latent_refresh)
end
return idleSet
end
-------------------------------------------------------------------------------------------------------------------
-- General hooks for other events.
-------------------------------------------------------------------------------------------------------------------
-- Called when a player gains or loses a buff.
-- buff == buff gained or lost
-- gain == true if the buff was gained, false if it was lost.
function job_buff_change(buff, gain)
if state.Buff[buff] ~= nil then
state.Buff[buff] = gain
end
end
-------------------------------------------------------------------------------------------------------------------
-- User code that supplements self-commands.
-------------------------------------------------------------------------------------------------------------------
-- Called by the 'update' self-command.
function job_update(cmdParams, eventArgs)
if cmdParams[1] == 'user' and not areas.Cities:contains(world.area) then
local needsArts =
player.sub_job:lower() == 'sch' and
not buffactive['Light Arts'] and
not buffactive['Addendum: White'] and
not buffactive['Dark Arts'] and
not buffactive['Addendum: Black']
if not buffactive['Afflatus Solace'] and not buffactive['Afflatus Misery'] then
if needsArts then
send_command('@input /ja "Afflatus Solace" <me>;wait 1.2;input /ja "Light Arts" <me>')
else
send_command('@input /ja "Afflatus Solace" <me>')
end
end
end
end
-- Handle notifications of general user state change.
function job_state_change(stateField, newValue, oldValue)
if stateField == 'OffenseMode' then
if newValue == 'Normal' then
disable('main','sub')
else
enable('main','sub')
end
elseif stateField == 'Reset' then
if state.OffenseMode == 'None' then
enable('main','sub')
end
end
end
-- Function to display the current relevant user state when doing an update.
-- Return true if display was handled, and you don't want the default info shown.
function display_current_job_state(eventArgs)
local defenseString = ''
if state.Defense.Active then
local defMode = state.Defense.PhysicalMode
if state.Defense.Type == 'Magical' then
defMode = state.Defense.MagicalMode
end
defenseString = 'Defense: '..state.Defense.Type..' '..defMode..', '
end
local meleeString = ''
if state.OffenseMode == 'Normal' then
meleeString = 'Melee: Weapons locked, '
end
add_to_chat(122,'Casting ['..state.CastingMode..'], '..meleeString..'Idle ['..state.IdleMode..'], '..defenseString..
'Kiting: '..on_off_names[state.Kiting])
eventArgs.handled = true
end
-------------------------------------------------------------------------------------------------------------------
-- Utility functions specific to this job.
-------------------------------------------------------------------------------------------------------------------
-- Select default macro book on initial load or subjob change.
function select_default_macro_book()
-- Default macro set/book
set_macro_page(4, 14)
end
PM me if there's any issues with this. I've tested it on my side, so hopefully it should work for you.
Thank you so much, it works perfectly!
Hello guys,
I would like to include a feature in my whm.lua that, when a cure spell is cast, checks to see if the spell Aurorastorm is active. Furthermore, if the check comes back false, I would like for it to print onto my screen a notice. Such a notice could be a line of text that reads "Aurorastorm currently inactive.". It would be even nicer if it could give a subtle sound effect to go along with the notice - though perhaps now I am wandering into the realm of unrealistic requests.
I will look into how to accomplish this while waiting for a response. If anyone has the know-how to accomplish this please help.
Thanks guys,
Roland
PROGRESS UPDATE: Solved
Thanks to multiple contributions from Vow, Braden, and Conagh, I have been able to build the code for this feature to include in my WHM.lua. A thanks also goes out to Draylo for pointing out ingame where in my lua to put the code.
Here is the code - you might notice that it needs to be contained within the precast function in your lua. That's where it is in mine, at least. Code function job_precast(spell, action, spellMap, eventArgs)
if map == 'Cure' and player.sub_job == "SCH" and not buffactive.Aurorastorm then
add_to_chat(123,'Aurorastorm not active.')
windower.play_sound('C:/Program Files (x86)/Windower4/addons/GearSwap/data/wav/Chime.wav')
end
if map == 'Curaga' and player.sub_job == "SCH" and not buffactive.Aurorastorm then
add_to_chat(123,'Aurorastorm not active.')
windower.play_sound('C:/Program Files (x86)/Windower4/addons/GearSwap/data/wav/Chime.wav')
end
end
You will also need to either add a folder named "wav" in your '...\Windower4\addons\GearSwap\data\' folder and put a .wav file named Chime within or create your own folder and name your own .wav in a location of your choosing and manipulate the code to point to your folder and your .wav.
Thank you for taking a look, I hope some people find this helpful.
Thank you all who helped!
Kind Regards,
Roland
|
|