PE LUA Help menu

User Tag List

Thread: PE LUA Help

Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Tiger23078001's Avatar Member
    Reputation
    1
    Join Date
    Mar 2014
    Posts
    36
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PE LUA Help

    I'm looking for some help making some LUA functions for my warlock profile. Looking to do two things:

    Have a function that maintains a list of buffs (trinkets spell IDs, profession buffs, things like that), and another on that returns how many of said buffs the player has at any given time. This would allow me to use chaos bolt/shadowburn properly without having to code each buff into the PE rotation.

    Any help appreciated!

    PE LUA Help
  2. #2
    ProbablyEngine's Avatar Contributor Lead ProbablyEngine Dev CoreCoins Purchaser
    Reputation
    160
    Join Date
    Mar 2008
    Posts
    64
    Thanks G/R
    0/0
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Due to some annoying limitations in Lua and the design of PE (but mostly limitations in Lua), this isn't really possible.

    I did create a modification to PE to try this out and it doesn't work well, memory leaks all over the place.

  3. #3
    pcmdxx's Avatar Member
    Reputation
    1
    Join Date
    Sep 2012
    Posts
    46
    Thanks G/R
    2/0
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    snapshot your stats on pull / before and check for changes infight

  4. #4
    Tiger23078001's Avatar Member
    Reputation
    1
    Join Date
    Mar 2014
    Posts
    36
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by phelpsben View Post
    Due to some annoying limitations in Lua and the design of PE (but mostly limitations in Lua), this isn't really possible.

    I did create a modification to PE to try this out and it doesn't work well, memory leaks all over the place.
    Maybe I'm wording what I need wrong because there used to be a profile I used on the PE forums (I forget the author) that had exactly what I'm looking for. It was for destruction warlock and had a function.lua file that had two things in it. one was a list of all the proc spell IDs and another function that returned a value of how many of those buffs the player had. I was able to use that in my profiles for chaos bolt/shadowburn

  5. #5
    InternetExplorer's Avatar Contributor
    Reputation
    136
    Join Date
    Sep 2007
    Posts
    420
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So you want to have a table with a list of buffs, then use the table to track how many of the buffs the player currently has active? Or did I misunderstand
    Last edited by InternetExplorer; 08-26-2014 at 03:34 PM.

  6. #6
    Tiger23078001's Avatar Member
    Reputation
    1
    Join Date
    Mar 2014
    Posts
    36
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes. Here is how I would have used it in PE. Maybe that will help with what I'm after:

    Code:
    { "116858", { -- Chaos Bolt
    			"haveBuff(1),
    			"target.health > 20",
    			"player.embers >= 20"}
    		},
    
    
    { "116858", { -- Chaos Bolt
    			"haveBuff(2)",
    			"target.health > 20",
    			"player.embers >= 10"}
    		},
    Last edited by Tiger23078001; 08-26-2014 at 03:51 PM. Reason: error

  7. #7
    Soapbox's Avatar Legendary Founder of Soapbox Rotations

    CoreCoins Purchaser Authenticator enabled
    Reputation
    743
    Join Date
    Nov 2012
    Posts
    986
    Thanks G/R
    1118/364
    Trade Feedback
    61 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Function:

    PHP Code:
    function UnitBuffID(unitspellfilter)
        if 
    not unit or unit == nil or not UnitExists(unitthen 
            
    return false 
        end
        
    if spell then 
            spell 
    GetSpellInfo(spell
        else 
            return 
    false 
        end
        
    if filter then 
            
    return UnitBuff(unitspellnilfilter
        else 
            return 
    UnitBuff(unitspell
        
    end
    end

    ProbablyEngine
    .condition.register("buffs",function()
    local Procs 0
    local Buff1 
    UnitBuffID("player"012345
    local Buff2 UnitBuffID("player"678910
        if 
    Buff1 then
            Procs 
    Procs 1
            
    else
            
    Procs Procs
        end
        
    if Buff2 then
            Procs 
    Procs 1
            
    else
            
    Procs Procs
        end
    return Procs
    end

    Call:
    PHP Code:

    {"Chaos Bolt""player.buffs > 1" }, 

    I wouldn't make a table unless you run an update to purge it. This is probably the easiest way to achieve what you're looking for. You can even go into detail and compare the duration of the buff with the cast time of chaos bolt itself.
    Last edited by Soapbox; 08-26-2014 at 03:59 PM.

  8. #8
    Tiger23078001's Avatar Member
    Reputation
    1
    Join Date
    Mar 2014
    Posts
    36
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Soapbox View Post
    Function:

    PHP Code:
    function UnitBuffID(unitspellfilter)
        if 
    not unit or unit == nil or not UnitExists(unitthen 
            
    return false 
        end
        
    if spell then 
            spell 
    GetSpellInfo(spell
        else 
            return 
    false 
        end
        
    if filter then 
            
    return UnitBuff(unitspellnilfilter
        else 
            return 
    UnitBuff(unitspell
        
    end
    end

    ProbablyEngine
    .condition.register("buffs",function()
    local Procs 0
    local Buff1 
    UnitBuffID("player"012345
    local Buff2 UnitBuffID("player"678910
        if 
    Buff1 then
            Procs 
    Procs 1
            
    else
            
    Procs Procs
        end
        
    if Buff2 then
            Procs 
    Procs 1
            
    else
            
    Procs Procs
        end
    return Procs
    end

    Call:
    PHP Code:

    {"Chaos Bolt""player.buffs > 1" }, 

    I wouldn't make a table unless you run an update to purge it. This is probably the easiest way to achieve what you're looking for. You can even go into detail and compare the duration of the buff with the cast time of chaos bolt itself.
    With this I'd have to have all list all of my spell IDs as variables in the function though?

  9. #9
    Soapbox's Avatar Legendary Founder of Soapbox Rotations

    CoreCoins Purchaser Authenticator enabled
    Reputation
    743
    Join Date
    Nov 2012
    Posts
    986
    Thanks G/R
    1118/364
    Trade Feedback
    61 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Tiger23078001 View Post
    With this I'd have to have all list all of my spell IDs as variables in the function though?
    Which is easy. You just have to do it, hell I will do it for you. You can't make it check your buffs, identify which are temporary, identify which are beneficial etc without doing a little work yourself. I spelled them out so you can see which ones I accounted for.


    Code:
    local Jade, _, _, _, _, _, JadeEndTime = UnitBuffID("player", 104993) 
    local Yulon, _, _, _, _, _, YulonEndTime = UnitBuffID("player", 128985)
    local Lightweave, _, _, _, _, _, LightweaveEndTime = UnitBuffID("player", 125487) 
    local PotJadeSerpent, _, _, _, _, _, PotJadeSerpentEndTime = UnitBuffID("player", 105702) 
    local CosmosTrinket, _, _, _, _, _, CosmosTrinketEndTime = UnitBuffID("player", 126577) 
    local FlashFrozenTrinket, _, _, _, _, _, FlashFrozenTrinketEndTime = UnitBuffID("player", 126478) 
    local ShockChargerTrinket, _, _, _, _, _, ShockChargerTrinketEndTime = UnitBuffID("player", 136082) 
    local WushoolayTrinket, _, _, _, _, _, WushoolayTrinketEndTime = UnitBuffID("player", 138786) 
    local ChayeEssenceTrinket, _, _, _, _, _, ChayeEssenceTrinketEndTime = UnitBuffID("player", 139134) 
    local HydraTrinket, _, _, _, _, _, HydraTrinketEndTime = UnitBuffID("player", 138898) 
    local PurifiedImmerseusTrinket, _, _, _, _, _, PurifiedImmerseusTrinketEndTime = UnitBuffID("player", 146046) 
    local KardrisTrinket, _, _, _, _, _, KardrisTrinketEndTime = UnitBuffID("player", 148906) 
    local DarkSoul, _, _, _, _, _, DarkSoulEndTime = UnitBuffID("player", 113858) 
    local FrenziedCrystalTrinket, _, _, _, _, _, FrenziedCrystalTrinketEndTime = UnitBuffID("player", 148897) 
    local BlackBloodTrinket, _, _, _, _, _, BlackBloodTrinketEndTime = UnitBuffID("player", 146184) 
    local SkullBanner, _, _, _, _, _, SkullBannerEndTime = UnitBuffID("player", 114206) 
    local TierBonus, _, _, _, _, _, TierBonusEndTime = UnitBuffID("player", 145164) 
    local Dominance, _, _, _, _, _, DominanceEndTime = UnitBuffID("player", 126705)
    Also, you can give certain buffs that you add, more of a priority, so you aren't blowing chaos bolts on a smaller proc. Will allow you to cast a chaos bolt on either one big buff, a combination of smaller buffs etc

    Code:
    if Yulon then 
    	Procs = Procs + 1
    				else
    	Procs = Procs
    end
    if Lightweave then
    	Procs = Procs + 0.3
    				else
    	Procs = Procs
    end
    Last edited by Soapbox; 08-26-2014 at 05:36 PM.

  10. #10
    Tiger23078001's Avatar Member
    Reputation
    1
    Join Date
    Mar 2014
    Posts
    36
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, I see what you're doing. So when WoD comes out and I want to add new buffs I would add the following into the function (assuming PE still functions in WoD:

    PHP Code:
    local WoDBuff_____WoDBuffEndTime UnitBuffID("player"XXXXXXX
    if 
    WoDBuff then 
        Procs 
    Procs 1
                    
    else
        
    Procs Procs
    end 

  11. #11
    Soapbox's Avatar Legendary Founder of Soapbox Rotations

    CoreCoins Purchaser Authenticator enabled
    Reputation
    743
    Join Date
    Nov 2012
    Posts
    986
    Thanks G/R
    1118/364
    Trade Feedback
    61 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Tiger23078001 View Post
    Ok, I see what you're doing. So when WoD comes out and I want to add new buffs I would add the following into the function (assuming PE still functions in WoD:

    {snip}
    You got it

  12. #12
    Tiger23078001's Avatar Member
    Reputation
    1
    Join Date
    Mar 2014
    Posts
    36
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you very much!

    Is it possible to expand that same function to prevent PE from casting CB if the buff duration will end before the cast completes?

  13. #13
    Soapbox's Avatar Legendary Founder of Soapbox Rotations

    CoreCoins Purchaser Authenticator enabled
    Reputation
    743
    Join Date
    Nov 2012
    Posts
    986
    Thanks G/R
    1118/364
    Trade Feedback
    61 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Tiger23078001 View Post
    Thank you very much!

    Is it possible to expand that same function to prevent PE from casting CB if the buff duration will end before the cast completes?
    just add a line under where you check for the buff, comparing the spells cast time, chaos bolt in this case, with the buff duration. and if it is less than or equal to, + some milsecs for lag then return the Proc = Proc + 1 etc

  14. #14
    Tiger23078001's Avatar Member
    Reputation
    1
    Join Date
    Mar 2014
    Posts
    36
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Soapbox View Post
    just add a line under where you check for the buff, comparing the spells cast time, chaos bolt in this case, with the buff duration. and if it is less than or equal to, + some milsecs for lag then return the Proc = Proc + 1 etc
    Ok, how do I get the cast time for a certain spell so I can setup the variable in the function?

    Once I have that is this how I would implement?

    PHP Code:
    ProbablyEngine.condition.register("haveBuffs",function()
    local Procs 0
    local chaosBoltCastTime 
    SpellCastTime(116858)
    local Beserk_____BeserkEndTime UnitBuffID("player"33702)

        if 
    Beserk then
            Procs 
    Procs .5
            
    if chaosBoltCastTime BeserkEndTime then
                Procs 
    Procs .5
            
    else
            
    Procs Procs
        end
        
    return Procs
    end

    Sorry in advance.

  15. #15
    RedRussian's Avatar Banned CoreCoins Purchaser Authenticator enabled
    Reputation
    221
    Join Date
    Nov 2012
    Posts
    430
    Thanks G/R
    2/3
    Trade Feedback
    2 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OP, for the purpose of DoT (or heavy casts like Chaos Bolt) snapshotting you might want to know only the present and future (I prefer to call it "projected") value of your stats. I use my custom rotation engine but I think the following approach could implemented in PE as well.

    1. I use some abstract score of buff's utility called "Burst rating". The score for each buff of interest is set manually.
    The table of such buffs of interest is as follows. I filled it with some sample content:
    Code:
    RRR_DB.bursts = {
    --[<buff_id>] = { rating = <buff_burst_rating> },
    --ratings are purely imaginary though they can be interpreted as "main stat value"
        --general INT
        [105702] = { rating = 4000 },    --potion MoP
        [104993] = { rating = 1650 },     --jade spirit
        [125487] = { rating = 2000 },    --lightweave INT
        [96230]  = { rating = 1920 },    --synapse springs INT
        [126705] = { rating = 6750 },    --pvp proc trinket INT
        [126683] = { rating = 5000 },    --pvp use trinket INT
        
        --druid
        [102560] = { rating = 9000 },    --incarnation
        [112071] = { rating = 9000 },    --celestial alignment
        [124974] = { rating = 4000 },    --nature's vigil
    }
    2. Then you need to store info of all buffs you get. How you do so is entirely of your choosing, but the result you should aim for is a table contating buff_id as keys and buff_info (table) as values, which would be updated on various events concerning your buffs.

    3. Given the tables of bursts of interest and your current buffs, you need a function to calculate and project your burst rating.
    Mine looks as follows:
    Code:
    function ProjectBurstRating(horizon)
    --NOTE
    --for every horizon, epsilon > 0 : ProjectBurstRating(horizon) >= ProjectBurstRating(horizon + epsilon)
        horizon = horizon or 0
        local current_time = GetTime()
        local burst_rating = 1
        local first_expiry_in = math.huge
        for id, burst_info in pairs(RRR_DB.bursts) do
            local buff = RRR_PlayerInfo.player_data.buffs[id] --it's the table of stored buffs
            if buff then
                burst_rating = burst_rating + burst_info.rating * buff.num_stacks
                local buff_expiry_in = buff.expiry_time - current_time
                if buff_expiry_in <= first_expiry_in then
                    first_expiry_in = buff_expiry_in
                end
                if buff.expiry_time - current_time <= horizon then
                    burst_rating = burst_rating - burst_info.rating * buff.num_stacks
                end
            end
        end
        return burst_rating, first_expiry_in
    end
    4. Given the knowledge of your current and future "power", it's easy to decide whether it's time to refresh your DoTs or cast a long yet powerful cast.
    Chaos Bolt example:
    Code:
    local critical_ratio = 1.5
    if ( ProjectBurstRating( CB_cast_time + 0.5 ) / ProjectBurstRating(0) ) >= critical_ratio then  --our bursts are about to expire!
       CastSpellByID(CB_id)
    end
    Last edited by RedRussian; 09-02-2014 at 07:04 AM.

Page 1 of 2 12 LastLast

Similar Threads

  1. [Help] Need LUA help? Post here!
    By EcHoEs in forum World of Warcraft Emulator Servers
    Replies: 20
    Last Post: 10-03-2010, 01:18 PM
  2. [Help] i need Lua help with this script...
    By Ellenor in forum World of Warcraft Emulator Servers
    Replies: 25
    Last Post: 03-03-2008, 03:45 PM
  3. LUA help
    By stoneharry in forum World of Warcraft Emulator Servers
    Replies: 16
    Last Post: 02-25-2008, 03:27 PM
  4. Lua help
    By reconz in forum World of Warcraft Emulator Servers
    Replies: 12
    Last Post: 02-18-2008, 07:03 PM
  5. Lua help
    By Tom_2001 in forum World of Warcraft Emulator Servers
    Replies: 10
    Last Post: 02-04-2008, 12:17 PM
All times are GMT -5. The time now is 04:10 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search