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

101

Tuesday, November 8th 2011, 6:02am

@CROMI80 - Try running "/run KillSequence()" as your macro and see if that fixes it. You do not need to do anything special for the targeting functions to work. If you are using Sekrit's code, make sure to uncomment out the lines for the targeting sequence, as he comments them out since they do not work best for his personal playstyle.

@lee9859 - My mistake, there is an extra ) on that line. At the end, just delete one of the extra )'s to make it look like the Thunder line. Also, for a well written W/R code sample, take a look at the last link in my sig. (You will also learn a LOT by reading that particular thread as well.)

@lordmohg - Take a look at the new Priest Fairy function, and since you have a Wd class (I don't have enough experience with wardens) you should be able to write up something along those lines for wardens to use for their pets. You should also be able to see the other changes elsewhere in the code to see how it all works together. If you can make up a function that will cover all warden classes/pet combos I will include it in the main DIYCE. If not, then could you just post up an example of how it would work so any future wardens can edit it and figure it out from their on their own? (Assuming you even rework it to fit into the style the priest fairy code is done, if not no big deal.)

102

Tuesday, November 8th 2011, 6:54am

Nice job on working the simple fairy code into a full fledged function with all the bells and whistles. I am not a .Lua coder any where near your level of talents. I can just see what others have done and what i want to do and try n come close. But to come up with all the proper code from scratch?... yeah.. no. I will just continue to /poke you with my stick n hope you have time.

And as for the Buffparty Function... Good job shortening that. I took the big Buffparty code and put it in my customfunctions.lua at the very end and it works just fine. However i am using a different code.

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
-- BuffParty version 2.0
-- Change log:
--   1) Modified to swap back to original target after buff is cast.

g_BPskill = {}

function BP_Msg(outstr,a1,a2,a3)
    if not IsShiftKeyDown() then
        DEFAULT_CHAT_FRAME:AddMessage(tostring(outstr), a1, a2, a3)
    end
end

function BP_ReadSkills()
    g_BPskill = {}
    local skillname,slot

    DEFAULT_CHAT_FRAME:AddMessage("#BuffParty: Reading Class Skills", 0, .6, 0)
    for page = 2,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_BPskill[skillname] = { ['page'] = page, ['slot'] = slot }
            end
            slot = slot + 1
            skillname = GetSkillDetail(page,slot)
        until skillname == nil
    end
end
BP_ReadSkills() -- Read skills into g_BPskill table at login

function BP_CD(skillname)
    local firstskill = GetSkillDetail(2,1)
    if (g_BPskill[firstskill] == nil) or (g_BPskill[firstskill].page ~= 2) then
        BP_ReadSkills()
    end

    if g_BPskill[skillname] ~= nil then
        local tt,cd = GetSkillCooldown(g_BPskill[skillname].page,g_BPskill[skillname].slot)
        return cd==0
    else
        BP_Msg("- Skill not available: "..skillname)
        return false
    end
end

function BP_BuffTimeLeft(thisunit, buffname)
    local cnt = 1
    local buff = UnitBuff(thisunit, cnt)

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

    return 0
end

function BP_FreeFocusSlot()
    for i = 1,11 do
        if (not UnitExists("focus"..i)) then
            return i
        end
    end
  
    return 12
end

function BP_CastBuff(thisunit, buff, arg1)
    local focus_slot = BP_FreeFocusSlot() -- Focus slot to use for target swapping
    local retval = true
    
    FocusUnit(focus_slot, "target")  -- Remember original target
    TargetUnit(thisunit)
    if (arg1 == nil) or GetActionUsable(arg1) then
        BP_Msg("- Casting "..buff.." on "..UnitName(thisunit))
        CastSpellByName(buff)
    else
        retval = false
    end
    TargetUnit("focus"..focus_slot)  -- Return to original target
    FocusUnit(focus_slot, "")
    
    return retval
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 60 seconds.

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

    local buffrefresh = arg2 or 60           -- Refresh buff time (seconds)
    local spell = UnitCastingTime("player")  -- Spell being cast?
    local thisunit = "player"

    if (spell ~= nil) then
        return false
    end

    BP_Msg("- Checking self buffs on "..UnitName(thisunit))
    for i,buff in ipairs(selfbuffs) do
        if (g_BPskill[buff] ~= nil) and BP_CD(buff) and (BP_BuffTimeLeft(thisunit, buff) <= buffrefresh) then
            if BP_CastBuff(thisunit, buff) then
                return true
            end
        end
    end

    BP_Msg("- Checking group buffs on "..UnitName(thisunit))
    for i,buff in ipairs(groupbuffs) do
        if (g_BPskill[buff] ~= nil) and BP_CD(buff) and (BP_BuffTimeLeft(thisunit,buff) <= buffrefresh) then
            if BP_CastBuff(thisunit, buff) then
                return true
            end
        end
    end

    for num = 1,GetNumPartyMembers()-1 do
        thisunit = "party"..num
        if (UnitHealth(thisunit) > 0) then
            BP_Msg("- Checking group buffs on "..UnitName(thisunit))
            for i,buff in ipairs(groupbuffs) do
                if (g_BPskill[buff] ~= nil) and BP_CD(buff) and (BP_BuffTimeLeft(thisunit, buff) <= buffrefresh) then
                    if BP_CastBuff(thisunit, buff, arg1) then
                        return true
                    end
                end
            end
            for i,buff in ipairs(othersbuffs) do
                if (g_BPskill[buff] ~= nil) and BP_CD(buff) and (BP_BuffTimeLeft(thisunit, buff) <= buffrefresh) then
                    if BP_CastBuff(thisunit, buff, arg1) then
                        return true
                    end
                end
            end
        end
    end

    BP_Msg("- Nothing to do.")
    return true
end


With this code it has the local othersbuffs = { "Holy Protection" } part so my Knight can Buff other members without buffing himself.

ghostwolf82

Professional

  • "ghostwolf82" started this thread

Posts: 859

Location: Kalvans Trunk

Occupation: It's dark in here

  • Send private message

103

Tuesday, November 8th 2011, 7:18am

Yeah, that was the final release of the code from Sixpax for BuffParty before he turned it into an addon. I wanted something simple to put into the main diyce body that could be used on a universal scale, with the least amount of wiggle room for possible errors from player input. Eventually, I may make changes to the code to incorporate what is seen in the one you posted, but that for now will remain down the road.

Do continue to /poke, eventually once I see where something can be taken, or have an example of what is wanted, I normally eventually get around to it. Without other people providing input on what they would want to see, I can only imagine so many possibilities. So again, thanks everyone for the feedback so far!

mrmisterwaa

Professional

Posts: 670

Location: Kuwait

  • Send private message

104

Tuesday, November 8th 2011, 12:06pm

Nice changes, I do have one tiny thing that needs to be added. Not sure if many people do Sardo/Grafu but there are several spells that need to be interrupt.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
                        }


And I just updated my RogueScout one.

ghostwolf82

Professional

  • "ghostwolf82" started this thread

Posts: 859

Location: Kalvans Trunk

Occupation: It's dark in here

  • Send private message

105

Tuesday, November 8th 2011, 4:03pm

Good to know, and I'll add those into the next update. Thanks sekrit.

106

Tuesday, November 8th 2011, 4:03pm

I'm starting to feel like a serious leech now, so I'll try to make this the last question....if I can't get it to work, I'll just continue on as a button masher.

Was able to remove the previous error by removing the parentheses and removing "," in front of buff names. Now I'm getting the message "=" expected near '<eof>'

Did my best to figure out what this means and sounds like I have my "end" statements fouled or am calling the function incorrectly...my in game macro is "/run WarriorRogue ()"

Also GW....read through your thread and WR example which was great...hope to graduate to something more sophisticated if I can get the basics figured out.

As always...much thanks.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
elseif mainClass == "WARRIOR" and subClass == "THIEF" then
    
        --Combat
        if enemy then
            Skill = {
                { name = "Survival Instinct",        use    = (health <= .49) },  --IMHO you should set this to trigger at .33 as an "OH SH!T"
                { name = "Splitting Chop",            use = (rage >= 15) and (tbuffs['Weakened']) },
                { name = "Thunder",                    use = (rage >= 15) and (tbuffs['Weakened']) },
                { name = "Open Flank",                use = (rage >= 10) and (tbuffs['Vulnerable']) and CD("Thunder") },
                { name = "Keen Attack",                use = (energy >= 20) and (tbuffs['Vulnerable']) },
                { name = "Probing Attack",            use = (rage >= 15) },
                { name = "Blood Dance",                use = (health >= .50) },
                { name = "Slash",                    use = (rage >= 25) },
                { name = "Shadowstab",                use = (energy >= 20) },
                    }
        end

ghostwolf82

Professional

  • "ghostwolf82" started this thread

Posts: 859

Location: Kalvans Trunk

Occupation: It's dark in here

  • Send private message

107

Tuesday, November 8th 2011, 4:06pm

Do me a favor lee9859, edit the post above (the one you just made) and in the code block, paste your entire CustomFunctions.lua for me.

108

Tuesday, November 8th 2011, 4:09pm

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
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")
    --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(13) -- # is your melee range spell 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/Priest
            elseif mainClass == "THIEF" and subClass == "AUGUR" then
            
            --Potions and Buffs
            Skill = {
                { name = "Regenerate",                    use = (phealth <= .90) and (pctEB2 >= .05) and (not pbuffs['Regenerate']) },
                { 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 pbuffs['Poisonous']) or (pbuffs['Poisonous'].time <= 45))},
                    }
                    
            --Combat
                if enemy then
                Skill2 = {
                    { name = "Premeditation",                use = (not combat) and boss and (EnergyBar1 >= 50) },
                    { 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 = (EnergyBar1 >= 35) },
                    { name = "Shadowstab",                   use = (EnergyBar1 >= 20) },
                    { name = "Attack",                       use = (thealth == 1) },                    
                            }
                end

elseif mainClass == "WARRIOR" and subClass == "THIEF" then
    
        --Combat
        if enemy then
            Skill = {
                { name = "Survival Instinct",        use    = (health <= .49) },  --IMHO you should set this to trigger at .33 as an "OH SH!T"
                { name = "Splitting Chop",            use = (rage >= 15) and (tbuffs['Weakened']) },
                { name = "Thunder",                    use = (rage >= 15) and (tbuffs['Weakened']) },
                { name = "Open Flank",                use = (rage >= 10) and (tbuffs['Vulnerable']) and CD("Thunder") },
                { name = "Keen Attack",                use = (energy >= 20) and (tbuffs['Vulnerable']) },
                { name = "Probing Attack",            use = (rage >= 15) },
                { name = "Blood Dance",                use = (health >= .50) },
                { name = "Slash",                    use = (rage >= 25) },
                { name = "Shadowstab",                use = (energy >= 20) },
                    }
        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 (not MyCombat(Skill, arg1)) then
        MyCombat(Skill2, arg1)
    end
        
    --Select Next Enemy
    if (tDead) then
        TargetUnit("")
        return
    elseif (not LockedOn) or (not enemy) then
        TargetNearestEnemy()
        return
    end
    
end

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

109

Tuesday, November 8th 2011, 4:50pm

I don't see anything wrong with your posted code per-se, though you haven't shown the WarriorRogue() function that is being called by the macro. Could simply be you are running the wrong function.
2013... The year from hell....

ghostwolf82

Professional

  • "ghostwolf82" started this thread

Posts: 859

Location: Kalvans Trunk

Occupation: It's dark in here

  • Send private message

110

Tuesday, November 8th 2011, 5:43pm

Peryl is probably right, make your macro "/run KillSequence" this is the macro for every class combo using diyce v2, there is no more calls to individual functions for each class combo. Give that a try and see if that does the trick. If not, let us know.

111

Tuesday, November 8th 2011, 6:51pm

Just had a thought. Can i call a function with Skill[x]? Like:

Source code

1
2
                { name = "PriestFairySequence()",    use = (not combat) },
                { name = "BuffParty(22)",    use = (true) },


Would keep the game macro short and all in KillSequence.

112

Tuesday, November 8th 2011, 8:21pm

I've been looking all over the place, but I can't seem to find out how to look up buff/debuff ids. It would seem like there should either be 1 or 2 lines of code to show you in-game or a table somewhere with this information.

ghostwolf82

Professional

  • "ghostwolf82" started this thread

Posts: 859

Location: Kalvans Trunk

Occupation: It's dark in here

  • Send private message

113

Tuesday, November 8th 2011, 9:28pm

Quoted from "gimlear;481685"

I've been looking all over the place, but I can't seem to find out how to look up buff/debuff ids. It would seem like there should either be 1 or 2 lines of code to show you in-game or a table somewhere with this information.

Page 2 of this very thread has the answer you are "looking" for.

114

Tuesday, November 8th 2011, 10:59pm

DOH! Lol. I looked on the first and third page but for some reason not the second. Thanks.

And I tweaked it a little to make it show me the player buffs too.

CROMI80

Intermediate

Posts: 338

Occupation: Mechcanical service engineer

  • Send private message

115

Wednesday, November 9th 2011, 3:18am

Range check

Ghost, is it possible to make the codes that will only use a skill if it's within it's range. For example, gryphon bash will only be used when the range between you and the target is less or equal to 150.
~Know no limit to unleash the untap potential in yourself
&#30475;&#30340;&#25026;&#30340;&#20154;&#35831;&#26469;osha&#32852;&#32476;&#25105;&#12290;Leogolas

116

Wednesday, November 9th 2011, 6:14am

Ghost and Peryl---Thanks for all the help. Function is working smoothly now and I'm looking forward to tinkering....appreciate all the time you both took to get me started! Final product below...I know it's quite simplistic, but a good start I hope.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
elseif mainClass == "WARRIOR" and subClass == "THIEF" then
    
        --Combat
        if enemy then
            Skill = {
                { name = "Survival Instinct",        use    = (phealth <= .49) },  
                { name = "Splitting Chop",            use = (EnergyBar1 >= 15) and (tbuffs['Weakened']) },
                { name = "Thunder",                    use = (EnergyBar1 >= 15) and (tbuffs['Weakened']) },
                { name = "Open Flank",                use = (EnergyBar1 >= 10) and (tbuffs['Vulnerable']) and CD("Thunder") },
                { name = "Keen Attack",                use = (EnergyBar2 >= 20) and (tbuffs['Vulnerable']) },
                { name = "Probing Attack",            use = (EnergyBar1 >= 15) },
                { name = "Blood Dance",                use = (phealth >= .50) },
                { name = "Slash",                    use = (EnergyBar1 >= 25) },
                { name = "Shadowstab",                use = (EnergyBar2 >= 20) },
                    }
        end
Thanks again!

ghostwolf82

Professional

  • "ghostwolf82" started this thread

Posts: 859

Location: Kalvans Trunk

Occupation: It's dark in here

  • Send private message

117

Wednesday, November 9th 2011, 6:57am

@gimlear - Glad you got that figured out now.

@CROMI80 - The code already checks distance. Look into proper use of the "melee" check, as well as the "enemy" and "combat" checks.

@Peryl - ^5!!! We got another one working the dark side with us! I mean...

@lee9859 - Awesome! Glad you got it working finally! If you have any more questions, just ask them. The more you learn, the more you can help others as well ;)

118

Wednesday, November 9th 2011, 11:27am

Source code

1
2
{ name = "Action: 7 (Hidden Peril)",             use = (true) },
				{ name = "Snipe",              use = (pbuffs['Hidden Peril']) },


why diyce not use the skill "Snipe" when the player is buff "Hidden Peril"?

mrmisterwaa

Professional

Posts: 670

Location: Kuwait

  • Send private message

119

Wednesday, November 9th 2011, 11:43am

Quoted from "Skodziro;481814"

Source code

1
2
{ name = "Action: 7 (Hidden Peril)",             use = (true) },
                { name = "Snipe",              use = (pbuffs['Hidden Peril']) },
why diyce not use the skill "Snipe" when the player is buff "Hidden Peril"?


Please post the rest of your code.

That doesn't help us. :\

120

Wednesday, November 9th 2011, 12:01pm

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
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 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(13) -- # is your melee range spell 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,3 do
            if (IsPetSummoned(i) == true) then
                ReturnPet(i);
            end
        end        
    end
        
    if (LockedOn and (UnitLevel("target") < 2)) then
        TargetUnit("")
        TargetNearestEnemy()
        return
    end
    
    --Begin Player Skill Sequences
    
          
				-- Class: Scout/Warden
-- DIYCE 2.0
       if mainClass == "RANGER" and subClass == "WARDEN" then

    --  Cancel Blood Arrows out of combat or at less than 40% health, without invoking the GCD.    
    if friendly or (not UnitExists("target")) or tdead or (phealth <= .40) and (pbuffs['Blood Arrow']) then 
    CancelBuff("Blood Arrow")
    end



				
   

               

-- Combat
                if enemy then
                Skill = {
                
				{ name = "Action: 7 (Hidden Peril)",             use = (true) },
				{ name = "Snipe",              use = (pbuffs['Hidden Peril']) },
				{ name = "Action: 20 (Autoshot)",             use = ((boss) and (not ASon)) },
                                { name = "Action: 5 (Shot)",              use = (true) },
				{ name = "Combo 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 (not MyCombat(Skill, arg1)) then
        MyCombat(Skill2, arg1)
    end
        
    --Select Next Enemy
    if (tDead) then
        TargetUnit("")
        TargetNearestEnemy()
        return
    elseif (not LockedOn) or (not enemy) then
        TargetNearestEnemy()
        return
    end
    
end