Gearswap Support Thread

Language: JP EN DE FR
New Items
2018-08-14
users online
Forum » Windower » Support » Gearswap Support Thread
Gearswap Support Thread
First Page 2 3 ... 145 146
 Sylph.Subadai
Offline
Server: Sylph
Game: FFXI
user: Subadai
Posts: 171
By Sylph.Subadai 2018-11-25 19:36:52
Link | Quote | Reply
 
Asura.Alkk said: »
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/5E4FRJwM
I 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
Offline
Server: Asura
Game: FFXI
user: Alkai
Posts: 23
By Asura.Alkk 2018-11-25 20:55:55
Link | Quote | Reply
 
Bahamut.Ayasha said: »
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 :)
 Asura.Elizabet
Online
Server: Asura
Game: FFXI
user: Elizabet
Posts: 60
By Asura.Elizabet 2018-11-25 22:58:24
Link | Quote | Reply
 
how do I turn this:

Gearswap:
windower.send_command('Fun')

which does this in Game:
Elizabet: Fun

into the auto-translated:

Game:
Elizabet: (Fun)
Offline
Posts: 28
By Shichishito 2018-11-26 10:01:46
Link | Quote | Reply
 
Asura.Elizabet said: »
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
Offline
Posts: 28
By Shichishito 2018-11-26 10:41:35
Link | Quote | Reply
 
i want to check current active buffs against a dictionary in a loop each time the player gains a new buff/debuff.
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.
once the table collected all values i want to turn the table into a string so i can print it into party chat.
finally clear the table and the consequent string so its empty next time the player gets hit by a debuff.


full code:

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??
 Asura.Elizabet
Online
Server: Asura
Game: FFXI
user: Elizabet
Posts: 60
By Asura.Elizabet 2018-11-26 10:43:48
Link | Quote | Reply
 
Shichishito said: »
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
 Asura.Elizabet
Online
Server: Asura
Game: FFXI
user: Elizabet
Posts: 60
By Asura.Elizabet 2018-11-26 11:00:03
Link | Quote | Reply
 
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, ", "))..'!!')
Offline
Posts: 28
By Shichishito 2018-11-26 12:02:10
Link | Quote | Reply
 
Asura.Elizabet said: »
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
Offline
Server: Asura
Game: FFXI
user: Demmis
Posts: 893
By Asura.Chiaia 2018-11-26 20:45:40
Link | Quote | Reply
 
Shichishito said: »
*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
 Asura.Elizabet
Online
Server: Asura
Game: FFXI
user: Elizabet
Posts: 60
By Asura.Elizabet 2018-11-26 22:29:13
Link | Quote | Reply
 
I can confirm that table.concat() works. I used it with my table and it printed out as expected.

Derp, see post below.
 Asura.Elizabet
Online
Server: Asura
Game: FFXI
user: Elizabet
Posts: 60
By Asura.Elizabet 2018-11-26 22:42:42
Link | Quote | Reply
 
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" ?
Offline
Posts: 28
By Shichishito 2018-11-27 14:43:05
Link | Quote | Reply
 
Asura.Elizabet said: »
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:
Offline
Posts: 28
By Shichishito 2018-11-27 16:45:40
Link | Quote | Reply
 
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
Offline
Server: Carbuncle
Game: FFXI
user: dlsmd
Posts: 76
By Carbuncle.Kigensuro 2018-11-27 17:30:08
Link | Quote | Reply
 
Shichishito said: »
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
Offline
Posts: 28
By Shichishito 2018-11-27 21:04:28
Link | Quote | Reply
 
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:

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
Offline
Server: Carbuncle
Game: FFXI
user: dlsmd
Posts: 76
By Carbuncle.Kigensuro 2018-11-28 12:20:06
Link | Quote | Reply
 
Shichishito said: »
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
Offline
Posts: 28
By Shichishito 2018-11-28 12:38:17
Link | Quote | Reply
 
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
Offline
Server: Carbuncle
Game: FFXI
user: dlsmd
Posts: 76
By Carbuncle.Kigensuro 2018-11-28 20:08:14
Link | Quote | Reply
 
Shichishito said: »
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

Shichishito said: »
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
Offline
Posts: 28
By Shichishito 2018-11-29 18:45:24
Link | Quote | Reply
 
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
Offline
Server: Bismarck
Game: FFXI
user: SSJAV
By Bismarck.Uzugami 2018-12-09 23:46:29
Link | Quote | Reply
 
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?
First Page 2 3 ... 145 146
Log in to post.