Jump to content


Photo

Gearswap help


    19 replies to this topic

    #1 Kenshi

    Kenshi

      Advanced Member

    • Members
    • PipPipPip
    • 334 posts

      Posted 19 May 2014 - 06:01 PM

      Hello!

       

      Is there a way on Gearswap to cancel the swaps if the spell or the ability is in recast? It keeps swapping to my precast sets if I hit the macro and recast in not up.

       

      thank you for the help!



      #2 Arcon

      Arcon

        Advanced Member

      • Windower Staff
      • 1189 posts
      • LocationMunich, Germany

      Posted 19 May 2014 - 08:09 PM

          if windower.ffxi.get_ability_recasts()[60] > 0 then
              cancel_spell()
          end

       

      The 60 in this case is from Windower/res/job_abilities.lua (or just abilities.lua, if you aren't on dev). In this case 60 refers to Steal.


      • Kenshi likes this

      #3 Kenshi

      Kenshi

        Advanced Member

      • Members
      • PipPipPip
      • 334 posts

        Posted 19 May 2014 - 09:49 PM

        Thank you! I will try it



        #4 Kenshi

        Kenshi

          Advanced Member

        • Members
        • PipPipPip
        • 334 posts

          Posted 19 May 2014 - 10:46 PM

          I had to add a return after cancel_spell() or it will swap me to precast set, but it worked pefectly, thx.

           

          btw is there a way to add multiple abilities in one rule or for spells like Elemental magic? or I have to do rule for every spell?



          #5 Kenshi

          Kenshi

            Advanced Member

          • Members
          • PipPipPip
          • 334 posts

            Posted 20 May 2014 - 12:22 AM

            after further testing it is preventing to other abilities and even magic to fire until the recast on the ability in the code gets to 0.



            #6 Byrth

            Byrth

              Advanced Member

            • Members
            • PipPipPip
            • 85 posts

              Posted 20 May 2014 - 12:00 PM

              Try this for a more general case:

              if spell.type == 'JobAbility' and windower.ffxi.get_ability_recasts()[spell.recast_id] > 0 then
                  cancel_spell()
              end
              

               

               

              Specifically for Steal:

              if spell.english == 'Steal' and windower.ffxi.get_ability_recasts()[60] > 0 then
                  cancel_spell()
              end
              

              • Kenshi likes this

              #7 Kenshi

              Kenshi

                Advanced Member

              • Members
              • PipPipPip
              • 334 posts

                Posted 20 May 2014 - 02:02 PM

                ok got  the abilities working, now Im trying to do it with spells but not working this is the code Im using

                if spell.type == 'BlackMagic' and windower.ffxi.get_spell_recasts()[spell.recast_id] > 0 then
                cancel_spell()
                end
                

                but it still swaps me, whats goin wrong? thank you!



                #8 Byrth

                Byrth

                  Advanced Member

                • Members
                • PipPipPip
                • 85 posts

                  Posted 20 May 2014 - 10:35 PM

                  Ah, you need to put "return" after cancel_spell() for all above examples.



                  #9 Kenshi

                  Kenshi

                    Advanced Member

                  • Members
                  • PipPipPip
                  • 334 posts

                    Posted 20 May 2014 - 11:28 PM

                    even with return its still not working, its swaps me to precast >midcast>aftercast sets, no idea why cause the abilities one is working perfectly. this is the full code

                     

                    function pretarget(spell)
                    	if spell.type == 'BlackMagic' and windower.ffxi.get_spell_recasts()[spell.recast_id] > 0 then
                        send_command('@input /echo '..spell.english..' not rdy!')
                    	cancel_spell()
                    	return
                    	elseif spell.type == 'JobAbility' and windower.ffxi.get_ability_recasts()[spell.recast_id] > 0 then
                        send_command('@input /echo '..spell.english..' not rdy!')
                    	cancel_spell()
                        return
                        end
                    end
                    

                    I have tried the code in precast function but still not working,



                    #10 Kenshi

                    Kenshi

                      Advanced Member

                    • Members
                    • PipPipPip
                    • 334 posts

                      Posted 21 May 2014 - 03:25 PM

                      Just noticed that for spells you need to use [spell.id] instead of [spell.recast_id]

                       

                      Working now!! thx Arcon and Byrth!



                      #11 Arcon

                      Arcon

                        Advanced Member

                      • Windower Staff
                      • 1189 posts
                      • LocationMunich, Germany

                      Posted 21 May 2014 - 03:48 PM

                      It should definitely be "recast_id", if it isn't, it's a bug and we need to fix it.



                      #12 Kenshi

                      Kenshi

                        Advanced Member

                      • Members
                      • PipPipPip
                      • 334 posts

                        Posted 21 May 2014 - 04:09 PM

                        the spell_recast.lua doesn't have a recast_id thats why it wasn't working



                        #13 Arcon

                        Arcon

                          Advanced Member

                        • Windower Staff
                        • 1189 posts
                        • LocationMunich, Germany

                        Posted 21 May 2014 - 04:40 PM

                        The id in there is the recast_id, that's the point of it. It should still work.



                        #14 Kenshi

                        Kenshi

                          Advanced Member

                        • Members
                        • PipPipPip
                        • 334 posts

                          Posted 21 May 2014 - 06:35 PM

                          If I use [spell.recast_id] I get the error "attempt to compare number with nil", if I use [spell.id] it works.

                           

                          thats with spells, for abilities it works ok with [spell.recast_id]



                          #15 sdahlka

                          sdahlka

                            Advanced Member

                          • Members
                          • PipPipPip
                          • 324 posts

                            Posted 30 May 2014 - 12:32 AM

                            If I use [spell.recast_id] I get the error "attempt to compare number with nil", if I use [spell.id] it works.

                             

                            thats with spells, for abilities it works ok with [spell.recast_id]

                            the reason your getting this is because weapon-skills and ranged do not have recast ids

                             

                            this is what i use

                             

                            function pretarget(spell)
                                if spell.name ~= 'Ranged' and spell.type ~= 'WeaponSkill' then
                                    if spell.action_type == 'Ability' then
                                        if spell and (windower.ffxi.get_ability_recasts()[spell.recast_id] >= 1) then
                                            cancel_spell()
                                            return
                                        end
                                    elseif spell.action_type == 'Magic' then
                                        if spell and (windower.ffxi.get_spell_recasts()[spell.recast_id] >= 1) then
                                            cancel_spell()
                                            return
                                        end
                                    end
                                end
                            end
                            function precast(spell)
                                if spell.name ~= 'Ranged' and spell.type ~= 'WeaponSkill' then
                                    if spell.action_type == 'Ability' then
                                        if spell and (windower.ffxi.get_ability_recasts()[spell.recast_id] >= 1) then
                                            cancel_spell()
                                            return
                                        end
                                    elseif spell.action_type == 'Magic' then
                                        if spell and (windower.ffxi.get_spell_recasts()[spell.recast_id] >= 1) then
                                            cancel_spell()
                                            return
                                        end
                                    end
                                end
                            end
                             


                            #16 sealorik

                            sealorik

                              Newbie

                            • Members
                            • Pip
                            • 3 posts

                              Posted 16 June 2014 - 04:03 PM

                              http://pastebin.com/V48U6Sz5

                               

                              lua19 attempt to call global 



                              #17 Byrth

                              Byrth

                                Advanced Member

                              • Members
                              • PipPipPip
                              • 85 posts

                                Posted 16 June 2014 - 05:09 PM

                                You probably don't define the update_pet_mode function.



                                #18 sealorik

                                sealorik

                                  Newbie

                                • Members
                                • Pip
                                • 3 posts

                                  Posted 16 June 2014 - 05:16 PM

                                  so would i remove it entirely and just use the

                                   

                                   
                                  -- Var to track the current pet mode.
                                  state.PetMode = 'Melee'
                                  update_pet_mode()
                                  end
                                   
                                  ??


                                  #19 Arcon

                                  Arcon

                                    Advanced Member

                                  • Windower Staff
                                  • 1189 posts
                                  • LocationMunich, Germany

                                  Posted 16 June 2014 - 06:14 PM

                                  Where did you get the file from? Your question cannot be answered as is, because we have no idea what you want. The function definition is corrupt. It looks like a copy/paste mistake.



                                  #20 sealorik

                                  sealorik

                                    Newbie

                                  • Members
                                  • Pip
                                  • 3 posts

                                    Posted 16 June 2014 - 06:22 PM

                                    it was a pup.lua that i moded into a bst but i'm fairly new to writing this type of files,

                                    https://github.com/K.../master/PUP.lua






                                    1 user(s) are reading this topic

                                    0 members, 1 guests, 0 anonymous users