|
whm lua - toggle issues? in over my head?
By Naue 2019-02-14 13:39:56
Hi guys,
I'm relatively new to GS, but have had some success at least getting it to function as I build sets on my whm. I've noticed here and there that sometimes my sets do not swap properly, and I can't for the life of me figure out why...and none of the "obvious" fixes like spelling or referencing an error message (not getting errors) are helping.
Early on I was confused by the fact that my warp ring wouldn't swap, but then realized there was a warp ring slot lock coded into the lua...which makes me think there are other things in there I'm not realizing are impacting how it works.
Lately, and seemingly out of no where, i've noticed my idle set won't be put back on sometimes...if it weren't for equipviewer I wouldn't have even known.
Also have never been able to figure out how to get the refresh/movement(idle) sets to work. I added H.Gaiters to my idle movement set, but when I am standing still, it won't ever swap the boots back to my MDT boots.
All in all...really just looking for someone who wouldn't mind hopping on disc and helping me understand how to use my lua properly.
Seems like WHM needs a lot of different toggle sets for certain situations, so although I could use a dumbed down version, I'd prefer to just get it all right the first time.
LUA below: Code function get_sets()
IdleIndex = 1
IdleArray = {"Movement", "Refresh"} -- Default Idle Set Is Movement --
Armor = 'None'
canceled = false
DC = false
Lock_Main = 'OFF' -- Set Default Lock Main Weapon ON or OFF Here --
Enmity = 'OFF' -- Set Default Enmity Set ON or OFF Here --
Kiting = 'OFF' -- Set Default Sublimation Kiting ON or OFF Here --
Elemental_Staff = 'OFF' -- Set Default Precast Elemental Staff ON or OFF Here --
target_distance = 5 -- Set Default Distance Here --
select_default_macro_book() -- Change Default Macro Book At The End --
Cure_Spells = {"Cure","Cure II","Cure III","Cure IV","Cure V","Cure VI"} -- Cure Degradation --
Curaga_Spells = {"Curaga","Curaga II","Curaga III","Curaga IV","Curaga V"} -- Curaga Degradation --
Na_Spells = S{"Paralyna","Cursna","Silena","Poisona","Blindna","Viruna","Stona","Erase"} -- For Yagrush --
sc_map = {SC1 = "LightArts", SC2 = "Celerity", SC3 = "Accession"} -- 3 Additional Binds. Can Change Whatever JA/WS/Spells You Like Here. Remember Not To Use Spaces. --
sets.Idle = {}
-- Refresh Set --
sets.Idle.Refresh = {
main={ name="Queller Rod", augments={'Healing magic skill +15','"Cure" potency +10%','"Cure" spellcasting time -7%',}},
sub="Genmei Shield",
ammo="Incantor Stone",
body="Inyanga Jubbah +2",
head="Inyanga Tiara +2",
hands="Inyan. Dastanas +1",
legs="Inyanga Shalwar +1",
feet="Inyan. Crackows +1",
neck="Loricate Torque",
waist="Witful Belt",
left_ear="Dominance Earring",
right_ear="Mendi. Earring",
left_ring="Aquasoul Ring",
right_ring="Sirona's Ring",
back="Kumbira Cape",
}
-- Movement Set --
sets.Idle.Movement = set_combine(sets.Idle.Refresh,{
feet="Herald's Gaiters",
})
-- Resting Set --
sets.Resting = {}
-- PDT Set --
sets.PDT = {}
-- Sublimation Set --
sets.Sublimation = {}
sets.Precast = {}
-- Fastcast Set (empty = To Fix Club/Staff Issue) --
sets.Precast.FastCast = {
main={ name="Queller Rod", augments={'Healing magic skill +15','"Cure" potency +10%','"Cure" spellcasting time -7%',}},
sub="Sors Shield",
ammo="Incantor Stone",
head="Inyanga Tiara +2",
body="Inyanga Jubbah +2",
hands="Inyan. Dastanas +1",
legs="Kaykaus Tights",
feet="Inyan. Crackows +1",
neck="Nuna Gorget",
waist="Witful Belt",
left_ear="Nourish. Earring +1",
right_ear="Mendi. Earring",
left_ring="Aquasoul Ring",
right_ring="Sirona's Ring",
back={ name="Alaunus's Cape", augments={'MND+20','Mag. Acc+20 /Mag. Dmg.+20','Mag. Evasion+10','"Fast Cast"+10',}},
}
-- Elemental Staves --
sets.Precast.Lightning = {main='Apamajas I'}
sets.Precast.Water = {main='Haoma I'}
sets.Precast.Fire = {main='Atar I'}
sets.Precast.Ice = {main='Vourukasha I'}
sets.Precast.Wind = {main='Vayuvata I'}
sets.Precast.Earth = {main='Vishrava I'}
sets.Precast.Light = {main='Arka I'}
sets.Precast.Dark = {main='Xsaeta I'}
sets.Precast['Enhancing Magic'] = set_combine(sets.Precast.FastCast,{main="Yagrush",waist="Siegel Sash"})
sets.Precast['Healing Magic'] = set_combine(sets.Precast.FastCast,{main="Yagrush",legs="Ebers Pantaloons"})
sets.Precast.Stoneskin = set_combine(sets.Precast.FastCast,{head="Umuthi Hat",waist="Siegel Sash"})
-- Cure Precast Set empty here too--
sets.Precast.Cure = {
main={ name="Queller Rod", augments={'Healing magic skill +15','"Cure" potency +10%','"Cure" spellcasting time -7%',}},
sub="Sors Shield",
ammo="Incantor Stone",
head="Kaykaus Mitra",
body="Inyanga Jubbah +2",
hands="Inyan. Dastanas +1",
legs="Ebers Pantaloons",
feet="Inyan. Crackows +1",
neck="Nuna Gorget",
waist="Witful Belt",
left_ear="Nourish. Earring +1",
right_ear="Mendi. Earring",
left_ring="Aquasoul Ring",
right_ring="Sirona's Ring",
back={ name="Alaunus's Cape", augments={'MND+20','Mag. Acc+20 /Mag. Dmg.+20','Mag. Evasion+10','"Fast Cast"+10',}},
}
-- Midcast Base Set --
sets.Midcast = {}
-- Haste Set --
sets.Midcast.Haste = set_combine(sets.Precast.FastCast,{})
-- Cure Set --
sets.Midcast.Cure = {
main={ name="Queller Rod", augments={'Healing magic skill +15','"Cure" potency +10%','"Cure" spellcasting time -7%',}},
sub="Sors Shield",
ammo="Incantor Stone",
head="Kaykaus Mitra",
body="Ebers Bliaud",
hands="Inyan. Dastanas +1",
legs="Ebers Pantaloons",
feet="Inyan. Crackows +1",
neck="Nuna Gorget",
waist="Cascade Belt",
left_ear="Nourish. Earring +1",
right_ear="Mendi. Earring",
left_ring="Aquasoul Ring",
right_ring="Sirona's Ring",
back={ name="Alaunus's Cape", augments={'MND+20','Mag. Acc+20 /Mag. Dmg.+20','Mag. Evasion+10','"Fast Cast"+10',}},
}
-- Cure Enmity Set --
sets.Midcast.Cure.Enmity = set_combine(sets.Midcast.Cure,{})
-- Curaga Set --
sets.Midcast.Curaga = {
main={ name="Queller Rod", augments={'Healing magic skill +15','"Cure" potency +10%','"Cure" spellcasting time -7%',}},
sub="Sors Shield",
ammo="Incantor Stone",
head="Kaykaus Mitra",
body="Gende. Bilaut +1",
hands="Inyan. Dastanas +1",
legs="Ebers Pantaloons",
feet="Inyan. Crackows +1",
neck="Nuna Gorget",
waist="Cascade Belt",
left_ear="Nourish. Earring +1",
right_ear="Mendi. Earring",
left_ring="Aquasoul Ring",
right_ring="Sirona's Ring",
back={ name="Alaunus's Cape", augments={'MND+20','Mag. Acc+20 /Mag. Dmg.+20','Mag. Evasion+10','"Fast Cast"+10',}},
}
-- Curaga Enmity Set --
sets.Midcast.Curaga.Enmity = set_combine(sets.Midcast.Curaga,{})
-- Enhancing Set --
sets.Midcast['Enhancing Magic'] = {
head="Chironic Hat"
}
-- Barspells Set --
sets.Midcast.Bar = {}
-- Regen Set --
sets.Midcast.Regen = set_combine(sets.Midcast.Haste,{
main="Bolelabunga",
head="Inyanga Tiara +2",
body="Piety Briault +1",
hands="Ebers Mitts +1",
legs="Theo. Pant. +1"})
-- Stoneskin Set --
sets.Midcast.Stoneskin = set_combine(sets.Midcast.Haste,{})
-- Na Set --
sets.Midcast.Na = set_combine(sets.Midcast.Haste,{main="Yagrush",legs="Ebers Pant. +1"})
-- Cursna Set --
sets.Midcast.Cursna = set_combine(sets.Midcast.Haste,{
main="Yagrush",
sub="Genbu's Shield",
ammo="Impatiens",
head="Nahtirah Hat",
neck="Malison Medallion",
ear2="Beatific Earring",
body="Ebers Briault +1",
hands="Theo. Mitts +1",
ring1="Haoma's Ring",
ring2="Haoma's Ring",
back="Mending Cape",
waist="Bishop's Sash",
legs="Theo. Pant. +1",
feet="Gende. Galosh. +1",
})
-- Divine Set --
sets.Midcast['Divine Magic'] = {}
-- Banish Set --
sets.Midcast.Banish = set_combine(sets.Midcast['Divine Magic'],{
hands="Piety Mitts +1",
ring1="Fenian Ring"})
-- Holy Set --
sets.Midcast.Holy = set_combine(sets.Midcast['Divine Magic'],{})
-- Enfeebling Set --
sets.Midcast['Enfeebling Magic'] = {}
-- Dark Magic Set --
sets.Midcast['Dark Magic'] = {}
-- Impact Set --
sets.Midcast.Impact = {}
-- JA Sets --
sets.JA = {}
sets.JA.Benediction = {body="Piety Briault +1"}
sets.JA.Martyr = {hands="Piety Mitts +1"}
sets.JA.Devotion = {head="Piety Cap +1"}
-- Divine Caress Set --
sets['Divine Caress'] = {
main="Yagrush",
hands="Ebers Mitts +1",
back="Mending Cape"}
-- Melee Set --
sets.Melee = set_combine(sets.Midcast.Haste,{})
-- WS Base Set --
sets.WS = {}
sets.WS['Hexa Strike'] = {}
sets.WS['Mystic Boon'] = {}
sets.WS.Dagan = {}
end
function pretarget(spell,action)
if midaction() then
canceled = true
return
elseif spell.action_type == 'Magic' and buffactive.silence then -- Auto Use Echo Drops If You Are Silenced --
cancel_spell()
send_command('input /item "Echo Drops" <me>')
elseif spell.type == "WeaponSkill" and spell.target.distance > target_distance and player.status == 'Engaged' then -- Cancel WS If You Are Out Of Range --
cancel_spell()
add_to_chat(123, spell.name..' Canceled: [Out of Range]')
return
elseif spell.english:ifind("Cure") and player.mp<actualCost(spell.mp_cost) then
degrade_spell(spell,Cure_Spells)
elseif spell.english:ifind("Curaga") and player.mp<actualCost(spell.mp_cost) then
degrade_spell(spell,Curaga_Spells)
elseif Na_Spells:contains(spell.english) then -- Auto Divine Caress --
if windower.ffxi.get_ability_recasts()[32] < 1 and (spell.target.type == 'PLAYER' or spell.target.name == player.name) and not buffactive.amnesia and not buffactive.charm and spell.english ~= "Erase" then
cancel_spell()
send_command('DivineCaress;wait 1.7;input /ma "'..spell.english..'" '..spell.target.name)
end
elseif buffactive['Light Arts'] or buffactive['Addendum: White'] then
if spell.english == 'Light Arts' and not buffactive['Addendum: White'] then
cancel_spell()
send_command('input /ja Addendum: White <me>')
elseif spell.english == "Manifestation" then
cancel_spell()
send_command('input /ja Accession <me>')
elseif spell.english == "Alacrity" then
cancel_spell()
send_command('input /ja Celerity <me>')
elseif spell.english == "Parsimony" then
cancel_spell()
send_command('input /ja Penury <me>')
end
elseif buffactive['Dark Arts'] or buffactive['Addendum: Black'] then
if spell.english == 'Dark Arts' and not buffactive['Addendum: Black'] then
cancel_spell()
send_command('input /ja Addendum: Black <me>')
elseif spell.english == "Accession" then
cancel_spell()
send_command('input /ja Manifestation <me>')
elseif spell.english == "Celerity" then
cancel_spell()
send_command('input /ja Alacrity <me>')
elseif spell.english == "Penury" then
cancel_spell()
send_command('input /ja Parsimony <me>')
end
end
end
function precast(spell,action)
if canceled then
return
elseif spell.action_type == 'Magic' then
if buffactive.silence or spell.target.distance > 16+target_distance then -- Cancel Magic or Ninjutsu If You Are Silenced or Out of Range --
cancel_spell()
add_to_chat(123, spell.name..' Canceled: [Silenced or Out of Casting Range]')
return
else
if spell.english:startswith('Cur') and spell.english ~= "Cursna" then
equip(sets.Precast.Cure)
elseif spell.english == "Stoneskin" then
equip(sets.Precast[spell.english])
elseif spell.english == "Impact" then
equip(set_combine(sets.Precast.FastCast,{body="Twilight Cloak"}))
elseif spell.english == 'Utsusemi: Ni' then
if buffactive['Copy Image (3)'] then
cancel_spell()
add_to_chat(123, spell.name .. ' Canceled: [3 Images]')
return
else
equip(sets.Precast.FastCast)
end
elseif sets.Precast[spell.skill] then
equip(sets.Precast[spell.skill])
else
equip(sets.Precast.FastCast)
end
end
elseif spell.type == "JobAbility" then
if sets.JA[spell.english] then
equip(sets.JA[spell.english])
end
elseif spell.type == "WeaponSkill" then
if player.status ~= 'Engaged' then -- Cancel WS If You Are Not Engaged. Can Delete It If You Don't Need It --
cancel_spell()
add_to_chat(123,'Unable To Use WeaponSkill: [Disengaged]')
return
else
if sets.WS[spell.english] then
equip(sets.WS[spell.english])
end
end
elseif spell.english == 'Spectral Jig' and buffactive.Sneak then
cast_delay(0.2)
send_command('cancel Sneak')
end
if sets.Precast[spell.element] and not Na_Spells:contains(spell.english) and Elemental_Staff == 'ON' then
equip(sets.Precast[spell.element])
end
end
function midcast(spell,action)
equipSet = {}
if spell.action_type == 'Magic' then
equipSet = sets.Midcast
if Na_Spells:contains(spell.english) then
equipSet = equipSet.Na
if DC then
equipSet = set_combine(equipSet,sets['Divine Caress'])
end
elseif spell.english:startswith('Cur') and spell.english ~= "Cursna" then
if spell.english:startswith('Cure') then
if Enmity == 'ON' then
equipSet = equipSet.Cure.Enmity
else
equipSet = equipSet.Cure
end
elseif spell.english:startswith('Cura') then
if Enmity == 'ON' then
equipSet = equipSet.Curaga.Enmity
else
equipSet = equipSet.Curaga
end
end
if world.day_element == spell.element or world.weather_element == spell.element then
equipSet = set_combine(equipSet,{back="Twilight Cape",waist="Hachirin-no-Obi"})
end
elseif spell.english == "Protectra V" then -- Equip Aug'ed Piety Duckbills +1 When You Cast Protectra V --
equipSet = set_combine(equipSet,{feet="Piety Duckbills +1"})
elseif spell.english == "Shellra V" then -- Equip Aug'ed Piety Pantaln. +1 When You Cast Shellra V --
equipSet = set_combine(equipSet,{legs="Piety Pantaln. +1"})
elseif spell.english == "Stoneskin" then
if buffactive.Stoneskin then
send_command('@wait 2.8;cancel stoneskin')
end
equipSet = equipSet.Stoneskin
elseif spell.english == "Sneak" then
if spell.target.name == player.name and buffactive['Sneak'] then
send_command('cancel sneak')
end
equipSet = equipSet.Haste
elseif spell.english:startswith('Bar') then
equipSet = equipSet.Bar
elseif spell.english:startswith('Regen') then
equipSet = equipSet.Regen
elseif spell.english:startswith('Banish') then
equipSet = equipSet.Banish
if world.day_element == spell.element or world.weather_element == spell.element then
equipSet = set_combine(equipSet,{back="Twilight Cape",waist="Hachirin-no-Obi"})
end
elseif spell.english:startswith('Holy') then
equipSet = equipSet.Holy
if world.day_element == spell.element or world.weather_element == spell.element then
equipSet = set_combine(equipSet,{back="Twilight Cape",waist="Hachirin-no-Obi"})
end
elseif spell.english:startswith('Reraise') then
equipSet = equipSet.Haste
elseif spell.english:startswith('Utsusemi') then
if spell.english == 'Utsusemi: Ichi' and (buffactive['Copy Image'] or buffactive['Copy Image (2)'] or buffactive['Copy Image (3)']) then
send_command('@wait 1.7;cancel Copy Image*')
end
equipSet = equipSet.Haste
elseif spell.english == 'Monomi: Ichi' then
if buffactive['Sneak'] then
send_command('@wait 1.7;cancel sneak')
end
equipSet = equipSet.Haste
else
if equipSet[spell.english] then
equipSet = equipSet[spell.english]
end
if equipSet[spell.skill] then
equipSet = equipSet[spell.skill]
end
if equipSet[spell.type] then
equipSet = equipSet[spell.type]
end
end
elseif equipSet[spell.english] then
equipSet = equipSet[spell.english]
end
equip(equipSet)
end
function aftercast(spell,action)
if canceled then
canceled = false
return
else
if not spell.interrupted then
if spell.type == "WeaponSkill" then
send_command('wait 0.2;gs c TP')
elseif spell.english == "Repose" or spell.english == "Sleep II" then -- Repose & Sleep II Countdown --
send_command('wait 60;input /echo Sleep Effect: [WEARING OFF IN 30 SEC.];wait 15;input /echo Sleep Effect: [WEARING OFF IN 15 SEC.];wait 10;input /echo Sleep Effect: [WEARING OFF IN 5 SEC.]')
elseif spell.english == "Sleep" or spell.english == "Sleepga" then -- Sleep & Sleepga Countdown --
send_command('wait 30;input /echo Sleep Effect: [WEARING OFF IN 30 SEC.];wait 15;input /echo Sleep Effect: [WEARING OFF IN 15 SEC.];wait 10;input /echo Sleep Effect: [WEARING OFF IN 5 SEC.]')
elseif spell.english == "Banish III" then -- Banish III Countdown --
send_command('wait 35;input /echo Banish Effect: [WEARING OFF IN 10 SEC.]')
end
end
status_change(player.status)
end
end
function status_change(new,old)
check_equip_lock()
if Armor == 'PDT' then
equip(sets.PDT)
elseif buffactive["Sublimation: Activated"] then
equip(sets.Sublimation)
if Kiting == 'ON' then
equip({feet="Herald's Gaiters"})
end
elseif new == 'Engaged' then
equip(sets.Melee)
elseif new == 'Idle' then
equipSet = sets.Idle
if equipSet[IdleArray[IdleIndex]] then
equipSet = equipSet[IdleArray[IdleIndex]]
end
if buffactive['Reive Mark'] then -- Equip Arciela's Grace +1 During Reive --
equipSet = set_combine(equipSet,{neck="Arciela's Grace +1"})
end
if world.area:endswith('Adoulin') then
equipSet = set_combine(equipSet,{body="Councilor's Garb"})
end
equip(equipSet)
elseif new == 'Resting' then
equip(sets.Resting)
end
end
function buff_change(buff,gain)
buff = string.lower(buff)
if buff == "aftermath: lv.3" then -- AM3 Timer/Countdown --
if gain then
send_command('timers create "Aftermath: Lv.3" 180 down;wait 150;input /echo Aftermath: Lv.3 [WEARING OFF IN 30 SEC.];wait 15;input /echo Aftermath: Lv.3 [WEARING OFF IN 15 SEC.];wait 5;input /echo Aftermath: Lv.3 [WEARING OFF IN 10 SEC.]')
else
send_command('timers delete "Aftermath: Lv.3"')
add_to_chat(123,'AM3: [OFF]')
end
elseif buff == 'divine caress' then
DC = gain
elseif buff == 'weakness' then -- Weakness Timer --
if gain then
send_command('timers create "Weakness" 300 up')
else
send_command('timers delete "Weakness"')
end
end
if not midaction() then
status_change(player.status)
end
end
-- In Game: //gs c (command), Macro: /console gs c (command), Bind: gs c (command) --
function self_command(command)
if command == 'C1' then -- Enmity Toggle --
if Enmity == 'ON' then
Enmity = 'OFF'
add_to_chat(123,'Enmity Set: [OFF]')
else
Enmity = 'ON'
add_to_chat(158,'Enmity Set: [ON]')
end
status_change(player.status)
elseif command == 'C2' then -- Follow Toggle --
send_command('input /ta Bokura;input /lockon;wait .3;setkey numpad8 down;wait .3;setkey numpad7 down;wait .3;setkey numpad7 up;wait .3;setkey numpad8 up')
elseif command == 'C3' then -- Kiting Toggle --
if Kiting == 'ON' then
Kiting = 'OFF'
add_to_chat(123,'Kiting Set: [Unlocked]')
else
Kiting = 'ON'
add_to_chat(158,'Kiting Set: [Locked]')
end
status_change(player.status)
elseif command == 'C5' then -- Auto Update Gear Toggle --
status_change(player.status)
add_to_chat(158,'Auto Update Gear')
elseif command == 'C7' then
if Armor == 'PDT' then -- PDT Toggle --
Armor = 'None'
add_to_chat(123,'PDT Set: [Unlocked]')
else
Armor = 'PDT'
add_to_chat(158,'PDT Set: [Locked]')
end
status_change(player.status)
elseif command == 'C17' then -- Lock Main Weapon Toggle --
if Lock_Main == 'ON' then
Lock_Main = 'OFF'
add_to_chat(123,'Main Weapon: [Unlocked]')
else
Lock_Main = 'ON'
add_to_chat(158,'Main Weapon: [Locked]')
end
status_change(player.status)
elseif command == 'C8' then -- Distance Toggle --
if player.target.distance then
target_distance = math.floor(player.target.distance*10)/10
add_to_chat(158,'Distance: '..target_distance)
else
add_to_chat(123,'No Target Selected')
end
elseif command == 'C6' then -- Idle Toggle
IdleIndex = (IdleIndex % #IdleArray) + 1
add_to_chat(158,'Idle Set: '..IdleArray[IdleIndex])
status_change(player.status)
elseif command == 'TP' then
add_to_chat(158,'TP Return: '..tostring(player.tp))
elseif command:match('^SC%d$') then
send_command('//' .. sc_map[command])
end
end
function check_equip_lock() -- Lock Equipment Here --
if player.equipment.left_ring == "Warp Ring" or player.equipment.left_ring == "Capacity Ring" or player.equipment.right_ring == "Warp Ring" or player.equipment.right_ring == "Capacity Ring" then
disable('ring1','ring2')
elseif player.equipment.back == "Mecisto. Mantle" or player.equipment.back == "Aptitude Mantle +1" or player.equipment.back == "Aptitude Mantle" then
disable('back')
elseif Lock_Main == 'ON' then
disable('main','sub')
else
enable('main','sub','ring1','ring2','back')
end
end
function actualCost(originalCost)
if buffactive["Penury"] then
return originalCost*.5
elseif buffactive["Light Arts"] or buffactive["Addendum: White"] then
return originalCost*.9
elseif buffactive["Dark Arts"] or buffactive["Addendum: Black"] then
return originalCost*1.1
else
return originalCost
end
end
function degrade_spell(spell,degrade_array)
spell_index = table.find(degrade_array,spell.name)
if spell_index > 1 then
new_spell = degrade_array[spell_index - 1]
change_spell(new_spell,spell.target.raw)
add_to_chat(8,spell.name..' Canceled: ['..player.mp..'/'..player.max_mp..'MP::'..player.mpp..'%] Casting '..new_spell..' instead.')
end
end
function change_spell(spell_name,target)
cancel_spell()
send_command('//'..spell_name..' '..target)
end
function sub_job_change(newSubjob, oldSubjob)
select_default_macro_book()
end
function set_macro_page(set,book)
if not tonumber(set) then
add_to_chat(123,'Error setting macro page: Set is not a valid number ('..tostring(set)..').')
return
end
if set < 1 or set > 10 then
add_to_chat(123,'Error setting macro page: Macro set ('..tostring(set)..') must be between 1 and 10.')
return
end
if book then
if not tonumber(book) then
add_to_chat(123,'Error setting macro page: book is not a valid number ('..tostring(book)..').')
return
end
if book < 1 or book > 20 then
add_to_chat(123,'Error setting macro page: Macro book ('..tostring(book)..') must be between 1 and 20.')
return
end
send_command('@input /macro book '..tostring(book)..';wait .1;input /macro set '..tostring(set))
else
send_command('@input /macro set '..tostring(set))
end
end
function select_default_macro_book()
-- Default macro set/book
if player.sub_job == 'SCH' then
set_macro_page(4, 1)
elseif player.sub_job == 'BLM' then
set_macro_page(4, 1)
elseif player.sub_job == 'RDM' then
set_macro_page(4, 1)
elseif player.sub_job == 'DNC' then
set_macro_page(4, 1)
elseif player.sub_job == 'NIN' then
set_macro_page(4, 1)
else
set_macro_page(4, 1)
end
end
Hi guys,
I'm relatively new to GS, but have had some success at least getting it to function as I build sets on my whm. I've noticed here and there that sometimes my sets do not swap properly, and I can't for the life of me figure out why...and none of the "obvious" fixes like spelling or referencing an error message (not getting errors) are helping.
Early on I was confused by the fact that my warp ring wouldn't swap, but then realized there was a warp ring slot lock coded into the lua...which makes me think there are other things in there I'm not realizing are impacting how it works.
Lately, and seemingly out of no where, i've noticed my idle set won't be put back on sometimes...if it weren't for equipviewer I wouldn't have even known.
Also have never been able to figure out how to get the refresh/movement(idle) sets to work. I added H.Gaiters to my idle movement set, but when I am standing still, it won't ever swap the boots back to my MDT boots.
All in all...really just looking for someone who wouldn't mind hopping on disc and helping me understand how to use my lua properly.
Seems like WHM needs a lot of different toggle sets for certain situations, so although I could use a dumbed down version, I'd prefer to just get it all right the first time.
LUA below: Code function get_sets()
IdleIndex = 1
IdleArray = {"Movement", "Refresh"} -- Default Idle Set Is Movement --
Armor = 'None'
canceled = false
DC = false
Lock_Main = 'OFF' -- Set Default Lock Main Weapon ON or OFF Here --
Enmity = 'OFF' -- Set Default Enmity Set ON or OFF Here --
Kiting = 'OFF' -- Set Default Sublimation Kiting ON or OFF Here --
Elemental_Staff = 'OFF' -- Set Default Precast Elemental Staff ON or OFF Here --
target_distance = 5 -- Set Default Distance Here --
select_default_macro_book() -- Change Default Macro Book At The End --
Cure_Spells = {"Cure","Cure II","Cure III","Cure IV","Cure V","Cure VI"} -- Cure Degradation --
Curaga_Spells = {"Curaga","Curaga II","Curaga III","Curaga IV","Curaga V"} -- Curaga Degradation --
Na_Spells = S{"Paralyna","Cursna","Silena","Poisona","Blindna","Viruna","Stona","Erase"} -- For Yagrush --
sc_map = {SC1 = "LightArts", SC2 = "Celerity", SC3 = "Accession"} -- 3 Additional Binds. Can Change Whatever JA/WS/Spells You Like Here. Remember Not To Use Spaces. --
sets.Idle = {}
-- Refresh Set --
sets.Idle.Refresh = {
main={ name="Queller Rod", augments={'Healing magic skill +15','"Cure" potency +10%','"Cure" spellcasting time -7%',}},
sub="Genmei Shield",
ammo="Incantor Stone",
body="Inyanga Jubbah +2",
head="Inyanga Tiara +2",
hands="Inyan. Dastanas +1",
legs="Inyanga Shalwar +1",
feet="Inyan. Crackows +1",
neck="Loricate Torque",
waist="Witful Belt",
left_ear="Dominance Earring",
right_ear="Mendi. Earring",
left_ring="Aquasoul Ring",
right_ring="Sirona's Ring",
back="Kumbira Cape",
}
-- Movement Set --
sets.Idle.Movement = set_combine(sets.Idle.Refresh,{
feet="Herald's Gaiters",
})
-- Resting Set --
sets.Resting = {}
-- PDT Set --
sets.PDT = {}
-- Sublimation Set --
sets.Sublimation = {}
sets.Precast = {}
-- Fastcast Set (empty = To Fix Club/Staff Issue) --
sets.Precast.FastCast = {
main={ name="Queller Rod", augments={'Healing magic skill +15','"Cure" potency +10%','"Cure" spellcasting time -7%',}},
sub="Sors Shield",
ammo="Incantor Stone",
head="Inyanga Tiara +2",
body="Inyanga Jubbah +2",
hands="Inyan. Dastanas +1",
legs="Kaykaus Tights",
feet="Inyan. Crackows +1",
neck="Nuna Gorget",
waist="Witful Belt",
left_ear="Nourish. Earring +1",
right_ear="Mendi. Earring",
left_ring="Aquasoul Ring",
right_ring="Sirona's Ring",
back={ name="Alaunus's Cape", augments={'MND+20','Mag. Acc+20 /Mag. Dmg.+20','Mag. Evasion+10','"Fast Cast"+10',}},
}
-- Elemental Staves --
sets.Precast.Lightning = {main='Apamajas I'}
sets.Precast.Water = {main='Haoma I'}
sets.Precast.Fire = {main='Atar I'}
sets.Precast.Ice = {main='Vourukasha I'}
sets.Precast.Wind = {main='Vayuvata I'}
sets.Precast.Earth = {main='Vishrava I'}
sets.Precast.Light = {main='Arka I'}
sets.Precast.Dark = {main='Xsaeta I'}
sets.Precast['Enhancing Magic'] = set_combine(sets.Precast.FastCast,{main="Yagrush",waist="Siegel Sash"})
sets.Precast['Healing Magic'] = set_combine(sets.Precast.FastCast,{main="Yagrush",legs="Ebers Pantaloons"})
sets.Precast.Stoneskin = set_combine(sets.Precast.FastCast,{head="Umuthi Hat",waist="Siegel Sash"})
-- Cure Precast Set empty here too--
sets.Precast.Cure = {
main={ name="Queller Rod", augments={'Healing magic skill +15','"Cure" potency +10%','"Cure" spellcasting time -7%',}},
sub="Sors Shield",
ammo="Incantor Stone",
head="Kaykaus Mitra",
body="Inyanga Jubbah +2",
hands="Inyan. Dastanas +1",
legs="Ebers Pantaloons",
feet="Inyan. Crackows +1",
neck="Nuna Gorget",
waist="Witful Belt",
left_ear="Nourish. Earring +1",
right_ear="Mendi. Earring",
left_ring="Aquasoul Ring",
right_ring="Sirona's Ring",
back={ name="Alaunus's Cape", augments={'MND+20','Mag. Acc+20 /Mag. Dmg.+20','Mag. Evasion+10','"Fast Cast"+10',}},
}
-- Midcast Base Set --
sets.Midcast = {}
-- Haste Set --
sets.Midcast.Haste = set_combine(sets.Precast.FastCast,{})
-- Cure Set --
sets.Midcast.Cure = {
main={ name="Queller Rod", augments={'Healing magic skill +15','"Cure" potency +10%','"Cure" spellcasting time -7%',}},
sub="Sors Shield",
ammo="Incantor Stone",
head="Kaykaus Mitra",
body="Ebers Bliaud",
hands="Inyan. Dastanas +1",
legs="Ebers Pantaloons",
feet="Inyan. Crackows +1",
neck="Nuna Gorget",
waist="Cascade Belt",
left_ear="Nourish. Earring +1",
right_ear="Mendi. Earring",
left_ring="Aquasoul Ring",
right_ring="Sirona's Ring",
back={ name="Alaunus's Cape", augments={'MND+20','Mag. Acc+20 /Mag. Dmg.+20','Mag. Evasion+10','"Fast Cast"+10',}},
}
-- Cure Enmity Set --
sets.Midcast.Cure.Enmity = set_combine(sets.Midcast.Cure,{})
-- Curaga Set --
sets.Midcast.Curaga = {
main={ name="Queller Rod", augments={'Healing magic skill +15','"Cure" potency +10%','"Cure" spellcasting time -7%',}},
sub="Sors Shield",
ammo="Incantor Stone",
head="Kaykaus Mitra",
body="Gende. Bilaut +1",
hands="Inyan. Dastanas +1",
legs="Ebers Pantaloons",
feet="Inyan. Crackows +1",
neck="Nuna Gorget",
waist="Cascade Belt",
left_ear="Nourish. Earring +1",
right_ear="Mendi. Earring",
left_ring="Aquasoul Ring",
right_ring="Sirona's Ring",
back={ name="Alaunus's Cape", augments={'MND+20','Mag. Acc+20 /Mag. Dmg.+20','Mag. Evasion+10','"Fast Cast"+10',}},
}
-- Curaga Enmity Set --
sets.Midcast.Curaga.Enmity = set_combine(sets.Midcast.Curaga,{})
-- Enhancing Set --
sets.Midcast['Enhancing Magic'] = {
head="Chironic Hat"
}
-- Barspells Set --
sets.Midcast.Bar = {}
-- Regen Set --
sets.Midcast.Regen = set_combine(sets.Midcast.Haste,{
main="Bolelabunga",
head="Inyanga Tiara +2",
body="Piety Briault +1",
hands="Ebers Mitts +1",
legs="Theo. Pant. +1"})
-- Stoneskin Set --
sets.Midcast.Stoneskin = set_combine(sets.Midcast.Haste,{})
-- Na Set --
sets.Midcast.Na = set_combine(sets.Midcast.Haste,{main="Yagrush",legs="Ebers Pant. +1"})
-- Cursna Set --
sets.Midcast.Cursna = set_combine(sets.Midcast.Haste,{
main="Yagrush",
sub="Genbu's Shield",
ammo="Impatiens",
head="Nahtirah Hat",
neck="Malison Medallion",
ear2="Beatific Earring",
body="Ebers Briault +1",
hands="Theo. Mitts +1",
ring1="Haoma's Ring",
ring2="Haoma's Ring",
back="Mending Cape",
waist="Bishop's Sash",
legs="Theo. Pant. +1",
feet="Gende. Galosh. +1",
})
-- Divine Set --
sets.Midcast['Divine Magic'] = {}
-- Banish Set --
sets.Midcast.Banish = set_combine(sets.Midcast['Divine Magic'],{
hands="Piety Mitts +1",
ring1="Fenian Ring"})
-- Holy Set --
sets.Midcast.Holy = set_combine(sets.Midcast['Divine Magic'],{})
-- Enfeebling Set --
sets.Midcast['Enfeebling Magic'] = {}
-- Dark Magic Set --
sets.Midcast['Dark Magic'] = {}
-- Impact Set --
sets.Midcast.Impact = {}
-- JA Sets --
sets.JA = {}
sets.JA.Benediction = {body="Piety Briault +1"}
sets.JA.Martyr = {hands="Piety Mitts +1"}
sets.JA.Devotion = {head="Piety Cap +1"}
-- Divine Caress Set --
sets['Divine Caress'] = {
main="Yagrush",
hands="Ebers Mitts +1",
back="Mending Cape"}
-- Melee Set --
sets.Melee = set_combine(sets.Midcast.Haste,{})
-- WS Base Set --
sets.WS = {}
sets.WS['Hexa Strike'] = {}
sets.WS['Mystic Boon'] = {}
sets.WS.Dagan = {}
end
function pretarget(spell,action)
if midaction() then
canceled = true
return
elseif spell.action_type == 'Magic' and buffactive.silence then -- Auto Use Echo Drops If You Are Silenced --
cancel_spell()
send_command('input /item "Echo Drops" <me>')
elseif spell.type == "WeaponSkill" and spell.target.distance > target_distance and player.status == 'Engaged' then -- Cancel WS If You Are Out Of Range --
cancel_spell()
add_to_chat(123, spell.name..' Canceled: [Out of Range]')
return
elseif spell.english:ifind("Cure") and player.mp<actualCost(spell.mp_cost) then
degrade_spell(spell,Cure_Spells)
elseif spell.english:ifind("Curaga") and player.mp<actualCost(spell.mp_cost) then
degrade_spell(spell,Curaga_Spells)
elseif Na_Spells:contains(spell.english) then -- Auto Divine Caress --
if windower.ffxi.get_ability_recasts()[32] < 1 and (spell.target.type == 'PLAYER' or spell.target.name == player.name) and not buffactive.amnesia and not buffactive.charm and spell.english ~= "Erase" then
cancel_spell()
send_command('DivineCaress;wait 1.7;input /ma "'..spell.english..'" '..spell.target.name)
end
elseif buffactive['Light Arts'] or buffactive['Addendum: White'] then
if spell.english == 'Light Arts' and not buffactive['Addendum: White'] then
cancel_spell()
send_command('input /ja Addendum: White <me>')
elseif spell.english == "Manifestation" then
cancel_spell()
send_command('input /ja Accession <me>')
elseif spell.english == "Alacrity" then
cancel_spell()
send_command('input /ja Celerity <me>')
elseif spell.english == "Parsimony" then
cancel_spell()
send_command('input /ja Penury <me>')
end
elseif buffactive['Dark Arts'] or buffactive['Addendum: Black'] then
if spell.english == 'Dark Arts' and not buffactive['Addendum: Black'] then
cancel_spell()
send_command('input /ja Addendum: Black <me>')
elseif spell.english == "Accession" then
cancel_spell()
send_command('input /ja Manifestation <me>')
elseif spell.english == "Celerity" then
cancel_spell()
send_command('input /ja Alacrity <me>')
elseif spell.english == "Penury" then
cancel_spell()
send_command('input /ja Parsimony <me>')
end
end
end
function precast(spell,action)
if canceled then
return
elseif spell.action_type == 'Magic' then
if buffactive.silence or spell.target.distance > 16+target_distance then -- Cancel Magic or Ninjutsu If You Are Silenced or Out of Range --
cancel_spell()
add_to_chat(123, spell.name..' Canceled: [Silenced or Out of Casting Range]')
return
else
if spell.english:startswith('Cur') and spell.english ~= "Cursna" then
equip(sets.Precast.Cure)
elseif spell.english == "Stoneskin" then
equip(sets.Precast[spell.english])
elseif spell.english == "Impact" then
equip(set_combine(sets.Precast.FastCast,{body="Twilight Cloak"}))
elseif spell.english == 'Utsusemi: Ni' then
if buffactive['Copy Image (3)'] then
cancel_spell()
add_to_chat(123, spell.name .. ' Canceled: [3 Images]')
return
else
equip(sets.Precast.FastCast)
end
elseif sets.Precast[spell.skill] then
equip(sets.Precast[spell.skill])
else
equip(sets.Precast.FastCast)
end
end
elseif spell.type == "JobAbility" then
if sets.JA[spell.english] then
equip(sets.JA[spell.english])
end
elseif spell.type == "WeaponSkill" then
if player.status ~= 'Engaged' then -- Cancel WS If You Are Not Engaged. Can Delete It If You Don't Need It --
cancel_spell()
add_to_chat(123,'Unable To Use WeaponSkill: [Disengaged]')
return
else
if sets.WS[spell.english] then
equip(sets.WS[spell.english])
end
end
elseif spell.english == 'Spectral Jig' and buffactive.Sneak then
cast_delay(0.2)
send_command('cancel Sneak')
end
if sets.Precast[spell.element] and not Na_Spells:contains(spell.english) and Elemental_Staff == 'ON' then
equip(sets.Precast[spell.element])
end
end
function midcast(spell,action)
equipSet = {}
if spell.action_type == 'Magic' then
equipSet = sets.Midcast
if Na_Spells:contains(spell.english) then
equipSet = equipSet.Na
if DC then
equipSet = set_combine(equipSet,sets['Divine Caress'])
end
elseif spell.english:startswith('Cur') and spell.english ~= "Cursna" then
if spell.english:startswith('Cure') then
if Enmity == 'ON' then
equipSet = equipSet.Cure.Enmity
else
equipSet = equipSet.Cure
end
elseif spell.english:startswith('Cura') then
if Enmity == 'ON' then
equipSet = equipSet.Curaga.Enmity
else
equipSet = equipSet.Curaga
end
end
if world.day_element == spell.element or world.weather_element == spell.element then
equipSet = set_combine(equipSet,{back="Twilight Cape",waist="Hachirin-no-Obi"})
end
elseif spell.english == "Protectra V" then -- Equip Aug'ed Piety Duckbills +1 When You Cast Protectra V --
equipSet = set_combine(equipSet,{feet="Piety Duckbills +1"})
elseif spell.english == "Shellra V" then -- Equip Aug'ed Piety Pantaln. +1 When You Cast Shellra V --
equipSet = set_combine(equipSet,{legs="Piety Pantaln. +1"})
elseif spell.english == "Stoneskin" then
if buffactive.Stoneskin then
send_command('@wait 2.8;cancel stoneskin')
end
equipSet = equipSet.Stoneskin
elseif spell.english == "Sneak" then
if spell.target.name == player.name and buffactive['Sneak'] then
send_command('cancel sneak')
end
equipSet = equipSet.Haste
elseif spell.english:startswith('Bar') then
equipSet = equipSet.Bar
elseif spell.english:startswith('Regen') then
equipSet = equipSet.Regen
elseif spell.english:startswith('Banish') then
equipSet = equipSet.Banish
if world.day_element == spell.element or world.weather_element == spell.element then
equipSet = set_combine(equipSet,{back="Twilight Cape",waist="Hachirin-no-Obi"})
end
elseif spell.english:startswith('Holy') then
equipSet = equipSet.Holy
if world.day_element == spell.element or world.weather_element == spell.element then
equipSet = set_combine(equipSet,{back="Twilight Cape",waist="Hachirin-no-Obi"})
end
elseif spell.english:startswith('Reraise') then
equipSet = equipSet.Haste
elseif spell.english:startswith('Utsusemi') then
if spell.english == 'Utsusemi: Ichi' and (buffactive['Copy Image'] or buffactive['Copy Image (2)'] or buffactive['Copy Image (3)']) then
send_command('@wait 1.7;cancel Copy Image*')
end
equipSet = equipSet.Haste
elseif spell.english == 'Monomi: Ichi' then
if buffactive['Sneak'] then
send_command('@wait 1.7;cancel sneak')
end
equipSet = equipSet.Haste
else
if equipSet[spell.english] then
equipSet = equipSet[spell.english]
end
if equipSet[spell.skill] then
equipSet = equipSet[spell.skill]
end
if equipSet[spell.type] then
equipSet = equipSet[spell.type]
end
end
elseif equipSet[spell.english] then
equipSet = equipSet[spell.english]
end
equip(equipSet)
end
function aftercast(spell,action)
if canceled then
canceled = false
return
else
if not spell.interrupted then
if spell.type == "WeaponSkill" then
send_command('wait 0.2;gs c TP')
elseif spell.english == "Repose" or spell.english == "Sleep II" then -- Repose & Sleep II Countdown --
send_command('wait 60;input /echo Sleep Effect: [WEARING OFF IN 30 SEC.];wait 15;input /echo Sleep Effect: [WEARING OFF IN 15 SEC.];wait 10;input /echo Sleep Effect: [WEARING OFF IN 5 SEC.]')
elseif spell.english == "Sleep" or spell.english == "Sleepga" then -- Sleep & Sleepga Countdown --
send_command('wait 30;input /echo Sleep Effect: [WEARING OFF IN 30 SEC.];wait 15;input /echo Sleep Effect: [WEARING OFF IN 15 SEC.];wait 10;input /echo Sleep Effect: [WEARING OFF IN 5 SEC.]')
elseif spell.english == "Banish III" then -- Banish III Countdown --
send_command('wait 35;input /echo Banish Effect: [WEARING OFF IN 10 SEC.]')
end
end
status_change(player.status)
end
end
function status_change(new,old)
check_equip_lock()
if Armor == 'PDT' then
equip(sets.PDT)
elseif buffactive["Sublimation: Activated"] then
equip(sets.Sublimation)
if Kiting == 'ON' then
equip({feet="Herald's Gaiters"})
end
elseif new == 'Engaged' then
equip(sets.Melee)
elseif new == 'Idle' then
equipSet = sets.Idle
if equipSet[IdleArray[IdleIndex]] then
equipSet = equipSet[IdleArray[IdleIndex]]
end
if buffactive['Reive Mark'] then -- Equip Arciela's Grace +1 During Reive --
equipSet = set_combine(equipSet,{neck="Arciela's Grace +1"})
end
if world.area:endswith('Adoulin') then
equipSet = set_combine(equipSet,{body="Councilor's Garb"})
end
equip(equipSet)
elseif new == 'Resting' then
equip(sets.Resting)
end
end
function buff_change(buff,gain)
buff = string.lower(buff)
if buff == "aftermath: lv.3" then -- AM3 Timer/Countdown --
if gain then
send_command('timers create "Aftermath: Lv.3" 180 down;wait 150;input /echo Aftermath: Lv.3 [WEARING OFF IN 30 SEC.];wait 15;input /echo Aftermath: Lv.3 [WEARING OFF IN 15 SEC.];wait 5;input /echo Aftermath: Lv.3 [WEARING OFF IN 10 SEC.]')
else
send_command('timers delete "Aftermath: Lv.3"')
add_to_chat(123,'AM3: [OFF]')
end
elseif buff == 'divine caress' then
DC = gain
elseif buff == 'weakness' then -- Weakness Timer --
if gain then
send_command('timers create "Weakness" 300 up')
else
send_command('timers delete "Weakness"')
end
end
if not midaction() then
status_change(player.status)
end
end
-- In Game: //gs c (command), Macro: /console gs c (command), Bind: gs c (command) --
function self_command(command)
if command == 'C1' then -- Enmity Toggle --
if Enmity == 'ON' then
Enmity = 'OFF'
add_to_chat(123,'Enmity Set: [OFF]')
else
Enmity = 'ON'
add_to_chat(158,'Enmity Set: [ON]')
end
status_change(player.status)
elseif command == 'C2' then -- Follow Toggle --
send_command('input /ta Bokura;input /lockon;wait .3;setkey numpad8 down;wait .3;setkey numpad7 down;wait .3;setkey numpad7 up;wait .3;setkey numpad8 up')
elseif command == 'C3' then -- Kiting Toggle --
if Kiting == 'ON' then
Kiting = 'OFF'
add_to_chat(123,'Kiting Set: [Unlocked]')
else
Kiting = 'ON'
add_to_chat(158,'Kiting Set: [Locked]')
end
status_change(player.status)
elseif command == 'C5' then -- Auto Update Gear Toggle --
status_change(player.status)
add_to_chat(158,'Auto Update Gear')
elseif command == 'C7' then
if Armor == 'PDT' then -- PDT Toggle --
Armor = 'None'
add_to_chat(123,'PDT Set: [Unlocked]')
else
Armor = 'PDT'
add_to_chat(158,'PDT Set: [Locked]')
end
status_change(player.status)
elseif command == 'C17' then -- Lock Main Weapon Toggle --
if Lock_Main == 'ON' then
Lock_Main = 'OFF'
add_to_chat(123,'Main Weapon: [Unlocked]')
else
Lock_Main = 'ON'
add_to_chat(158,'Main Weapon: [Locked]')
end
status_change(player.status)
elseif command == 'C8' then -- Distance Toggle --
if player.target.distance then
target_distance = math.floor(player.target.distance*10)/10
add_to_chat(158,'Distance: '..target_distance)
else
add_to_chat(123,'No Target Selected')
end
elseif command == 'C6' then -- Idle Toggle
IdleIndex = (IdleIndex % #IdleArray) + 1
add_to_chat(158,'Idle Set: '..IdleArray[IdleIndex])
status_change(player.status)
elseif command == 'TP' then
add_to_chat(158,'TP Return: '..tostring(player.tp))
elseif command:match('^SC%d$') then
send_command('//' .. sc_map[command])
end
end
function check_equip_lock() -- Lock Equipment Here --
if player.equipment.left_ring == "Warp Ring" or player.equipment.left_ring == "Capacity Ring" or player.equipment.right_ring == "Warp Ring" or player.equipment.right_ring == "Capacity Ring" then
disable('ring1','ring2')
elseif player.equipment.back == "Mecisto. Mantle" or player.equipment.back == "Aptitude Mantle +1" or player.equipment.back == "Aptitude Mantle" then
disable('back')
elseif Lock_Main == 'ON' then
disable('main','sub')
else
enable('main','sub','ring1','ring2','back')
end
end
function actualCost(originalCost)
if buffactive["Penury"] then
return originalCost*.5
elseif buffactive["Light Arts"] or buffactive["Addendum: White"] then
return originalCost*.9
elseif buffactive["Dark Arts"] or buffactive["Addendum: Black"] then
return originalCost*1.1
else
return originalCost
end
end
function degrade_spell(spell,degrade_array)
spell_index = table.find(degrade_array,spell.name)
if spell_index > 1 then
new_spell = degrade_array[spell_index - 1]
change_spell(new_spell,spell.target.raw)
add_to_chat(8,spell.name..' Canceled: ['..player.mp..'/'..player.max_mp..'MP::'..player.mpp..'%] Casting '..new_spell..' instead.')
end
end
function change_spell(spell_name,target)
cancel_spell()
send_command('//'..spell_name..' '..target)
end
function sub_job_change(newSubjob, oldSubjob)
select_default_macro_book()
end
function set_macro_page(set,book)
if not tonumber(set) then
add_to_chat(123,'Error setting macro page: Set is not a valid number ('..tostring(set)..').')
return
end
if set < 1 or set > 10 then
add_to_chat(123,'Error setting macro page: Macro set ('..tostring(set)..') must be between 1 and 10.')
return
end
if book then
if not tonumber(book) then
add_to_chat(123,'Error setting macro page: book is not a valid number ('..tostring(book)..').')
return
end
if book < 1 or book > 20 then
add_to_chat(123,'Error setting macro page: Macro book ('..tostring(book)..') must be between 1 and 20.')
return
end
send_command('@input /macro book '..tostring(book)..';wait .1;input /macro set '..tostring(set))
else
send_command('@input /macro set '..tostring(set))
end
end
function select_default_macro_book()
-- Default macro set/book
if player.sub_job == 'SCH' then
set_macro_page(4, 1)
elseif player.sub_job == 'BLM' then
set_macro_page(4, 1)
elseif player.sub_job == 'RDM' then
set_macro_page(4, 1)
elseif player.sub_job == 'DNC' then
set_macro_page(4, 1)
elseif player.sub_job == 'NIN' then
set_macro_page(4, 1)
else
set_macro_page(4, 1)
end
end
|
|