Jump to content


Photo

Quick lua question...


23 replies to this topic

#21 sdahlka

sdahlka

    Advanced Member

  • Members
  • PipPipPip
  • 324 posts

    Posted 29 May 2016 - 03:03 PM

    Sorry for the necro post. I tried saving this as a lua and load it but I can't get the toggle to work. Am I doing something wrong or has there been changes making this code invalid?

    ok is your file named Silt.lua

    and do you have this at the top of your file

    _addon.name = 'Silt'
    _addon.command = 'silt'

     

    and are you sure its loaded



    #22 alk

    alk

      Newbie

    • Members
    • Pip
    • 3 posts

      Posted 29 May 2016 - 06:29 PM

      No, I added those two lines though and the toggle is still not doing anything. It's named like you said and loads fine however. Just to be clear this is now the full content of my Silt.lua

       

      _addon.name = 'Silt'
      _addon.command = 'silt'
      
      silt = false
      windower.send_command('unbind !x')
      windower.send_command('bind !x lua silt Toggle')
      windower.send_command('alias sp lua silt')
      
      function freemyinv()
          while silt do
              windower.send_command('input /item "Silt Pouch" <me>')
              coroutine.sleep(1)
          end
      end
          
      windower.register_event('addon command', function(command)
          if command == 'Toggle' then
              silt = not silt
              windower.add_to_chat(7, "Auto Silt "..(silt and "Enabled" or "Disabled"))
              if silt then
                  freemyinv()
              end
          end
      end)
      


      #23 sdahlka

      sdahlka

        Advanced Member

      • Members
      • PipPipPip
      • 324 posts

        Posted 29 May 2016 - 09:50 PM


        windower.send_command('bind !x silt Toggle')



        #24 alk

        alk

          Newbie

        • Members
        • Pip
        • 3 posts

          Posted 29 May 2016 - 10:09 PM

          That did it, thank you very much sdahlka :)






          1 user(s) are reading this topic

          0 members, 1 guests, 0 anonymous users