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.

Drake1132

Beginner

Posts: 11

Location: Wait a minute... you mean I'm *not* a figment of your imagination?

  • Send private message

1,641

Sunday, July 31st 2011, 5:03am

Quoted from "goldguardian;449211"

I checked the spelling on my action bar and on the skill when i pressed "k", it was all the same.

I think i fixed it though. When I first noticed the problem I was changing classes from a P/S to a P/K. I think the system might have thought that i was still a P/S at the time and didnt let me use the skill. All it took was a restart to fix it.

I had also been having problems with the name of my classes when i changed them. For example, i would be P/K switch to K/S then switch back to P/K. I had all the skills of a P/K but when i scrolled over my portrait it said i was a S/K. A restart fixed that too.


I haven't experienced anything like that *knocks on wooden desk*. But I'm glad it's working for you now.
[img][/img]


-- Almost all human knowledge is built upon earlier foundations of more basic knowledge. If you are having trouble, go back two steps and work on something more basic. This can provide insights that will help you with whatever you were having trouble with.


-- Want to learn how to use the Do-it-yourself Combat Engine system (DIYCE)? A good place to start might be RIGHT HERE.

ghostwolf82

Professional

Posts: 859

Location: Kalvans Trunk

Occupation: It's dark in here

  • Send private message

1,642

Sunday, July 31st 2011, 9:28am

Yeah, that does sound a bit odd. Good to know that it can potentially be an issue. Now if someone has a similar issue in the future, we can reference them to your posts. This, people, is why it is good to report odd occurrences and the solutions you find for them! Even when you think it's not important, it may save other people time in the future. So thank you goldguardian! (Also appreciate the willingness to learn on your part.)

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

1,643

Sunday, July 31st 2011, 7:07pm

Was looking at Ghostwolf's latest DIYCE function when I realized that there is a simple optimization that could be done both to it, and DIYCE itself.

Basically, the buff/debuff list is being build into a string, then this string is searched for every buff/debuff interested in. A better way would be to build a table with all the entries named after the buff, then use that to see if the buff is present or not. As a bonus, extra info can be put into this table.

Here's my proposed change to the BuffList function in DIYCE:
Edit:
Changing the code originally posted to add lookups via buff/debuff ID as well since if two different buffs/debuffs have the same name, only the last one will get listed by name.

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
unction BuffList(tgt)
    local list = {}
    local buffcmd = UnitBuff
    local infocmd = UnitBuffLeftTime

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

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

    return list
end

To use it, instead of doing this:

Source code

1
not string.find(pbuffs,"Electric Attack")
you would do this:

Source code

1
not pbuffs['Electric Attack']
Further, since the buff list table also includes the time and stack size, this information can then be retrieved with:

Source code

1
2
timeRemaining = pbuffs['Electric Attack'].time
stackSize = pbuffs['Electric Attack'].stack
As to Ghostwolf's code, the list of spells that can be silenced can be taken out of the function itself and modified like this:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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,
}
The check can then be performed as follows:

Source code

1
local silenceThis = tSpell and silenceList[tSpell] and ((tTime - tElapsed) > 0.1)


Edit:
With the new version posted, you can lookup buffs/debuffs by ID as well. Use:

Source code

1
tbuff[buffID]

In this case, buffID is the buff/debuff number. When looking up by ID, there is now a name entry which gives the name for that buff/debuff, and the entries listed by name have an id entry
2013... The year from hell....

Drake1132

Beginner

Posts: 11

Location: Wait a minute... you mean I'm *not* a figment of your imagination?

  • Send private message

1,644

Sunday, July 31st 2011, 8:42pm

Quoted from "Peryl;449471"

Was looking at Ghostwolf's latest DIYCE function when I realized that there is a simple optimization that could be done both to it, and DIYCE itself.

Basically, the buff/debuff list is being build into a string, then this string is searched for every buff/debuff interested in. A better way would be to build a table with all the entries named after the buff, then use that to see if the buff is present or not. As a bonus, extra info can be put into this table.

<snip>



Those are *superb* ideas. Peryl, I am temporarily blinded by your brilliance. Thank you so much for posting that! Your new methods could be used in the original DIYCE, in ghostwolf's DIYCE, and even in my own "new methodology" DIYCE (which at this point I should probably rename to "Drake's Methodology" or something similar, since there are other custom methods, like ghostwolf's, that could be classified as, and named, "new").

This could also reduce the number of times people have missing or extra parentheses, since they would need fewer to begin with by eliminating a lot of string.find() checks.


However, I would suggest one thing... change the for loop back to the old while loop method (the content of the loop itself would still need to be modified as you have done). Since it will be extremely rare for a target or character to have as many as 100 buffs or debuffs, why make the full 100 iterations for the for loop in the BuffList function? I think the old method of using a while loop checked against (buff ~= nil) would be faster to process and therefore more optimized, because the number of times the loop will iterate will never be larger than the number of buffs or debuffs on the specified unit.
[img][/img]


-- Almost all human knowledge is built upon earlier foundations of more basic knowledge. If you are having trouble, go back two steps and work on something more basic. This can provide insights that will help you with whatever you were having trouble with.


-- Want to learn how to use the Do-it-yourself Combat Engine system (DIYCE)? A good place to start might be RIGHT HERE.

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

1,645

Sunday, July 31st 2011, 9:23pm

Quoted from "Drake1132;449493"

Since it will be extremely rare for a target or character to have as many as 100 buffs or debuffs, why make the full 100 iterations for the for loop in the BuffList function? I think the old method of using a while loop checked against (buff ~= nil) would be faster to process and therefore more optimized, because the number of times the loop will iterate will never be larger than the number of buffs or debuffs on the specified unit.

Nope, it doesn't check all of them. The key is the break statement in the if-else statement. This will break out of the loop if buff is nil, which is the same as before. However, since the whole thing is in a for loop, we also guarantee that it will never go beyond 100 iterations no matter what. Its a little redundant, yes, but is also avoids having to increment a counter externally since the for loop does it for us.
2013... The year from hell....

1,646

Sunday, July 31st 2011, 11:19pm

Quoted from "ghostwolf82;449398"

Yeah, that does sound a bit odd. Good to know that it can potentially be an issue. Now if someone has a similar issue in the future, we can reference them to your posts. This, people, is why it is good to report odd occurrences and the solutions you find for them! Even when you think it's not important, it may save other people time in the future. So thank you goldguardian! (Also appreciate the willingness to learn on your part.)



It seems to happen everytime i switch classes now. I have to relog in order for it to work. Its getting really annoying because everytime i want to go from a P/K to a P/S or P/S to P/K i have to relog. Ill post some screen shots to show the probelm.




ghostwolf82

Professional

Posts: 859

Location: Kalvans Trunk

Occupation: It's dark in here

  • Send private message

1,647

Monday, August 1st 2011, 12:21am

@peryl - Brilliant! I will make those changes, and edit the new code in the post on the previous page.

@goldguardian - That is extremely odd. I have never heard nor seen anyone having that issue. Do me a favor if you will, please post your functions you use for that toon. Maybe there is something in them that is in error that you have overlooked.

1,648

Monday, August 1st 2011, 12:37am

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
[FONT=Courier New]function PriestKnight(arg1)[/FONT]
[FONT=Courier New]   local Skill = {}[/FONT]
[FONT=Courier New]   local i = 0[/FONT]
[FONT=Courier New]   local friendly = (not UnitCanAttack("player", "target"))[/FONT]
[FONT=Courier New]   local combat = GetPlayerCombatState()[/FONT]
[FONT=Courier New]   local pbuffs = BuffList("player")[/FONT]
[FONT=Courier New]   local tbuffs = BuffList("target")[/FONT]
[FONT=Courier New]   local health, buffs[/FONT]
 
[FONT=Courier New]   if friendly then[/FONT]
[FONT=Courier New]       health = PctH("target")[/FONT]
[FONT=Courier New]       buffs = tbuffs[/FONT]
[FONT=Courier New]   else[/FONT]
[FONT=Courier New]       health = PctH("player")[/FONT]
[FONT=Courier New]       buffs = pbuffs[/FONT]
[FONT=Courier New]   end[/FONT]
 
[FONT=Courier New]   i=i+1; Skill[i] = { name = "Magic Barrier",         use = ((not combat) and (not string.find(pbuffs, "Magic Barrier"))) }[/FONT]
[FONT=Courier New]   i=i+1; Skill[i] = { name = "Blessed Spring Water",  use = ((not combat) and (not string.find(pbuffs, "Blessed Spring Water"))) }[/FONT]
[FONT=Courier New]   i=i+1; Skill[i] = { name = "Soul Bond",             use = (not string.find(pbuffs, "Soul Bond")) }[/FONT]
[FONT=Courier New]   i=i+1; Skill[i] = { name = "Soul Source",           use = (health <= .25) }[/FONT]
[FONT=Courier New]   i=i+1; Skill[i] = { name = "Holy Aura",             use = (PctH("player") <= .35) }[/FONT]
[FONT=Courier New]   i=i+1; Skill[i] = { ['name'] = "Action: 21",            ['use'] = (PctH("player") <= .40) }[/FONT]
[FONT=Courier New]   i=i+1; Skill[i] = { ['name'] = "Action: 22",            ['use'] = (PctM("player") <= .40) }[/FONT]
[FONT=Courier New]   i=i+1; Skill[i] = { name = "Heal",                  use = (health <= .60) }[/FONT]
[FONT=Courier New]   i=i+1; Skill[i] = { name = "Urgent Heal",           use = (health <= .80) }[/FONT]
[FONT=Courier New]   i=i+1; Skill[i] = { name = "Regenerate",            use = ((health <= .90) and (not string.find(buffs, "Regenerate"))) }[/FONT]
[FONT=Courier New]   i=i+1; Skill[i] = { name = "Grace of Life",         use = (not string.find(pbuffs, "Grace of Life")) }[/FONT]
[FONT=Courier New]   i=i+1; Skill[i] = { name = "Amplified Attack",      use = (not string.find(pbuffs, "Amplified Attack")) }[/FONT]
[FONT=Courier New]   i=i+1; Skill[i] = { name = "Enhanced Armor",        use = (not string.find(pbuffs, "Enhanced Armor")) }[/FONT]
[FONT=Courier New]   i=i+1; Skill[i] = { name = "Bone Chill",            use = ((not friendly) and (not string.find(tbuffs, "Bone Chill"))) }[/FONT]
[FONT=Courier New]   i=i+1; Skill[i] = { name = "Rising Tide",           use = (not friendly) }[/FONT]
 
[FONT=Courier New]   MyCombat(Skill,arg1)[/FONT]
[FONT=Courier New]end[/FONT]


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
[FONT=Courier New]function PriestScout(arg1)[/FONT]
[FONT=Courier New]  local Skill = {}[/FONT]
[FONT=Courier New]  local i = 0[/FONT]
[FONT=Courier New]  local tgt = "player"[/FONT]
[FONT=Courier New]  local friendly = false[/FONT]
[FONT=Courier New]  local combat = GetPlayerCombatState()[/FONT]
[FONT=Courier New]  local pbuffs = BuffList("player")[/FONT]
[FONT=Courier New]  local tbuffs = BuffList("target")[/FONT]
[FONT=Courier New]  local focus  = UnitSkill("player")[/FONT]
 
[FONT=Courier New]  i=i+1; Skill[i] = { ['name'] = "Soul Bond",             ['use'] = (not string.find(pbuffs,"Soul Bond")) }[/FONT]
[FONT=Courier New]  i=i+1; Skill[i] = { ['name'] = "Embrace of the Water Spirit",  ['use'] = (not string.find(pbuffs,"Embrace of the Water Spirit")) }[/FONT]
[FONT=Courier New]  i=i+1; Skill[i] = { ['name'] = "Soul Source",           ['use'] = (PctH("player") <= .20) }[/FONT]
[FONT=Courier New]  i=i+1; Skill[i] = { ['name'] = "Holy Aura",             ['use'] = (PctH("player") <= .40) }[/FONT]
[FONT=Courier New]  i=i+1; Skill[i] = { ['name'] = "Regenerate",            ['use'] =      ((combat) and (not string.find(pbuffs,"Regenerate")) or (PctH("player")[/FONT]
[FONT=Courier New]<= .90) and (not string.find(pbuffs,"Regenerate"))) }[/FONT]
[FONT=Courier New]  i=i+1; Skill[i] = { ['name'] = "Heal",                  ['use'] = (PctH("player") <= .65) }[/FONT]
[FONT=Courier New]  i=i+1; Skill[i] = { ['name'] = "Urgent Heal",           ['use'] = (PctH("player") <= .80) }[/FONT]
[FONT=Courier New]  i=i+1; Skill[i] = { ['name'] = "Action: 22",        ['use'] = (PctM("player")    [/FONT]
[FONT=Courier New]<= .55) }                           [/FONT]
[FONT=Courier New]  i=i+1; Skill[i] = { ['name'] = "Action: 23",        ['use'] = (PctM("player")[/FONT]
[FONT=Courier New]<= .25) } [/FONT]
[FONT=Courier New]  i=i+1; Skill[i] = { ['name'] = "Action: 21",        ['use'] = (PctH("player")[/FONT]
[FONT=Courier New]<= .40) }[/FONT]
[FONT=Courier New]  i=i+1; Skill[i] = { ['name'] = "Action: 24",        ['use'] = (PctH("player")[/FONT]
[FONT=Courier New]<= .15) } [/FONT]
[FONT=Courier New]  i=i+1; Skill[i] = { ['name'] = "Grace of Life",         ['use'] = ((not combat) and (not string.find(pbuffs,"Grace of Life"))) }[/FONT]
[FONT=Courier New]  i=i+1; Skill[i] = { ['name'] = "Amplified Attack",      ['use'] = ((not combat) and (friendly and (not string.find(tbuffs,"Amplified Attack")))) }[/FONT]
[FONT=Courier New]  i=i+1; Skill[i] = { ['name'] = "Magic Barrier",         ['use'] = ((not combat) and (not string.find(pbuffs,"Magic Barrier"))) }[/FONT]
[FONT=Courier New]  i=i+1; Skill[i] = { ['name'] = "Blessed Spring Water",  ['use'] = ((not combat) and (not string.find(pbuffs,"Blessed Spring Water"))) }[/FONT]
[FONT=Courier New]  i=i+1; Skill[i] = { ['name'] = "Bone Chill",            ['use'] = ((not friendly) and (not string.find(tbuffs,"Bone Chill"))) }[/FONT]
[FONT=Courier New]  i=i+1; Skill[i] = { ['name'] = "Vampire Arrows",  ['use'] = ((not friendly) and (focus >= 20)) }[/FONT]
[FONT=Courier New]  i=i+1; Skill[i] = { ['name'] = "Ice Blade",           ['use'] = ((not friendly) and (PctM("player") >= .55)) }[/FONT]
[FONT=Courier New]  i=i+1; Skill[i] = { ['name'] = "Rising Tide",           ['use'] = (not friendly) }[/FONT]
 
[FONT=Courier New]  MyCombat(Skill,arg1)[/FONT]
[FONT=Courier New]end[/FONT]

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

1,649

Monday, August 1st 2011, 12:39am

Quoted from "goldguardian;449540"

It seems to happen everytime i switch classes now. I have to relog in order for it to work. Its getting really annoying because everytime i want to go from a P/K to a P/S or P/S to P/K i have to relog. Ill post some screen shots to show the probelm.

Since this is happening switching secondary and tertiary classes, I wonder if it isn't some kind of caching bug in the game where it has some old info hanging around. Do you know if it happens when swapping primary and secondary or other combinations?

Also, check if you have any add-ons that deal with class swaps in case something odd is happening there (somewhat doubtful, but you never know).

Another thing to check would be if when it does start acting up, if switching primary/secondary class then switching back again helps fix the problem.

This is all speculation of course, but if you can consistently reproduce the problem, and are fairly certain it isn't just your computer. Submit a bug report.
2013... The year from hell....

1,650

Monday, August 1st 2011, 12:56am

Quoted from "Peryl;449563"

Since this is happening switching secondary and tertiary classes, I wonder if it isn't some kind of caching bug in the game where it has some old info hanging around. Do you know if it happens when swapping primary and secondary or other combinations?

Also, check if you have any add-ons that deal with class swaps in case something odd is happening there (somewhat doubtful, but you never know).

Another thing to check would be if when it does start acting up, if switching primary/secondary class then switching back again helps fix the problem.

This is all speculation of course, but if you can consistently reproduce the problem, and are fairly certain it isn't just your computer. Submit a bug report.



If i go from P/K to P/S i get the ice blade/embrace error, but from there if i go back to P/K i dont have the enhanced error. It seems like when i log in, my primary and seecondary classes set and it doesnt work for anyother class that i had when i logged in.

As for any auto class-swapping add-on, i did have one but i removed it and i was still haveing the same problem

ghostwolf82

Professional

Posts: 859

Location: Kalvans Trunk

Occupation: It's dark in here

  • Send private message

1,651

Monday, August 1st 2011, 1:08am

I see no inherent errors in your code. However, there are a lot of optimization issues going on. You are using a very old method of a diyce function. Perhaps optimizing the code could eliminate the issue you are having. That's really my only other suggestion at this point.

1,652

Monday, August 1st 2011, 1:26am

I havent checked up on this thread for a while so i guess im behind lol. Ill try updateing it and see if it helps

ghostwolf82

Professional

Posts: 859

Location: Kalvans Trunk

Occupation: It's dark in here

  • Send private message

1,653

Monday, August 1st 2011, 1:52am

Quoted from "goldguardian;449571"

I havent checked up on this thread for a while so i guess im behind lol. Ill try updateing it and see if it helps

Check this post for my latest upgrades to the DIYCE functionality. Included is Peryls contribution to it, and instructions on how to include his changes as well.

Posts: 25

Location: Rochester,N.Y.

Occupation: Work from home

  • Send private message

1,654

Monday, August 1st 2011, 3:24am

Anyone know if there is a way to use Deadly poison Bite after i use Vampire arrow. Everytime i put it in it messes up and only 1 or 2 skills will go off.

function ScoutRogue(arg1)
local Skill = {}
local i = 0
local focus = UnitMana("player")
local enemy = UnitCanAttack("player","target")

i=i+1; Skill = { name = "Frost Arrow", use = (not ChkBuff("player","Frost Arrow")) }
i=i+1; Skill[i] = { name = "Combo Shot", use = enemy }
i=i+1; Skill[i] = { name = "Shot", use = enemy }
i=i+1; Skill[i] = { name = "Piercing Arrow", use = enemy }
i=i+1; Skill[i] = { name = "Weak Spot", use = (enemy and (focus >= 30)) }
-- i=i+1; Skill[i] = { name = "Vampire Arrows", use = (enemy and (focus >= 20)) }
i=i+1; Skill[i] = { name = "Sapping Arrow", use = enemy }
i=i+1; Skill[i] = { name = "Wind Arrows", use = (enemy and (focus >= 15)) }
i=i+1; Skill[i] = { name = "Snipe", use = enemy }

MyCombat(Skill,arg1)
end
I use Six's code with a few changes in it putting shot and wind arrow near the bottom and put reflected shot in there as well but when i go to put in Deadly Poison Bite after Vamp Arrow then only a couple skills will fire off. Any help will greatly help. Thanks in advance
Phrost S67/W57/R67
Elyza M/P chap 2 and 3
Jeanny S/M chap 1 and 2

Drake1132

Beginner

Posts: 11

Location: Wait a minute... you mean I'm *not* a figment of your imagination?

  • Send private message

1,655

Monday, August 1st 2011, 3:24am

Quoted from "Peryl;449506"

Nope, it doesn't check all of them. The key is the break statement in the if-else statement. This will break out of the loop if buff is nil, which is the same as before. However, since the whole thing is in a for loop, we also guarantee that it will never go beyond 100 iterations no matter what. Its a little redundant, yes, but is also avoids having to increment a counter externally since the for loop does it for us.



Ah yes, you're quite right, I overlooked that one, sorry about that.


Quoted from "goldguardian;449567"

If i go from P/K to P/S i get the ice blade/embrace error, but from there if i go back to P/K i dont have the enhanced error. It seems like when i log in, my primary and seecondary classes set and it doesnt work for anyother class that i had when i logged in.

As for any auto class-swapping add-on, i did have one but i removed it and i was still haveing the same problem



I'm starting to seriously think this may have to do with the g_skill array and the ReadSkills() function... more specifically with how infrequently ReadSkills() is normally called to populate or re-populate the g_skill array. The g_skill array is populated by ReadSkills() with your known skills and their skill levels when DIYCE is first loaded, on login or ReloadUI. The only other time ReadSkills() is normally called is if you are checking to see if a skill is available (using the CD() function), in which case it will only be called to repopulate the g_skill array if either the *Primary* class has changed, or the g_skill array has no entries (a blank array). This means that if you change your *Secondary* class *only*, then ReadSkills() will *not* be called, and the g_skill array will still contain the old data from your old Secondary class. Back before we could have three classes, this setup was fine, because if your Secondary class changed, it always meant that your Primary had as well, and since your Primary had changed, ReadSkills() would be called to re-populate the g_skill array.

To fix this issue, replace your CD() function with the following...

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function CD(skillname)
    local firstskill = GetSkillDetail(2,1)
     local firstgeneralskill = GetSkillDetail(3,1)
    if (g_skill[firstskill] == nil) or (g_skill[firstskill].page ~= 2) or (g_skill[firstgeneralskill].page ~= 3) 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)
        return false
    end
end
This adds a single local variable, firstgeneralskill, and adds an additional true/false check to the if statement that determines if it needs to call ReadSkills. If it works like it should, then ReadSkills should now run if either your Primary *or* Secondary class has changed, as well as if g_skill has no entries.

Please note that I think this may still have problems for anyone trying to use it if one of their classes is a Mage of level 1-3, because Mages do not learn their first General Skill, Fireball, until level 4, but if memory serves, this was even a problem with the original CD() function before we could get a third class.

Try that and see if it fixes the problem. If it does, and I firmly believe it will, then that would explain why I haven't had problems with this... I usually have my class functions make a call to ReadSkills() if my classes and/or levels have changed in any way, so that when I learn new skills or switch classes, my skills are automatically re-populated into the g-skill array the next time I run my macro (this requires additional global variables to keep track of the most recent classes and levels so that they can be compared to the current classes and levels).

Anyway, replace the CD() function like I said above, try it out, and let us know how it goes.
[img][/img]


-- Almost all human knowledge is built upon earlier foundations of more basic knowledge. If you are having trouble, go back two steps and work on something more basic. This can provide insights that will help you with whatever you were having trouble with.


-- Want to learn how to use the Do-it-yourself Combat Engine system (DIYCE)? A good place to start might be RIGHT HERE.

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

1,656

Monday, August 1st 2011, 11:39am

Quoted from "missjeanny31;449594"

Anyone know if there is a way to use Deadly poison Bite after i use Vampire arrow. Everytime i put it in it messes up and only 1 or 2 skills will go off.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function ScoutRogue(arg1)
    local Skill = {}
    local i = 0
    local focus = UnitMana("player")
    local enemy = UnitCanAttack("player","target")

    i=i+1; Skill[i] = { name = "Frost Arrow",    use = (not ChkBuff("player","Frost Arrow")) }
       i=i+1; Skill[i] = { name = "Combo Shot",     use = enemy }
       i=i+1; Skill[i] = { name = "Shot",           use = enemy }
    i=i+1; Skill[i] = { name = "Piercing Arrow", use = enemy }
    i=i+1; Skill[i] = { name = "Weak Spot",      use = (enemy and (focus >= 30)) }
    -- i=i+1; Skill[i] = { name = "Vampire Arrows", use = (enemy and (focus >= 20)) }
    i=i+1; Skill[i] = { name = "Sapping Arrow",  use = enemy }
    i=i+1; Skill[i] = { name = "Wind Arrows",    use = (enemy and (focus >= 15)) }
       i=i+1; Skill[i] = { name = "Snipe",          use = enemy }

    MyCombat(Skill,arg1)
end

I use Six's code with a few changes in it putting shot and wind arrow near the bottom and put reflected shot in there as well but when i go to put in Deadly Poison Bite after Vamp Arrow then only a couple skills will fire off. Any help will greatly help. Thanks in advance

I'm not sure what the problem would be. Could you post your code you have with the Deadly Poison Bite included in it? Oh and please use the code tags when posting your code, it makes it much easier to read. Use [noparse]

Source code

1
[/noparse][i]Your code here[/i][noparse]
[/noparse].
2013... The year from hell....

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

1,657

Monday, August 1st 2011, 11:48am

Quoted from "ghostwolf82;449575"

Check this post for my latest upgrades to the DIYCE functionality. Included is Peryls contribution to it, and instructions on how to include his changes as well.

You missed one of the changes mentioned though. Define the silenceList outside the function itself. Put it right after the definition of g_skills and g_lastaction. This way, the list doesn't get recreated each time the function is executed (it doesn't need to since the list is constant).

As an extra optimization, define g_skills and g_lastaction as local to the file as well (the _G.xxx stuff just makes them still globally accessible). So it becomes:

Source code

1
2
3
4
5
6
7
8
9
local g_skills  = {}
_G.g_skills = g_skills

local g_lastaction = ""
_G.g_lastaction = g_lastaction

local silenceList = {
        [B][I]<insert list of spells here>[/I][/B]
     }
2013... The year from hell....

Posts: 25

Location: Rochester,N.Y.

Occupation: Work from home

  • Send private message

1,658

Monday, August 1st 2011, 1:10pm

Quoted from "Peryl;449699"

I'm not sure what the problem would be. Could you post your code you have with the Deadly Poison Bite included in it? Oh and please use the code tags when posting your code, it makes it much easier to read. Use [noparse]

Source code

1
[/noparse][I]Your code here[/I][noparse]
[/noparse].


Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function ScoutRogue(arg1)
   local Skill = {}
   local i = 0
   local focus = UnitMana("player")
 --local energy = UnitMana("player")
   local enemy = UnitCanAttack("player","target")
   i=i+1; Skill[i] = { name = "Frost Arrow",    use = (not ChkBuff("player","Frost Arrow")) }
   i=i+1; Skill[i] = { name = "Combo Shot",     use = enemy }
   i=i+1; Skill[i] = { name = "Vampire Arrows", use = (enemy and (focus >= 20)) }
 --i=i+1; Skill[i] = { name = "Deadly Poison Bite", use = enemy and (energy >=30)) }
   i=i+1; Skill[i] = { name = "Piercing Arrow", use = enemy }
   i=i+1; Skill[i] = { name = "Weak Spot",      use = (enemy and (focus >= 30)) }
   i=i+1; Skill[i] = { name = "Sapping Arrow",  use = enemy }
   i=i+1; Skill[i] = { name = "Reflected Shot", use = enemy }
 --i=i+1; Skill[i] = { name = "Snipe",          use = enemy }
   i=i+1; Skill[i] = { name = "Wind Arrows",    use = (enemy and (focus >= 15)) }
   i=i+1; Skill[i] = { name = "Shot",           use = enemy }
   MyCombat(Skill,arg1)
end



hope i did this right i deactivated the energy and the skill for deadly poison bite but removed them completely i just added them in to show where i added the code
Phrost S67/W57/R67
Elyza M/P chap 2 and 3
Jeanny S/M chap 1 and 2

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

1,659

Monday, August 1st 2011, 4:33pm

Quoted from "missjeanny31;449714"

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function ScoutRogue(arg1)
   local Skill = {}
   local i = 0
   local focus = UnitMana("player")
 --local energy = UnitMana("player")
   local enemy = UnitCanAttack("player","target")
   i=i+1; Skill[i] = { name = "Frost Arrow",    use = (not ChkBuff("player","Frost Arrow")) }
   i=i+1; Skill[i] = { name = "Combo Shot",     use = enemy }
   i=i+1; Skill[i] = { name = "Vampire Arrows", use = (enemy and (focus >= 20)) }
 --i=i+1; Skill[i] = { name = "Deadly Poison Bite", use = enemy and (energy >=30)) }
   i=i+1; Skill[i] = { name = "Piercing Arrow", use = enemy }
   i=i+1; Skill[i] = { name = "Weak Spot",      use = (enemy and (focus >= 30)) }
   i=i+1; Skill[i] = { name = "Sapping Arrow",  use = enemy }
   i=i+1; Skill[i] = { name = "Reflected Shot", use = enemy }
 --i=i+1; Skill[i] = { name = "Snipe",          use = enemy }
   i=i+1; Skill[i] = { name = "Wind Arrows",    use = (enemy and (focus >= 15)) }
   i=i+1; Skill[i] = { name = "Shot",           use = enemy }
   MyCombat(Skill,arg1)
end
hope i did this right i deactivated the energy and the skill for deadly poison bite but removed them completely i just added them in to show where i added the code

There's an extra close parenthesis at the end of your Deadly Poison Bite line. Apart from that I don't see anything drastically wrong with your code, though as I don't play either a Scout or a Rogue, I could very well be missing something.

Having said this however, the line:

Source code

1
local energy = UnitMana("player")
should be

Source code

1
local energy = UnitSkill("player")
since you want to get the energy for the secondary class.

As for detecting if you've applied Vampire Arrows on your target, you will likely need to check for the presence or absence of the Debuff on your target. Something like this (taken from other folks DIYCE code):

Source code

1
2
    i=i+1; Skill[i] = { name = "Vampire Arrows", use = (enemy and (focus >= 20) and not string.find(tbuffs, "Vampire Arrows")) }
 --i=i+1; Skill[i] = { name = "Deadly Poison Bite", use = enemy and (energy >=30) and string.find(tbuffs, "Vampire Arrows") }
You'll also need this at the top of the function:

Source code

1
    local tbuffs = BuffList("target")
2013... The year from hell....

ghostwolf82

Professional

Posts: 859

Location: Kalvans Trunk

Occupation: It's dark in here

  • Send private message

1,660

Monday, August 1st 2011, 4:43pm

Ah, I had missed that. Thanks! As for the globals, I was actually thinking about this... Since I no longer have the functions in a MyFunctions.lua, I no longer need to have these be global in the first place. Since that was the only reason to ever have them as globals.