Jump to content


Photo

Trust checklist script

trust

    2 replies to this topic

    #1 Zubis

    Zubis

      Newbie

    • Members
    • Pip
    • 2 posts

      Posted 15 November 2015 - 12:09 AM

      Inspired by this thread recently I attempted to write a script to list all trusts a character had. However res.spells:type('Trust') is always 0.

       

      Listing total spells and total white magic works fine (listing 514 and 143 respectively as of 15-Nov-2015).

       

      Any ideas?

       

      res = require('resources')
      
      windower.add_to_chat(24, "+----------------------------------------+")
      windower.add_to_chat(24, "   Simple Trust Spell Checklist by Zubis  ")
      windower.add_to_chat(24, "+----------------------------------------+")
      	 
      total_spells = res.spells
      total_whitemagic = res.spells:type('WhiteMagic')
      total_trust = res.spells:type('Trust')
      
      windower.add_to_chat(24, 'Total Spells: ' .. #total_spells)	 
      windower.add_to_chat(24, 'Total White Magic: ' .. #total_whitemagic)	 
      windower.add_to_chat(55, 'Total Trust: ' .. #total_trust)	
      

       



      #2 Arcon

      Arcon

        Advanced Member

      • Windower Staff
      • 1189 posts
      • LocationMunich, Germany

      Posted 15 November 2015 - 07:34 AM

      The problem lies with the # operator. Overloading it is not implemented for Lua 5.1, which we happen to be using. Instead of #foo you need to be using foo:length(), that should work.



      #3 Zubis

      Zubis

        Newbie

      • Members
      • Pip
      • 2 posts

        Posted 15 November 2015 - 12:53 PM

        Yeah that did it, thanks!

         

        Missing 11 trusts ._.






        1 user(s) are reading this topic

        0 members, 1 guests, 0 anonymous users