Jump to content


Photo

Follow detection (bug?) windower.ffxi.get_player().follow_index


    3 replies to this topic

    #1 Sammeh

    Sammeh

      Member

    • Members
    • PipPip
    • 24 posts

      Posted 16 January 2017 - 02:30 AM

      In my gearswap lua I was trying to determine if I was running or following someone - to pause and re-cast.  Then - keep running again.

       

      I don't want to re-invent the wheel - so if this is already made let me know.. but the problem I'm having here is specifically in the windower.ffxi.get_player().follow_index.   

       

      If I have something on auto-follow - that is valid.  If I don't have something on follow - it's 'nil'.

       

      If I simply auto-run after a follow - then it has the index of the last person following (regardless if I'm following that index or not).   Shouldn't it be nil upon follow cancel and stay that way until I start following something again?

       

       

      Recreation steps: 

       

      Stopped: 

       

      print(windower.ffxi.get_player().follow_index)  == nil

       

      /follow (character)

      print(windower.ffxi.get_player().follow_index)  == 1502

       

      stop following character

      print(windower.ffxi.get_player().follow_index)  == nil

       

      autorun anywhere random

      print(windower.ffxi.get_player().follow_index)  == 1502

       

      Doesn't even reset on zone.

       

       

       

      Anyway otherwise this is what I'm starting up:  (part of precast in Gearswap)

      	if type(windower.ffxi.get_player().autorun) == 'table' and spell.action_type == 'Magic' then 
      		windower.add_to_chat(3,'Currently auto-running - stopping to cast spell')
      		windower.ffxi.run(false)
      		autorun = 1
      		print(windower.ffxi.get_player().follow_index)
      		if windower.ffxi.get_player().follow_index then
      			print("Following - figuring this out")
      			last_follow_target = windower.ffxi.get_player().follow_index
      			windower.ffxi.follow()
      			follow = 1
      		end
      		cancel_spell()
      		send_command('wait 1; input /ma '..spell.name)
      		return
      	end
      

       

      then in after_cast

       

      check_run_status()
      
      function check_run_status()
      	if follow == 1 then
      		windower.ffxi.follow(last_follow_target)
      		follow = 0
      		return
      	end
      	if autorun == 1 then 
      		windower.ffxi.run()
      		autorun = 0
      	end
      end
      

       

       

       



      #2 Sammeh

      Sammeh

        Member

      • Members
      • PipPip
      • 24 posts

        Posted 16 January 2017 - 02:38 AM

        By the way I just randomly am testing if I'm on-follow based on the follow_index().  Is there any better way to test if I'm on follow?



        #3 Sammeh

        Sammeh

          Member

        • Members
        • PipPip
        • 24 posts

          Posted 16 January 2017 - 02:56 AM

          ok - sorry to ramble.. continued testing.

           

          Apparently

           

          "windower.ffxi.follow()" by itself seems to not do much of anything

           

          simply "windower.ffxi.run(false)" stops running.. then if you auto-run it automatically re-engages follow on target.    It doesn't seem that the "windower.ffxi.follow()" actually stops following???

           

          -Sam



          #4 Sammeh

          Sammeh

            Member

          • Members
          • PipPip
          • 24 posts

            Posted 16 January 2017 - 11:34 AM

            Ok - last bit of rambling.  (off topic of the windower.ffxi.follow - but was the original intent/goal of the script.)

             

            Resetting Goal:  To be able to pause when auto-running to cast a spell; then continue auto-running when complete.  Really useful for a drag-along mule, but also quite useful in Kiting scenarios.

             

            My problem with the original code snipit I wrote - was that i was canceling the spell, then sending a wait 1; /ma (spell)    -   This assumed 'shortcuts' addon; as well if the target were something other than what Shortcuts recognized, it wouldn't be a replica.   So I already had code around to send the spell via packets so i could track actual targets etc - but that didn't allow me to work because gearswap specifically blocks the 'coroutine.sleep' function.   I didn't realize Gearswap had a cast_delay(#seconds) function built-in - so this did all the proper delay for me and not needing to re-send the actual casting packet.

             

            So anyway - final code snipit:

            (Inside of PRECAST)

            	if type(windower.ffxi.get_player().autorun) == 'table' and spell.action_type == 'Magic' then 
            
            		windower.add_to_chat(3,'Currently auto-running - stopping to cast spell')
            
                    windower.ffxi.run(false)
                    windower.ffxi.follow()
            
            		autorun = 1
            
            		cast_delay(1)
            
            		return
            
            	end
            

             

            Inside of aftercast:

            check_run_status()
            
            function check_run_status()
            
            	if autorun == 1 then 
            
            		windower.ffxi.run()
            
            		autorun = 0
            
            	end
            
            end
            





            1 user(s) are reading this topic

            0 members, 1 guests, 0 anonymous users