Jump to content


Photo

RuneMeNow


    2 replies to this topic

    #1 Hagenige

    Hagenige

      Newbie

    • Members
    • Pip
    • 3 posts

      Posted 12 January 2017 - 08:52 PM

      Hi everyone. I have no scripting experience. There, I said it.

      I am, however trying to learn and decided to start with lua.

       

      I play runefencer and geomancer in 11, and decided my first and second attempts at addons would be for those. 

      I have a working Rune fencer addon called RuneMeNow. 

       

      What it does is let's you select what you're "RuneMeNow" rune of choice is, along with a matching bar element spell

       

      Then, you only need to macro 2 commands on your macrobar,  a rune one, and a bar one.(instead of 8 rune and 6 bar element ones)

       

      It may not be 100% needed , but it was an idea, and an excuse to start lua. My question is this. The code itself, seems quite long for such a simple action, (so many if statements). 

       

      Does anyone have an idea of how to shrink this down? and maybe an explanation of how for a noob scripter so that I can understand it, and implement it in the GeoMeNow i'm in the process of creating? because so far... the geo one has around 450 lines of code and almost all of it is if statements.  

       

       

      Thank you in advance. Attached is the RuneMeNow code. Use if you want, and thanks for any help.

       

       

       

      Attached Files



      #2 trv

      trv

        Advanced Member

      • Members
      • PipPipPip
      • 34 posts

        Posted 14 January 2017 - 08:34 PM

        You can use a table.

        map = {
            fire = {element = 'Ignis', barele = 'Barblizzard'},
            earth...
            water...
            ...
        }
        

        You'd assign your element variable a little differently:

        if command and map[command] then
            element = map[command].element
            ...
        end
        


        #3 Hagenige

        Hagenige

          Newbie

        • Members
        • Pip
        • 3 posts

          Posted 15 January 2017 - 04:52 AM

          Thank you so very much for the information trv. This has helped me create a smaller addon, as well as VASTLY reducing the size of my geo version. Much appreciation. /bow

           

          Download file has been updated with the newest version.






          1 user(s) are reading this topic

          0 members, 1 guests, 0 anonymous users