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.

741

Tuesday, August 21st 2012, 5:07pm

Quoted from "Peryl;565564"

You've got two choices for this. In both cases they return two values.

Either do:

Source code

1
2
local TrgtMainClass, TrgtSecClass = UnitClass("target")
local PriestScout = (TrgtMainClass == "Priest" and TrgtSecClass == "Scout")


or you can do:

Source code

1
2
local TrgtMainClass, TrgtSecClass = UnitClassToken("target")
local PriestScout = (TrgtMainClass == "AUGUR" and TrgtSecClass == "RANGER")


The only difference here is that UnitClassToken returns those oddly named string tokens for the classes, but will work regardless of the language region while UnitClass returns the easily identifiable class names, but would need to be translated for other language regions.

Sweet, I'll try this out, thanks Peryl! :D

edit: Works like a charm ;) (went with the 2nd option)

Ravesden, D/S/Wd 80/75/62
Retired. Click siggy for old RoM vids, among other things.

742

Wednesday, August 22nd 2012, 2:50am

Quoted from "xMagus;565427"

Ok this is frustrating to me ive been trying to get Escape Danger to trigger when i am shadow prisoned or lightning in siege when using my diyce and i keep getting an error saying cant use these skills while stunned/rooted etc. however when i do it manually it works is there sumtin i need to tag on the end of the lil code to get it to work in pvp conditions?

Anyone have an answer for this is there something different i should be doing in my DIYCE (like instead of "pbuffs" is it a different code altogether)? or is this not possible
-[EvilEmpires]-
Cocheech - RIP
Ricknight - R/M/S/Wd
Necrotix - WL/C/M
Yamanight D/W/Wd
Nightmareknight K/W/M/P

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

743

Wednesday, August 22nd 2012, 6:24am

Quoted from "xMagus;565688"

Anyone have an answer for this is there something different i should be doing in my DIYCE (like instead of "pbuffs" is it a different code altogether)? or is this not possible

There is/was a post about something along these lines but I can't seem to find it.

Anyway, I suspect that at least part of the problem is that you are using pbuffs to look for player debuffs. Unfortunately, the function that fills that table only looks at the player buffs, so it'll never trigger in DIYCE as is.

To "fix" this, you'll need to create a new function for retrieving the debuffs.

Open DIYCE.lua in a text editor (notepad will do at a pinch, but try Notepad++. It rocks, and it's free)
Look for the function BuffList and copy all the lines of the function (should be about 26 lines or so). Starting with:

Source code

1
2
function BuffList(tgt)
    local list = {}

up to

Source code

1
2
    return list
end

again, should be about 26 lines

Now that you have a copy paste a duplicate of this function in this same file (right after the BuffList function itself is fine).
Change the name of this copied function to DebuffList and change the code so that where in says UnitBuff to UnitDebuff, change where it originally says UnitDebuff to UnitBuff (do the same for the UnitBuffTimeLeft and UnitDebuffTimeLeft). In effect we are just swapping the functions it calls. The first few lines of your function should then look like this:

Source code

1
2
3
4
5
6
7
8
9
function DebuffList(tgt)
    local list = {}
    local buffcmd = UnitDebuff
    local infocmd = UnitDebuffLeftTime

    if UnitCanAttack("player",tgt) then
        buffcmd = UnitBuff
        infocmd = UnitBuffLeftTime
    end

Save the file.

Now in your CustomFunctions.lua, you can add the following in KillSequence where all the local variables are:

Source code

1
    local pdebuffs = DebuffList("player")


And finally, you can now look for debuffs in your use clauses with pdebuffs['name of debuff'] much like you do for the buffs.

Note that this "DebuffList" also works for targets, but in that case it will return the actual buffs of the target (much like BuffList returns target debuffs).
2013... The year from hell....

744

Wednesday, August 22nd 2012, 8:08am

Yeah i added what u told me its still not working ill post what i have

Customfunctions.lua

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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
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 pdebuffs = DebuffList("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: Warrior/Mage
            if mainClass == "WARRIOR" and subClass == "MAGE" then
                local SurpriseAttack = GetActionUsable(14)
    
            --Potions and Buffs
            Skill = {
                { name = "Action: "..healthpot,            use = (phealth <= .70) },
                { name = "Survival Instinct",              use = (phealth <= .30) and combat },
                { name = "Sense of Danger",                use = (phealth <= .30) and combat },
                { name = "Action: "..manapot,              use = (pctEB2 <= .40) },
                { name = "Action: "..Healslot,             use = (phealth < .70) and (not combat) and (not party) },
                { name = "Action: "..HoTslot,              use = (phealth < .80) and (not party) },
                { name = "Intensification",                use = (pctEB2 >= .05) and (not pbuffs['Intensification']) and boss and enemy },
                { name = "Aggressiveness",                 use = boss and enemy },
                { name = "Electric Attack",                use = (pctEB2 >= .05) and ((not pbuffs['Electric Attack']) or (pbuffs['Electric Attack'].time <= 45)) },
                    }
                    
            --Combat
                if enemy then
                Skill2 = {
                    { name = "Silence",                    use = (silenceThis) },
                    { name = "Surprise Attack",            use = SurpriseAttack },
                    { name = "Enraged",                    use = (EnergyBar1 <= 30) and (boss or elite) },
                    { name = "Electrical Rage",            use = (EnergyBar1 >= 15) and (pctEB2 >=.05) and (not pbuffs['High Voltage III']) },
                    { name = "Thunder Sword",              use = (pctEB2 >= .05) },
                    { name = "Lightning's Touch",          use = (pctEB2 >= .05) },
                    { name = "Attack",                     use = (thealth == 1) },
                        }
                end

            --Class: Rogue/Scout
            elseif mainClass == "THIEF" and subClass == "RANGER" then

            --Potions and Buffs
            Skill = {
                { name = "Combat Master",                      use = ((EnergyBar2 >= 30) and (not pbuffs['Combat Master'])) },
                { name = "Action: 50 (Yawaka's Blessing)",     use = ((EnergyBar2 >= 30) and (not pbuffs['Yawaka's Blessing'])) },
                    }

            --Combat
                if enemy then
                Skill2 = {
                    { name = "Combat Master",                use = (not combat) and (EnergyBar2 >= 30) and ((not pbuffs['Combat Master']) or (pbuffs['Combat Master'].time <= 45)) },
                    { name = "Wound Attack",                 use = ((EnergyBar1 >= 35) and (tbuffs['Bleed']) and (tbuffs['Grievous Wound'])) },
                    { name = "Shadowstab",                   use = ((EnergyBar1 >= 20) and (not tbuffs['Bleed'])) },
                    { name = "Low Blow",                     use = ((EnergyBar1 >= 25) and (tbuffs['Bleed'])) },
                    { name = "Vampire Arrows",               use = (EnergyBar2 >=20) },
                    { name = "Shot",                         use = (true) },
                    { name = "Joint Blow",                   use = (EnergyBar2 >=15) },                    
                            }
                end

            --Class: Scout/Rogue
            elseif mainClass == "RANGER" and subClass == "THIEF" then

            --Combat
                if enemy then
                Skill2 = {
                    { name = "Autoshot",                     use = (not ASon) },
                    { name = "Sapping Arrow",                use = ((EnergyBar2 >= 30) and (boss) and (tbuffs['Sapping Arrow'])) },
                    { name = "Combo Shot",                   use = (true) },
                    { name = "Weak Spot",                    use = (EnergyBar1 >= 30) },
                    { name = "Vampire Arrows",               use = (EnergyBar1 >=20) },
                    { name = "Deadly Poison Bite",           use = ((EnergyBar2 >= 30) and (boss) and (tbuffs['Vampire Arrows'])) },
                    { name = "Piercing Arrow",               use = (true) },
                    { name = "Reflected Shot",               use = (true) },
                    { name = "Shot",                         use = (true) },                   
                            }
                end

            --Class: Scout/Knight
            elseif mainClass == "RANGER" and subClass == "KNIGHT" then

            --Potions and Buffs
            Skill = {
                { name = "Enhanced Armor",                     use = (not pbuffs['Significantly Enhanced Armor']) },
                { name = "Frost Arrow",                        use = (not pbuffs['Frost Arrow']) },
            { name = "Escape Danger"                       use = (pdebuffs['Shadow Prison']) },
                    }

            --Combat
                if enemy then
                Skill2 = {
                    { name = "Escape Danger"                 use = (pdebuffs['Shadow Prison']) },
                    { name = "Combo Shot",                   use = (true) },
                    { name = "Autoshot",                     use = (not ASon) },
                    { name = "Vampire Arrows",               use = (EnergyBar1 >=20) },
                    { name = "Piercing Arrow",               use = (true) },
                    { name = "Reflected Shot",               use = (true) },
                    { name = "Shot",                         use = (true) },
                    { name = "Wind Arrows",                  use = (EnergyBar1 >=15) },
                    { name = "Healing 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

end


DIYCE.lua

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
-- DIY Combat Engine version 2.2

local g_skill  = {}
local g_lastaction = ""

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("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, id = ID }
            -- We also list by ID in case two different buffs/debuffs have the same name.
            list[ID] = {stack = stackSize, time = timeRemaining, name = buff:gsub("(%()(.)(%))", "%2") }
        else
            break
        end
    end

    return list
end

function DebuffList(tgt)
    local list = {}
    local buffcmd = UnitDebuff
    local infocmd = UnitDebuffLeftTime

    if UnitCanAttack("player",tgt) then
        buffcmd = UnitBuff
        infocmd = UnitBuffLeftTime
    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, id = ID }
            -- We also list by ID in case two different buffs/debuffs have the same name.
            list[ID] = {stack = stackSize, time = timeRemaining, 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 CD(Skill[x].name) then
                if talktome then Msg("- "..Skill[x].name) end
                CastSpellByName(Skill[x].name)
                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

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
-[EvilEmpires]-
Cocheech - RIP
Ricknight - R/M/S/Wd
Necrotix - WL/C/M
Yamanight D/W/Wd
Nightmareknight K/W/M/P

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

745

Wednesday, August 22nd 2012, 12:26pm

Did you try running it with the debug options?
2013... The year from hell....

746

Thursday, August 23rd 2012, 1:38am

Quoted from "Peryl;565747"

Did you try running it with the debug options?


You are speaking greek to me now lol I am very basic when it comes to DIYCE i followed your directions that you gave (so did my guildy) and neither one of us could get it working.
-[EvilEmpires]-
Cocheech - RIP
Ricknight - R/M/S/Wd
Necrotix - WL/C/M
Yamanight D/W/Wd
Nightmareknight K/W/M/P

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

747

Thursday, August 23rd 2012, 2:07am

Call DIYCE with

Source code

1
/run KillSequence("debugskills")

This will make DIYCE show the skill list as it sees it. That is, it will show you the skill names and a true/false value. The first value in the list that it sees as true will be the skill attempted. If it isn't on cooldown, it will be used and the rest of the list is not processed.

Try the above and see if it ever actually uses that desired skill or if it keeps attempting to use something else first under those conditions. If so, then you'll need to move the skill up in the list.
2013... The year from hell....

748

Thursday, August 23rd 2012, 9:04am

Quoted from "Peryl;565881"

Call DIYCE with

Source code

1
/run KillSequence("debugskills")

This will make DIYCE show the skill list as it sees it. That is, it will show you the skill names and a true/false value. The first value in the list that it sees as true will be the skill attempted. If it isn't on cooldown, it will be used and the rest of the list is not processed.

Try the above and see if it ever actually uses that desired skill or if it keeps attempting to use something else first under those conditions. If so, then you'll need to move the skill up in the list.


Thank You i found the issue i was missing a ","
-[EvilEmpires]-
Cocheech - RIP
Ricknight - R/M/S/Wd
Necrotix - WL/C/M
Yamanight D/W/Wd
Nightmareknight K/W/M/P

749

Thursday, August 23rd 2012, 12:21pm

Wanted to know if this was possible. I have this macro i wanna call with DIYCE but i dont think DIYCE can call another macro so was i wondering if it was possible to make a function in DIYCE that does what my macro does and then just use that function.

Macro in question

Source code

1
2
3
4
5
/run UseAction(29)
/wait 0.2
/run UseAction(29)
/wait 0.2
/run UseAction(28)


This macro is for my Gloves of Assassination to use when i get shadow prison or any other things like that.

If this function is possible, is it also possible to have it skip this function if these gloves are on cooldown. If i use it for being lignting by a mage and they are on cd it would just keep spamming the glove function instead of attacking which you can still do while rooted with lightning.

I already modified my DIYCE with the debuff stuff and i tried adding my current macro into my DIYCE like this

Source code

1
                { name = "Action: 33",                 use = (pdebuffs['Shadow Prison']) },


And using debug its showing that that line is true when i get shadow prison but its not working becuase you cant use a macro (diyce) to call another macro.

750

Monday, August 27th 2012, 7:29pm

SwapEquipmentItem() doesn't work

Hallo,

One little question:

The "SwapEquipmentItem()" funktion seems not to work.
After the patch that allowed to use 3 equipment slots I try to adjust this funktion,
unfortunately without succsess ;-|

Instead of the old code for changing the equipment:

Source code

1
2
3
4
5
6
7
8
9
--Equipment and Pet Protection
    if phealth <= .05 then
            SwapEquipmentItem()
        for i=1,6 do
            if (IsPetSummoned(i) == true) then
                ReturnPet(i);
            end
        end        
    end


I tried this code:

Source code

1
2
3
4
5
6
7
8
9
--Equipment and Pet Protection
    if phealth <= .05 then
            GetEuipmentNumber() == 1 or GetEuipmentNumber() == 2 then SwapEquipmentItem(2) else SwapEquipmentItem(0)
        for i=1,6 do
            if (IsPetSummoned(i) == true) then
                ReturnPet(i);
            end
        end        
    end


As you can see I just changed the "SwapEquipmentItem()" line, unfortunately this doesn't work.
It seems this is not as easy as I thought^^
Any Ideas?

Thank you
biLL
Rogue/Scout/Priest 72/72/56 - Rogue/Warden/Scout 55/55/60
Mage/Druid/Rogue 72/70/58 - Rogue/Warlock/Mage 60/72/62

751

Thursday, August 30th 2012, 2:01am

Hello all,
I'm looking for a Rogue/Warrior DIYCE rotation. If thats to much to ask then I would like to learn how to search for a specific thing in those 75 pages. That would become so much easier instead of reading page 1 - 75. And of course, the thing I want to search for is Rogue/Warrior DIYCE.
- B

752

Friday, August 31st 2012, 12:11pm

Quoted from "BloodyArrow;567296"

Hello all,
I'm looking for a Rogue/Warrior DIYCE rotation. If thats to much to ask then I would like to learn how to search for a specific thing in those 75 pages. That would become so much easier instead of reading page 1 - 75. And of course, the thing I want to search for is Rogue/Warrior DIYCE.
- B


it is easy.

just look at the sample script in the addon, and change the skills to your rotation.

you DO know how to play w/r don't you? :)

because if you don't, dyice won't help your dps.

753

Friday, August 31st 2012, 1:34pm

Quoted from "doodoobird;567511"

it is easy.

just look at the sample script in the addon, and change the skills to your rotation.

you DO know how to play w/r don't you? :)

because if you don't, dyice won't help your dps.


He said Rogue/Warrior not Warrior/Rogue at least read before you insult someone.
-[EvilEmpires]-
Cocheech - RIP
Ricknight - R/M/S/Wd
Necrotix - WL/C/M
Yamanight D/W/Wd
Nightmareknight K/W/M/P

754

Friday, August 31st 2012, 3:32pm

Quoted from "xMagus;567514"

He said Rogue/Warrior not Warrior/Rogue at least read before you insult someone.


it was a typo obviously :)
an i didnt mean to insult, but look at the other diyce bashing threads. it is all because of ppl who want everything mouth fed and generic.

and to quote you:
at least think before you try to troll. if you were, you could have seen it was a typo, and even if it wasn't it is not relevant. noone will do okay dps with these generic scripts.

and ppl like you are the reason i don't post my functions here.

755

Friday, August 31st 2012, 8:27pm

Quoted from "doodoobird;567527"

it was a typo obviously :)
an i didnt mean to insult, but look at the other diyce bashing threads. it is all because of ppl who want everything mouth fed and generic.

and to quote you:
at least think before you try to troll. if you were, you could have seen it was a typo, and even if it wasn't it is not relevant. noone will do okay dps with these generic scripts.

and ppl like you are the reason i don't post my functions here.


I "typo," obviously. Lawlz. BS.

You DO know how to check your own posts and edit right?

Because if you don't, of course people are going to mistake things you say. Even if you """"didn't mean to say it wrong.""""" Obviously.

If you're not going to be helpful, then don't post. Don't bash on someone just because they have a question on here.

People like you are the reason we can't have nice things.
-----------------------
BloodyArrow, I'm going to assume you already know your rotation as a r/w, otherwise a diyce function isn't going to be fed to you, unless someone who has already made one/tested it out makes theirs public. Many don't. Since generally all rogue rotations are similar (SS or equivalent bleed>Low blow>Wound Attack), the only real thing that changes are the filler attacks (instead of vamp/shot/joint blow, r/w would use slash, poisonous infection, etc).

Just look over one of the rogue DIYCE functions in this thread and adjust things to suit your needs. This may mean taking out timers, locals, etc.

You will have to do your own research, however.

Ravesden, D/S/Wd 80/75/62
Retired. Click siggy for old RoM vids, among other things.

756

Monday, September 3rd 2012, 2:09am

Hey!
Uhm I dont where to start. But okay, I play R/S, S/R, S/Warr, so I pretty much know how the rotation goes. My purpose was just to see how they seted up the Death's Touch, Decay, Poison Spray and Poisonous Infection.
@ doodoobird: I know DIYCE dont increase my dps. And please dont insult me next time. I didnt mean anything bad. If I offended someone please forgive me, because I really didnt mean to.
Thx for ur time all who replied.
- B

757

Tuesday, September 4th 2012, 9:29pm

Hello all,

despite I got no answer to my "SwapEquipmentItem()" problem (Post #750),
I try another attempt to get a new problem solved^^

Something seems to work wrong with my "shot" - command:

Source code

1
2
3
4
5
6
7
8
9
if ((enemy) and (goat2 == "1")) then
            Skill2 = {
{ name = "Toter Winkel",               use = (((EnergyBar1 >= 25) and (behind)) and ((Boss) or pbuffs['Vorsatz']) and (melee)) },
{ name = "Wunden angreifen",           use = ((EnergyBar1 >= 25) and (tbuffs['Starke Blutung']) and ((tbuffs['Blutung']) or (tbuffs['Toter Winkel-Blutung'])) and (melee)) },
{ name = "Gemeiner Schlag",            use = (((EnergyBar1 >= 25) and (not tbuffs['Starke Blutung']) and (tbuffs['Blutung'] or tbuffs['Toter Winkel-Blutung'])) and (melee)) },
{ name = "Meucheln",                   use = ((EnergyBar1 >= 20) and (not tbuffs['Blutung']) and (not tbuffs['Toter Winkel-Blutung']) and (melee)) },
{ name = "Vampirpfeil",                use = ((EnergyBar2 >= 20) or (not melee)) },
{ name = "shot",                       use = ((EnergyBar1 < 20) or (not melee)) },
    }


Shot should trigger when I am not in melee combat or when the energybar1 is below 20.
But when i am in melee combat it fires even when the energybar1 is higher than 20.
Where is my mistake?
Any ideas?

Thank you so far
biLL
Rogue/Scout/Priest 72/72/56 - Rogue/Warden/Scout 55/55/60
Mage/Druid/Rogue 72/70/58 - Rogue/Warlock/Mage 60/72/62

758

Tuesday, September 4th 2012, 10:35pm

Quoted from "BloodyArrow;567925"

Hey!
Uhm I dont where to start. But okay, I play R/S, S/R, S/Warr, so I pretty much know how the rotation goes. My purpose was just to see how they seted up the Death's Touch, Decay, Poison Spray and Poisonous Infection.
@ doodoobird: I know DIYCE dont increase my dps. And please dont insult me next time. I didnt mean anything bad. If I offended someone please forgive me, because I really didnt mean to.
Thx for ur time all who replied.
- B



i apologize too, i just wanted to know why u wanted one from scratch.

now for BillTscherno what is the action slot ypou use for melee check? sometimes if the skill is not ready, the script will think you are ranged. that is why i made another function, but that makes me use shot too much, and that is worse.

one thing i would recommend to put a ranged arg in there, and make separate macro call for it, when you know you are far enough for it.


also a function for those who wanna use it. it makes the "Item: ..." actually usable, even if it has cooldown, because that sux when you change items in hotbar frequently, and the slot number is wrong suddenly. this function checks if the item is present in your inventory, and it is not on CD:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function IsBagItemUsable(itemname)
    if (GetCountInBagByName(itemname) == 0) then
        return false
    end
        i=1
        while (i < 180)
            do
                local inventoryIndex, icon, name, itemCount, locked, invalid = GetBagItemInfo ( i )
                if (name == itemname) then
                    local maxCD, CurrentCD = GetBagItemCooldown ( inventoryIndex )
                    if (locked == true) then
                        return false
                    elseif (CurrentCD == 0) then
                        return true
                    else
                        return false
                    end
                end
                i = i + 1
            end
end


to use it, look at the example:

Source code

1
{ name = "Item: Potion: Clear Thought",                     use = ((not pbuffs['Clear Thought']) and (not pbuffs['Thunder Force']) and (IsBagItemUsable("Potion: Clear Thought"))) },


the item does not have to be dragged on the hotbar.

759

Wednesday, September 5th 2012, 3:19am

Hi
and thank you doodoobird for your quick answer.
I have defined a action slot number with the melee skill (Blind Stab - Range: 50).

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
-- 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(18) -- # is your melee range spell slot number <------------------------
    local a1,a2,a3,a4,a5,ASon = GetActionInfo(20)  -- # 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
    local PsiPoints, PsiStatus = GetSoulPoint()


And yes, my "shots" come to often too, thats why I tried to handle this with the
limitation for (EnergyBar1 < 20) when in melee combat. But nevertheless the shot is in use when my bow is ready and unfortunately not only when (EnergyBar1 < 20) in melee combat.
Especially when I use a fast bow and not a pretty slow crossbow this is worse :-(

Any idea where my mistake is?

Thanks so far
biLL
Rogue/Scout/Priest 72/72/56 - Rogue/Warden/Scout 55/55/60
Mage/Druid/Rogue 72/70/58 - Rogue/Warlock/Mage 60/72/62

760

Wednesday, September 5th 2012, 9:54am

dunno about you, mate but my problem was, that even though other skill were ready, they were still on cd (you know, when cd is 0.3 sec, but skill would be already usable), and dyice thinks it is NOT usable because of that cd, and then uses shot.

the melee/ranged check is a major problem for diyce, so it is better to just make separate function calls for melee, and ranged, and just use what you see fit at a moment.

how i solved it, is that i made shot as the last filler, without any checks, and that seems to work. but it never triggers from afar as a ranged skill. for that, i usa an argument in another macro, for ex: /run KillSequence("ranged"), and then use ranged as an argument.