|
Gearswap Support Thread
Server: Sylph
Game: FFXI
Posts: 184
By Sylph.Subadai 2018-11-25 19:36:52
Having an issue with my current corsair lua, can't for the life of me get Luzaf's ring to be used during Phantom rolls. I know it's a toggle and I make sure it's on but still doesn't work.
I've also tried without gearinfo and gearinfo ugs off.
Getting quite desperate, been looking into this for too many hours to mention.
https://pastebin.com/5E4FRJwMI had a look at a friend's lua and the only difference is his lua doesn't combine sets.precast.CorsairRoll with Luzaf's to make sets.precast.Luzaf, it is simply sets.precast.LuzafRing = {ring2="Luzaf's Ring"}. Strangely enough, Gearswap combines the sets itself anyway and equips sets.precast.CorsairRoll along with Luzaf's, even though that's not specified in the lua anywhere that I can find.
Also "Luzaf's Ring" is always capitalized in his lua, you have "Luzaf's ring" in there once. Shouldn't make a difference, but you never know.
The full lua is here if you want to take a look.
[+]
Asura.Alkk
Server: Asura
Game: FFXI
Posts: 38
By Asura.Alkk 2018-11-25 20:55:55
My guess is its line 699-702 causing the problem.
It may very well be equipping your Luzaf's ring during precast, but since you have it re-equip your normal COR roll set in post_precast, it will unequip the ring. A way around this would be to either remove the post precast check altogether, or alternatively you can delete line 258 (your normal COR Roll ring1). No need to have all 16 gear slots defined for rolls when only half of them have any affect. It will swap to idle/engaged/whatever set nearly immediately after the roll anyway.
Had already tried your 2nd suggestion but combined with your 1st it FINALLY works now, phew.. that's one less headache. Many thanks <3
Edit: Thank you Subadai also for taking the time :)
Server: Asura
Game: FFXI
Posts: 496
By Asura.Elizabet 2018-11-25 22:58:24
how do I turn this:
Gearswap:
windower.send_command('Fun')
which does this in Game:
Elizabet: Fun
into the auto-translated:
Game:
Elizabet: (Fun)
By Shichishito 2018-11-26 10:01:46
how do I turn this:
Gearswap:
windower.send_command('Fun')
which does this in Game:
Elizabet: Fun
into the auto-translated:
Game:
Elizabet: (Fun)
recently asked a similar question and somone replied that windower can't do autotranslate
By Shichishito 2018-11-26 10:41:35
i want to check current active buffs against a dictionary in a loop each time the player gains a new buff/debuff. Code if gain then
for key,value in ipairs(secondary_debuffs) do if one of the keys in the dictionary checks true against current buffs i want to insert the value for that key into a table. Code if key == buff then
current_debuffs_table = table.insert(current_debuffs_table, value)
end once the table collected all values i want to turn the table into a string so i can print it into party chat. Code current_debuffs_string = table.concat(current_debuffs_table, ", ")
send_command('input /p '..current_debuffs_string..'!!') finally clear the table and the consequent string so its empty next time the player gets hit by a debuff. Code current_debuffs = {}
current_debuffs_string = ""
end
full code: Code
function job_buff_change(buff, gain)
if state.Buff[buff] ~= nil then
state.Buff[buff] = gain
end
secondary_debuffs = {['poison'] = 'Poisoned',['curse'] = 'Cursed',['bind'] = 'Bound',['weight'] = 'Weighed down',
['stun'] = 'Stunned',['terror'] = 'Terrorized'}
local current_debuffs_table = {}
local current_debuffs_string = ""
if gain then
for key,value in ipairs(secondary_debuffs) do
if key == buff then
current_debuffs_table = table.insert(current_debuffs_table, value)
end
end
current_debuffs_string = table.concat(current_debuffs_table, ", ")
send_command('input /p '..current_debuffs_string..'!!')
current_debuffs = {}
current_debuffs_string = ""
end
end
the problem is it only prints "!!" as if the for loop doesn't add any values to the table or the if condition doesn't return true.
i checked wether buff returns a buff with "send_command('input /p '..buff..')" so the if condition should return true, why does the for loop not add any values to the table??
Server: Asura
Game: FFXI
Posts: 496
By Asura.Elizabet 2018-11-26 10:43:48
trying to write a addon that requires to know current ready and stratagem charges.
is it reasonable to assume that everyone is using kinematics BST / SCH luas or if they made custom ones, built upon kinematics ones?
I use my own SCH.lua, that is not using Kinematics or mote includes.
However could you not just implement the below function for your addon to get the number of strats?
Code
-- Gets the current number of available strategems based on the recast remaining and the level of the sch.
function get_current_strategem_count()
-- returns recast in seconds.
local allRecasts = windower.ffxi.get_ability_recasts()
local stratsRecast = allRecasts[231]
local maxStrats = math.floor(player.main_job_level + 10) / 20
-- assuming level 90+, if not 550JP replace 5*33 by 5*45 below
local fullRechargeTime = 5*33
local currentCharges = math.floor(maxStrats - maxStrats * stratsRecast / fullRechargeTime)
return currentCharges
end
Server: Asura
Game: FFXI
Posts: 496
By Asura.Elizabet 2018-11-26 11:00:03
I tried:
Code
windower.send_command('input /p '..tostring(table.concat(elements, ", "))..'!!')
Where elements is: Code elements = {'Ice', 'Air', 'Dark', 'Light', 'Earth', 'Lightning', 'Water', 'Fire'}
and it returned in pt chat:
(Elizabet) Ice, Air, Dark, Light, Earth, Lightning, Water, Fire!!
Try skipping the variable current_debuffs_string cast? and go for this directly: Code
windower.send_command('input /p '..tostring(table.concat(current_debuffs_table, ", "))..'!!')
By Shichishito 2018-11-26 12:02:10
Try skipping the variable current_debuffs_string cast? and go for this directly: Code
windower.send_command('input /p '..tostring(table.concat(current_debuffs_table, ", "))..'!!') Code function job_buff_change(buff, gain)
if state.Buff[buff] ~= nil then
state.Buff[buff] = gain
end
secondary_debuffs = {['poison'] = 'Poisoned',['curse'] = 'Cursed',['bind'] = 'Bound',['weight'] = 'Weighed down',
['stun'] = 'Stunned',['terror'] = 'Terrorized'}
local current_debuffs_table = {}
local current_debuffs_string = ""
if gain then
for key,value in ipairs(secondary_debuffs) do
if key == buff then
current_debuffs_table = table.insert(current_debuffs_table, value)
end
end
windower.send_command('input /p '..tostring(table.concat(current_debuffs_table, ", "))..'!!')
current_debuffs = {}
current_debuffs_string = ""
end
end
like this? still returns "!!".
i think "tostring()" only turns numbers (1, 2, 3..) into strings ("1","2","3"...) since i don't have any numbers in the dicitionary nor the table it probably doesn't do anything in this case.
does anyone know what lua version windower is using? are the functions "table.insert()" or "table.concat()" already supported with that version?
*edit* this (is this for windower4 or the windower5 beta?) states windower uses lua version 5.1 and the lua 5.1 manual also lists "table.concat (table [, sep [, i [, j]]])" under "5.5Table Manipulation"
so that can't be the error either.
i already figured the issue with sch stratagems/bst charges out, currently only that empty table gives me headaches.
Asura.Chiaia
VIP
Server: Asura
Game: FFXI
Posts: 1656
By Asura.Chiaia 2018-11-26 20:45:40
*edit* this (is this for windower4 or the windower5 beta?) states windower uses lua version 5.1 and the lua 5.1 manual also lists "table.concat (table [, sep [, i [, j]]])" under "5.5Table Manipulation" W4 Uses Lua 5.1 and that wiki you linked is for W4 also.
W5 uses LuaJIT and this is the wiki for it
Server: Asura
Game: FFXI
Posts: 496
By Asura.Elizabet 2018-11-26 22:29:13
I can confirm that table.concat() works. I used it with my table and it printed out as expected.
Derp, see post below.
Server: Asura
Game: FFXI
Posts: 496
By Asura.Elizabet 2018-11-26 22:42:42
To debug it you could do this:
Code
if gain then
windower.add_to_chat(211,'gain is true')
for key, value in ipairs(secondary_debuffs) do
windower.add_to_chat(211,'value is: '..tostring(value)) -- Is value any good
windower.add_to_chat(211,'key is: '..tostring(key)) -- is key any good
if key == buff then
windower.add_to_chat(211,'adding '..tostring(key)..' to table.') -- check if key is any good
current_debuffs_table = table.insert(current_debuffs_table, value)
end
end
windower.send_command('input /p '..tostring(table.concat(current_debuffs_table, ", "))..'!!')
current_debuffs = {}
current_debuffs_string = ""
end
Then see what happens...
Edit: just reading through but shouldn't your if check be:
if value == buff then
instead of
if key == buff then
As you are trying to match "buff" to one that's in the secondary_debuffs list represented by "value" ?
By Shichishito 2018-11-27 14:43:05
Edit: just reading through but shouldn't your if check be:
if value == buff then
instead of
if key == buff then
As you are trying to match "buff" to one that's in the secondary_debuffs list represented by "value" ?
i assumed key stands for the left side of a dictionary entry thats in the square brackets and value is on the right side. if i print '..buff..' into party chat it also posts the lower case words written in the square brackets on the left of the table entries.
thanks for suggesting the windower.add_to_chat line, should help with debuging. when run that code i get the usuall "!!" and a "gain is true", doesn't that mean the code doesn't even enter the for loop?
*edit* apparently lua ignores table entries that have anything other than a integer as a key. since all the key values in my table were strings and not integers it didn't loop thru any keys.
i think this makes it more complicated as i'd need at least 2 tables for each dictionary i made.
if i feed a ordinary table like this: Code secondary_debuffs_test = {'poison','curse','weight'}
it does iterate over all indexes/values but i get the error: Code Gearswap: Lua runtime error: GearSwap/flow.lua:346:
Gearswap has detected an error in the user function buff_change:
...Windower4//addons/libs/functions.lua:363: bad argument #1 to 'next' (table expected, got nil)[s][/s]
the functions the error points to: Code -- flow.lua
function user_pcall(str,...)
if user_env then
if type(user_env[str]) == 'function' then
bool,err = pcall(user_env[str],...)
if not bool then error('\nGearSwap has detected an error in the user function '..str..':\n'..err) end -- line 346
elseif user_env[str] then
msg.addon_msg(123,windower.to_shift_jis(tostring(str))..'() exists but is not a function')
end
end
end
-- functions.lua
table.it = function()
local it = function(t)
local key
return function()
key = next(t, key) -- line 363
return t[key], key
end
end
return function(t)
local meta = getmetatable(t)
if not meta then
return it(t)
end
local index = meta.__index
if index == table then
return it(t)
end
local fn = type(index) == 'table' and index.it or index(t, 'it') or it
return (fn == table.it and it or fn)(t)
end
end()
By Shichishito 2018-11-27 16:45:40
managed to fix the previous flow.lua/functions.lua error, i was referencing to the wrong table.
now i get a even worse error: Code
Gearswap: Lua runtime error: GearSwap/flow.lua:346:
Gearswap has detected an error in the user function buff_change:
not enough memory
causes a freeze for a couple of seconds, if i'm lucky it throws the memory error, if not the game crashes.
current code: Code
function job_buff_change(buff, gain)
if state.Buff[buff] ~= nil then
state.Buff[buff] = gain
end
secondary_debuffs_test = {'poison','curse','weight'}
[s][/s]
local current_debuffs_table = {}
local current_debuffs_string = ""
current_buff = buff
if gain then
for key, value in ipairs(secondary_debuffs_test) do
if value == current_buff then
current_debuffs_table = table.insert(secondary_debuffs_test, value)
end
end
current_debuffs_string = table.concat(current_debuffs_table, ", ")
send_command('input /p '..current_debuffs_string..'!!')
end
end
how can a for loop over a table with only 3 entries cause a not enough memory error!?
even had to edit out the windower.add_to_chat lines as those would always cause a crash.
*edit*
just found this thread. someone mentions that the motes "function job_buff_change(buff, gain)" is actually "buff_change(name,gain,buff_details)" in gearswap cause motes haven't been updated in a long while.
that means even if i'd get it running with my motes-inlcude it would probably lead to errors without motes-include, so its most likely best i leave it out of the addon.
thanks for the help though.
Carbuncle.Kigensuro
Server: Carbuncle
Game: FFXI
Posts: 93
By Carbuncle.Kigensuro 2018-11-27 17:30:08
Code
function job_buff_change(buff, gain)
if state.Buff[buff] ~= nil then
state.Buff[buff] = gain
end
secondary_debuffs_test = {'poison','curse','weight'}
[s][/s]
local current_debuffs_table = {}
local current_debuffs_string = ""
current_buff = buff
if gain then
for key, value in ipairs(secondary_debuffs_test) do
if value == current_buff then
current_debuffs_table = table.insert(secondary_debuffs_test, value)
end
end
current_debuffs_string = table.concat(current_debuffs_table, ", ")
send_command('input /p '..current_debuffs_string..'!!')
end
end this is pointless as for each job_buff_change is triggered you will only see one buff at a time unless you look through like this
Code function job_buff_change(buff, gain)
if state.Buff[buff] ~= nil then
state.Buff[buff] = gain
end
local secondary_debuffs_test = {'poison','curse','weight'}
local current_debuffs_table = T{}
if gain and then
if secondary_debuffs_test:contains(buff) then
table.append(current_debuffs_table, buff)
end
for _, value in ipairs(secondary_debuffs_test) do
if buffactive[value] and not current_debuffs_table:contains(value) then
current_debuffs_table = table.append(current_debuffs_table, value)
end
end
send_command('input /p '..table.concat(current_debuffs_table, ", ")..'!!')
end
end
this is also most likely what you want
By Shichishito 2018-11-27 21:04:28
Carbuncle.Kigensuro said: »this is also most likely what you want
its not what i want but gave me a idea.
does anyone know why the buffs.lua has multiple entries for the same debuffs?
examples: Code [9] = {id=9,en="curse",ja="呪い",enl="cursed",jal="呪い"},
[20] = {id=20,en="curse",ja="呪い",enl="cursed",jal="呪い"},
or
[2] = {id=2,en="sleep",ja="睡眠",enl="asleep",jal="睡眠"},
[19] = {id=19,en="sleep",ja="睡眠",enl="asleep",jal="睡眠"},
the entries are identical with the exception of the index number and the id.
also, how do i distinguish between regular debuffs and auras?
*edit*
in case anyone still cares, i think this is what i was after: Code function job_buff_change(buff, gain)
-- doom, charm, petrification, gradual petrification, sleep, paralysis, slow, -- remove 9 and 'curse', 5 and 'blindness', 3 and 'poison'
prim_db_ids = {15,17,7,18,19,4,13,9,5,3}
prim_db_strs = {'DOOMED','CHARMED','Petrified','gradually Petrifying','zZz','Paralyzed','Slowed','curse','blindness','poison'}
current_debuffs_table = T{}
-- provides a table with all current active buffs/debuffs
current_buff_ids_table = (windower.ffxi.get_player().buffs)
if gain then
for key_index, value_id in ipairs(current_buff_ids_table) do
for key_prim_db_ids, value_prim_db_ids in ipairs(prim_db_ids) do
if value_id == value_prim_db_ids then
for key_prim_db_strs, value_prim_db_strs in ipairs(prim_db_strs) do
if key_prim_db_strs == key_prim_db_ids then
current_debuffs_table = table.append(current_debuffs_table, value_prim_db_strs)
end
end
end
end
end
send_command('input /p '..table.concat(current_debuffs_table, ", ")..'!!')
end
end
for loops make my head spin... i guess i could have achieved the same thing without the 3rd nested for loop by making a copy of the prim_db_strs table and then use table.remove on it and finaly table.insert the removed parts into the current_debuffs_table, not sure which is more performance efficient.
with the current code i only have 2 issues:
- i don't understand what "T{}" does, although i noticed i could only use :contains on a table that had a S ("S{}") infront of it and i think i couldn't iterate in a for loop over a table with a S{} or a T{}.
- notepad doesn't recognize "table.append" as a method (doesn't color it differently) but it still works just like i'd expect table.insert to, however table.insert only returns the error "bad argument to the #1 to 'next' (table expected, got nil)
Carbuncle.Kigensuro
Server: Carbuncle
Game: FFXI
Posts: 93
By Carbuncle.Kigensuro 2018-11-28 12:20:06
does anyone know why the buffs.lua has multiple entries for the same debuffs?
...
the entries are identical with the exception of the index number and the id.
also, how do i distinguish between regular debuffs and auras? there is no difference except that it is caused by different things
1. the biggest issue with using buff_change is you only see one buff at a time
2. if you want to see a full list of buffs you are currently are afflicted with you need to check buffactive
3. most if not all debuffs are all lower case in spelling (except for Down debuffs) while all positive buffs are capitalized (at lest the first letter of every word)
--this is except for KO but if you have this buff you cant do anything anyways
By Shichishito 2018-11-28 12:38:17
Carbuncle.Kigensuro said: »there is no difference except that it is caused by different things so i also have to put the copies of the debuffs in my tables to make sure i'll catch them everytime? damn...
Carbuncle.Kigensuro said: »2. if you want to see a full list of buffs you are currently are afflicted with you need to check buffactive with the following line i got around "buffactive". Code current_buff_ids_table = (windower.ffxi.get_player().buffs)
you can conveniently iterate over that table in a for loop. (you need to use the buff/debuff ids, not the names)
Carbuncle.Kigensuro said: »3. most if not all debuffs are all lower case in spelling (except for Down debuffs) while all positive buffs are capitalized (at lest the first letter of every word) i mean debuff auras, not geo bubbles or auras from gear. how do i for example tell apart a regular doom from a doom caused by a aura (for example some urganite NM in delve or some caturae NM from geas-fete ru'aun have those)
Carbuncle.Kigensuro
Server: Carbuncle
Game: FFXI
Posts: 93
By Carbuncle.Kigensuro 2018-11-28 20:08:14
Carbuncle.Kigensuro said: »
there is no difference except that it is caused by different things
so i also have to put the copies of the debuffs in my tables to make sure i'll catch them everytime? damn... yes
Carbuncle.Kigensuro said: »
3. most if not all debuffs are all lower case in spelling (except for Down debuffs) while all positive buffs are capitalized (at lest the first letter of every word)
i mean debuff auras, not geo bubbles or auras from gear. how do i for example tell apart a regular doom from a doom caused by a aura (for example some urganite NM in delve or some caturae NM from geas-fete ru'aun have those) if it does not give you a debuff there is nothing you can do as it is only server side
however if you get a buff because of it you will see it
By Shichishito 2018-11-29 18:45:24
how can i set keybinds inside a addon? Code
function user_setup()
state.AutoRecasts = M{['description']='AutoRecasts', 'Off', 'Silent', 'Sound'}
state.ManualPostRecasts = M(false, 'ManualPostRecasts') -- to post recasts/charges on button push
state.AutoDebuffs = M{['description']='AutoDebuffs', 'Off', 'PrimarySilent', 'PrimarySound', 'AllSilent', 'AllSound'}
state.ManualPostDebuffs = M(false, 'ManualPostDebuffs') -- to post current afflicted debuffs on button push
send_command('bind !c gs c toggle AutoRecasts')
send_command('bind @c gs c toggle ManualPostRecasts')
send_command('bind !v gs c toggle AutoDebuffs')
send_command('bind @v gs c toggle ManualPostDebuffs')
end
function file_unload()
send_command('unbind !c')
send_command('unbind @c')
send_command('unbind !v')
send_command('unbind @v')
end
this usually works in my job.lua files but it doesn't in the addon.
no error message, just acts as if the bind commands never happened
Bismarck.Uzugami
Server: Bismarck
Game: FFXI
By Bismarck.Uzugami 2018-12-09 23:46:29
Trying to setup different sets for different types of spells; like when /blu, using SIRD set for spells like Geist Wall/Blank Gaze, and just a normal set for Cocoon or Jettatura.
Code
function job_setup()
blue_magic_maps = {}
blue_magic_maps.Enmity = S{
'Blank Gaze', 'Geist Wall', 'Jettatura', 'Soporific', 'Poison Breath', 'Blitzstrahl',
'Sheep Song', 'Chaotic Eye'
}
blue_magic_maps.Cure = S{
'Wild Carrot', 'Healing Breeze'
}
blue_magic_maps.Buff = S{
'Cocoon', 'Refueling'
sets.midcast['Blue Magic'] = {ammo="Staunch Tathlum",
head="Souveran Schaller +1",neck="Moonbeam Necklace",ear1="Friomisi Earring",ear2="Knightly Earring",
body="Souveran Cuirass +1",hands="Eschite Gauntlets",ring1="Moonbeam Ring",ring2="Defending Ring",
back={ name="Rudianos's Mantle", augments={'HP+60','Enmity+10','Spell interruption rate down-10%',}},waist="Flume Belt",legs="Carmine Cuisses +1",feet="Eschite Greaves"}
This is what get used for every BLU spell regardless, and adding another set for Enmity/Cure/Buff doesn't take. Is there a way/how would I go about making them independant?
Asura.Byrne
By Asura.Byrne 2018-12-11 21:58:59
https://www.youtube.com/watch?v=5s7mFeV1WIE
Here's a video tutorial for GearSwap basics...
Now I'm not a programmer myself, and there's lots I don't know, but at the same time I know this is one of the most requested videos anyone asks for so, here it is.
I was going to put this in a new topic, and I still may... I honestly wasn't sure whether it would be more appropriate to put it here or not... I'm open to making a new Topic with this if you guys think I should.
I'm open to feedback on that and the contents of the vid, and what I should do next. My first idea was maybe a more in-depth troubleshooting guide?
Any suggestions?
By Zerowone 2018-12-11 22:06:33
https://www.youtube.com/watch?v=5s7mFeV1WIE
Here's a video tutorial for GearSwap basics...
Now I'm not a programmer myself, and there's lots I don't know, but at the same time I know this is one of the most requested videos anyone asks for so, here it is.
I was going to put this in a new topic, and I still may... I honestly wasn't sure whether it would be more appropriate to put it here or not... I'm open to making a new Topic with this if you guys think I should.
I'm open to feedback on that and the contents of the vid, and what I should do next. My first idea was maybe a more in-depth troubleshooting guide?
Any suggestions?
Make three videos.
1 for gearswap itself and how versatile it is in of itself.
1 for mote luas since a lot of users seem to favor his sidecars.
1 for the Windower Resources.lua aka “Not all Job Ablities are Job Abilities”
Cerberus.Quintow
Server: Cerberus
Game: FFXI
Posts: 150
By Cerberus.Quintow 2018-12-21 04:39:55
Thinking about starting to job point my bard which has been in storage for years (no REMA). Attempting to setup basic 3 song lua before I do anything else. I am using Motes and changed daurdabla to terpander and songlimit from 2 to 1 in the setup functions but even when using the console shortcut command to dummy before my 3rd song my terpander never equips so I can never get the 3 song effect to go off. Although, the random gear I have on me like the Nahtirah Hat, Psystorm Earring, Lifestorm Earring, and Goading Belt do show as equipped during midcast so it appears it wants to work. Thus far, I have barely edited this lua from Kinematics. Like I said I changed the setup functions, placed a basic song fast cast set, an in town idle set, and placed eminent flute instead ghorn in the 3 main song categories. Anyone able to look at this and explain why it's not working? Thanks for your time.
lua without gear Code
-------------------------------------------------------------------------------------------------------------------
-- Setup functions for this job. Generally should not be modified.
-------------------------------------------------------------------------------------------------------------------
--[[
Custom commands:
ExtraSongsMode may take one of three values: None, Dummy, FullLength
You can set these via the standard 'set' and 'cycle' self-commands. EG:
gs c cycle ExtraSongsMode
gs c set ExtraSongsMode Dummy
The Dummy state will equip the bonus song instrument and ensure non-duration gear is equipped.
The FullLength state will simply equip the bonus song instrument on top of standard gear.
Simple macro to cast a dummy Daurdabla song:
/console gs c set ExtraSongsMode Dummy
/ma "Shining Fantasia" <me>
To use a Terpander rather than Daurdabla, set the info.ExtraSongInstrument variable to
'Terpander', and info.ExtraSongs to 1.
--]]
-- Initialization function for this job file.
function get_sets()
mote_include_version = 2
-- Load and initialize the include file.
include('Mote-Include.lua')
end
-- Setup vars that are user-independent. state.Buff vars initialized here will automatically be tracked.
function job_setup()
state.ExtraSongsMode = M{['description']='Extra Songs', 'None', 'Dummy', 'FullLength'}
state.Buff['Pianissimo'] = buffactive['pianissimo'] or false
-- For tracking current recast timers via the Timers plugin.
custom_timers = {}
end
-------------------------------------------------------------------------------------------------------------------
-- User setup functions for this job. Recommend that these be overridden in a sidecar file.
-------------------------------------------------------------------------------------------------------------------
-- Setup vars that are user-dependent. Can override this function in a sidecar file.
function user_setup()
state.OffenseMode:options('None', 'Normal')
state.CastingMode:options('Normal', 'Resistant')
state.IdleMode:options('Normal', 'PDT')
brd_daggers = S{'Izhiikoh', 'Vanir Knife', 'Atoyac', 'Aphotic Kukri', 'Sabebus'}
pick_tp_weapon()
-- Adjust this if using the Terpander (new +song instrument)
info.ExtraSongInstrument = 'Terpander'
-- How many extra songs we can keep from Daurdabla/Terpander
info.ExtraSongs = 1
-- Set this to false if you don't want to use custom timers.
state.UseCustomTimers = M(true, 'Use Custom Timers')
-- Additional local binds
send_command('bind ^` gs c cycle ExtraSongsMode')
send_command('bind !` input /ma "Chocobo Mazurka" <me>')
select_default_macro_book()
end
-- Called when this job file is unloaded (eg: job change)
function user_unload()
send_command('unbind ^`')
send_command('unbind !`')
end
-- Define sets and vars used by this job file.
function init_gear_sets()
end
-------------------------------------------------------------------------------------------------------------------
-- Job-specific hooks for standard casting events.
-------------------------------------------------------------------------------------------------------------------
-- 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 spell.type == 'BardSong' then
-- Auto-Pianissimo
if ((spell.target.type == 'PLAYER' and not spell.target.charmed) or (spell.target.type == 'NPC' and spell.target.in_party)) and
not state.Buff['Pianissimo'] then
local spell_recasts = windower.ffxi.get_spell_recasts()
if spell_recasts[spell.recast_id] < 2 then
send_command('@input /ja "Pianissimo" <me>; wait 1.5; input /ma "'..spell.name..'" '..spell.target.name)
eventArgs.cancel = true
return
end
end
end
end
-- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
function job_midcast(spell, action, spellMap, eventArgs)
if spell.action_type == 'Magic' then
if spell.type == 'BardSong' then
-- layer general gear on first, then let default handler add song-specific gear.
local generalClass = get_song_class(spell)
if generalClass and sets.midcast[generalClass] then
equip(sets.midcast[generalClass])
end
end
end
end
function job_post_midcast(spell, action, spellMap, eventArgs)
if spell.type == 'BardSong' then
if state.ExtraSongsMode.value == 'FullLength' then
equip(sets.midcast.Daurdabla)
end
state.ExtraSongsMode:reset()
end
end
-- Set eventArgs.handled to true if we don't want automatic gear equipping to be done.
function job_aftercast(spell, action, spellMap, eventArgs)
if spell.type == 'BardSong' and not spell.interrupted then
if spell.target and spell.target.type == 'SELF' then
adjust_timers(spell, spellMap)
end
end
end
-------------------------------------------------------------------------------------------------------------------
-- Job-specific hooks for non-casting events.
-------------------------------------------------------------------------------------------------------------------
-- Handle notifications of general user state change.
function job_state_change(stateField, newValue, oldValue)
if stateField == 'Offense Mode' then
if newValue == 'Normal' then
disable('main','sub','ammo')
else
enable('main','sub','ammo')
end
end
end
-------------------------------------------------------------------------------------------------------------------
-- User code that supplements standard library decisions.
-------------------------------------------------------------------------------------------------------------------
-- Called by the 'update' self-command.
function job_update(cmdParams, eventArgs)
pick_tp_weapon()
end
-- Modify the default idle set after it was constructed.
function customize_idle_set(idleSet)
if player.mpp < 51 then
idleSet = set_combine(idleSet, sets.latent_refresh)
end
return idleSet
end
-- Function to display the current relevant user state when doing an update.
function display_current_job_state(eventArgs)
display_current_caster_state()
eventArgs.handled = true
end
-------------------------------------------------------------------------------------------------------------------
-- Utility functions specific to this job.
-------------------------------------------------------------------------------------------------------------------
-- Determine the custom class to use for the given song.
function get_song_class(spell)
-- Can't use spell.targets:contains() because this is being pulled from resources
if set.contains(spell.targets, 'Enemy') then
if state.CastingMode.value == 'Resistant' then
return 'ResistantSongDebuff'
else
return 'SongDebuff'
end
elseif state.ExtraSongsMode.value == 'Dummy' then
return 'DaurdablaDummy'
else
return 'SongEffect'
end
end
-- Function to create custom buff-remaining timers with the Timers plugin,
-- keeping only the actual valid songs rather than spamming the default
-- buff remaining timers.
function adjust_timers(spell, spellMap)
if state.UseCustomTimers.value == false then
return
end
local current_time = os.time()
-- custom_timers contains a table of song names, with the os time when they
-- will expire.
-- Eliminate songs that have already expired from our local list.
local temp_timer_list = {}
for song_name,expires in pairs(custom_timers) do
if expires < current_time then
temp_timer_list[song_name] = true
end
end
for song_name,expires in pairs(temp_timer_list) do
custom_timers[song_name] = nil
end
local dur = calculate_duration(spell.name, spellMap)
if custom_timers[spell.name] then
-- Songs always overwrite themselves now, unless the new song has
-- less duration than the old one (ie: old one was NT version, new
-- one has less duration than what's remaining).
-- If new song will outlast the one in our list, replace it.
if custom_timers[spell.name] < (current_time + dur) then
send_command('timers delete "'..spell.name..'"')
custom_timers[spell.name] = current_time + dur
send_command('timers create "'..spell.name..'" '..dur..' down')
end
else
-- Figure out how many songs we can maintain.
local maxsongs = 2
if player.equipment.range == info.ExtraSongInstrument then
maxsongs = maxsongs + info.ExtraSongs
end
if buffactive['Clarion Call'] then
maxsongs = maxsongs + 1
end
-- If we have more songs active than is currently apparent, we can still overwrite
-- them while they're active, even if not using appropriate gear bonuses (ie: Daur).
if maxsongs < table.length(custom_timers) then
maxsongs = table.length(custom_timers)
end
-- Create or update new song timers.
if table.length(custom_timers) < maxsongs then
custom_timers[spell.name] = current_time + dur
send_command('timers create "'..spell.name..'" '..dur..' down')
else
local rep,repsong
for song_name,expires in pairs(custom_timers) do
if current_time + dur > expires then
if not rep or rep > expires then
rep = expires
repsong = song_name
end
end
end
if repsong then
custom_timers[repsong] = nil
send_command('timers delete "'..repsong..'"')
custom_timers[spell.name] = current_time + dur
send_command('timers create "'..spell.name..'" '..dur..' down')
end
end
end
end
-- Function to calculate the duration of a song based on the equipment used to cast it.
-- Called from adjust_timers(), which is only called on aftercast().
function calculate_duration(spellName, spellMap)
local mult = 1
if player.equipment.range == 'Daurdabla' then mult = mult + 0.3 end -- change to 0.25 with 90 Daur
if player.equipment.range == "Gjallarhorn" then mult = mult + 0.4 end -- change to 0.3 with 95 Gjall
if player.equipment.main == "Carnwenhan" then mult = mult + 0.1 end -- 0.1 for 75, 0.4 for 95, 0.5 for 99/119
if player.equipment.main == "Legato Dagger" then mult = mult + 0.05 end
if player.equipment.sub == "Legato Dagger" then mult = mult + 0.05 end
if player.equipment.neck == "Aoidos' Matinee" then mult = mult + 0.1 end
if player.equipment.body == "Aoidos' Hngrln. +2" then mult = mult + 0.1 end
if player.equipment.legs == "Mdk. Shalwar +1" then mult = mult + 0.1 end
if player.equipment.feet == "Brioso Slippers" then mult = mult + 0.1 end
if player.equipment.feet == "Brioso Slippers +1" then mult = mult + 0.11 end
if spellMap == 'Paeon' and player.equipment.head == "Brioso Roundlet" then mult = mult + 0.1 end
if spellMap == 'Paeon' and player.equipment.head == "Brioso Roundlet +1" then mult = mult + 0.1 end
if spellMap == 'Madrigal' and player.equipment.head == "Aoidos' Calot +2" then mult = mult + 0.1 end
if spellMap == 'Minuet' and player.equipment.body == "Aoidos' Hngrln. +2" then mult = mult + 0.1 end
if spellMap == 'March' and player.equipment.hands == 'Ad. Mnchtte. +2' then mult = mult + 0.1 end
if spellMap == 'Ballad' and player.equipment.legs == "Aoidos' Rhing. +2" then mult = mult + 0.1 end
if spellName == "Sentinel's Scherzo" and player.equipment.feet == "Aoidos' Cothrn. +2" then mult = mult + 0.1 end
if buffactive.Troubadour then
mult = mult*2
end
if spellName == "Sentinel's Scherzo" then
if buffactive['Soul Voice'] then
mult = mult*2
elseif buffactive['Marcato'] then
mult = mult*1.5
end
end
local totalDuration = math.floor(mult*120)
return totalDuration
end
-- Examine equipment to determine what our current TP weapon is.
function pick_tp_weapon()
if brd_daggers:contains(player.equipment.main) then
state.CombatWeapon:set('Dagger')
if S{'NIN','DNC'}:contains(player.sub_job) and brd_daggers:contains(player.equipment.sub) then
state.CombatForm:set('DW')
else
state.CombatForm:reset()
end
else
state.CombatWeapon:reset()
state.CombatForm:reset()
end
end
-- Function to reset timers.
function reset_timers()
for i,v in pairs(custom_timers) do
send_command('timers delete "'..i..'"')
end
custom_timers = {}
end
-- Select default macro book on initial load or subjob change.
function select_default_macro_book()
-- Default macro set/book
if player.sub_job == 'NIN' then
set_macro_page(2, 3)
elseif player.sub_job == 'RDM' then
set_macro_page(3, 3)
else
set_macro_page(1, 3)
end
end
windower.raw_register_event('zone change',reset_timers)
windower.raw_register_event('logout',reset_timers)
gear Code
--------------------------------------
-- Start defining the sets
--------------------------------------
-- Precast Sets
-- Fast cast sets for spells
sets.precast.FC = {head="Nahtirah Hat",ear2="Loquac. Earring",
hands="Gendewitha Gages",ring1="Prolix Ring",
back="Swith Cape +1",waist="Witful Belt",legs="Orvail Pants +1",feet="Chelona Boots +1"}
sets.precast.FC.Cure = set_combine(sets.precast.FC, {body="Heka's Kalasiris"})
sets.precast.FC.Stoneskin = set_combine(sets.precast.FC, {head="Umuthi Hat"})
sets.precast.FC['Enhancing Magic'] = set_combine(sets.precast.FC, {waist="Siegel Sash"})
sets.precast.FC.BardSong = {main="Kali",ammo="Sapience Orb",
head="Aoidos' Calot +1",neck="Baetyl Pendant",ear1="Aoidos' Earring",ear2="Loquac. Earring",
body="Inyanga Jubbah +2",hands="Leyline Gloves",ring1="Prolix Ring",ring2="Kishar Ring",
back="Swith Cape",legs="Aya. Cosciales +2",feet="Bihu Slippers"}
sets.precast.FC.Daurdabla = set_combine(sets.precast.FC.BardSong, {range=info.ExtraSongInstrument})
-- Precast sets to enhance JAs
sets.precast.JA.Nightingale = {feet="Bihu Slippers"}
sets.precast.JA.Troubadour = {body="Bihu Justaucorps"}
sets.precast.JA['Soul Voice'] = {legs="Bihu Cannions"}
-- Waltz set (chr and vit)
sets.precast.Waltz = {range="Gjallarhorn",
head="Nahtirah Hat",
body="Gendewitha Bliaut",hands="Buremte Gloves",
back="Kumbira Cape",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
-- Weaponskill sets
-- Default set for any weaponskill that isn't any more specifically defined
sets.precast.WS = {range="Gjallarhorn",
head="Nahtirah Hat",neck=gear.ElementalGorget,ear1="Bladeborn Earring",ear2="Steelflash Earring",
body="Bihu Justaucorps",hands="Buremte Gloves",ring1="Rajas Ring",ring2="K'ayres Ring",
back="Atheling Mantle",waist="Caudata Belt",legs="Brioso Cannions +1",feet="Gendewitha Galoshes"}
-- Specific weaponskill sets. Uses the base set if an appropriate WSMod version isn't found.
sets.precast.WS['Evisceration'] = set_combine(sets.precast.WS)
sets.precast.WS['Exenterator'] = set_combine(sets.precast.WS)
sets.precast.WS['Mordant Rime'] = set_combine(sets.precast.WS)
-- Midcast Sets
-- General set for recast times.
sets.midcast.FastRecast = {range="Angel Lyre",
head="Nahtirah Hat",ear2="Loquacious Earring",
body="Vanir Cotehardie",hands="Gendewitha Gages",ring1="Prolix Ring",
back="Swith Cape +1",waist="Goading Belt",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
-- Gear to enhance certain classes of songs. No instruments added here since Gjallarhorn is being used.
sets.midcast.Ballad = {legs="Aoidos' Rhing. +2"}
sets.midcast.Lullaby = {hands="Brioso Cuffs"}
sets.midcast.Madrigal = {head="Aoidos' Calot +2"}
sets.midcast.March = {hands="Aoidos' Manchettes +2"}
sets.midcast.Minuet = {body="Aoidos' Hongreline +2"}
sets.midcast.Minne = {}
sets.midcast.Paeon = {head="Brioso Roundlet +1"}
sets.midcast.Carol = {head="Aoidos' Calot +2",
body="Aoidos' Hongreline +2",hands="Aoidos' Manchettes +2",
legs="Aoidos' Rhing. +2",feet="Aoidos' Cothrn. +2"}
sets.midcast["Sentinel's Scherzo"] = {feet="Aoidos' Cothrn. +2"}
sets.midcast['Magic Finale'] = {neck="Wind Torque",waist="Corvax Sash",legs="Aoidos' Rhing. +2"}
sets.midcast.Mazurka = {range=info.ExtraSongInstrument}
-- For song buffs (duration and AF3 set bonus)
sets.midcast.SongEffect = {main="Legato Dagger",range="Eminent Flute",
head="Aoidos' Calot +2",neck="Aoidos' Matinee",ear2="Loquacious Earring",
body="Aoidos' Hongreline +2",hands="Aoidos' Manchettes +2",ring1="Prolix Ring",
back="Harmony Cape",waist="Corvax Sash",legs="Marduk's Shalwar +1",feet="Brioso Slippers +1"}
-- For song defbuffs (duration primary, accuracy secondary)
sets.midcast.SongDebuff = {main="Lehbrailg +2",sub="Mephitis Grip",range="Eminent Flute",
head="Brioso Roundlet +1",neck="Aoidos' Matinee",ear1="Psystorm Earring",ear2="Lifestorm Earring",
body="Aoidos' Hongreline +2",hands="Aoidos' Manchettes +2",ring1="Prolix Ring",ring2="Sangoma Ring",
back="Kumbira Cape",waist="Goading Belt",legs="Marduk's Shalwar +1",feet="Brioso Slippers +1"}
-- For song defbuffs (accuracy primary, duration secondary)
sets.midcast.ResistantSongDebuff = {main="Lehbrailg +2",sub="Mephitis Grip",range="Eminent Flute",
head="Brioso Roundlet +1",neck="Wind Torque",ear1="Psystorm Earring",ear2="Lifestorm Earring",
body="Brioso Justaucorps +1",hands="Aoidos' Manchettes +2",ring1="Prolix Ring",ring2="Sangoma Ring",
back="Kumbira Cape",waist="Demonry Sash",legs="Brioso Cannions +1",feet="Bokwus Boots"}
-- Song-specific recast reduction
sets.midcast.SongRecast = {ear2="Loquacious Earring",
ring1="Prolix Ring",
back="Harmony Cape",waist="Corvax Sash",legs="Aoidos' Rhing. +2"}
--sets.midcast.Daurdabla = set_combine(sets.midcast.FastRecast, sets.midcast.SongRecast, {range=info.ExtraSongInstrument})
-- Cast spell with normal gear, except using Daurdabla instead
sets.midcast.Daurdabla = {range=info.ExtraSongInstrument}
-- Dummy song with Daurdabla; minimize duration to make it easy to overwrite.
sets.midcast.DaurdablaDummy = {main="Izhiikoh",range=info.ExtraSongInstrument,
head="Nahtirah Hat",neck="Wind Torque",ear1="Psystorm Earring",ear2="Lifestorm Earring",
body="Brioso Justaucorps +1",hands="Aoidos' Manchettes +2",ring1="Prolix Ring",ring2="Sangoma Ring",
back="Swith Cape +1",waist="Goading Belt",legs="Gendewitha Spats",feet="Bokwus Boots"}
-- Other general spells and classes.
sets.midcast.Cure = {main="Arka IV",sub='Achaq Grip',
head="Gendewitha Caubeen",
body="Gendewitha Bliaut",hands="Bokwus Gloves",ring1="Ephedra Ring",ring2="Sirona's Ring",
legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
sets.midcast.Curaga = sets.midcast.Cure
sets.midcast.Stoneskin = {
head="Nahtirah Hat",
body="Gendewitha Bliaut",hands="Gendewitha Gages",
legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
sets.midcast.Cursna = {
neck="Malison Medallion",
hands="Hieros Mittens",ring1="Ephedra Ring"}
-- Sets to return to when not performing an action.
-- Resting sets
sets.resting = {main=gear.Staff.HMP,
body="Gendewitha Bliaut",
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=gear.Staff.PDT, sub="Mephitis Grip",range="Oneiros Harp",
head="Gendewitha Caubeen",neck="Wiglen Gorget",ear1="Bloodgem Earring",ear2="Loquacious Earring",
body="Gendewitha Bliaut",hands="Gendewitha Gages",ring1="Paguroidea Ring",ring2="Sangoma Ring",
back="Umbra Cape",waist="Flume Belt",legs="Nares Trews",feet="Aoidos' Cothurnes +2"}
sets.idle.PDT = {main=gear.Staff.PDT, sub="Mephitis Grip",range="Oneiros Harp",
head="Gendewitha Caubeen",neck="Wiglen Gorget",ear1="Bloodgem Earring",ear2="Loquacious Earring",
body="Gendewitha Bliaut",hands="Gendewitha Gages",ring1="Defending Ring",ring2="Sangoma Ring",
back="Umbra Cape",waist="Flume Belt",legs="Gendewitha Spats",feet="Aoidos' Cothurnes +2"}
sets.idle.Town = {main={ name="Kali", augments={'Mag. Acc.+15','String instrument skill +10','Wind instrument skill +10',}},
sub="Genbu's Shield",
ammo="Staunch Tathlum",
head="Aya. Zucchetto +2",
body="Councilor's Garb",
hands="Aya. Manopolas +2",
legs="Aya. Cosciales +2",
feet="Fili Cothurnes",
neck="Sanctity Necklace",
waist="Fucho-no-Obi",
left_ear="Infused Earring",
right_ear="Ethereal Earring",
left_ring="Warp Ring",
right_ring="Dim. Ring (Holla)",
back="Kumbira Cape",}
sets.idle.Weak = {main=gear.Staff.PDT,sub="Mephitis Grip",range="Oneiros Harp",
head="Gendewitha Caubeen",neck="Twilight Torque",ear1="Bloodgem Earring",
body="Gendewitha Bliaut",hands="Gendewitha Gages",ring1="Defending Ring",ring2="Sangoma Ring",
back="Umbra Cape",waist="Flume Belt",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
-- Defense sets
sets.defense.PDT = {main=gear.Staff.PDT,sub="Mephitis Grip",
head="Gendewitha Caubeen",neck="Twilight Torque",
body="Gendewitha Bliaut",hands="Gendewitha Gages",ring1="Defending Ring",ring2=gear.DarkRing.physical,
back="Umbra Cape",waist="Flume Belt",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
sets.defense.MDT = {main=gear.Staff.PDT,sub="Mephitis Grip",
head="Nahtirah Hat",neck="Twilight Torque",
body="Gendewitha Bliaut",hands="Gendewitha Gages",ring1="Defending Ring",ring2="Shadow Ring",
back="Engulfer Cape",waist="Flume Belt",legs="Bihu Cannions",feet="Gendewitha Galoshes"}
sets.Kiting = {feet="Aoidos' Cothurnes +2"}
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 = {range="Angel Lyre",
head="Nahtirah Hat",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
body="Bihu Justaucorps",hands="Buremte Gloves",ring1="Rajas Ring",ring2="K'ayres Ring",
back="Atheling Mantle",waist="Goading Belt",legs="Brioso Cannions +1",feet="Gendewitha Galoshes"}
-- Sets with weapons defined.
sets.engaged.Dagger = {range="Angel Lyre",
head="Nahtirah Hat",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
body="Bihu Justaucorps",hands="Buremte Gloves",ring1="Rajas Ring",ring2="K'ayres Ring",
back="Atheling Mantle",waist="Goading Belt",legs="Brioso Cannions +1",feet="Gendewitha Galoshes"}
-- Set if dual-wielding
sets.engaged.DW = {range="Angel Lyre",
head="Nahtirah Hat",neck="Asperity Necklace",ear1="Dudgeon Earring",ear2="Heartseeker Earring",
body="Bihu Justaucorps",hands="Buremte Gloves",ring1="Rajas Ring",ring2="K'ayres Ring",
back="Atheling Mantle",waist="Goading Belt",legs="Brioso Cannions +1",feet="Gendewitha Galoshes"}
Also, I have noticed if I start casting a 2nd song before the 1st song casting bar is not fully gone I will cast the 2nd song without a instrument (doesn't seem 100% replicable so IDK).
Server: Phoenix
Game: FFXI
Posts: 32
By Phoenix.Latravant 2018-12-22 05:26:56
i'm having trouble with my keybinds. i'm trying to use them on my thf but theyre not working, i used the thf file in the gearswap file and the only thing i changed was the equipment. my blu keybinds work. when i hit f11 it just makes my screen go dark/brighter. when i use them on blu it switches between gear sets.
Bismarck.Xurion
Server: Bismarck
Game: FFXI
Posts: 694
By Bismarck.Xurion 2018-12-22 06:40:34
Phoenix.Latravant said: »i'm having trouble with my keybinds. i'm trying to use them on my thf but theyre not working, i used the thf file in the gearswap file and the only thing i changed was the equipment. my blu keybinds work. when i hit f11 it just makes my screen go dark/brighter. when i use them on blu it switches between gear sets. My guess is you're seeing a bind shadowing another on a key. You can have the following on a Q key bind:
Code
//bind q input /echo q bind triggered
//bind %q input /echo %q bind triggered
The % sign tells the bind to not execute when Q is pressed if you're currently typing text into the text input (the main one where you type messages in /say or /party).
I can't remember which takes precedence, but one of them does.
By Dsuza 2018-12-22 09:07:04
Too many characters.
By Dsuza 2018-12-22 09:09:44
Too many characters.
Just looking for someone to explain this addon a bit for me. It looks like it is an alternative to Spellcast.
Is it going to be replacing Spellcast? In which ways is it better or worse. I don't know any programming but I've slowly learned more and more about spellcast and the 'language' used in gearswap is confusing to me.
It says it uses packets so it potentially could be more detectable? but does that also eliminate any lag that spellcast may encounter?
I plan on redoing my PUP xml to include pet casting sets thanks to the new addon petschool. I'm just not sure if it's worth it to just wait until gearswap gets more popular or to go ahead and do it in spellcast.
If anyone could give me more info I'd greatly appreciate it.
|
|