You are not logged in.

Applications: [GameMaster: OPEN] | [Volunteer Testers: OPEN]


This forum will be permanently shut down on Friday 13.07.2018
Please copy or save all important information from old forum before they will be deactivated
We have moved to new board. https://forum.runesofmagic.gameforge.com/Come join us.

ghostwolf82

Professional

  • "ghostwolf82" started this thread

Posts: 859

Location: Kalvans Trunk

Occupation: It's dark in here

  • Send private message

221

Wednesday, November 23rd 2011, 4:08pm

@Peryl - I'll add the code for the timers to the main body of code and update the first post to correspond. Nice job on that.

As for the emotes, and calling general lua functions, it's probably best to leave that to be implemented by those that really want it. I'm trying to stick to generalities in the base code, stuff that will be used by most of the people most of the time. (I only included the fairy code and buff code because there are a lot of priests/druids out there.)

However, if enough people show an interest in having this included, then yes it is a change I would gladly include.

Edit: One quick question (have yet to test the timer code) does the timer interfere with the .4 change in the code?

@karol891 - Nicely done, have you tested the sublist on those bosses? Does it work as intended?

222

Wednesday, November 23rd 2011, 4:33pm

Quoted from "ghostwolf82;485489"

Does it work as intended?


Yea, had been using it for a week .
This not limited to r/s class only but can be used with Holy Aura or candy/cake (have to make different list for physical or magical attack though)

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

223

Wednesday, November 23rd 2011, 4:35pm

@Ghost
The timers should only affect things if one is associated with a skill entry, so when not present they have no effect whatsoever.

If they are present, then they act like an additional cooldown timer. So if the timer is active and counting down, then DIYCE will not use the skill regardless of whether or not CD() returns true. The CD() function is unchanged by this.

@mrmisterwaa
I think you are looking at this in wrong way. The timers do not allow you to add a delay to the use of a skill, nor does it allow periodic casting of a skill. It merely acts as an extra cooldown timer on a skill. That is, it blocks DIYCE from using the skill until the timer has expired. Everything else is at it was before, so to fire off a skill every 7 seconds will still require you to press a button every 7 seconds to execute the skill.

@eguner
It may simply be that since you have a fear debuff on you, the emotes (and likely other things) are blocked from use. If this is the case, there really isn't anything that can be done to get around it short of hacking the game executable (and I don't think Frogster/Runewaker would be overly pleased by that)
2013... The year from hell....

mrmisterwaa

Professional

Posts: 670

Location: Kuwait

  • Send private message

224

Wednesday, November 23rd 2011, 4:40pm

@Peryl, I understood that. >.>

I was wondering if I could add a condition to the timer, to be ignored, if tbuffs['Energy Thief'] was true.

Oh and another thing I just saw when I was using my buffing part of my DIYCE

Source code

1
[string '?']:145: attempt to call global 'GetDIYCETimerValue' (a nil value)


Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
-- DIY Combat Engine version 2.2

local g_skill  = {}
local g_lastaction = ""
-- Holds the created timers
local DIYCE_Timers = {}

function Msg(outstr,a1,a2,a3)
    DEFAULT_CHAT_FRAME:AddMessage(tostring(outstr),a1,a2,a3)
end

function ReadSkills()
    g_skill = {}
    local skillname,slot

    for page = 1,4 do
        slot = 1
        skillname = GetSkillDetail(page,slot)
        repeat
            local a1,a2,a3,a4,a5,a6,a7,a8,skillusable = GetSkillDetail(page,slot)
            if skillusable then
                g_skill[skillname] = { ['page'] = page, ['slot'] = slot }
            end
            slot = slot + 1
            skillname = GetSkillDetail(page,slot)
        until skillname == nil
    end
end

-- Read Skills on Log-In/Class Change/Level-Up
        local DIYCE_EventFrame = CreateUIComponent("Frame","DIYCE_EventFrame","UIParent")
        DIYCE_EventFrame:SetScripts("OnUpdate", [=[ DIYCE_TimerUpdate(elapsedTime) ]=] )
            DIYCE_EventFrame:SetScripts("OnEvent", [=[ 
                    if event == 'PLAYER_SKILLED_CHANGED' then
                        ReadSkills()
                        end
                    ]=] )
            DIYCE_EventFrame:RegisterEvent("PLAYER_SKILLED_CHANGED")

function PctH(tgt)
    return (UnitHealth(tgt)/UnitMaxHealth(tgt))
end

function PctM(tgt)
    return (UnitMana(tgt)/UnitMaxMana(tgt))
end

function PctS(tgt)
    return (UnitSkill(tgt)/UnitMaxSkill(tgt))
end

function CancelBuff(buffname)
    local i = 1
    local buff = UnitBuff("player",i)

    while buff ~= nil do
        if buff == buffname then
            CancelPlayerBuff(i)
            return true
        end

        i = i + 1
        buff = UnitBuff("player",i)
    end
    return false
end

function BuffList(tgt)
    local list = {}
    local buffcmd = UnitBuff
    local infocmd = UnitBuffLeftTime

    if UnitCanAttack("player",tgt) then
        buffcmd = UnitDebuff
        infocmd = UnitDebuffLeftTime
    end

    -- There is a max of 100 buffs/debuffs per unit apparently
    for i = 1,100 do
        local buff, _, stackSize, ID = buffcmd(tgt, i)
        local timeRemaining = infocmd(tgt,i)
        if buff then
            -- Ad to list by name
            list[buff:gsub('(%()(.)(%))', '%2')] = { stack = stackSize, time = timeRemaining or 0, id = ID }
            -- We also list by ID in case two different buffs/debuffs have the same name.
            list[ID] = {stack = stackSize, time = timeRemaining or 0, name = buff:gsub("(%()(.)(%))", "%2") }
        else
            break
        end
    end

    return list
end

function CD(skillname)
    local firstskill = GetSkillDetail(2,1)
    if (g_skill[firstskill] == nil) or (g_skill[firstskill].page ~= 2) then
        ReadSkills()
    end

    if g_skill[skillname] ~= nil then
        local tt,cd = GetSkillCooldown(g_skill[skillname].page,g_skill[skillname].slot)
        return cd <= 0.4
    elseif skillname == nil then
        return false
    else
        Msg("Skill not available: "..skillname)        --Comment this line out if you do not wish to recieve this error message.
        return
    end
end

function MyCombat(Skill, arg1)
    local spell_name = UnitCastingTime("player")
    local talktome = ((arg1 == "v1") or (arg1 == "v2"))
    local action,actioncd,actiondef,actioncnt
    
    if spell_name ~= nil then
        if (arg1 == "v2") then Msg("- ['..spell_name..']", 0, 1, 1) end
        return true
    end

    for x,tbl in ipairs(Skill) do
        
    local useit = type(Skill[x].use) ~= "function" and Skill[x].use or (type(Skill[x].use) == "function" and Skill[x].use() or false)
        if useit then
            if string.find(Skill[x].name, "Action:") then
                action = tonumber((string.gsub(Skill[x].name, "(Action:)( *)(%d+)(.*)", "%3")))
                _1,actioncd = GetActionCooldown(action)
                actiondef,_1,actioncnt = GetActionInfo(action)
                if GetActionUsable(action) and (actioncd == 0) and (actiondef ~= nil) and (actioncnt > 0) then
                    if talktome then Msg("- "..Skill[x].name) end
                    UseAction(action)
                    return true
                end
            elseif string.find(Skill[x].name, "Custom:") then
                action = string.gsub(Skill[x].name, "(Custom:)( *)(.*)", "%3")
                if CustomAction(action) then
                    return true
                end
            elseif string.find(Skill[x].name, "Item:") then
                action = string.gsub(Skill[x].name, "(Item:)( *)(.*)", "%3")
                if talktome then Msg("- "..Skill[x].name) end
                UseItemByName(action)
                return true
            elseif GetDIYCETimerValue(Skill[x].timer) == 0 and CD(Skill[x].name) then
                if talktome then Msg("- "..Skill[x].name) end
                CastSpellByName(Skill[x].name)
                StartDIYCETimer(Skill[x].timer)
                return true
            elseif string.find(Skill[x].name, "Pet Skill:") then
                action = string.gsub(Skill[x].name, "(Pet Skill:)( *)(%d+)(.*)", "%3")
                    UsePetAction(action)
                if (arg1 == "v2") then Msg(Skill[x].name.." has been fully processed") end
                return true
            end
        end
    end
    if (arg1 == "v2") then Msg("- [IDLE]", 0, 1, 1) end
    
    return false
end

--[[ Timer Update function ]]--
-- Tick down any active timers
function DIYCE_TimerUpdate(elapsed)
    for k,v in pairs(DIYCE_Timers) do
        v.timeLeft = v.timeLeft - elapsed
        if v.timeLeft < 0 then
            v.timeLeft = 0
        end
    end
end

--[[ Create a named timer ]]--
-- if the named timer already exists, this does nothing.
function CreateDIYCETimer(timerName, waitTime)
    if not DIYCE_Timers[timerName] then
        DIYCE_Timers[timerName] = { timeLeft = 0, waitTime = waitTime }
    end
end

--[[ Set/reset waitTimer of an existing timer ]]--
-- if the timer doesn't exist, this does nothing
function SetDIYCETimerDelay(timerName, waitTime)
    if DIYCE_Timers[timerName] then
        DIYCE_Timers[timerName].waitTime = waitTime
    end
end

--[[ Delete named timer ]]--
-- if the timer doesn't exist, this does nothing
-- Not really needed, but added for completeness
function DeleteDIYCETimer(timerName)
    if DIYCE_Timers[timerName] then
        DIYCE_Timers[timerName] = nil
    end
end

function CustomAction(action)
    if CD(action) then
        if IsShiftKeyDown() then Msg("- "..action) end
        g_lastaction = action
        CastSpellByName(action)
        return true
    else
        return false
    end
end

function BuffTimeLeft(tgt, buffname)
    local cnt = 1
    local buff = UnitBuff(tgt,cnt)

    while buff ~= nil do
        if string.find(buff,buffname) then
            return UnitBuffLeftTime(tgt,cnt)
        end
        cnt = cnt + 1
        buff = UnitBuff(tgt,cnt)
    end

    return 0
end

function BuffParty(arg1,arg2)
--    arg1 = Quickbar slot # for targetable, instant-cast buff without a cooldown (eg. Amp Attack) for range checking.
--    arg2 = buff expiration time cutoff (in seconds) for refreshing buffs, default is 45 seconds.

    local selfbuffs = { "Soul Bond", "Enhanced Armor", "Holy Seal" }
    local groupbuffs = { "Grace of Life", "Amplified Attack", "Angel's Blessing", "Essence of Magic", "Magic Barrier", "Blessed Spring Water", "Fire Ward", "Savage Blessing", "Concentration Prayer", "Shadow Fury"  }

    local buffrefresh = arg2 or 45           -- Refresh buff time (seconds)
    local spell = UnitCastingTime("player")  -- Spell being cast?
    local vocal = IsShiftKeyDown()           -- Generate feedback if Shift key held

    if (spell ~= nil) then
        return
    end

    if vocal then Msg("- Checking self buffs on "..UnitName("player")) end
    for i,buff in ipairs(selfbuffs) do
        if (g_skill[buff] ~= nil) and CD(buff) and (BuffTimeLeft("player",buff) <= buffrefresh) then
            if vocal then Msg("- Casting "..buff.." on "..UnitName("player")) end
            TargetUnit("player")
            CastSpellByName(buff)
            return
        end
    end

    if vocal then Msg("- Checking group buffs on "..UnitName("player")) end
    for i,buff in ipairs(groupbuffs) do
        if (g_skill[buff] ~= nil) and CD(buff) and (BuffTimeLeft("player",buff) <= buffrefresh) then
            if vocal then Msg("- Casting "..buff.." on "..UnitName("player")) end
            TargetUnit("player")
            CastSpellByName(buff)
            return
        end
    end

    for num=1,GetNumPartyMembers()-1 do
        TargetUnit("party"..num)
        if GetActionUsable(arg1) and (UnitHealth("party"..num) > 0) then
            if vocal then Msg("- Checking group buffs on "..UnitName("party"..num)) end
            for i,buff in ipairs(groupbuffs) do
                if (g_skill[buff] ~= nil) and CD(buff) and (BuffTimeLeft("target",buff) <= buffrefresh) then
                    if UnitIsUnit("target","party"..num) then
                        if vocal then Msg("- Casting "..buff.." on "..UnitName("target")) end
                        CastSpellByName(buff)
                        return
                    else
                        if vocal then Msg("- Error: "..UnitName("target").." != "..UnitName("party"..num)) end
                    end
                end
            end
        else
            if vocal then Msg("- Player "..UnitName("party"..num).." out of range or dead.") end
        end
    end

    if vocal then Msg("- Nothing to do.") end
end


Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
local WHITE = "|cffffffff"
local SILVER = "|cffc0c0c0"
local GREEN = "|cff00ff00"
local LTBLUE = "|cffa0a0ff"

function DIYCE_DebugSkills(skillList)
    DEFAULT_CHAT_FRAME:AddMessage(GREEN.."Skill List:")
    
    for i,v in ipairs(skillList) do
        DEFAULT_CHAT_FRAME:AddMessage(SILVER.."  ['..WHITE..i..SILVER..']: "..LTBLUE.."" "..WHITE..v.name..LTBLUE..""  use = "..WHITE..(v.use and "true" or "false"))
    end

    DEFAULT_CHAT_FRAME:AddMessage(GREEN.."----------")
end

function DIYCE_DebugBuffList(buffList)
    DEFAULT_CHAT_FRAME:AddMessage(GREEN.."Buff List:")
    
    for k,v in pairs(buffList) do
        -- We ignore numbered entries because both the ID and name 
        -- are stored in the list. This avoids doubling the output.
        if type(k) ~= "number" then
            DEFAULT_CHAT_FRAME:AddMessage(SILVER.."  ['..WHITE..k..SILVER..']:  "..LTBLUE.."id: "..WHITE..v.id..LTBLUE.."  stack: "..WHITE..v.stack..LTBLUE.."  time: "..WHITE..v.time)
        end
    end
    
    DEFAULT_CHAT_FRAME:AddMessage(GREEN.."----------")    
end

local silenceList = {
        ['Annihilation']    = true,
        ['King Bug Shock']  = true,
        ['Mana Rift']       = true,
        ['Dream of Gold']   = true,
        ['Flame']           = true,
        ['Flame Spell']     = true,
        ['Wave Bomb']       = true,
        ['Silence']         = true,
        ['Recover']         = true,
        ['Restore Life']    = true,
        ['Heal']            = true,
        ['Curing Shot']     = true,
        ['Leaves of Fire']  = true,
        ['Urgent Heal']     = true,
        ['Heavy Shelling']  = true, --Juggler Apprentice in Grafu
        ['Dark Healing']    = true, --Mini-boss in Sardo
                    }
                    
function PriestFairySequence(arg1)
    local Skill = {}
    local Skill2 = {}
    local i = 0
    local FairyExists = UnitExists("playerpet")
    local FairyBuffs = BuffList("playerpet")
    local combat = GetPlayerCombatState()

    --Determine Class-Combo
    mainClass, subClass = UnitClassToken( "player" )

    --Summon Fairy
    if (not FairyExists) and (not combat) then
        if mainClass == "AUGUR" then
            if subClass == "THIEF" then
                Skill = {
                    { name = "Shadow Fairy",            use = true },
                        }
            elseif subClass == "RANGER" then
                Skill = {
                    { name = "Water Fairy",                use = true },
                        }
            elseif subClass == "MAGE" then
                Skill = {
                    { name = "Wind Fairy",                use = true },
                        }            
            elseif subClass == "KNIGHT" then
                Skill = {
                    { name = "Light Fairy",                use = true },
                        }            
            elseif subClass == "WARRIOR" then
                Skill = {
                    { name = "Fire Fairy",                use = true },
                        }
            end
        end
    end    
    
    --Cast Halo
    if FairyExists then
        if mainClass == "AUGUR" then
            if subClass == "THIEF" then
                if (not FairyBuffs[503459]) then
                    if (arg1 == "v1") then
                        Msg("- Activating Halo", 0, 1, 1)
                    end
                    Skill = {
                        { name = "Pet Skill: 6 (Wraith Halo)",    use = true },
                            }
                end
            elseif subClass == "RANGER" then
                if (not FairyBuffs[503457]) then
                    if (arg1 == "v1") then
                        Msg("- Activating Halo", 0, 1, 1)
                    end
                    Skill = {
                        { name = "Pet Skill: 6 (Frost Halo)",    use = true },
                            }
                end
            elseif subClass == "MAGE" then
                if (not FairyBuffs[503461]) then
                    if (arg1 == "v1") then
                        Msg("- Activating Halo", 0, 1, 1)
                    end
                    Skill = {
                        { name = "Pet Skill: 6 (Windrider Halo)",    use = true },
                            }
                end
            elseif subClass == "KNIGHT" then
                if (not FairyBuffs[503507]) then
                    if (arg1 == "v1") then
                        Msg("- Activating Halo", 0, 1, 1)
                    end
                    Skill = {
                        { name = "Pet Skill: 6 (Devotion Halo)",    use = true },
                            }
                end
            elseif subClass == "WARRIOR" then
                if (not FairyBuffs[503455]) then
                    if (arg1 == "v1") then
                        Msg("- Activating Halo", 0, 1, 1)
                    end
                    Skill = {
                        { name = "Pet Skill: 6 (Accuracy Halo)",    use = true },
                            }
                end
            end
        
            --Cast Conceal
        if (not MyCombat(Skill, arg1)) then
            if (not FairyBuffs[503753]) then
                if (arg1 == "v1") then
                    Msg("- Activating Conceal", 0, 1, 1)
                end
                Skill2 = {
                    { name = "Pet Skill: 7 (Conceal)",    use = true },
                        }
            end
        end
        end
    end
    
    if (not MyCombat(Skill, arg1)) then
        MyCombat(Skill2, arg1)
    end
end
                        
function KillSequence(arg1, goat2, healthpot, manapot, foodslot)
--arg1 = "v1" or "v2" for debugging
--healthpot = # of actionbar slot for health potions
--manapot = # of actionbar slot for mana potions
--foodslot = # of actionbar slot for food (add more args for more foodslots if needed)

    local Skill = {}
    local Skill2 = {}
    local i = 0
    
    -- Player and target status.
    local combat = GetPlayerCombatState()
    local enemy = UnitCanAttack("player","target")
    local EnergyBar1 = UnitMana("player")
    local EnergyBar2 = UnitSkill("player")
    local pctEB1 = PctM("player")
    local pctEB2 = PctS("player")
    local tbuffs = BuffList("target")
    local pbuffs = BuffList("player")
    local tDead = UnitIsDeadOrGhost("target")
    local behind = (not UnitIsUnit("player", "targettarget"))
    local melee = GetActionUsable(13) -- # is your melee range spell slot number
    local a1,a2,a3,a4,a5,ASon = GetActionInfo(14)  -- # is your Autoshot slot number
    local phealth = PctH("player")
    local thealth = PctH("target")
    local LockedOn = UnitExists("target")
    local boss = UnitSex("target") > 2
    local elite = UnitSex("target") == 2
    local party = GetNumPartyMembers() >= 2
    
    
    --Determine Class-Combo
    mainClass, subClass = UnitClassToken( "player" )

    --Silence Logic
    local tSpell,tTime,tElapsed = UnitCastingTime("target")
    local silenceThis = tSpell and silenceList[tSpell] and ((tTime - tElapsed) > 0.1)
    
    --Potion Checks
    healthpot = healthpot or 0
    manapot = manapot or 0
    
    --Equipment and Pet Protection
    if phealth <= .04 then
            SwapEquipmentItem()        --Note: Remove the first double dash to re-enable equipment protection.
        for i=1,6 do
            if (IsPetSummoned(i) == true) then
                ReturnPet(i);
            end
        end        
    end
        
    --Check for level 1 mobs, if it is, drop target and acquire a new one.
    if (LockedOn and (UnitLevel("target") < 2)) then
        TargetUnit("")
        return
    end
    
    --Begin Player Skill Sequences
    
        --Priest = AUGUR, Druid = DRUID, Mage = MAGE, Knight = KNIGHT, 
        --Scout = RANGER, Rogue = THIEF, Warden = WARDEN, Warrior = WARRIOR
        
        -- Class: Rogue/Scout
            if mainClass == "THIEF" and subClass == "RANGER" then
            --Timers for this class
            CreateDIYCETimer("SSBleed", 7) --Cooldown to ensure Shadowstab is only hit every 7 seconds.
            CreateDIYCETimer("LBBleed", 9) --Cooldown to ensure Low Blow is only hit every 9 seconds*.
            --goat2: 0 = Buffs, 1 = Melee, 2 = Ranged, 3 = Cooldowns & Potions, 4 = Longer Cooldowns
            
            if (goat2 == "0") then
            Skill =  {
                { name = "Combat Master",                      use = ((not pbuffs['Combat Master'])) },
                { name = "Action: 62 (Yawaka's Blessing)",     use = ((not pbuffs['Yawaka's Blessing'])) },
                { name = "Action: 69 (Unbridled Enthusiam)",   use = ((not pbuffs['Unbridled Enthusiasm'])) }, -- Speed Potion
                     }
            elseif (goat2 == "3") then
            Skill =  {
               { name = "Informer",                            use = ((not pbuffs['Informer'])) },
               { name = "Action: 64 (Unknown Choice)",         use = ((EnergyBar1 > 20)) },
               { name = "Action: 65 (Caviar Sandwich)",        use = ((not pbuffs['Caviar Sandwich'])) },
                     }
            elseif (goat2 == "4") then
            Skill = {
                { name = "Action: 46 (Energy Potion)",         use = ((EnergyBar1) <= 15 and (boss)) },
                { name = "Action: 30 (Strong Stimulant)",      use = ((boss) and (not pbuffs['Fervent Attack'])) },
                { name = "Action: 34 (Extinction Potion)",     use = ((boss) and (not pbuffs['Extinction Potion'])) },
                { name = "Energy Thief",                       use = ((EnergyBar1 < 50) and (boss) and (not tDead)) },
                { name = "Assassins Rage",                     use = ((boss) and (not tDead)) },
                { name = "Fervent Attack",                     use = ((boss) and (not tDead) and (not pbuffs['Strong Stimulant'])) },
                    }
            end

            if ((enemy) and (goat2 == "1")) then
            Skill2 = {
                { name = "Wound Attack",                       use = ((EnergyBar1 >= 35) and ((tbuffs[500654]) and (tbuffs[500704]))) },
                { name = "Blind Spot",                         use = (((EnergyBar1 >= 25) and (boss) and (behind)) and (pbuffs['Energy Thief'] or pbuffs['Premeditation'])) },
                { name = "Shadowstab",                         use = (EnergyBar1 >= 20),       timer = "SSBleed" },
                { name = "Low Blow",                           use = ((EnergyBar1 >= 25) and (tbuffs[500654])),      timer = "LBBleed" },
                { name = "Throat Attack",                      use = ((EnergyBar2 >= 50) and (boss or elite) and (silenceThis)) },
                { name = "Vampire Arrows",                     use = (EnergyBar2 >= 20) },
                { name = "Wrist Attack",                       use = ((EnergyBar2 >= 50) and (boss)) },
                { name = "Shot",                               use = ((EnergyBar1 < 20 )) },
                    }
            elseif ((enemy) and (goat2 == "2")) then
            Skill2 = {
                { name = "Vampire Arrows",                     use = (EnergyBar2 >= 20) },
                { name = "Shot",                               use = (true) },
                     }
            end
                
            --ADD MORE CLASS COMBOS HERE. 
            --USE AN "ELSEIF" TO CONTINUE WITH MORE CLASS COMBOS.
            --THE NEXT "END" STATEMENT IS THE END OF THE CLASS COMBOS STATEMENTS.
            --DO NOT POST BELOW THE FOLLOWING "END" STATEMENT!
            end
    --End Player Skill Sequences
    
    if (arg1=="debugskills") then        --Used for printing the skill table, and true/false usability
        DIYCE_DebugSkills(Skill)
        DIYCE_DebugSkills(Skill2)
    elseif (arg1=="debugpbuffs") then    --Used for printing your buff names, and buffID
        DIYCE_DebugBuffList(pbuffs)
    elseif (arg1=="debugtbuffs") then    --Used for printing target buff names, and buffID
        DIYCE_DebugBuffList(tbuffs)
    elseif (arg1=="debugall") then        --Used for printing all of the above at the same time
        DIYCE_DebugSkills(Skill)
        DIYCE_DebugSkills(Skill2)
        DIYCE_DebugBuffList(pbuffs)
        DIYCE_DebugBuffList(tbuffs)
    end
    
    if (not MyCombat(Skill, arg1)) then
        MyCombat(Skill2, arg1)
    end
        
    --Select Next Enemy
    if (tDead) then
        TargetUnit("")
        return
    end
    if (mainClass == "RANGER" or subClass == "RANGER")  and (not party) then        --To keep scouts from pulling mobs without meaning to.
        if (not LockedOn) or (not enemy) then
            TargetNearestEnemy()
            return
        end
    elseif mainClass ~= "RANGER" then                    --Let all other classes auto target.
        if (not LockedOn) or (not enemy) then
            TargetNearestEnemy()
            return
        end
    end
end

ghostwolf82

Professional

  • "ghostwolf82" started this thread

Posts: 859

Location: Kalvans Trunk

Occupation: It's dark in here

  • Send private message

225

Wednesday, November 23rd 2011, 4:51pm

@Peryl - That's what I thought. Ok, thanks for clarifying.

As for the use of the timers, I see a great potential use for rogues and warriors to keep track of bleeds now. Which is what I assume Sekrit is wanting to get this working for. (My uses have more to deal with priest/druid buffs than anything else.)

mrmisterwaa

Professional

Posts: 670

Location: Kuwait

  • Send private message

226

Wednesday, November 23rd 2011, 4:58pm

Quoted from "ghostwolf82;485502"

@Peryl - That's what I thought. Ok, thanks for clarifying.

As for the use of the timers, I see a great potential use for rogues and warriors to keep track of bleeds now. Which is what I assume Sekrit is wanting to get this working for.


:D

That is actually true.

I was planning on doing it myself but I never got around to it.

I was still tweaking my code some more then I see Peryl post a timer and I was like. :cool:

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

227

Wednesday, November 23rd 2011, 5:26pm

Quoted from "mrmisterwaa;485500"

@Peryl, I understood that. >.>
Guess I'm the one not quite getting what you wanted (though I think ghostwolf's comment has cleared it up for me somewhat.

Quoted from "mrmisterwaa;485500"

Source code

1
[string '?']:145: attempt to call global 'GetDIYCETimerValue' (a nil value)

I don't see the GetDIYCETimerValue function defined anywhere in your posted code. I'm guessing you accidentally deleted it. Most likely the cause of the error.

Quoted from "mrmisterwaa;485500"

I was wondering if I could add a condition to the timer, to be ignored, if tbuffs['Energy Thief'] was true.

Hmmmm... was never the intent when I originally made the code, but I 'supose it could be done.

In an attempt to not break existing stuff, lets add yet another entry to the skill list that we can set to true/false if we want the timer to be taken into account. Edit Lets call it ignoretimer

So your shadowstab line would become some something like:

Source code

1
{ name = "Shadowstab",   use = (EnergyBar1 >= 20),       timer = "SSBleed",   ignoretimer = tbuffs['Energy Thief'] }


Now in MyCombat(), the GetDIYCETimerValue line becomes:

Source code

1
elseif (Skill[x].ignoretimer or GetDIYCETimerValue(Skill[x].timer) == 0) and CD(Skill[x].name) then


That should do it.

Edit: I inverted the logic and renamed the new skill table entry to avoid a possible problem with code that used a timer without the "usetimer" entry. This way should make it work even under that condition.
2013... The year from hell....

mrmisterwaa

Professional

Posts: 670

Location: Kuwait

  • Send private message

228

Wednesday, November 23rd 2011, 5:53pm

@Peryl, I LOVE YOU.

Sorry I didn't notice that, I must have deleted it.

Okay, some testing ... it was working for a few minutes ...

And!

IT WORKS. *cough*

Well as far as I can tell it is going it's job.

Energy Thief fix works, the timers work perfectly.

Changing the delays fixed the problem I was having with Shadowstab & Low Blow.

ghostwolf82

Professional

  • "ghostwolf82" started this thread

Posts: 859

Location: Kalvans Trunk

Occupation: It's dark in here

  • Send private message

229

Thursday, November 24th 2011, 5:19pm

DIYCE works fine for me. Check to make sure other addons are not conflicting with it. Also look at the minimap to see if any error messages have popped up for you.

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

230

Thursday, November 24th 2011, 5:24pm

Quoted from "Stagg3r;485903"

DIYCE 2.2 BROKEN in 4.05 :mad: Major nerf and DIYCE broken again... sigh...

I forgot to add this. There are a few erros in the middle that were my fault (spacing incorrect) but the others are just broken... Sad day for mages and healers today...

...snip...





please post your CustomFunctions.lua file as well as the complete first error message in that list (just click it and it will display the complete error in the chat window)
2013... The year from hell....

231

Thursday, November 24th 2011, 8:43pm

OK, I found it.... NVM... Sure is slower now though... Time to QQ in my turkey.....
-- Stagger - Osha - Eyeofthetempest --

M/R/W 72/52/51
Formerly M/D/S, M/R/D (The search for decent DPS in a post GCD RoM continues)

232

Friday, November 25th 2011, 7:00am

something is wierd, befor the patch everything worked like a charm.
Now my mage just stands and throws the same buff over and over again (blessed spring water).
And im not getting any errors :(

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
local WHITE = "|cffffffff"
local SILVER = "|cffc0c0c0"
local GREEN = "|cff00ff00"
local LTBLUE = "|cffa0a0ff"

function DIYCE_DebugSkills(skillList)
    DEFAULT_CHAT_FRAME:AddMessage(GREEN.."Skill List:")
    
    for i,v in ipairs(skillList) do
        DEFAULT_CHAT_FRAME:AddMessage(SILVER.."  ['..WHITE..i..SILVER..']: "..LTBLUE.."" "..WHITE..v.name..LTBLUE..""  use = "..WHITE..(v.use and "true" or "false"))
    end

    DEFAULT_CHAT_FRAME:AddMessage(GREEN.."----------")
end

function DIYCE_DebugBuffList(buffList)
    DEFAULT_CHAT_FRAME:AddMessage(GREEN.."Buff List:")
    
    for k,v in pairs(buffList) do
        -- We ignore numbered entries because both the ID and name 
        -- are stored in the list. This avoids doubling the output.
        if type(k) ~= "number" then
            DEFAULT_CHAT_FRAME:AddMessage(SILVER.."  ['..WHITE..k..SILVER..']:  "..LTBLUE.."id: "..WHITE..v.id..LTBLUE.."  stack: "..WHITE..v.stack..LTBLUE.."  time: "..WHITE..v.time)
        end
    end
    
    DEFAULT_CHAT_FRAME:AddMessage(GREEN.."----------")    
end

local silenceList = {
        ['Annihilation']     = true,
        ['King Bug Shock']   = true,
        ['Mana Rift']        = true,
        ['Dream of Gold']    = true,
        ['Flame']            = true,
        ['Flame Spell']      = true,
        ['Wave Bomb']        = true,
        ['Silence']          = true,
        ['Recover']          = true,
        ['Restore Life']     = true,
        ['Heal']             = true,
        ['Curing Shot']      = true,
        ['Leaves of Fire']   = true,
        ['Urgent Heal']      = true,
                    }    

function PriestFairySequence(arg1)
    local Skill = {}
    local Skill2 = {}
    local i = 0
    local FairyExists = UnitExists("playerpet")
    local FairyBuffs = BuffList("playerpet")
    local combat = GetPlayerCombatState()    
    
    --Determine Class-Combo
    mainClass, subClass = UnitClassToken( "player" )

    --Summon Fairy
    if (not FairyExists) and (not combat) then
        if mainClass == "AUGUR" then
            if subClass == "THIEF" then
                Skill = {
                    { name = "Shadow Fairy",            use = true },
                        }
            elseif subClass == "RANGER" then
                Skill = {
                    { name = "Water Fairy",                use = true },
                        }
            elseif subClass == "MAGE" then
                Skill = {
                    { name = "Wind Fairy",                use = true },
                        }            
            elseif subClass == "KNIGHT" then
                Skill = {
                    { name = "Light Fairy",                use = true },
                        }            
            elseif subClass == "WARRIOR" then
                Skill = {
                    { name = "Fire Fairy",                use = true },
                        }
            end
        end
    end    
    
    --Cast Halo
    if FairyExists then
        if mainClass == "AUGUR" then
            if subClass == "THIEF" then
                if (not FairyBuffs[503459]) then
                    if (arg1 == "v1") then
                        Msg("- Activating Halo", 0, 1, 1)
                    end
                    Skill = {
                        { name = "Pet Skill: 6 (Wraith Halo)",    use = true },
                            }
                end
            elseif subClass == "RANGER" then
                if (not FairyBuffs[503457]) then
                    if (arg1 == "v1") then
                        Msg("- Activating Halo", 0, 1, 1)
                    end
                    Skill = {
                        { name = "Pet Skill: 6 (Frost Halo)",    use = true },
                            }
                end
            elseif subClass == "MAGE" then
                if (not FairyBuffs[503461]) then
                    if (arg1 == "v1") then
                        Msg("- Activating Halo", 0, 1, 1)
                    end
                    Skill = {
                        { name = "Pet Skill: 6 (Windrider Halo)",    use = true },
                            }
                end
            elseif subClass == "KNIGHT" then
                if (not FairyBuffs[503507]) then
                    if (arg1 == "v1") then
                        Msg("- Activating Halo", 0, 1, 1)
                    end
                    Skill = {
                        { name = "Pet Skill: 6 (Devotion Halo)",    use = true },
                            }
                end
            elseif subClass == "WARRIOR" then
                if (not FairyBuffs[503455]) then
                    if (arg1 == "v1") then
                        Msg("- Activating Halo", 0, 1, 1)
                    end
                    Skill = {
                        { name = "Pet Skill: 6 (Accuracy Halo)",    use = true },
                            }
                end
            end
        
            --Cast Conceal
        if (not MyCombat(Skill, arg1)) then
            if (not FairyBuffs[503753]) then
                if (arg1 == "v1") then
                    Msg("- Activating Conceal", 0, 1, 1)
                end
                Skill2 = {
                    { name = "Pet Skill: 7 (Conceal)",    use = true },
                        }
            end
        end
        end
    end
    
    if (not MyCombat(Skill, arg1)) then
        MyCombat(Skill2, arg1)
    end
end
                        
function KillSequence(arg1, healthpot, manapot, foodslot)
--arg1 = "v1" or "v2" for debugging
--healthpot = # of actionbar slot for health potions
--manapot = # of actionbar slot for mana potions
--foodslot = # of actionbar slot for food (add more args for more foodslots if needed)

    local Skill = {}
    local Skill2 = {}
    local i = 0
    
    -- Player and target status.
    local combat = GetPlayerCombatState()
    local enemy = UnitCanAttack("player","target")
    local EnergyBar1 = UnitMana("player")
    local EnergyBar2 = UnitSkill("player")
    local pctEB1 = PctM("player")
    local pctEB2 = PctS("player")
    local tbuffs = BuffList("target")
    local pbuffs = BuffList("player")
    local tDead = UnitIsDeadOrGhost("target")
    local behind = (not UnitIsUnit("player", "targettarget"))
    local melee = GetActionUsable(4) -- # is your melee range spell slot number ************************************************************************
    local a1,a2,a3,a4,a5,ASon = GetActionInfo(11)  -- # is your Autoshot slot number  ******************************************************************    
    local phealth = PctH("player")
    local thealth = PctH("target")
    local LockedOn = UnitExists("target")
    local boss = UnitSex("target") > 2
    local elite = UnitSex("target") == 2
    local party = GetNumPartyMembers() >= 2
    
    --Determine Class-Combo
    mainClass, subClass = UnitClassToken( "player" )

    --Silence Logic
    local tSpell,tTime,tElapsed = UnitCastingTime("target")
    local silenceThis = tSpell and silenceList[tSpell] and ((tTime - tElapsed) > 0.1)
    
    --Potion Checks
    healthpot = healthpot or 0
    manapot = manapot or 0
    
    --Equipment and Pet Protection
    if phealth <= .04 then
            --SwapEquipmentItem()        --Note: Remove the first double dash to re-enable equipment protection.
        for i=1,6 do
            if (IsPetSummoned(i) == true) then
                ReturnPet(i);
            end
        end        
    end
        
    --Check for level 1 mobs, if it is, drop target and acquire a new one.
    if (LockedOn and (UnitLevel("target") < 2)) then
        TargetUnit("")
        return
    end
    
    --Begin Player Skill Sequences
    
        --Priest = AUGUR, Druid = DRUID, Mage = MAGE, Knight = KNIGHT, 
        --Scout = RANGER, Rogue = THIEF, Warden = WARDEN, Warrior = WARRIOR
         --Class: Mage/Priest
            elseif mainClass == "MAGE" and subClass == "AUGUR" then
            
            --Potions and Buffs
            Skill = {
                { name = "Regenerate",                    use = (phealth <= .75) and (pctEB1 >= .05) and (not pbuffs['Regenerate']) },
                { name = "Urgent Heal",                   use = (phealth <= .70) and (pctEB1 >= .05) },
                { name = "Energy Well",                      use = (not pbuffs['Energy Well']) },
                { name = "Blessed Spring Water",          use = (not combat) and (not pbuffs['Blessed Spring Water']) },
                { name = "Fire Ward",                      use = (not pbuffs['Fire Ward']) },
                { name = "Magic Barrier",                 use = (not pbuffs['Magic Barrier']) },
                { name = "Essence of Magic",              use = (not pbuffs['Essence of Magic']) },
                { name = "Electrostatic Charge",          use = (not pbuffs['Electrostatic Charge']) },
                { name = "Energy Influx",                  use = (boss) and (not pbuffs['Energy Influx']) },   -- 30 sec. lasting time
                { name = "Intensification",               use = (boss) and (not pbuffs['Intensification']) },  -- 20 sec. lasting tme
                { name = "Elemental Catalysis",           use = (boss) and (not pbuffs['Elemental Catalysis']) }, --20 sec. lasting time
                
                    }
                    
            --Combat
                if enemy then
                Skill2 = {
                    { name = "Magic Drain",                  use = (boss) and (not tbuffs['Magic Drain']) },
                    { name = "Electric Bolt",                use = not (tbuffs['Electric Flow']) },
                    { name = "Lightning",                    use = not (tbuffs['Lightning']) },
                    { name = "Plasma Arrow",                 use = not (pbuffs['Charged']) },
                    { name = "Electric Explosion",           use = (enemy) and (pbuffs['Charged']) },
                    { name = "Fireball",                     use = "Fireball" },
                    { name = "Flame",                        use = "Flame" },
                    { name = "Silence",                      use = silenceThis },                    
                            }
                end 

   --End Player Skill Sequences
    
    if (arg1=="debugskills") then        --Used for printing the skill table, and true/false usability
        DIYCE_DebugSkills(Skill)
        DIYCE_DebugSkills(Skill2)
    elseif (arg1=="debugpbuffs") then    --Used for printing your buff names, and buffID
        DIYCE_DebugBuffList(pbuffs)
    elseif (arg1=="debugtbuffs") then    --Used for printing target buff names, and buffID
        DIYCE_DebugBuffList(tbuffs)
    elseif (arg1=="debugall") then        --Used for printing all of the above at the same time
        DIYCE_DebugSkills(Skill)
        DIYCE_DebugSkills(Skill2)
        DIYCE_DebugBuffList(pbuffs)
        DIYCE_DebugBuffList(tbuffs)
    end
    
    if (not MyCombat(Skill, arg1)) then
        MyCombat(Skill2, arg1)
    end
        
    --Select Next Enemy
 --[[       if (tDead) then
        TargetUnit('')
        return
    end
    if mainClass == 'RANGER' and (not party) then        --To keep scouts from pulling mobs without meaning to.
        if (not LockedOn) or (not enemy) then
            TargetNearestEnemy()
            return
        end
    elseif mainClass ~= 'RANGER' then                    --Let all other classes auto target.
        if (not LockedOn) or (not enemy) then
            TargetNearestEnemy()
            return  
        end   
    end        --]]
end

233

Friday, November 25th 2011, 7:14am

Quoted from "mrmisterwaa;480680"

RogueScout v1.1

A few changes were added to the DIYCE.lua that ghostwolf posted in the OP.

This macro now works with other Rogues in the party.

Line 222 & 223 have the timers for Shadowstab & Low Blow, these values can be changed to ensure that energy conservation is maintained during combat (non-burns) and that during burns with Energy Thief active, it will not activate the counter on Low Blow.

Everything is working perfectly (well, as far as I can tell.)

If you want to use it, don't forget you also have to change the Action #'s for the following:

Melee Check (Line 177) (Any skill with a range of 50, Shadowstab, Low Blow, Wound Attack from your hot-bar should be put here for me it's Low Blow)
Yawaka's Blessing (Line 229),
Unbridled Enthusiam (Line 230),
Unknown Choice (Line 235),
Caviar Sandwich (Line 236),
Energy Potion (Line 240),
Strong Stimulant (Line 241),
Extinction Potion (Line 242).

A macro should be made for each one.

/run KillSequence("","0") --- Buffs
/run KillSequence("","1") --- Melee Combat
/run KillSequence("","2") --- Ranged Combat
/run KillSequence("","3") --- Long Cooldowns (Informer, Unknown Choice, Caviar Sandwich)
/run KillSequence("","4") --- Burning Cooldowns (Strong Stimluant etc.)

iluperylghostwolf.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
-- DIY Combat Engine version 2.2

local g_skill  = {}
local g_lastaction = ""
-- Holds the created timers
local DIYCE_Timers = {}

function Msg(outstr,a1,a2,a3)
    DEFAULT_CHAT_FRAME:AddMessage(tostring(outstr),a1,a2,a3)
end

function ReadSkills()
    g_skill = {}
    local skillname,slot

    for page = 1,4 do
        slot = 1
        skillname = GetSkillDetail(page,slot)
        repeat
            local a1,a2,a3,a4,a5,a6,a7,a8,skillusable = GetSkillDetail(page,slot)
            if skillusable then
                g_skill[skillname] = { ['page'] = page, ['slot'] = slot }
            end
            slot = slot + 1
            skillname = GetSkillDetail(page,slot)
        until skillname == nil
    end
end

-- Read Skills on Log-In/Class Change/Level-Up
        local DIYCE_EventFrame = CreateUIComponent("Frame","DIYCE_EventFrame","UIParent")
        DIYCE_EventFrame:SetScripts("OnUpdate", [=[ DIYCE_TimerUpdate(elapsedTime) ]=] )
            DIYCE_EventFrame:SetScripts("OnEvent", [=[ 
                    if event == 'PLAYER_SKILLED_CHANGED' then
                        ReadSkills()
                        end
                    ]=] )
            DIYCE_EventFrame:RegisterEvent("PLAYER_SKILLED_CHANGED")

function PctH(tgt)
    return (UnitHealth(tgt)/UnitMaxHealth(tgt))
end

function PctM(tgt)
    return (UnitMana(tgt)/UnitMaxMana(tgt))
end

function PctS(tgt)
    return (UnitSkill(tgt)/UnitMaxSkill(tgt))
end

function CancelBuff(buffname)
    local i = 1
    local buff = UnitBuff("player",i)

    while buff ~= nil do
        if buff == buffname then
            CancelPlayerBuff(i)
            return true
        end

        i = i + 1
        buff = UnitBuff("player",i)
    end
    return false
end

function BuffList(tgt)
    local list = {}
    local buffcmd = UnitBuff
    local infocmd = UnitBuffLeftTime

    if UnitCanAttack("player",tgt) then
        buffcmd = UnitDebuff
        infocmd = UnitDebuffLeftTime
    end

    -- There is a max of 100 buffs/debuffs per unit apparently
    for i = 1,100 do
        local buff, _, stackSize, ID = buffcmd(tgt, i)
        local timeRemaining = infocmd(tgt,i)
        if buff then
            -- Ad to list by name
            list[buff:gsub('(%()(.)(%))', '%2')] = { stack = stackSize, time = timeRemaining or 0, id = ID }
            -- We also list by ID in case two different buffs/debuffs have the same name.
            list[ID] = {stack = stackSize, time = timeRemaining or 0, name = buff:gsub("(%()(.)(%))", "%2") }
        else
            break
        end
    end

    return list
end

function CD(skillname)
    local firstskill = GetSkillDetail(2,1)
    if (g_skill[firstskill] == nil) or (g_skill[firstskill].page ~= 2) then
        ReadSkills()
    end

    if g_skill[skillname] ~= nil then
        local tt,cd = GetSkillCooldown(g_skill[skillname].page,g_skill[skillname].slot)
        return cd <= 0.4
    elseif skillname == nil then
        return false
    else
        Msg("Skill not available: "..skillname)        --Comment this line out if you do not wish to recieve this error message.
        return
    end
end

function MyCombat(Skill, arg1)
    local spell_name = UnitCastingTime("player")
    local talktome = ((arg1 == "v1") or (arg1 == "v2"))
    local action,actioncd,actiondef,actioncnt
    
    if spell_name ~= nil then
        if (arg1 == "v2") then Msg("- ['..spell_name..']", 0, 1, 1) end
        return true
    end

    for x,tbl in ipairs(Skill) do
        
    local useit = type(Skill[x].use) ~= "function" and Skill[x].use or (type(Skill[x].use) == "function" and Skill[x].use() or false)
        if useit then
            if string.find(Skill[x].name, "Action:") then
                action = tonumber((string.gsub(Skill[x].name, "(Action:)( *)(%d+)(.*)", "%3")))
                _1,actioncd = GetActionCooldown(action)
                actiondef,_1,actioncnt = GetActionInfo(action)
                if GetActionUsable(action) and (actioncd == 0) and (actiondef ~= nil) and (actioncnt > 0) then
                    if talktome then Msg("- "..Skill[x].name) end
                    UseAction(action)
                    return true
                end
            elseif string.find(Skill[x].name, "Custom:") then
                action = string.gsub(Skill[x].name, "(Custom:)( *)(.*)", "%3")
                if CustomAction(action) then
                    return true
                end
            elseif string.find(Skill[x].name, "Item:") then
                action = string.gsub(Skill[x].name, "(Item:)( *)(.*)", "%3")
                if talktome then Msg("- "..Skill[x].name) end
                UseItemByName(action)
                return true
            elseif (Skill[x].ignoretimer or GetDIYCETimerValue(Skill[x].timer) == 0) and CD(Skill[x].name) then
                if talktome then Msg("- "..Skill[x].name) end
                CastSpellByName(Skill[x].name)
                StartDIYCETimer(Skill[x].timer)
                return true
            elseif string.find(Skill[x].name, "Pet Skill:") then
                action = string.gsub(Skill[x].name, "(Pet Skill:)( *)(%d+)(.*)", "%3")
                    UsePetAction(action)
                if (arg1 == "v2") then Msg(Skill[x].name.." has been fully processed") end
                return true
            end
        end
    end
    if (arg1 == "v2") then Msg("- [IDLE]", 0, 1, 1) end
    
    return false
end

--[[ Timer Update function ]]--
-- Tick down any active timers
function DIYCE_TimerUpdate(elapsed)
    for k,v in pairs(DIYCE_Timers) do
        v.timeLeft = v.timeLeft - elapsed
        if v.timeLeft < 0 then
            v.timeLeft = 0
        end
    end
end

--[[ Create a named timer ]]--
-- if the named timer already exists, this does nothing.
function CreateDIYCETimer(timerName, waitTime)
    if not DIYCE_Timers[timerName] then
        DIYCE_Timers[timerName] = { timeLeft = 0, waitTime = waitTime }
    end
end

--[[ Set/reset waitTimer of an existing timer ]]--
-- if the timer doesn't exist, this does nothing
function SetDIYCETimerDelay(timerName, waitTime)
    if DIYCE_Timers[timerName] then
        DIYCE_Timers[timerName].waitTime = waitTime
    end
end

--[[ Delete named timer ]]--
-- if the timer doesn't exist, this does nothing
-- Not really needed, but added for completeness
function DeleteDIYCETimer(timerName)
    if DIYCE_Timers[timerName] then
        DIYCE_Timers[timerName] = nil
    end
end

--[[ Get a timer's current time ]]--
-- if the timer doesn't exist, this returns 0
function GetDIYCETimerValue(timerName)
    if timerName then
        return DIYCE_Timers[timerName] and DIYCE_Timers[timerName].timeLeft or 0
    end
    return 0
end

--[[ Starts a timer ticking down ]]--
-- if timer doesn't exist, this does nothing
function StartDIYCETimer(timerName)
    if timerName and DIYCE_Timers[timerName] then
        DIYCE_Timers[timerName].timeLeft = DIYCE_Timers[timerName].waitTime
    end
end

function CustomAction(action)
    if CD(action) then
        if IsShiftKeyDown() then Msg("- "..action) end
        g_lastaction = action
        CastSpellByName(action)
        return true
    else
        return false
    end
end

function BuffTimeLeft(tgt, buffname)
    local cnt = 1
    local buff = UnitBuff(tgt,cnt)

    while buff ~= nil do
        if string.find(buff,buffname) then
            return UnitBuffLeftTime(tgt,cnt)
        end
        cnt = cnt + 1
        buff = UnitBuff(tgt,cnt)
    end

    return 0
end

function BuffParty(arg1,arg2)
--    arg1 = Quickbar slot # for targetable, instant-cast buff without a cooldown (eg. Amp Attack) for range checking.
--    arg2 = buff expiration time cutoff (in seconds) for refreshing buffs, default is 45 seconds.

    local selfbuffs = { "Soul Bond", "Enhanced Armor", "Holy Seal" }
    local groupbuffs = { "Grace of Life", "Amplified Attack", "Angel's Blessing", "Essence of Magic", "Magic Barrier", "Blessed Spring Water", "Fire Ward", "Savage Blessing", "Concentration Prayer", "Shadow Fury"  }

    local buffrefresh = arg2 or 45           -- Refresh buff time (seconds)
    local spell = UnitCastingTime("player")  -- Spell being cast?
    local vocal = IsShiftKeyDown()           -- Generate feedback if Shift key held

    if (spell ~= nil) then
        return
    end

    if vocal then Msg("- Checking self buffs on "..UnitName("player")) end
    for i,buff in ipairs(selfbuffs) do
        if (g_skill[buff] ~= nil) and CD(buff) and (BuffTimeLeft("player",buff) <= buffrefresh) then
            if vocal then Msg("- Casting "..buff.." on "..UnitName("player")) end
            TargetUnit("player")
            CastSpellByName(buff)
            return
        end
    end

    if vocal then Msg("- Checking group buffs on "..UnitName("player")) end
    for i,buff in ipairs(groupbuffs) do
        if (g_skill[buff] ~= nil) and CD(buff) and (BuffTimeLeft("player",buff) <= buffrefresh) then
            if vocal then Msg("- Casting "..buff.." on "..UnitName("player")) end
            TargetUnit("player")
            CastSpellByName(buff)
            return
        end
    end

    for num=1,GetNumPartyMembers()-1 do
        TargetUnit("party"..num)
        if GetActionUsable(arg1) and (UnitHealth("party"..num) > 0) then
            if vocal then Msg("- Checking group buffs on "..UnitName("party"..num)) end
            for i,buff in ipairs(groupbuffs) do
                if (g_skill[buff] ~= nil) and CD(buff) and (BuffTimeLeft("target",buff) <= buffrefresh) then
                    if UnitIsUnit("target","party"..num) then
                        if vocal then Msg("- Casting "..buff.." on "..UnitName("target")) end
                        CastSpellByName(buff)
                        return
                    else
                        if vocal then Msg("- Error: "..UnitName("target").." != "..UnitName("party"..num)) end
                    end
                end
            end
        else
            if vocal then Msg("- Player "..UnitName("party"..num).." out of range or dead.") end
        end
    end

    if vocal then Msg("- Nothing to do.") end
end
A few changes to the OP's Customfunctions to suit my needs.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
local WHITE = "|cffffffff"
local SILVER = "|cffc0c0c0"
local GREEN = "|cff00ff00"
local LTBLUE = "|cffa0a0ff"

function DIYCE_DebugSkills(skillList)
    DEFAULT_CHAT_FRAME:AddMessage(GREEN.."Skill List:")
    
    for i,v in ipairs(skillList) do
        DEFAULT_CHAT_FRAME:AddMessage(SILVER.."  ['..WHITE..i..SILVER..']: "..LTBLUE.."" "..WHITE..v.name..LTBLUE..""  use = "..WHITE..(v.use and "true" or "false"))
    end

    DEFAULT_CHAT_FRAME:AddMessage(GREEN.."----------")
end

function DIYCE_DebugBuffList(buffList)
    DEFAULT_CHAT_FRAME:AddMessage(GREEN.."Buff List:")
    
    for k,v in pairs(buffList) do
        -- We ignore numbered entries because both the ID and name 
        -- are stored in the list. This avoids doubling the output.
        if type(k) ~= "number" then
            DEFAULT_CHAT_FRAME:AddMessage(SILVER.."  ['..WHITE..k..SILVER..']:  "..LTBLUE.."id: "..WHITE..v.id..LTBLUE.."  stack: "..WHITE..v.stack..LTBLUE.."  time: "..WHITE..v.time)
        end
    end
    
    DEFAULT_CHAT_FRAME:AddMessage(GREEN.."----------")    
end

local silenceList = {
        ['Annihilation']    = true,
        ['King Bug Shock']  = true,
        ['Mana Rift']       = true,
        ['Dream of Gold']   = true,
        ['Flame']           = true,
        ['Flame Spell']     = true,
        ['Wave Bomb']       = true,
        ['Silence']         = true,
        ['Recover']         = true,
        ['Restore Life']    = true,
        ['Heal']            = true,
        ['Curing Shot']     = true,
        ['Leaves of Fire']  = true,
        ['Urgent Heal']     = true,
        ['Heavy Shelling']  = true, --Juggler Apprentice in Grafu
        ['Dark Healing']    = true, --Mini-boss in Sardo
                    }
                    
function PriestFairySequence(arg1)
    local Skill = {}
    local Skill2 = {}
    local i = 0
    local FairyExists = UnitExists("playerpet")
    local FairyBuffs = BuffList("playerpet")
    local combat = GetPlayerCombatState()

    --Determine Class-Combo
    mainClass, subClass = UnitClassToken( "player" )

    --Summon Fairy
    if (not FairyExists) and (not combat) then
        if mainClass == "AUGUR" then
            if subClass == "THIEF" then
                Skill = {
                    { name = "Shadow Fairy",            use = true },
                        }
            elseif subClass == "RANGER" then
                Skill = {
                    { name = "Water Fairy",                use = true },
                        }
            elseif subClass == "MAGE" then
                Skill = {
                    { name = "Wind Fairy",                use = true },
                        }            
            elseif subClass == "KNIGHT" then
                Skill = {
                    { name = "Light Fairy",                use = true },
                        }            
            elseif subClass == "WARRIOR" then
                Skill = {
                    { name = "Fire Fairy",                use = true },
                        }
            end
        end
    end    
    
    --Cast Halo
    if FairyExists then
        if mainClass == "AUGUR" then
            if subClass == "THIEF" then
                if (not FairyBuffs[503459]) then
                    if (arg1 == "v1") then
                        Msg("- Activating Halo", 0, 1, 1)
                    end
                    Skill = {
                        { name = "Pet Skill: 6 (Wraith Halo)",    use = true },
                            }
                end
            elseif subClass == "RANGER" then
                if (not FairyBuffs[503457]) then
                    if (arg1 == "v1") then
                        Msg("- Activating Halo", 0, 1, 1)
                    end
                    Skill = {
                        { name = "Pet Skill: 6 (Frost Halo)",    use = true },
                            }
                end
            elseif subClass == "MAGE" then
                if (not FairyBuffs[503461]) then
                    if (arg1 == "v1") then
                        Msg("- Activating Halo", 0, 1, 1)
                    end
                    Skill = {
                        { name = "Pet Skill: 6 (Windrider Halo)",    use = true },
                            }
                end
            elseif subClass == "KNIGHT" then
                if (not FairyBuffs[503507]) then
                    if (arg1 == "v1") then
                        Msg("- Activating Halo", 0, 1, 1)
                    end
                    Skill = {
                        { name = "Pet Skill: 6 (Devotion Halo)",    use = true },
                            }
                end
            elseif subClass == "WARRIOR" then
                if (not FairyBuffs[503455]) then
                    if (arg1 == "v1") then
                        Msg("- Activating Halo", 0, 1, 1)
                    end
                    Skill = {
                        { name = "Pet Skill: 6 (Accuracy Halo)",    use = true },
                            }
                end
            end
        
            --Cast Conceal
        if (not MyCombat(Skill, arg1)) then
            if (not FairyBuffs[503753]) then
                if (arg1 == "v1") then
                    Msg("- Activating Conceal", 0, 1, 1)
                end
                Skill2 = {
                    { name = "Pet Skill: 7 (Conceal)",    use = true },
                        }
            end
        end
        end
    end
    
    if (not MyCombat(Skill, arg1)) then
        MyCombat(Skill2, arg1)
    end
end
                        
function KillSequence(arg1, goat2, healthpot, manapot, foodslot)
--arg1 = "v1" or "v2" for debugging
--healthpot = # of actionbar slot for health potions
--manapot = # of actionbar slot for mana potions
--foodslot = # of actionbar slot for food (add more args for more foodslots if needed)

    local Skill = {}
    local Skill2 = {}
    local i = 0
    
    -- Player and target status.
    local combat = GetPlayerCombatState()
    local enemy = UnitCanAttack("player","target")
    local EnergyBar1 = UnitMana("player")
    local EnergyBar2 = UnitSkill("player")
    local pctEB1 = PctM("player")
    local pctEB2 = PctS("player")
    local tbuffs = BuffList("target")
    local pbuffs = BuffList("player")
    local tDead = UnitIsDeadOrGhost("target")
    local behind = (not UnitIsUnit("player", "targettarget"))
    local melee = GetActionUsable(2) -- # is your melee range spell slot number
    local a1,a2,a3,a4,a5,ASon = GetActionInfo(14)  -- # is your Autoshot slot number
    local phealth = PctH("player")
    local thealth = PctH("target")
    local LockedOn = UnitExists("target")
    local boss = UnitSex("target") > 2
    local elite = UnitSex("target") == 2
    local party = GetNumPartyMembers() >= 2
    
    
    --Determine Class-Combo
    mainClass, subClass = UnitClassToken( "player" )

    --Silence Logic
    local tSpell,tTime,tElapsed = UnitCastingTime("target")
    local silenceThis = tSpell and silenceList[tSpell] and ((tTime - tElapsed) > 0.1)
    
    --Potion Checks
    healthpot = healthpot or 0
    manapot = manapot or 0
    
    --Equipment and Pet Protection
    if phealth <= .03 then
            SwapEquipmentItem()        --Note: Remove the first double dash to re-enable equipment protection.
        for i=1,6 do
            if (IsPetSummoned(i) == true) then
                ReturnPet(i);
            end
        end        
    end
        
    --Check for level 1 mobs, if it is, drop target and acquire a new one.
    if (LockedOn and (UnitLevel("target") < 2)) then
        TargetUnit("")
        return
    end
    
    --Begin Player Skill Sequences
    
        --Priest = AUGUR, Druid = DRUID, Mage = MAGE, Knight = KNIGHT, 
        --Scout = RANGER, Rogue = THIEF, Warden = WARDEN, Warrior = WARRIOR
        
        -- Class: Rogue/Scout
            if mainClass == "THIEF" and subClass == "RANGER" then
            --Timers for this class
            CreateDIYCETimer("SSBleed", 6.5) --Change the value between 6 -> 7.5 depending on your lag.
            CreateDIYCETimer("LBBleed", 8.5) --Change the value between 7 ->  8.5 depending on your lag.
            --goat2: 0 = Buffs, 1 = Melee, 2 = Ranged, 3 = Cooldowns & Potions, 4 = Longer Cooldowns
            
            if (goat2 == "0") then
            Skill =  {
                { name = "Combat Master",                      use = ((not pbuffs['Combat Master'])) },
                { name = "Action: 62 (Yawaka's Blessing)",     use = ((not pbuffs['Yawaka's Blessing'])) },
                { name = "Action: 69 (Unbridled Enthusiam)",   use = ((not pbuffs['Unbridled Enthusiasm'])) }, -- Speed Potion
                     }
            elseif (goat2 == "3") then
            Skill =  {
               { name = "Informer",                            use = ((not pbuffs['Informer'])) },
               { name = "Action: 64 (Unknown Choice)",         use = ((EnergyBar1 > 20)) },
               { name = "Action: 65 (Caviar Sandwich)",        use = ((not pbuffs['Caviar Sandwich'])) },
                     }
            elseif (goat2 == "4") then
            Skill = {
                { name = "Action: 46 (Energy Potion)",         use = ((EnergyBar1) <= 15 and (boss)) },
                { name = "Action: 30 (Strong Stimulant)",      use = ((boss) and (not pbuffs['Fervent Attack'])) },
                { name = "Action: 34 (Extinction Potion)",     use = ((boss) and (not pbuffs['Extinction Potion'])) },
                { name = "Energy Thief",                       use = ((EnergyBar1 < 50) and (boss) and (not tDead)) },
                { name = "Assassins Rage",                     use = ((boss) and (not tDead)) },
                { name = "Fervent Attack",                     use = ((boss) and (not tDead) and (not pbuffs['Strong Stimulant'])) },
                    }
            end

            if ((enemy) and (goat2 == "1")) then
            Skill2 = {
                { name = "Wound Attack",                       use = ((EnergyBar1 >= 35) and ((tbuffs[500654]) and (tbuffs[500704]))) },
                { name = "Blind Spot",                         use = (((EnergyBar1 >= 25) and (boss) and (behind)) and (pbuffs['Energy Thief'] or pbuffs['Premeditation'])) },
                { name = "Shadowstab",                         use = (EnergyBar1 >= 20),       timer = "SSBleed" },
                { name = "Low Blow",                           use = (((EnergyBar1 >= 25) and (tbuffs[500654])) or (tbuffs['Energy Thief'])),      timer = "LBBleed",   ignoretimer = not tbuffs['Energy Thief'] },
                { name = "Throat Attack",                      use = ((EnergyBar2 >= 50) and (boss or elite) and (silenceThis)) },
                { name = "Vampire Arrows",                     use = (EnergyBar2 >= 20) },
                { name = "Wrist Attack",                       use = ((EnergyBar2 >= 50) and (boss)) },
                { name = "Shot",                               use = ((EnergyBar1 < 20 )) },
                    }
            elseif ((enemy) and (goat2 == "2")) then
            Skill2 = {
                { name = "Vampire Arrows",                     use = (EnergyBar2 >= 20) },
                { name = "Shot",                               use = (true) },
                     }
            end
                
            --ADD MORE CLASS COMBOS HERE. 
            --USE AN "ELSEIF" TO CONTINUE WITH MORE CLASS COMBOS.
            --THE NEXT "END" STATEMENT IS THE END OF THE CLASS COMBOS STATEMENTS.
            --DO NOT POST BELOW THE FOLLOWING "END" STATEMENT!
            end
    --End Player Skill Sequences
    
    if (arg1=="debugskills") then        --Used for printing the skill table, and true/false usability
        DIYCE_DebugSkills(Skill)
        DIYCE_DebugSkills(Skill2)
    elseif (arg1=="debugpbuffs") then    --Used for printing your buff names, and buffID
        DIYCE_DebugBuffList(pbuffs)
    elseif (arg1=="debugtbuffs") then    --Used for printing target buff names, and buffID
        DIYCE_DebugBuffList(tbuffs)
    elseif (arg1=="debugall") then        --Used for printing all of the above at the same time
        DIYCE_DebugSkills(Skill)
        DIYCE_DebugSkills(Skill2)
        DIYCE_DebugBuffList(pbuffs)
        DIYCE_DebugBuffList(tbuffs)
    end
    
    if (not MyCombat(Skill, arg1)) then
        MyCombat(Skill2, arg1)
    end
        
    --Select Next Enemy
    if (tDead) then
        TargetUnit("")
        return
    end
    if (mainClass == "RANGER" or subClass == "RANGER")  and (not party) then        --To keep scouts from pulling mobs without meaning to.
        if (not LockedOn) or (not enemy) then
            TargetNearestEnemy()
            return
        end
    elseif mainClass ~= "RANGER" then                    --Let all other classes auto target.
        if (not LockedOn) or (not enemy) then
            TargetNearestEnemy()
            return
        end
    end
end
Change log (06/11/2011): Updated to DIYCE 2.1 & Updated the silenceList with a few spells to interrupt during Sardo/Grafu.
Change log (11/11/2011): Updated to DIYCE 2.2.
Change log (12/11/2011): Fixed a tiny bug.
Change log (23/11/2011): Timers have been added.



Well if use had a value of false, it wouldn't cast that specific skill.
As far as I can tell, it's working perfectly, a little delay that I do not enjoy. But it's perfect for people who have a low-ping to the server.


Appreciate the time that went into this. Tried it and for melee attacks, I always cast shadowstab and then vampire arrows. It never seems to use low blow or wound attack?
I miss the ant party

mrmisterwaa

Professional

Posts: 670

Location: Kuwait

  • Send private message

234

Friday, November 25th 2011, 12:37pm

Still in the process of testing it. I have encountered a couple bugs with it.

As of Patch 4.0.0.5, it doesn't work as it use to.

Give me a few days to debug it.

ghostwolf82

Professional

  • "ghostwolf82" started this thread

Posts: 859

Location: Kalvans Trunk

Occupation: It's dark in here

  • Send private message

235

Friday, November 25th 2011, 6:15pm

@kurreduttan - Has the name of your buff changed since the patch?

@thread - Not sure why so many are having issues since the release of the patch. I have yet to find any problems with DIYCE v2...

mrmisterwaa

Professional

Posts: 670

Location: Kuwait

  • Send private message

236

Friday, November 25th 2011, 6:50pm

@ghostwolf,

It's not the ranged I am having trouble with. It's the melee.

Melee isn't working properly.

I think it has something to do with the melee checks.

237

Friday, November 25th 2011, 8:07pm

@GhostWolf


Found my problem, solved!

ghostwolf82

Professional

  • "ghostwolf82" started this thread

Posts: 859

Location: Kalvans Trunk

Occupation: It's dark in here

  • Send private message

238

Saturday, November 26th 2011, 1:53am

Quoted from "mrmisterwaa;486335"

@ghostwolf,

It's not the ranged I am having trouble with. It's the melee.

Melee isn't working properly.

I think it has something to do with the melee checks.

Yeah, just tested the melee issue, its due to this GCD nerf. The spell/skill you have in the melee slot is no longer always ready due to to GCD. Which means yet something else was screwed up with this patch. Again, thanks RoM!

ghostwolf82

Professional

  • "ghostwolf82" started this thread

Posts: 859

Location: Kalvans Trunk

Occupation: It's dark in here

  • Send private message

239

Tuesday, November 29th 2011, 5:23pm

I currently ha a R/P/S giving me R/P and R/S to play as. Here are my scripts for those two combos:

R/P
:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
--Class: Rogue/Priest
            elseif mainClass == "THIEF" and subClass == "AUGUR" then
            
            --Potions and Buffs
            Skill = {
                { name = "Holy Aura",                    use = (phealth <= .20) },
                { name = "Regenerate",                    use = (phealth <= .90) and (pctEB2 >= .05) and (not pbuffs['Regenerate']) },
                { name = "Urgent Heal",                    use = (phealth <= .70) and (pctEB2 >= .05) and (not combat) },
                { name = "Action: "..healthpot,            use = (phealth <= .70) },
                { name = "Action: "..manapot,            use = (pctEB2 <= .40) },
                { name = "Magic Barrier",                use = (pctEB2 >= .05) and ((not pbuffs['Magic Barrier']) or (pbuffs['Magic Barrier'].time <= 45)) },
                { name = "Quickness Aura",                use = (pctEB2 >= .05) and ((not pbuffs['Quickness Aura']) or (pbuffs['Quickness Aura'].time <= 45)) },
                { name = "Poison",                        use = (not combat) and ((not pbuffs['Poisonous']) or (pbuffs['Poisonous'].time <= 45))},
                    }
                    
            --Combat
                if enemy then
                Skill2 = {
                    --{ name = "Throw",                        use = (not melee) and (not boss) },
                    { name = "Premeditation",                use = (not combat) and boss and (EnergyBar1 >= 50) and (not pbuffs['Premeditiation']) },
                    { name = "Slowing Poison",                use = boss },
                    { name = "Informer",                    use = boss },
                    { name = "Fervent Attack",                use = boss },
                    { name = "Assassins Rage",                use = boss },
                    { name = "Kick",                        use = (pctEB2 >= .05) },
                    { name = "Sneak Attack",                use = (EnergyBar1 >= 20) and boss and behind and party },
                    { name = "Blind Spot Attack",            use = (EnergyBar1 >= 20) and boss and behind and party },
                    { name = "Shadowstab",                    use = (EnergyBar1 >= 20) and (not tbuffs[620313]) },
                    { name = "Low Blow",                    use = (EnergyBar1 >= 30) and (tbuffs[620313]) and (not tbuffs[500704]) },
                    { name = "Wound Attack",                use = (tbuffs[620313]) and (tbuffs[500704]) and (EnergyBar1 >= 35) },
                    { name = "Shadowstab",                    use = (EnergyBar1 >= 20) },
                    { name = "Attack",                        use = (thealth == 1) },                    
                            }
                end
R/S:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
--Class: Rogue/Scout
            elseif mainClass == "THIEF" and subClass == "RANGER" then
                --Timers for this class
                    CreateDIYCETimer("SSBleed", 6.8) --Change the value between 6 -> 7.5 depending on your lag.
                    CreateDIYCETimer("LBBleed", 8.8) --Change the value between 7 ->  8.5 depending on your lag.
            
                --Ammo Check and Equip
                if GetCountInBagByName("Runic Thorn") > 0 then
                    UseItemByName("Runic Thorn")
                    return true
                end
                if GetInventoryItemDurable("player", 9) == 0 
                    and GetTime() - arrowTime > 2 then
                        if (not RWB) then
                            UseAction(SlotRWB)
                            return
                        end
                    UseEquipmentItem(10)
                    arrowTime = GetTime()
                    return true
                end
            if (not MNB) then
                    UseAction(SlotMNB)
                    return
                end
            
            --Potions and Buffs
            Skill = {
                { name = "Action: "..healthpot,            use = (phealth <= .70) },
                { name = "Combat Master",                use = ((not pbuffs['Combat Master']) or (pbuffs['Combat Master'].time <= 45)) and (EnergyBar2 >= 30) },
                { name = "Poison",                        use = (not combat) and ((not pbuffs['Poisonous']) or (pbuffs['Poisonous'].time <= 45)) },                
                }
                    
            --Combat
                if enemy then
                Skill2 = {
                    { name = "Throat Attack",                use = melee and (silenceThis) },
                    { name = "Substitute",                    use = subThis and (EnergyBar2 >= 30) },
                    { name = "Energy Thief",                use = ((EnergyBar1 < 25) and (boss) and (not tDead)) },
                    { name = "Fervent Attack",                use = (pbuffs['Energy Thief']) },
                    { name = "Premeditation",                use = (not combat) and boss and (EnergyBar1 >= 50) and (not pbuffs['Premeditation']) },
                    { name = "Informer",                    use = boss },
                    { name = "Assassins Rage",                use = boss },
                    { name = "Evasion",                        use = boss },
                    { name = "Wrist Attack",                use = (EnergyBar2 >= 35) and boss },
                    { name = "Sneak Attack",                use = (EnergyBar1 >= 20) and boss and behind and party and (not combat) },
                    { name = "Blind Spot",                    use = (EnergyBar1 >= 20) and boss and behind and party },
                    { name = "Vampire Arrows",                use = (not melee) and (EnergyBar2 >= 20) },
                    { name = "Shot",                        use = (not melee) },
                    { name = "Wound Attack",                use = (EnergyBar1 >= 35) and (tbuffs[620313]) and (tbuffs[500704]) },
                    { name = "Low Blow",                    use = (EnergyBar1 >= 25) and (tbuffs[620313]) and (not tbuffs[500704]),    timer = "LBBleed" },
                    { name = "Shadowstab",                    use = (EnergyBar1 >= 20) and (not tbuffs[620313]),    timer = "SSBleed" },
                    { name = "Vampire Arrows",                use = (EnergyBar2 >= 20) },
                    { name = "Shot",                        use = true },
                    { name = "Shadowstab",                    use = (EnergyBar1 >= 20) },                    
                    { name = "Attack",                        use = (thealth == 1) },                    
                            }
                end
For the R/S combo, add this to the local variables section:

Source code

1
2
    local _,_,_,_,RWB,_ = GetActionInfo( SlotRWB )
    local _,_,_,_,MNB,_ = GetActionInfo( SlotMNB )


And then add this to CustomFunctions.lua, outside of any functions:

Source code

1
2
3
arrowTime = 0
SlotRWB = 16 --Action Bar Slot # for Rune War Bow
SlotMNB = 17 --Action Bar Slot # for your Main Bow


Hope this helps someone along the way.

Grandpoubba

Beginner

Posts: 4

Location: Just a place...

Occupation: Just a job...

  • Send private message

240

Tuesday, November 29th 2011, 6:01pm

warr/kni looking for help

ok, i read the thread page by page but cannot find what im looking for
(almost certain i missed what im looking for but...ya know...lol)
I've been gone for 6months too since like april/may ish
i/ve lost most info, links, addons etc since then(PC total crash, long story hehe)
I want my "Ignore Pain" skill to activate if im feared for example.
in v1.4 i made a addition script looking at my debuffs on myself

if i remember i had a "pdbuff" that checked my debuffs and applied Ignore Pain if i was stunned, rooted etc

now, i could read old thread from scratch and make it and convert to new 2.2 but... Thought I'd ask the pros.
The fears spells applied to me are name "Primal Fear" and seem to be instant spells from mobs so "local silenceList" doest apply.

just for reference my script works just the way i need it atm
-------------- Class: Warrior/Knight--------------------------------------------
elseif mainClass == "WARRIOR" and subClass == "KNIGHT" then
local SurpriseAttack = GetActionUsable(3)
local FeintAttack = GetActionUsable(10)
--Potions and Buffs
Skill = {
{ name = "Enhanced Armor", use = (pctEB1 >= .05 and (not pbuffs['Enhanced Armor'])) }, --KnightSkillGeneral 12
{ name = "Blocking Stance", use = (pctEB1 >= .05 and (not pbuffs['Blocking Stance'])) }, --EliteSkill 20
{ name = "Aggressiveness", use = combat and (EnergyBar1 >= 50)},
{ name = "Berserk", use = combat and (EnergyBar1 >= 70) },
--{ name = "Defensive Formation", use = enemy },
{ name = "Survival Instinct", use = combat and (phealth <= .50) },
{ name = "Enraged", use = combat and (EnergyBar1 > 60) },
{ name = "Frenzy", use = combat and (EnergyBar1 > 70) },
--{ name = "Ignore Pain", use = combat and (pbuffs['Primal Fear']) }, --EliteSkill 25
}
--Combat
if enemy then
Skill2 = {
{ name = "Surprise Attack", use = SurpriseAttack },
--{ name = "Throw Shield", use = enemy }, --EliteSkill 15, Shield Only
--{ name = "Shield Bash", use = enemy }, --EliteSkill 30, Shield Only
{ name = "Blasting Cyclone", use = combat and (EnergyBar1 >= 35) },
{ name = "Slash", use = (EnergyBar1 >= 25) and (not tbuffs['Bleed']) }, --SharpWeapon Only
{ name = "Tactical Attack", use = (EnergyBar1 >= 15) and (tbuffs['Bleed']) }, --2H Only
{ name = "Moon Cleave", use = (EnergyBar1 >= 50) }, --unsure if proper rage or rotation, 2H Only
{ name = "Whirlwind", use = (EnergyBar1 >= 50) }, --unsure if proper rage or rotation
--{ name = "Probing Attack", use = (EnergyBar1 >= 20) and XYZ },
--{ name = "Open Flank", use = (EnergyBar1 >= 10) and (tbuffs['Vulnerable']) and XYZ },
--{ name = "Thunder", use = (EnergyBar1 >= 15) and (tbuffs['Weakened']) and XYZ }, --1H Only
{ name = "Feint", use = FeintAttack }, --modify local if used, Dodged Only
--{ name = "Taunt", use = enemy },
--{ name = "Shout", use = enemy },
--{ name = "Terror", use = enemy },
--{ name = "Group Taunt", use = enemy },
--{ name = "Punishment", use = enemy and (tbuffs[Light Seal III]) }, --KnightSkillGeneral 1, LightSeals Only
--{ name = "Disarmament", use = elite and (not tbuffs[Disarmament IV]) }, --KnightSkillGeneral 4
--{ name = "Shield of Atonement", use = enemy }, --KnightSkillGeneral 8, Shield Only
{ name = "Holy Strike", use = enemy }, --KnightSkillGeneral 1
{ name = "Attack", use = enemy },
}
end

can someone point me in right direction please or give me an example as reference
TY all for your time
...it's too hard to say "Au Revoir", so let's just say "Au Gratin"...