Item Search
     
BG-Wiki Search
Page 130 of 302 FirstFirst ... 80 120 128 129 130 131 132 140 180 ... LastLast
Results 2581 to 2600 of 6036

Thread: Gearswap Help Thread!     submit to reddit submit to twitter

  1. #2581
    Melee Summoner
    Join Date
    May 2014
    Posts
    38
    BG Level
    1
    FFXI Server
    Bismarck

    Quote Originally Posted by Motenten View Post
    This is a bit trickier. I never did build a solution to it, since I found that no matter what I was casting, I'd either never use the item in question, or would use it regardless of the arts. Thus I just ignored the per-arts gear and just set up gear sets with whatever was appropriate.

    I'd recommend putting more thought into whether you actually need such a distinction. If you can come up with a good use case, I'll see what sort of rules I can write up.
    After putting some thought into it, the enhancing effects from Savant's Gown +2 aren't necessary. The Dark Arts+20 from AF Gown & Light Arts+20 from AF Legs are very useful. The pants specifically adds +20 to enhancing skill, allowing my to reach 500+.

  2. #2582
    E. Body
    Join Date
    Nov 2008
    Posts
    2,048
    BG Level
    7
    FFXI Server
    Bismarck

    anyone know the code to have an idle set for town use?

  3. #2583
    Bagel
    Join Date
    Dec 2012
    Posts
    1,488
    BG Level
    6

    Quote Originally Posted by Snprphnx View Post
    anyone know the code to have an idle set for town use?
    to do it ware you would have to at lest heal once when you enter or leave a town its not so hard but if you want to have it done automatically thats harder

    (have to heal when entering or leaving town)
    Code:
    function status_change(new,old)
    	if new=='Idle' then
    		if S{"Ru'Lude Gardens","Upper Jeuno","Lower Jeuno","Port Jeuno","Port Windurst","Windurst Waters","Windurst Woods","Windurst Walls",
    			"Heavens Tower","Port San d'Oria","Northern San d'Oria","Southern San d'Oria","Port Bastok","Bastok Markets","Bastok Mines","Metalworks",
    			"Aht Urhgan Whitegate","Tavanazian Safehold","Nashmau","Selbina","Mhaura","Norg","Eastern Adoulin","Western Adoulin","Kazham"}:contains(world.area)then
    			equip(sets.city)
    		else
    			equip(sets.Idle)
    		end
    	end
    ...
    end

  4. #2584
    Sea Torques
    Join Date
    Jun 2012
    Posts
    570
    BG Level
    5
    FFXI Server
    Asura
    WoW Realm
    The Scryers

    hmm how does get_spell_recasts() work?...

    trying to make this to work, for my RDM Mule, to cast Haste 2 by default.. but if Haste 2 is on recast, then cast Haste
    Code:
    	if spell.english == "Haste" and player.main_job_level == 99 and  windower.ffxi.get_spell_recasts()[78] < 1 then
    		cancel_spell()
    		send_command('input /ma "Haste II" '..spell.target.raw..'')		
    	end
    have tried different ways..
    windower.ffxi.get_spell_recasts()[78]
    windower.ffxi.get_spell_recasts(78)
    get_spell_recasts()[78]
    get_spell_recasts(78)

  5. #2585
    Bagel
    Join Date
    Dec 2012
    Posts
    1,488
    BG Level
    6

    Quote Originally Posted by JSHidaka View Post
    hmm how does get_spell_recasts() work?...

    trying to make this to work, for my RDM Mule, to cast Haste 2 by default.. but if Haste 2 is on recast, then cast Haste
    Code:
    	if spell.english == "Haste" and player.main_job_level == 99 and  windower.ffxi.get_spell_recasts()[78] < 1 then
    		cancel_spell()
    		send_command('input /ma "Haste II" '..spell.target.raw..'')		
    	end
    have tried different ways..
    windower.ffxi.get_spell_recasts()[78]
    windower.ffxi.get_spell_recasts(78)
    get_spell_recasts()[78]
    get_spell_recasts(78)
    this is what i use

    Code:
    	if spell.english ~= 'Ranged' and spell.type ~= 'WeaponSkill' then
    		if spell.action_type == 'Ability' then
    			if spell and (windower.ffxi.get_ability_recasts()[spell.recast_id] > 0) then
    				cancel_spell()
    				return
    			elseif spell then
    				if spell.tp_cost > player.tp then
    					cancel_spell()
    					return
    				end
    			end
    		elseif spell.action_type == 'Magic' then
    			if spell and (windower.ffxi.get_spell_recasts()[spell.recast_id] > 0)then
    				cancel_spell()
    				return
    			elseif spell then
    				if spell.mp_cost > player.mp and not (buffactive['Manawell'] or buffactive['Manafont']) then
    					cancel_spell()
    					return true
    				end
    			end
    		end
    	end
    if there is less then a second left it will not work

  6. #2586
    Melee Summoner
    Join Date
    Apr 2008
    Posts
    46
    BG Level
    1
    FFXI Server
    Shiva

    Is there a way in gearswap or luacore to check if an item has charges left on it or is ready for use? I'm attempting to write a function into my gearswap to automatically use Vocation/Capacity Ring whenever the commitment buff is not active. This works great with Vocation because the timer is up when the buff wears off, but with Capacity Ring there is a 1 hour recharge rate. I've been scouring for similar projects and have had no luck.

    Can anyone who is a bit more experienced with gearswap/luacore give me some pointers?

    Here is what I have so far:

    Code:
    
    function jpRing()
        local expBuff = buffactive.Commitment
        if AUTORING == 'ON' then
            if not expBuff then
                equip(sets.VocationRing)
                if player.equipment.right_ring == "Vocation Ring" then
                 -- ideally add check for ring ready for use here --
                    disable("ring2")
                    add_to_chat(158,'Equipping Vocation Ring')
                    send_command('@wait 16; input /item "Vocation Ring" <me>;')
                else
                    equip(sets.CapacityRing)
                    if player.equipment.right_ring == "Capacity Ring" then
                        -- ideally add check for ring ready for use here ---
                        disable("ring2")
                        add_to_chat(158,'Equipping Capacity Ring')
                        send_command('@wait 16; input /item "Capacity Ring" <me>;')
                    else
                        add_to_chat(128,'Disabling Auto JP Ring, No Commitment Buff Ring Available')
                        AUTORING = 'OFF'
                        enable("ring2")
                    end
                end
            else
                if player.equipment.right_ring == "Vocation Ring" or player.equipment.right_ring == "Capacity Ring" then
                    enable("ring2")
                end
            end
        end
    end
    Thanks!

  7. #2587
    Bagel
    Join Date
    Dec 2012
    Posts
    1,488
    BG Level
    6

    Quote Originally Posted by Isindil View Post
    Is there a way in gearswap or luacore to check if an item has charges left on it or is ready for use? I'm attempting to write a function into my gearswap to automatically use Vocation/Capacity Ring whenever the commitment buff is not active. This works great with Vocation because the timer is up when the buff wears off, but with Capacity Ring there is a 1 hour recharge rate. I've been scouring for similar projects and have had no luck.

    Can anyone who is a bit more experienced with gearswap/luacore give me some pointers?

    Here is what I have so far:

    Code:
    
    function jpRing()
        local expBuff = buffactive.Commitment
        if AUTORING == 'ON' then
            if not expBuff then
                equip(sets.VocationRing)
                if player.equipment.right_ring == "Vocation Ring" then
                 -- ideally add check for ring ready for use here --
                    disable("ring2")
                    add_to_chat(158,'Equipping Vocation Ring')
                    send_command('@wait 16; input /item "Vocation Ring" <me>;')
                else
                    equip(sets.CapacityRing)
                    if player.equipment.right_ring == "Capacity Ring" then
                        -- ideally add check for ring ready for use here ---
                        disable("ring2")
                        add_to_chat(158,'Equipping Capacity Ring')
                        send_command('@wait 16; input /item "Capacity Ring" <me>;')
                    else
                        add_to_chat(128,'Disabling Auto JP Ring, No Commitment Buff Ring Available')
                        AUTORING = 'OFF'
                        enable("ring2")
                    end
                end
            else
                if player.equipment.right_ring == "Vocation Ring" or player.equipment.right_ring == "Capacity Ring" then
                    enable("ring2")
                end
            end
        end
    end
    Thanks!
    if its anyware its in the item ExtData but im not sure how to parse it

  8. #2588
    Melee Summoner
    Join Date
    Apr 2008
    Posts
    46
    BG Level
    1
    FFXI Server
    Shiva

    Made some changes so that it now detects if either ring is in inventory, or wardrobe. I'm still stuck with it spamming capacity ring when buff is down, but charge isn't ready yet. I tried viewing extdata in console, but it just returns weird characters. Can I export it to a file and view?

    Code:
    function jpRing()
        local expBuff = buffactive.Commitment
        if AUTORING == 'ON' then
            if not expBuff then
                if vocationRing() then
                    equip(sets.VocationRing)
                    if player.equipment.right_ring == "Vocation Ring" then
                        disable("ring2")
                        add_to_chat(158,'Equipping Vocation Ring')
                        send_command('@wait 16; input /item "Vocation Ring" <me>;')
                    end
                elseif capacityRing() then
                    equip(sets.CapacityRing)
                    if player.equipment.right_ring == "Capacity Ring" then
                        disable("ring2")
                        add_to_chat(158,'Equipping Capacity Ring')
                        send_command('@wait 16; input /item "Capacity Ring" <me>;')
                    end
                else
                    enable("ring2")
                    add_to_chat(128,'You do not have a Commitment Ring')
                end
            else
                if player.equipment.right_ring == "Vocation Ring" or player.equipment.right_ring == "Capacity Ring" then
                    enable("ring2")
                end
            end
        end
    end
    
    
    function capacityRing()
        local itemsInv = windower.ffxi.get_items().inventory
        local itemsWar = windower.ffxi.get_items().wardrobe
        i = 0
        while i < table.getn(itemsInv)
            do i = i + 1
            if itemsInv[i].id == 28546 then
                return true;
            end
        end
        i = 0
        while i < table.getn(itemsWar)
            do i = i + 1
            if itemsWar[i].id == 28546 then
                return true;
            end
        end
    end
    
    function vocationRing()
        local itemsInv = windower.ffxi.get_items().inventory
        local itemsWar = windower.ffxi.get_items().wardrobe
        i = 0
        while i < table.getn(itemsInv)
            do i = i + 1
            if itemsInv[i].id == 28563 then
                return true;
            end
        end
        i = 0
        while i < table.getn(itemsWar)
            do i = i + 1
            if itemsWar[i].id == 28563 then
                return true;
            end
        end
    end

  9. #2589
    Bagel
    Join Date
    Dec 2012
    Posts
    1,488
    BG Level
    6

    just so you know you can just use
    player.inventory[<item name here>]
    and
    player.wardrobe[<item name here>]
    it should be nil if you do not have the item and true if you do

    or
    player.inventory:contains(<item name here>)
    and
    player.wardrobe:contains(<item name here>)
    this should be true or false

    i use this when checking for nin tools
    Code:
    nin_tools ={
    		["Monomi: Ichi"] = {tool='Sanjaku-Tenugui',tool_bag="Toolbag (Sanja)",tool_bag_id=5417,uni_tool="Shikanofuda",uni_tool_bag="Toolbag (Shika)",uni_tool_bag_id=5868},
    		["Aisha: Ichi"] = {tool='Soshi',tool_bag="Toolbag (Soshi)",tool_bag_id=5734,uni_tool="Chonofuda",uni_tool_bag="Toolbag (Cho)",uni_tool_bag_id=5869},
    		["Katon: Ichi"] = {tool='Uchitake',tool_bag="Toolbag (Uchi)",tool_bag_id=5308,uni_tool="Inoshishinofuda",uni_tool_bag="Toolbag (Ino)",uni_tool_bag_id=5867},
    		["Katon: Ni"] = {tool='Uchitake',tool_bag="Toolbag (Uchi)",tool_bag_id=5308,uni_tool="Inoshishinofuda",uni_tool_bag="Toolbag (Ino)",uni_tool_bag_id=5867},
    		["Katon: San"] = {tool='Uchitake',tool_bag="Toolbag (Uchi)",tool_bag_id=5308,uni_tool="Inoshishinofuda",uni_tool_bag="Toolbag (Ino)",uni_tool_bag_id=5867},
    		["Hyoton: Ichi"] = {tool='Tsurara',tool_bag="Toolbag (Tsura)",tool_bag_id=5309,uni_tool="Inoshishinofuda",uni_tool_bag="Toolbag (Ino)",uni_tool_bag_id=5867},
    		["Hyoton: Ni"] = {tool='Tsurara',tool_bag="Toolbag (Tsura)",tool_bag_id=5309,uni_tool="Inoshishinofuda",uni_tool_bag="Toolbag (Ino)",uni_tool_bag_id=5867},
    		["Hyoton: San"] = {tool='Tsurara',tool_bag="Toolbag (Tsura)",tool_bag_id=5309,uni_tool="Inoshishinofuda",uni_tool_bag="Toolbag (Ino)",uni_tool_bag_id=5867},
    		["Huton: Ichi"] = {tool='Kawahori-Ogi',tool_bag="Toolbag (Kawa)",tool_bag_id=5310,uni_tool="Inoshishinofuda",uni_tool_bag="Toolbag (Ino)",uni_tool_bag_id=5867},
    		["Huton: Ni"] = {tool='Kawahori-Ogi',tool_bag="Toolbag (Kawa)",tool_bag_id=5310,uni_tool="Inoshishinofuda",uni_tool_bag="Toolbag (Ino)",uni_tool_bag_id=5867},
    		["Huton: San"] = {tool='Kawahori-Ogi',tool_bag="Toolbag (Kawa)",tool_bag_id=5310,uni_tool="Inoshishinofuda",uni_tool_bag="Toolbag (Ino)",uni_tool_bag_id=5867},
    		["Doton: Ichi"] = {tool='Makibishi',tool_bag="Toolbag (Maki)",tool_bag_id=5311,uni_tool="Inoshishinofuda",uni_tool_bag="Toolbag (Ino)",uni_tool_bag_id=5867},
    		["Doton: Ni"] = {tool='Makibishi',tool_bag="Toolbag (Maki)",tool_bag_id=5311,uni_tool="Inoshishinofuda",uni_tool_bag="Toolbag (Ino)",uni_tool_bag_id=5867},
    		["Doton: San"] = {tool='Makibishi',tool_bag="Toolbag (Maki)",tool_bag_id=5311,uni_tool="Inoshishinofuda",uni_tool_bag="Toolbag (Ino)",uni_tool_bag_id=5867},
    		["Raiton: Ichi"] = {tool='Hiraishin',tool_bag="Toolbag (Hira)",tool_bag_id=5312,uni_tool="Inoshishinofuda",uni_tool_bag="Toolbag (Ino)",uni_tool_bag_id=5867},
    		["Raiton: Ni"] = {tool='Hiraishin',tool_bag="Toolbag (Hira)",tool_bag_id=5312,uni_tool="Inoshishinofuda",uni_tool_bag="Toolbag (Ino)",uni_tool_bag_id=5867},
    		["Raiton: San"] = {tool='Hiraishin',tool_bag="Toolbag (Hira)",tool_bag_id=5312,uni_tool="Inoshishinofuda",uni_tool_bag="Toolbag (Ino)",uni_tool_bag_id=5867},
    		["Suiton: Ichi"] = {tool='Mizu-Deppo',tool_bag="Toolbag (Mizu)",tool_bag_id=5313,uni_tool="Inoshishinofuda",uni_tool_bag="Toolbag (Ino)",uni_tool_bag_id=5867},
    		["Suiton: Ni"] = {tool='Mizu-Deppo',tool_bag="Toolbag (Mizu)",tool_bag_id=5313,uni_tool="Inoshishinofuda",uni_tool_bag="Toolbag (Ino)",uni_tool_bag_id=5867},
    		["Suiton: San"] = {tool='Mizu-Deppo',tool_bag="Toolbag (Mizu)",tool_bag_id=5313,uni_tool="Inoshishinofuda",uni_tool_bag="Toolbag (Ino)",uni_tool_bag_id=5867},
    		["Utsusemi: Ichi"] = {tool='Shihei',tool_bag="Toolbag (Shihe)",tool_bag_id=5314,uni_tool="Shikanofuda",uni_tool_bag="Toolbag (Shika)",uni_tool_bag_id=5868},
    		["Utsusemi: Ni"] = {tool='Shihei',tool_bag="Toolbag (Shihe)",tool_bag_id=5314,uni_tool="Shikanofuda",uni_tool_bag="Toolbag (Shika)",uni_tool_bag_id=5868},
    		["Utsusemi: San"] = {tool='Shihei',tool_bag="Toolbag (Shihe)",tool_bag_id=5314,uni_tool="Shikanofuda",uni_tool_bag="Toolbag (Shika)",uni_tool_bag_id=5868},
    		["Jubaku: Ichi"] = {tool='Jusatsu',tool_bag="Toolbag (Jusa)",tool_bag_id=5315,uni_tool="Chonofuda",uni_tool_bag="Toolbag (Cho)",uni_tool_bag_id=5869},
    		["Jubaku: Ni"] = {tool='Jusatsu',tool_bag="Toolbag (Jusa)",tool_bag_id=5315,uni_tool="Chonofuda",uni_tool_bag="Toolbag (Cho)",uni_tool_bag_id=5869},
    		["Jubaku: San"] = {tool='Jusatsu',tool_bag="Toolbag (Jusa)",tool_bag_id=5315,uni_tool="Chonofuda",uni_tool_bag="Toolbag (Cho)",uni_tool_bag_id=5869},
    		["Hojo: Ichi"] = {tool='Kaginawa',tool_bag="Toolbag (Kagi)",tool_bag_id=5316,uni_tool="Chonofuda",uni_tool_bag="Toolbag (Cho)",uni_tool_bag_id=5869},
    		["Hojo: Ni"] = {tool='Kaginawa',tool_bag="Toolbag (Kagi)",tool_bag_id=5316,uni_tool="Chonofuda",uni_tool_bag="Toolbag (Cho)",uni_tool_bag_id=5869},
    		["Hojo: San"] = {tool='Kaginawa',tool_bag="Toolbag (Kagi)",tool_bag_id=5316,uni_tool="Chonofuda",uni_tool_bag="Toolbag (Cho)",uni_tool_bag_id=5869},
    		["Kurayami: Ichi"] = {tool='Sairui-Ran',tool_bag="Toolbag (Sai)",tool_bag_id=5317,uni_tool="Chonofuda",uni_tool_bag="Toolbag (Cho)",uni_tool_bag_id=5869},
    		["Kurayami: Ni"] = {tool='Sairui-Ran',tool_bag="Toolbag (Sai)",tool_bag_id=5317,uni_tool="Chonofuda",uni_tool_bag="Toolbag (Cho)",uni_tool_bag_id=5869},
    		["Kurayami: San"] = {tool='Sairui-Ran',tool_bag="Toolbag (Sai)",tool_bag_id=5317,uni_tool="Chonofuda",uni_tool_bag="Toolbag (Cho)",uni_tool_bag_id=5869},
    		["Dokumori: Ichi"] = {tool='Kodoku',tool_bag="Toolbag (Kodo)",tool_bag_id=5318,uni_tool="Chonofuda",uni_tool_bag="Toolbag (Cho)",uni_tool_bag_id=5869},
    		["Dokumori: Ni"] = {tool='Kodoku',tool_bag="Toolbag (Kodo)",tool_bag_id=5318,uni_tool="Chonofuda",uni_tool_bag="Toolbag (Cho)",uni_tool_bag_id=5869},
    		["Dokumori: San"] = {tool='Kodoku',tool_bag="Toolbag (Kodo)",tool_bag_id=5318,uni_tool="Chonofuda",uni_tool_bag="Toolbag (Cho)",uni_tool_bag_id=5869},
    		["Tonko: Ichi"] = {tool='Shinobi-Tabi',tool_bag="Toolbag (Shino)",tool_bag_id=5319,uni_tool="Shikanofuda",uni_tool_bag="Toolbag (Shika)",uni_tool_bag_id=5868},
    		["Tonko: Ni"] = {tool='Shinobi-Tabi',tool_bag="Toolbag (Shino)",tool_bag_id=5319,uni_tool="Shikanofuda",uni_tool_bag="Toolbag (Shika)",uni_tool_bag_id=5868},
    		["Tonko: San"] = {tool='Shinobi-Tabi',tool_bag="Toolbag (Shino)",tool_bag_id=5319,uni_tool="Shikanofuda",uni_tool_bag="Toolbag (Shika)",uni_tool_bag_id=5868},
    		["Gekka: Ichi"] = {tool='Ranka',tool_bag="Toolbag (Ranka)",tool_bag_id=6265,uni_tool="Shikanofuda",uni_tool_bag="Toolbag (Shika)",uni_tool_bag_id=5868},
    		["Yain: Ichi"] = {tool='Furusumi',tool_bag="Toolbag (Furu)",tool_bag_id=6266,uni_tool="Shikanofuda",uni_tool_bag="Toolbag (Shika)",uni_tool_bag_id=5868},
    		["Myoshu: Ichi"] = {tool='Kabenro',tool_bag="Toolbg. (Kaben)",tool_bag_id=5863,uni_tool="Shikanofuda",uni_tool_bag="Toolbag (Shika)",uni_tool_bag_id=5868},
    		["Yurin: Ichi"] = {tool='Jinko',tool_bag="Toolbag (Jinko)",tool_bag_id=5864,uni_tool="Chonofuda",uni_tool_bag="Toolbag (Cho)",uni_tool_bag_id=5869},
    		["Kakka: Ichi"] = {tool='Ryuno',tool_bag="Toolbag (Ryuno)",tool_bag_id=5865,uni_tool="Shikanofuda",uni_tool_bag="Toolbag (Shika)",uni_tool_bag_id=5868},
    		["Migawari: Ichi"] = {tool='Mokujin',tool_bag="Toolbag (Moku)",tool_bag_id=5866,uni_tool="Shikanofuda",uni_tool_bag="Toolbag (Shika)",uni_tool_bag_id=5868},
    		}
    if (player.inventory[nin_tools[spell.english].tool] == nil  or player.inventory[nin_tools[spell.english].uni_tool] == nil) 
    	and (player.inventory[nin_tools[spell.english].tool_bag] ~= nil or player.inventory[nin_tools[spell.english].uni_tool_bag] ~= nil) then

  10. #2590
    Sea Torques
    Join Date
    Nov 2007
    Posts
    694
    BG Level
    5
    FFXI Server
    Asura

    Do Mote's files have Elemental Obis for magical WS? Eg, Wildfire/Leaden Salute/Quick Draw.

    Still transitioning

    e: Found a link:
    http://www.ffxiah.com/forum/topic/41...ad/23/#2661945

  11. #2591
    Campaign
    Join Date
    Jul 2007
    Posts
    6,633
    BG Level
    8

    I found something strange in my lua.
    There's a function that gets executed and gives the correct (expected) result only from the second time onwards it gets executed, but produces a wrong result on the first time. I cannot understand why and maybe someone in here can help me see where the problem is.

    First of all, the function itself.
    Note that the add-to-chat lines are completely unnecessary, I added them temporarily to debug and see where the problem was.
    Spoiler: show
    Code:
    function set_dagger()
        if player.inventory["Izhiikoh"] or player.wardrobe["Izhiikoh"] then
            pugnale.name = "Izhiikoh"
    		add_to_chat(053,' ***** Pugnale impostato su Izhiikoh *****')
        elseif player.inventory["Atoyac"] or player.wardrobe["Atoyac"] then
            pugnale.name = "Atoyac"
    		add_to_chat(053,' ***** Pugnale impostato su Atoyac *****')
    	else
    		add_to_chat(053,' ***** Nessun pugnale trovato in inventario *****')
    
        end
    end



    This small custom function gets executed inside another small one which, itself, gets executed once every time the Lua is loaded (I put it at the end of get_sets) and each time subjob is changed.
    Spoiler: show
    Code:
    function set_idle_mode(sub_job)
    	if sub_job == 'NIN' or sub_job == 'DNC' then
    		Idlemode = 'dw'
    		dwmode = 'dw'
    		set_dagger()
    	else
    		Idlemode = 'normal'
    		dwmode = 'nodw'
    	end
    	add_to_chat(053,' ***** Swapped idle mode to: '..Idlemode)
    	equip(sets.Idle[Idlemode])
    end


    It also gets executed when I activate a manual command.
    Now, back to the issue.
    The first time this function gets executed (for instance after a //gs reload) it goes to the third branch of the "if". No Dagger found.
    Even if either (or both) of those daggers are in inventory or wardrobe.
    The second time onwards (if I swap subjob again or press the manual command) it works perfectly.
    Note: it's not a matter of inventory not loaded, it happens even if I've been in the zone for a long time.

    So, what could be the issue? I'm not getting it.

  12. #2592
    Bagel
    Join Date
    Dec 2012
    Posts
    1,488
    BG Level
    6

    Quote Originally Posted by Sechs View Post
    I found something strange in my lua.
    There's a function that gets executed and gives the correct (expected) result only from the second time onwards it gets executed, but produces a wrong result on the first time. I cannot understand why and maybe someone in here can help me see where the problem is.

    First of all, the function itself.
    Note that the add-to-chat lines are completely unnecessary, I added them temporarily to debug and see where the problem was.
    Spoiler: show
    Code:
    function set_dagger()
        if player.inventory["Izhiikoh"] or player.wardrobe["Izhiikoh"] then
            pugnale.name = "Izhiikoh"
    		add_to_chat(053,' ***** Pugnale impostato su Izhiikoh *****')
        elseif player.inventory["Atoyac"] or player.wardrobe["Atoyac"] then
            pugnale.name = "Atoyac"
    		add_to_chat(053,' ***** Pugnale impostato su Atoyac *****')
    	else
    		add_to_chat(053,' ***** Nessun pugnale trovato in inventario *****')
    
        end
    end



    This small custom function gets executed inside another small one which, itself, gets executed once every time the Lua is loaded (I put it at the end of get_sets) and each time subjob is changed.
    Spoiler: show
    Code:
    function set_idle_mode(sub_job)
    	if sub_job == 'NIN' or sub_job == 'DNC' then
    		Idlemode = 'dw'
    		dwmode = 'dw'
    		set_dagger()
    	else
    		Idlemode = 'normal'
    		dwmode = 'nodw'
    	end
    	add_to_chat(053,' ***** Swapped idle mode to: '..Idlemode)
    	equip(sets.Idle[Idlemode])
    end


    It also gets executed when I activate a manual command.
    Now, back to the issue.
    The first time this function gets executed (for instance after a //gs reload) it goes to the third branch of the "if". No Dagger found.
    Even if either (or both) of those daggers are in inventory or wardrobe.
    The second time onwards (if I swap subjob again or press the manual command) it works perfectly.
    Note: it's not a matter of inventory not loaded, it happens even if I've been in the zone for a long time.

    So, what could be the issue? I'm not getting it.
    its this player.inventory["Izhiikoh"] if you look in my above post i had tried this but it is not always 100% and can give nil errors
    try
    if player.inventory["Izhiikoh"] ~= nil or player.wardrobe["Izhiikoh"] ~= nil then
    and
    elseif player.inventory["Atoyac"] ~= nil or player.wardrobe["Atoyac"] ~= nil then

  13. #2593
    Campaign
    Join Date
    Jul 2007
    Posts
    6,633
    BG Level
    8

    Didn't see a behaviour change.
    I analyzed it a bit more though.

    1) When the Function is called from within the self_command, it seems to be always working
    2) When the function is called from within the set_idle_mode function it never works. The variable for some reason gets "stucked" on whatever value it already is. Which will be "no value" for a newly loaded Lua, or whatever value was set by point 1) last.

    I cannot understand this different behaviour, it's the same exact function... why does it act so strange? >.>
    Don't get me wrong it's not a big deal, it just gets on my nerves, I want to understand!

  14. #2594
    Bagel
    Join Date
    Dec 2012
    Posts
    1,488
    BG Level
    6

    Quote Originally Posted by Sechs View Post
    Didn't see a behaviour change.
    I analyzed it a bit more though.

    1) When the Function is called from within the self_command, it seems to be always working
    2) When the function is called from within the set_idle_mode function it never works. The variable for some reason gets "stucked" on whatever value it already is. Which will be "no value" for a newly loaded Lua, or whatever value was set by point 1) last.

    I cannot understand this different behaviour, it's the same exact function... why does it act so strange? >.>
    Don't get me wrong it's not a big deal, it just gets on my nerves, I want to understand!
    if the items are still loading that might be the cause

  15. #2595
    Campaign
    Join Date
    Jul 2007
    Posts
    6,633
    BG Level
    8

    If the items were still loading I think I would get a different behaviour, the behaviour of my custom function not recognizing an item there, when it actually is.
    But this happens even when items have been loaded, and we have the same exact function behaving correctly when called from a Self_command, but behaving incorrectly when called from within another function.
    This is really strange, it's the same fucking function, how can it work in one place but not in another? >.>

  16. #2596
    Bagel
    Join Date
    Dec 2012
    Posts
    1,488
    BG Level
    6

    try putting this as the first line in your item check function
    gearswap.refresh_globals()

    it refreshes all of gearswaps global tables but this will only work if you use player.inventory or player.wardrobe

  17. #2597
    Chram
    Join Date
    Sep 2007
    Posts
    2,526
    BG Level
    7
    FFXI Server
    Fenrir

    Quote Originally Posted by Sechs View Post
    If the items were still loading I think I would get a different behaviour, the behaviour of my custom function not recognizing an item there, when it actually is.
    But this happens even when items have been loaded, and we have the same exact function behaving correctly when called from a Self_command, but behaving incorrectly when called from within another function.
    This is really strange, it's the same fucking function, how can it work in one place but not in another? >.>
    Try putting in print_set(player.inventory, 'inventory') at the point where you're checking for the item (assuming the item is in inventory), and look at what that prints out.

  18. #2598
    Sea Torques
    Join Date
    Nov 2007
    Posts
    694
    BG Level
    5
    FFXI Server
    Asura

    Just got a zodiac ring, but I can't seem to get it to fire with QD.
    Spoiler: show

    Code:
    	sets.midcast.CorsairShot = {ammo=gear.QDbullet,
    		head="Pandinus Beret",neck="Stoicheion Medal",ear1="Novio Earring",ear2="Friomisi Earring",
    		body="Mirke Wardecors",hands="Nvrch. Gants +2",ring1="Acumen Ring",ring2=gear.ElementalRing,
    		back="Gunslinger's Cape",waist=gear.ElementalObi,legs="Shned. Tights +1",feet="Nvrch. Bottes +2"}
    Code:
    function job_precast(spell, action, spellMap, eventArgs)
        -- Check that proper ammo is available if we're using ranged attacks or similar.
        if spell.action_type == 'Ranged Attack' or spell.type == 'WeaponSkill' or spell.type == 'CorsairShot' then
            do_bullet_checks(spell, spellMap, eventArgs)
        end
    	
    	
         
        -- Define proper defaults for weaponskills that use obis
        if spell.english == 'Leaden Salute' then
            gear.default.obi_waist = "Light Belt"
    		gear.default.obi_ring = "Stormsoul Ring"
        elseif spell.english == 'Wildfire' then
            gear.default.obi_waist = "Aquiline Belt"
    		gear.default.obi_ring = "Stormsoul Ring"
    	elseif spell.type == 'CorsairShot' then
            gear.default.obi_waist = "Aquiline Belt"
    		gear.default.obi_ring = "Stormsoul Ring"
    	end
    
    	-- gear sets
    	if (spell.type == 'CorsairRoll' or spell.english == "Double-Up") and state.LuzafRing then
    		equip(sets.precast.LuzafRing)
    	elseif spell.type == 'CorsairShot' and state.CastingMode == 'Resistant' then
    		classes.CustomClass = 'Acc'
    	elseif spell.english == 'Fold' and buffactive['Bust'] == 2 then
    		if sets.precast.FoldDoubleBust then
    			equip(sets.precast.FoldDoubleBust)
    			eventArgs.handled = true
    		end
    	end
    end


    And here's a link to the full code: http://pastebin.com/mq6gU8a3

    gear.ElementalRing is Zodiac on the right day, correct? Trying to get it to trigger on IceShot but it doesn't seem to be working.


    e: It's working on Fire Shot in Fire Weather, but not on Ice Shot on Ice Day. Is it failing because I don't have the Ice obi, too?

    e: Thunder Shot on Thunder day works. I have Fire and Thunder obi, maybe it is the fact that I don't have an Ice obi.

  19. #2599
    Campaign
    Join Date
    Jul 2007
    Posts
    6,633
    BG Level
    8

    Quote Originally Posted by Motenten View Post
    Try putting in print_set(player.inventory, 'inventory') at the point where you're checking for the item (assuming the item is in inventory), and look at what that prints out.
    Thanks for this command, I could get some more insight on what is happening, which I'm going to describe now.

    1) Atoyac is already in inventory
    2) I swap job to BRD from /NIN to /DNC
    3) The two functions get launched, and it swaps my variable correctly to "Atoyac", print_set displays Atoyac in the items list.
    4) I try swapping job (launches the function automatically from within the other one) or using the self_command (launches the specific function only) and both seem to work.
    5) I take off my Atoyac and put it in my Satchel, and do the opposite with my Izhiikoh
    6) I try to swap job again between /NIN and /DNC
    7) The variable remains set to "Atoyac" and the print_set still displays Atoyac in my inventory, even if it's not there anymore. It doesn't display Izhiikoh instead.
    8) I try to repeat step 6) multiple times, but nothing changes
    9) I try to launch the function directly from the self_command, it correctly swaps the variable to Izhiikoh, Print_set displays Izhiikoh in the inventory list and no more Atoyac.


    Repeated this whole process a few times with the same results, I'm really puzzled.
    It seems like launching the dagger function from within that other function makes the inventory list get stuck on whatever the inventory was when the Lua file was loaded (???), but launching the function directly instead refreshes the inventory correctly?
    I think this is what's happening but I don't get why. Seems to be a Gearswap issue, not in my lua though.

  20. #2600
    Chram
    Join Date
    Sep 2007
    Posts
    2,526
    BG Level
    7
    FFXI Server
    Fenrir

    What actual GearSwap events (not your personal functions) are the base from which you call the function that may or may not find the dagger? sub_job_change? Which event works, and which event does not?

Page 130 of 302 FirstFirst ... 80 120 128 129 130 131 132 140 180 ... LastLast

Similar Threads

  1. Replies: 6547
    Last Post: 2014-07-08, 22:45