View Single Post
08-24-15, 06:01 AM   #1
wrathdamage
A Murloc Raider
Join Date: Aug 2015
Posts: 4
Inserting lua into TMW

I am trying to make a code that i can put into a tmw snippet that will calculate starfires and wraths dps/sp
Then use a condition that will show starfire if it does more dps/sp than wrath

so far i have
Code:
sfgeneral = function ()
        name, rank, icon, castTime, minRange, maxRange, spellID = GetSpellInfo(2912);
        sfcasttime = castTime*.001;
        cpower= UnitPower("player", 8);
        edirection = GetEclipseDirection();
        if edirection == "moon" then sffem = (math.max(-100,math.min(100,105*math.sin(math.pi - math.asin(cpower/105) + math.pi/10 * sfcasttime))));
            elseif edirection == "sun" then sffem = (math.max(-100,math.min(100,105*math.sin(math.asin(cpower/105) + math.pi/10 * sfcasttime))));
            else sffem = (math.max(-100,math.min(100,105*math.sin(math.pi - math.asin(cpower/105) + math.pi/10 * sfcasttime))));
        end
        getmas= GetMasteryEffect()+30;
        sfdmg=224.6*(1+(((-1*(sffem))+100)/2/100*getmas)/100)/sfcasttime;
    end
sfgeneral();
print(sfdmg);
wgeneral = function ()
        name, rank, icon, castTime, minRange, maxRange, spellID = GetSpellInfo(5176);
        wcasttime = castTime*.001;
        cpower= UnitPower("player", 8);
        edirection = GetEclipseDirection();
        if edirection == "moon" then wfem = (math.max(-100,math.min(100,105*math.sin(math.pi - math.asin(cpower/105) + math.pi/10 * wcasttime))));
            elseif edirection == "sun" then wfem = (math.max(-100,math.min(100,105*math.sin(math.asin(cpower/105) + math.pi/10 * wcasttime))));
            else wfem = (math.max(-100,math.min(100,105*math.sin(math.pi - math.asin(cpower/105) + math.pi/10 * wcasttime))));
        end
        getmas= GetMasteryEffect()+30;
        wdmg=140.4*(1+(((wfem)+100)/2/100*getmas)/100)/wcasttime;
    end
wgeneral();
print (wdmg);
Which prints the correct dps/sp for both spells when run

But i don't understand how to make variables local and still have access to them
I also dont understand how to define in functions for conditions in TMW.CNDT.Env
as instructed to do so in TMW

Also i expect that my code is flawed as i only just started with lua

If anyone can help me make this work it would mean alot
I am really at a loss with this

Thanks in advance
Mentaur-Defias Brotherhood
  Reply With Quote