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.

901

Monday, January 28th 2013, 11:51am

Hi all. Long time havent posted in this thread.
I noticed that dyice is at version 2.2. Any link to where i can find the differences between 2.0 and 2.2.

On another note good luck to peryl for fuzzy dyice i m looking forward to see it.

Edit: Also any way with dyice to assess psy pointa for warlocks?. Posts 650 to 660 anseer my question

902

Monday, January 28th 2013, 9:52pm

Hey,
I was trying to make a M/P DIYCE rotation for bosses and mob farming. The code looks like below.

Quoted

--Class: Mage/Priest
elseif mainClass == "MAGE" and subClass == "AUGUR" then

--Combat
if ((enemy) and (goat2 == "1")) then
--if enemy then
Skill2 = {
{ name = "Elemental Weakness", use = (boss or elite) and (pctEB1 >= 550) and (not tbuffs['620189']) },
--{ name = "Magic Drain", use = (boss) and (pctEB1 >= 212) and (not tbuffs['623211']) },
{ name = "Electric Bolt", use = (boss or elite) and (pctEB1 >= 330) and (not tbuffs['501550']) },
{ name = "Flame", use = (pctEB1 >= 220) },
{ name = "Fireball", use = (pctEB1 >= 330) },
{ name = "Rising Tide", use = (pctEB2 >= 318) },
}

elseif ((enemy) and (goat2 == "2")) then
Skill2 = {
{ name = "Lightning", use = (pctEB1 >= 212) },
{ name = "Fireball", use = (pctEB1 >= 330) },
{ name = "Rising Tide", use = (pctEB2 >= 318) },
}

end

The problem is, its doesnt execute/work at all. And I am pretty new to make a casters DIYCE. Have difficulties with declaring mana. As for example the Magic Drain skill. It uses 288 MP and 10% MP. I dont know how to code that?
So if anyone could go through my code and see whats wrong it would be really appreciated.
Thanks in advance.
- B

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

903

Tuesday, January 29th 2013, 2:46am

As a first guess, I'd say you are using the pctEB1 and pctEB2 values incorrectly. These are percentage like values (they are actually values between 0 and 1). So according to your posted code, they will never be greater or equal than the values you are checking for.

To fix, either adjust the values being checked against, or replace pctEB1 with EnergyBar1 (which is the actual value of your main mana bar) and replace pctEB2 with EnergyBar2 (ditto for secondary class's mana bar).
2013... The year from hell....

904

Tuesday, January 29th 2013, 1:14pm

Thanks for your reply Peryl. I have changed the code now and will try it as soon as possible.

And one more thing. If I want those skills as Silence only to be cast when I need to interupt in instances or in PvP. Do it write it as below?

Quoted

{ name = "Silence", use = (silenceThis) and (EnergyBar1 >= 50) or (pvp) },
{ name = "Elemental Weakness", use = (boss or elite) and (EnergyBar1 >= 550) and (not tbuffs['620189']) },
{ name = "Magic Drain", use = (boss) and (EnergyBar1 >= 212) and (not tbuffs['623211']) },
{ name = "Electric Bolt", use = (boss or elite) and (EnergyBar1 >= 330) and (not tbuffs['501550']) },
{ name = "Lightning", use = (EnergyBar1 >= 212) or (pvp) },
{ name = "Flame", use = (EnergyBar1 >= 220) },
{ name = "Fireball", use = (EnergyBar1 >= 330) or (pvp) },
{ name = "Rising Tide", use = (EnergyBar2 >= 318) or (pvp) },

So let me see if I understood this right. Silence casts only when I have more or thesame mana it needs and only in PvP? Am a bit unsure about those (or, and) PvP thats why I ask.
- B

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

905

Wednesday, January 30th 2013, 2:00am

Quoted from "BloodyArrow;586602"

So let me see if I understood this right. Silence casts only when I have more or thesame mana it needs and only in PvP? Am a bit unsure about those (or, and) PvP thats why I ask.
- B

Not quite.

The line in question is:

Source code

1
{ name = "Silence", use = (silenceThis) and (EnergyBar1 >= 50) or (pvp) },

The way the condition is written, it will attempt to use Silence if your target is casting a silence-able spell (the silenceThis part) and you have enough energy to do so (the EnergyBar1 >= 50 bit) or you happen to be in PvP.

In other words, if you are in PvP, it'll try to use Silence regardless of your mana, even if the mob you are fighting isn't casting something (also note that you aren't checking for instances at all).

To get it to do what you want, lets start by writing out, in English, what the conditions we want to cast Silence.
We want to cast Silence when:
[indent]The mob is casting a spell that can be silenced.[/indent]
and
[indent]We've got enough energy to cast Silence[/indent]
and
[indent]We are either in PvP or We are in an instance[/indent]
(I purposefully broke the lines up and put emphasis on the logic operators).

Now the one problem we'll encounter here is that there is no convenient way to detect if we are in an instance, but we'll cheat and say that you are "in an instance" when you are in a party.

Given the English-logic above, the DIYCE line would then become:

Source code

1
{ name = "Silence", use = silenceThis and EnergyBar1 >= 50 and (pvp or party) },

Look at the line and compare it to the English version.


For more information than you care to know about Lua logic operators and how they work see this guide.
2013... The year from hell....

906

Wednesday, January 30th 2013, 2:30pm

Thanks for the explaination. Works great.
- B

krssrb

Beginner

Posts: 20

Location: Serbia

  • Send private message

907

Saturday, February 9th 2013, 1:51pm

i readed mose of post's here, but i didnt find anything about item set skill's.
can be added something to ReadSkills()

Source code

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

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
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
    
    local name,num
    
    for class = 1,9 do
        num = 1
        name,_,_ = GetSuitSkill_List(class, num)
        repeat
            local a1,a2,a3,a4,a5,a6,a7,a8,skillusable = GetSuitSkill_List(class, num)
            if skillusable then
                g_skill[name] = { ['class'] = page, ['num'] = num }
            end
            num = num + 1
            name = GetSkillDetail(class, num)
        until name == nil
    end
end
Warrior80/Mage80/Warlock80

908

Sunday, February 10th 2013, 1:19am

Hi again everyone. I've asked once there in this thread about puting 2 skills to be used in 1 s - I'm W/WD and Charged Chop is spamable so I can use my warriors skills in that same time when CC is used ( m2 skills in 1 sec).
I still got no idea how to put CC in Code - DIYCE seems to have 1s CD like global CD ...

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
            if mainClass == "WARRIOR" and subClass == "WARDEN" then
                       
            --Combat
                if enemy then
                Skill = {
                    { name = "Charged Chop",                use = (EnergyBar2 >=300) },
                    { name = "Savage Whirlwind",            use = (EnergyBar2 >=312) },
                    { name = "Tactical Attack",            use = ((EnergyBar1 >=15) and (tbuffs[500081])) },
                    { name = "Open Flank",                 use = ((EnergyBar1 >=10) and (tbuffs[501502])) },
                    { name = "Slash",                            use = ((EnergyBar1 >=25) and (not tbuffs[500081])) },
                    { name = "Probing Attack",              use = (EnergyBar1 >=20) },
                    { name = "Attack",                      use = (thealth ==1) },
                        }
                end



Here is my code, I though even about 2 sepparated lanes of skill combo in DYICE but got no idea how to use 2 lines of skill to be used at once ^^

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

909

Sunday, February 10th 2013, 6:54am

Quoted from "Linaquel;588331"

Hi again everyone. I've asked once there in this thread about puting 2 skills to be used in 1 s - I'm W/WD and Charged Chop is spamable so I can use my warriors skills in that same time when CC is used ( m2 skills in 1 sec).
I still got no idea how to put CC in Code - DIYCE seems to have 1s CD like global CD ...

...snip...

Here is my code, I though even about 2 sepparated lanes of skill combo in DYICE but got no idea how to use 2 lines of skill to be used at once ^^


DIYCE only verifies if the skill you are trying to use is on cooldown or not. Therefore, if you are seeing a delay it is because of the global cooldown.

As for getting DIYCE to use two (or more) skills at a time, though technically possible it would require some modifications to DIYCE. I won't give an explanation on how to do it as this could lead to activities too close to bot-like behaviour.

DIYCE is allowed to be used in-game precisely because it follows the rules laid down in the ToS and elsewhere. Gameforge/Runewaker et al are aware of the DIYCE add-on and have given it the okay, but it is my feeling that to describe such modifications would push things too far. Sorry.
2013... The year from hell....

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

910

Sunday, February 10th 2013, 7:09am

Quoted from "krssrb;588286"

i readed mose of post's here, but i didnt find anything about item set skill's.
can be added something to ReadSkills()
...snip...
something like this

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function ReadSkills()
    g_skill = {}
    local skillname,slot

[b][i]...snip...[/i][/b]

    local name,num
    
    for class = 1,9 do
        num = 1
        name,_,_ = GetSuitSkill_List(class, num)
        repeat
            local a1,a2,a3,a4,a5,a6,a7,a8,skillusable = GetSuitSkill_List(class, num)
            if skillusable then
                g_skill[name] = { ['class'] = page, ['num'] = num }
            end
            num = num + 1
            name = GetSkillDetail(class, num)
        until name == nil
    end
end

Interesting bit, but as is it wouldn't work (though I understand where you hope to go with it)

The intent of that loop is to read the list of known suit skills which is a good start, but doesn't really give us the ability to actually use the suit skill. I still haven't found how the game itself does it, but I haven't done any extensive searches either.

Even if it doesn't make it to DIYCE, I'll see if I can get some suit skill stuff implemented for FuzzyDIYCE.
2013... The year from hell....

911

Sunday, February 10th 2013, 3:46pm

i think the only way to get the set skills is with that getsuitskill_list but using the skillplateupdate function reading the entire plate and finding a specific skill by name. never found anyway to change and use different skills other than dragsuitskill_job() and SkillPlateReceiveDrag(,(slot-1))...change on the fly if not in combat.

you could then call the set skill by name if it was on the plate..but i was only doing stuff with this back in ch3. may be completely borked/incorrect

there was a little addon that made it a lot easier to work with...lemme check my folder

**derp- its called Titles :o http://rom.curseforge.com/addons/titles/pages/main/

lulz

krssrb

Beginner

Posts: 20

Location: Serbia

  • Send private message

912

Monday, February 11th 2013, 5:31pm

i managed to swap set skill's with diyce , but sill must use action bar's, e.g.

Source code

1
{ name = "Action: 67 (Yawaka's Blessing)",          use = (not pbuffs['Yawaka's Blessing']) }, 

so it would be nice if we can use skill by name ;D and remove it from action bar.
i can post code for swaping skill's
Warrior80/Mage80/Warlock80

913

Wednesday, February 13th 2013, 6:11pm

tbuffs[''] issue

playing champion trying to run the following:

Source code

1
2
3
{ name = "Heavy Bash",               use = ((EnergyBar1 >= 20) and (not tbuffs['Heavy Bash 3'])) },
{ name = "Shadowstab",               use = (EnergyBar2 >= 20) },
{ name = "Heavy Bash",               use = ((EnergyBar1 >= 20)) }


Source code

1
{ name = "Heavy Bash",               use = ((EnergyBar1  >= 20) and ((not tbuffs['Heavy Bash']) or (tbuffs['Heavy Bash'].stack  < 3))) },

didnt work either : no shadowstab nor havy bash ( acted weird here , sometimes casting sometimes not )

Source code

1
{ name = "Heavy Bash",               use = ((EnergyBar1 >= 20) and (not tbuffs['Heavy Bash'].stack =3)) },


this gave me error: ')' expected after =

Source code

1
{ name = "Heavy Bash",               use = ((EnergyBar1 >= 20) and (not tbuffs['Heavy Bash'].stack 3)) },


same kind of error ')' expected after 3.

what i m trying to achieve is this : havy bash till 3 stacked , when 3 stacked use shadowstab . if no more energy , use heavy bash.

i also want to recast heavybash if the timer on heavybash is less than 2s , how wouldi do this ?

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

914

Wednesday, February 13th 2013, 11:03pm

Quoted from "neonsun;588785"

what i m trying to achieve is this : havy bash till 3 stacked , when 3 stacked use shadowstab . if no more energy , use heavy bash.

i also want to recast heavybash if the timer on heavybash is less than 2s , how wouldi do this ?

I've been helping someone else trying to do something similar. Seems that some buffs/debuffs don't show up as stacks but instead add a new buff/debuff. I suggest trying to find the debuff IDs instead of the names (use DIYCE's "debugtbuffs" option for finding the IDs).

Once you have the IDs, you can then create use clauses that check for these IDs and the time remaining on them to achieve what you want.

Quoted from "neonsun;588785"

Source code

1
{ name = "Heavy Bash",               use = ((EnergyBar1 >= 20) and (not tbuffs['Heavy Bash'].stack =3)) },


this gave me error: ')' expected after =

Source code

1
{ name = "Heavy Bash",               use = ((EnergyBar1 >= 20) and (not tbuffs['Heavy Bash'].stack 3)) },


same kind of error ')' expected after 3.

These errors occur because they are malformed Lua. In the first case, you have a single equal sign (=) which in Lua is for assignment. That cannot be done in the middle of a line. Use a double equal sign for comparing values (==).

In the second case, you have no comparison operator at all and therefore Lua has no idea what it is supposed to do and is therefore simply confused.
2013... The year from hell....

915

Thursday, February 14th 2013, 12:15am

Help?

I had been using a version of mrmisterwaa's code for over a year, and it always worked perfectly. Then I lost my hard drive and have had to start over. The problem I am having now is with the timers continuing to run after I kill a target and move on to the next. As a R/K it may fire Disarm at the next target but won't go on to SS or anything else until the SS timer has run down. As a R/S I just stand there looking foolish until time is up. It's been so long since I played around with this that I have no idea what I might have done to prevent that from happening. How do I get the timers to reset when I switch targets? Anyone's help would ge greatly appreciated.


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
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
                    }
                    
    --Determine Class-Combo
    mainClass, subClass = UnitClassToken( "player" )

                        
function KillSequence(arg1, arg2, 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(42) -- # 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.
                        
            if (arg2 == "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
                     }
            
            end
            if ((enemy) and (arg2 == "DPS")) then
            Skill2 = {
                { name = "Wound Attack",                       use = ((EnergyBar1 >= 35) and ((tbuffs[500654]) and (tbuffs[620314]))) },
                { 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 (arg2 == "RANGE")) then
            Skill2 = {
                { name = "Vampire Arrows",                     use = (EnergyBar2 >= 20) },
                { name = "Shot",                               use = (true) },
                     }
            end
   -- Class: Scout/Rogue
        elseif mainClass == "RANGER" and subClass == "THIEF" then
            --Timers for this class
   CreateDIYCETimer("ExploitCooldown", 32, false) 
          
            if (enemy and (arg2 == "DPS")) then
                Skill2 = {
                    
                    { name = "Autoshot",                          use = (not ASon) },
                    { name = "Sapping Arrow",                     use = (not pbuffs['Sapping Arrow']) },
                    { name = "Shot",                              use = true,  timer = "ExploitCooldown" },
                    { name = "Reflected Shot",                    use = true },
                    { name = "Vampire Arrows",                    use = true },
                    { name = "Deadly Poison Bite",                use = true },
                    { name = "Piercing Arrow",                    use = true },
                    { name = "Combo Shot",                        use = true },
                    { name = "Weak Spot",                         use = true },
                    { name = "Wind Arrows",                       use = (EnergyBar1 >= 20) }
                            }
            elseif (enemy and (arg2 == "FARM")) then
                Skill2 = {
                    { name = "Reflected Shot",                    use = true },
                    { name = "Piercing Arrow",                    use = true },
                    { name = "Vampire Arrows",                    use = true },
                    { name = "Wind Arrows",                       use = (EnergyBar1 >= 20) }
                            }
            elseif (enemy and (arg2 == "SEIGE")) then
                Skill2 = {
                    { name = "Vampire Arrows",                    use = true },
                    { name = "Autoshot",                          use = (not ASon) },
                    { name = "Reflected Shot",                    use = true },
                    { name = "Piercing Arrow",                    use = true },
                    { name = "Wind Arrows",                       use = (EnergyBar1 >= 20) }
                            }
                    end
  
-- Class Rogue/Knight
elseif mainClass == "THIEF" and subClass == "KNIGHT" 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.
            --arg2: 0 = Buffs, 1 = Melee, 2 = Ranged, 3 = Cooldowns & Potions, 4 = Longer Cooldowns
                                    
            if (arg2 == "BUFF") then
            Skill = {
                { name = "Action: 72 (Unbridled Enthusiam)",   use = ((not pbuffs['Unbridled Enthusiasm'])) }, 
                { name = "Action: 71 (Galloping Gale)",        use = ((not pbuffs['Galloping Gale'])) }, 
                { name = "Action: 70 (Scarlet Love)",          use = ((not pbuffs['Scarlet Love'])) }, 
   -- { name = "Action: 69 (Hero Potion)",           use = ((not pbuffs['Hero Potion'])) },  
            --  { name = "Action: 68 (Grasslsnd Mix)",         use = ((not pbuffs['Grassland Mix'])) }, 
            --  { name = "Action: 67 (Energy Potion)",         use = ((not pbuffs['Unbridled Enthusiasm'])) }, 
                { name = "Enhanced Armor",                    use = ((not pbuffs['Enhanced Armor'])) }, 
    { name = "Lion's Protection",                 use = ((not pbuffs['Lion's Protection'])) }, 
    { name = "Searing Light",                     use = ((not pbuffs['Searing Light'])) }, 
                    }
            end

            if ((enemy) and (arg2 == "DPS")) then
            Skill2 = {
             { name = "Disarmament",                        use = ((not tbuffs['Disarmament IV'])) },
    { name = "Wound Attack",                       use = ((EnergyBar1 >= 35) and ((tbuffs[500704]) and (tbuffs[620313]))) },
             { name = "Shadowstab",                         use = (EnergyBar1 >= 20), timer = "SSBleed" },
             { name = "Low Blow",                           use = (((EnergyBar1 >= 25) and (tbuffs[620313])) or (tbuffs['Energy Thief'])),      timer = "LBBleed",   ignoretimer = not tbuffs['Energy Thief'] },
          }
            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



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
-- 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
    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

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

916

Thursday, February 14th 2013, 4:39am

Quoted from "misterrypto;588870"

...snip...
The problem I am having now is with the timers continuing to run after I kill a target and move on to the next. As a R/K it may fire Disarm at the next target but won't go on to SS or anything else until the SS timer has run down. As a R/S I just stand there looking foolish until time is up. It's been so long since I played around with this that I have no idea what I might have done to prevent that from happening. How do I get the timers to reset when I switch targets? Anyone's help would ge greatly appreciated.

Well its been a while, but I guess either I forgot to include a stop timer function, or Ghostwolf/mrmisterwaa forgot to add that function into DIYCE.

Either way, here's what you can do:

in DIYCE.lua, among all the other timer functions, add the following:

Source code

1
2
3
4
5
6
7
--[[ Stop a named timer ]]--
-- if timer doesn't exist, this does nothing
function StopDIYCETimer(timerName)
    if DIYCE_Timers[timerName] then
        DIYCE_Timers[timerName].timeLeft = 0
    end
end


Once this is in place, in CustomFunctions.lua, near the bottom of the KillSequence function is the code that changes targets.

There are two places where you will see the following two lines of code

Source code

1
2
    TargetNearestEnemy()
    return

Change these to

Source code

1
2
3
4
    TargetNearestEnemy()
[highlight]    StopDIYCETimer("LBBleed")
    StopDIYCETimer("SSBleed")[/highlight]
    return


That should do the trick.

Note that this only stops DIYCE's fake cooldown timers and does nothing towards any actual cooldowns the game maintains.
2013... The year from hell....

917

Thursday, February 14th 2013, 5:06am

thanks peryl for ur quick reply BUT :

Heavy bash ID is :621164 ( used the debugtbuffs)

tried this :

Source code

1
{ name = "Heavy Bash",               use = ((EnergyBar1 >= 20) and (not tbuffs[621164].stack == 3)) },


returned a red error , something about "cant be indexed "or something

checked for the buff at stack = 1 , 2,3, . the function returned the same buff id :621164

any other trick in ur bag ? cuz i m flat out of ideas.

EDIT :
coudnt try the following cuz at work :

Source code

1
--{ name = "Heavy Bash",               use = ((EnergyBar1 >= 20) and ((not tbuffs[621164]) or (tbuffs[621164].stack =< 3))) },

or the =< sign would not be recognized and it would be better to use <4

remember i want to move to another skill if the stack number =3

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

918

Thursday, February 14th 2013, 7:14am

Use <= (less than or equal to). =< is not a recognized operator in Lua.

As to the "can't be indexed" error, that can happen because of the way I setup the buff lists.

Now since you want to use Heavy Bash when the debuff isn't on the mob or the mob has fewer than 3 stacks of it, you need to check for both conditions. So your Heavy Bash line will become:

Source code

1
{ name = "Heavy Bash",               use = EnergyBar1 >= 20 and (not tbuffs[621164] or tbuffs[621164].stack < 3) },



More info on the reason the "can't index" error occurred:

Basically, the code to fill up the tbuffs list will only have entries for the debuffs that the mob currently has. So if the mob doesn't have debuff ID 621164, then tbuffs[621164] doesn't exist (and is therefore nil).

Now in Lua, tbuffs[621164].stack is just syntactic sugar for tbuffs[621164]['stack']. Since we've already established that tbuffs[621164] is nil, tbuffs[621164]['stack'] becomes nil['stack'] which is always invalid. Hence Lua's error "can't index tbuffs[621164].stack, a nil value" (or however it actually says the error).
2013... The year from hell....

919

Thursday, February 14th 2013, 12:28pm

hello
I am away for about 18 months, I would like Diyce2 scout / rogue.
I've older version of al diyce if someone just give me a version of scout / rogue, or give me a link, would be nice to

Quoted

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(3) -- # 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: Scout/Rogue
if mainClass == "RANGER" and subClass == "THIEF" 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 enemy and (Mode == "pve") then
Skill = {
{ name = "Flèche démoralisante", use = (CD['Flèche démoralisante']) and boss and elite },
{ name = "Tir auto.", use = (not ASon) },
{ name = "Flèches sangsues", use = (CD['Flèches sangsues']) and (EnergyBar1 >=20) },
{ name = "Flèche perçante", use = (CD['Flèche perçante']) },
{ name = "Tir multiple", use = (CD['Tir multiple']) },
{ name = "Tir", use = (CD['Tir']) },
{ name = "Talon d'Achille", use = (CD['Talon d'Achille']) and (EnergyBar1 >=30) },
{ name = "Morsure du poison mortel", use = (CD['Morsure du poison mortel']) and (EnergyBar1 >=30) and boss },
{ name = "Tir en ricochets", use = (CD['Tir en ricochets']) },
}
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




Quoted

-- 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


*/run KillSequence("","pve")*
I DL the file, I have translated the skill, but nothing happens, thank for help

920

Friday, February 15th 2013, 10:17pm

Is it possible to use DIYCE to equip and unequip gears?