Jump to content


Photo

Simple addon to filter text


    8 replies to this topic

    #1 Tantalus

    Tantalus

      Newbie

    • Members
    • Pip
    • 4 posts

      Posted 22 May 2015 - 10:37 PM

      I'd like to filter out the 

      "Unable to use job ability"

      "Time left"

      "not enough tp"

       

      yada yada yada cause it gets really annoying

       

      got this so far

       

       

       

      require('sets')
      
      
      filter = S{
          '* does not have enough *',
          'Unable to use *',
          '* Left: *',
          '* can only use that command during *'
      
      
      }
      
      
      windower.register_event('incoming text', function(text)
          for match in filter:it() do
              return windower.wc_match(text, match)
          end
      end)
       

       

       
       
      Credit: Arcon
       
      But it only filters out the "Can only use command during battle" 
       
      What could i modify to make it filter the higher level text as well?


      #2 Arcon

      Arcon

        Advanced Member

      • Windower Staff
      • 1189 posts
      • LocationMunich, Germany

      Posted 23 May 2015 - 01:08 AM

      What do you mean by higher level text? And do you mean that it does not filter out the other entries in there?

       

      It can actually be simplified a bit more:
       

      require('sets')
       
      filter = S{
          '* does not have enough *',
          'Unable to use *',
          '* Left: *',
          '* can only use that command during *',
      }
       
      windower.register_event('incoming text', function(text)
          return filter:any(windower.wc_match+{text})
      end)

      • modena and Tantalus like this

      #3 Tantalus

      Tantalus

        Newbie

      • Members
      • Pip
      • 4 posts

        Posted 24 May 2015 - 02:05 AM

        That works perfectly thank you! for some reason the way I had it before didn't work but this does o_O



        #4 modena

        modena

          Member

        • Members
        • PipPip
        • 28 posts

          Posted 09 August 2015 - 10:12 PM

          It's difficult to read anything while doing a CP party so I've been using something along these lines. This is much nicer than how I was doing it, so I'll gladly adopt this. I assume this is also undetectable by SE?

           

          Is there a way to restrict this filter to only work with particular zones? ie; Woh Gates, Yorcia Weald (U) etc.



          #5 Iryoku

          Iryoku

            Advanced Member

          • Windower Staff
          • 488 posts

            Posted 10 August 2015 - 09:37 AM

            I assume this is also undetectable by SE?

             
            Yes, this is client-side only.
             
             

            Is there a way to restrict this filter to only work with particular zones? ie; Woh Gates, Yorcia Weald (U) etc.

             
            Something like this should do the trick:
            require('sets')
             
            filter = S{
                -- filter strings here ...
            }
            
            zones = S{
                273, -- Woh Gates
                264, -- Yorcia Weald [U]
            }
             
            windower.register_event('incoming text', function(text)
                return zones:contains(windower.ffxi.get_info().zone)
                    and filter:any(windower.wc_match+{text})
            end)


            #6 modena

            modena

              Member

            • Members
            • PipPip
            • 28 posts

              Posted 11 August 2015 - 01:18 AM

              You are a life saver! I was trying to work it out using zone:match earlier and had failed ; ;

               

              Thank you for the help! It's nice to filter out all this junk that SE won't let us do normally



              #7 darkguardian

              darkguardian

                Newbie

              • Members
              • Pip
              • 2 posts

                Posted 12 April 2016 - 09:47 PM

                require('sets')
                 
                filter = S{
                    	'* が足りない *', --* does not have enough *
                    	'* 使うことができない', --Unable to use *
                    	'* 残り *',  --* Left: *
                    	'* はコマンドを実行できない *', --* can only use that command during *
                }
                 
                windower.register_event('incoming text', function(text)
                    	return filter:any(windower.wc_match+{text})
                end)
                

                Hello everyone!

                 

                Can somebody tell me how i can make this code work in japanese environment?



                #8 Iryoku

                Iryoku

                  Advanced Member

                • Windower Staff
                • 488 posts

                  Posted 13 April 2016 - 07:16 AM

                  The incoming text event is passed strings in Shift_JIS encoding. So you either need to make sure your filter strings are in Shift_JIS, or convert the game text to your file's encoding.



                  #9 darkguardian

                  darkguardian

                    Newbie

                  • Members
                  • Pip
                  • 2 posts

                    Posted 13 April 2016 - 10:31 AM

                    Thank you Iryoku!

                    I saved file as Shift_JIS and it worked! (^-^)






                    1 user(s) are reading this topic

                    0 members, 1 guests, 0 anonymous users