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

Monday, July 25th 2011, 8:20pm

Quoted from "ItIsFinished22;446926"

I was wondering about the cd==0.4 change. I know that for some it increased the DPS for scouts. I've been using it for about a year now and it works great. Was that minor tweak only meant for a scouts DIYCE script because of the ability to pull shot off before the actual CD is truly up?

I have a Wd/W and am wondering if I should put it back to cd==0 when playing Wd/W?



First, please note that that should be "cd <= 0.4", not "cd == 0.4". You want it to return true for any cd value of 0.4 or less, including 0.0, rather than only returning true for 0.4 exactly and false for all other values.

Other than that, in my experience, there is no reason to change it back. While classes other than Scout may not see a great improvement by keeping the change, they may see at least some minor improvement, and it shouldn't cause any problems at all, so why switch back and forth?

Basically the change allows you to anticipate the end of the cooldown period and take advantage of differences between the cooldown on the server vs. that on the client (differences largely present due to net lag).

Drake
[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.

Posts: 86

Location: Dominating in 3vs3, 6vs6 and siege.

Occupation: Network Administrator for a local NBC T.V. station.

  • Send private message

1,622

Monday, July 25th 2011, 8:42pm

Quoted from "Drake1132;446993"

First, please note that that should be "cd <= 0.4", not "cd == 0.4". You want it to return true for any cd value of 0.4 or less, including 0.0, rather than only returning true for 0.4 exactly and false for all other values.

Other than that, in my experience, there is no reason to change it back. While classes other than Scout may not see a great improvement by keeping the change, they may see at least some minor improvement, and it shouldn't cause any problems at all, so why switch back and forth?

Basically the change allows you to anticipate the end of the cooldown period and take advantage of differences between the cooldown on the server vs. that on the client (differences largely present due to net lag).

Drake



Oops. I'm not sure why I typed "cd == 0.4" instead of "cd <= 0.4". I was up late last night taking advantage of the double xp event and am tired today :). As for my question, thank you for clearing that up. I was testing out my Wd/W combo last night and it seemed as if I was hitting slower than if I was clicking the skills manually.

Drake1132

Beginner

Posts: 11

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

  • Send private message

1,623

Monday, July 25th 2011, 8:59pm

Quoted from "ItIsFinished22;447007"

Oops. I'm not sure why I typed "cd == 0.4" instead of "cd <= 0.4". I was up late last night taking advantage of the double xp event and am tired today :). As for my question, thank you for clearing that up. I was testing out my Wd/W combo last night and it seemed as if I was hitting slower than if I was clicking the skills manually.


For people who have gotten really fast with their timing with manual skill triggering, manual usage can often be at least a little faster than DIYCE. As Sixpax has pointed out (I don't recall where), DIYCE wasn't intended to be the most optimized way of handling things... it was designed to make things simpler to use. Basically, it allows you to develop a pre-battle standard strategy, so that you don't have to spend as much time and effort deciding what skill is best to use, and then use it. It can make improvements by removing the necessity of human reaction times, but if you are a very quick thinker, and readily able to choose and execute the best skill for a certain moment, then you could potentially be better off not using DIYCE. There is a degree of trade-off that is made, between maximum speed of skill execution vs. convenience. DIYCE can make things more convenient, especially for casual gamers, but it won't be as fast as the fastest hardcore gamer could potentially be manually, especially if they have become good at anticipating timing in view of lag.

And part of the problem is also in the time it takes for DIYCE to fully process each time you run your class function. I assume this is why you have been asking me in PMs about the new methodology, because that system runs faster, and could provide an improvement in skill execution times, which could then improve your overall DPS slightly compared to the unmodified DIYCE.

Drake
[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,624

Thursday, July 28th 2011, 6:05am

Ok, so for some reason using this in-game works just fine to de-select your target

Source code

1
/run TargetUnit("")


However, this does nothing

Source code

1
2
3
    if (tdead) then
        TargetUnit("")
    end

By now, most of you know/use the tdead variable, so no puns about not declaring that please. So the question is: why does this do nothing and yet the macro works fine?

1,625

Thursday, July 28th 2011, 8:17am

Quoted from "Drake1132;446993"

First, please note that that should be "cd <= 0.4", not "cd == 0.4". You want it to return true for any cd value of 0.4 or less, including 0.0, rather than only returning true for 0.4 exactly and false for all other values.

Other than that, in my experience, there is no reason to change it back. While classes other than Scout may not see a great improvement by keeping the change, they may see at least some minor improvement, and it shouldn't cause any problems at all, so why switch back and forth?

Basically the change allows you to anticipate the end of the cooldown period and take advantage of differences between the cooldown on the server vs. that on the client (differences largely present due to net lag).

Drake

The only reason I've found to change it is for my S/M. I have it set up so that whenever an enemy gets within range for lightning, it will use lightning, and without having cd == 0 lightning never goes off, as the game never considers it ready for use (I use GetActionUsable() to determine if the enemy is in range for lightning.)

Granted, I never play my S/M in instances, where the increase in DPS is actually relevant.

ghostwolf82

Professional

Posts: 859

Location: Kalvans Trunk

Occupation: It's dark in here

  • Send private message

1,626

Thursday, July 28th 2011, 9:30am

Quoted from "Vaeliorin;448406"

The only reason I've found to change it is for my S/M. I have it set up so that whenever an enemy gets within range for lightning, it will use lightning, and without having cd == 0 lightning never goes off, as the game never considers it ready for use (I use GetActionUsable() to determine if the enemy is in range for lightning.)

Granted, I never play my S/M in instances, where the increase in DPS is actually relevant.

I have never had any issues using Lightning with any mage combo. You may want to look at the parameters you have set to determine the use factor of that spell for yourself as the culprit instead of the GCD. (All that bit of code does is check to see if GCD is up, nothing more, nothing less. Which is why I suggest another reason for your problem with Lightning.)

Drake1132

Beginner

Posts: 11

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

  • Send private message

1,627

Thursday, July 28th 2011, 9:40pm

Quoted from "ghostwolf82;448377"

Ok, so for some reason using this in-game works just fine to de-select your target

Source code

1
/run TargetUnit("")
However, this does nothing

Source code

1
2
3
    if (tdead) then
        TargetUnit("")
    end
By now, most of you know/use the tdead variable, so no puns about not declaring that please. So the question is: why does this do nothing and yet the macro works fine?



That's seriously weird. There's no reason at all why it should work in the macro but not in the function. I would say, verify that the function is even trying to use the command by adding in some feedback...

Source code

1
2
3
4
5
    if (tdead) then
        Msg("Now attempting to clear your target.")
        TargetUnit("")
        Msg("You should now have no target.")
    end


If it sends the messages to your chat window, then you know it's something screwy with TargetUnit("") and should probably be submitted as a bug report, but if you don't get the messages then it would suggest a problem with the tdead check. I can't imagine you having trouble with tdead, considering how long you've been using it, but at least it would give more information and documentation for a bug report.
[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.

1,628

Friday, July 29th 2011, 5:32am

macro not working

hey guys, i'm trying my best to learn this but i'm a little slow. This is what i am using but get an error message,can you look it over and see whats wrong. Thanks.


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
function RSCombo(arg1, arg2)
local Skill = {}
local i = 0
local energy = UnitMana("player")
local focus = UnitSkill("player")
local enemy = (UnitCanAttack("player", "target"))
local combat = GetPlayerCombatState()
local tspell,ttime,telapsed = UnitCastingTime("target")
local pbuffs = BuffList("player")
local tbuffs = BuffList("target")
local melee
if(string.find(arg2, "ranged"))then
melee = false
else
melee = true
end
local tclass = UnitClass("target");
i=i+1; Skill[i] = { name = "Wound Attack", use = (melee and enemy and (energy >= 35) and string.find(tbuffs, "Bleed") and string.find(tbuffs, "Grievous Wound")) }
i=i+1; Skill[i] = { name = "Sneak Attack", use = (melee and enemy and (energy >= 30) and string.find(arg2, "behind") and (not combat)) }
i=i+1; Skill[i] = { name = "Throat Attack", use = (melee and enemy and (energy >= 15) and (not string.find(tbuffs, "Silenced")) and (not string.find(tbuffs, "Sneak Attack Stun")) }
i=i+1; Skill[i] = { name = "Blind Spot", use = (melee and enemy and (energy >= 25) and (not string.find(tbuffs, "Bleed")) and string.find(arg2, "behind")) }
i=i+1; Skill[i] = { name = "Low Blow", use = (melee and enemy and (energy >= 25) and string.find(tbuffs, "Bleed")) } 
i=i+1; Skill[i] = { name = "Shadowstab", use = (melee and enemy and (energy >= 20) and (not string.find(tbuffs, "Bleed"))) }
i=i+1; Skill[i] = { name = "Vampire Arrows", use = (enemy and (focus >= 20)) }
i=i+1; Skill[i] = { name = "Shot", use = enemy }
i=i+1; Skill[i] = { name = "Attack", use = enemy }
MyCombat(Skill,arg1)
end

1,629

Friday, July 29th 2011, 6:22am

ghostwolf82 is that the full file for Scout/knight in ur post #1218

ghostwolf82

Professional

Posts: 859

Location: Kalvans Trunk

Occupation: It's dark in here

  • Send private message

1,630

Friday, July 29th 2011, 8:29am

Quoted from "GunnyDuke;448721"

hey guys, i'm trying my best to learn this but i'm a little slow. This is what i am using but get an error message,can you look it over and see whats wrong. Thanks.

For starters, you need to define your variable "melee", you have extra variable you are not using (doesn't really cause problems, just clutters things up unnecessarily). Fix that, and then give it a try, and report what happens. :)

Quoted from "Fir3Storm;448727"

ghostwolf82 is that the full file for Scout/knight in ur post #1218

It is the full file of what I had at the time. The function was for a friend of mine though, and so once he got his hands on it, he tweaked it even more to suit his needs. It is a good place to start if you are a S/K, the keyword is start. It is not by any means a "final" version. (Actually, I have yet to create what I consider a "final version" of any function lol :p they are all works in progress. I just have the "final version at that time")

Drake1132

Beginner

Posts: 11

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

  • Send private message

1,631

Friday, July 29th 2011, 8:57am

Quoted from "GunnyDuke;448721"

hey guys, i'm trying my best to learn this but i'm a little slow. This is what i am using but get an error message,can you look it over and see whats wrong. Thanks.


Quoted from "ghostwolf82;448748"

For starters, you need to define your variable "melee", you have extra variable you are not using (doesn't really cause problems, just clutters things up unnecessarily). Fix that, and then give it a try, and report what happens. :)


Actually, the melee variable *is* defined, just below where it is declared, and based on the value of arg2. That isn't the way I would do it, personally, but whatever works for you. But ghostwolf is correct that you have a number of variables declared and defined that you don't use, which is unnecessary. It doesn't really hurt anything to have them there, but removing them might be less confusing and certainly would reduce the number of places where you could develop a syntax error.

The line for Throat Attack is missing a closing parenthesis at the end... it should be as follows...

Source code

1
i=i+1; Skill[i] = { name = "Throat Attack", use = (melee and enemy and (energy >= 15) and (not string.find(tbuffs, "Silenced")) and (not string.find(tbuffs, "Sneak Attack Stun"))) }
I don't see any other syntax problems, so fixing that should fix your error.

Also, while it's entirely up to you, if it were me I would add a check to make sure that the target is casting a spell before trying to use Throat Attack. I would do this by adding in a calculation for how much time is remaining on the cast time of a spell being cast, then only use Throat Attack if that time remaining is greater than a certain amount, say 0.5 seconds. Something like the following...

Source code

1
2
3
4
5
local tspell,ttime,telapsed = UnitCastingTime("target")
local tremaining = 0
if ((ttime ~= nil) and (telapsed > 0)) then
tremaining = (ttime - telapsed)
end
And then...

Source code

1
i=i+1; Skill[i] = { name = "Throat Attack", use = (melee and enemy and  (energy >= 15) and (not string.find(tbuffs, "Silenced")) and (not  string.find(tbuffs, "Sneak Attack Stun")) and (tremaining >= 0.5)) }
[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,632

Friday, July 29th 2011, 9:59am

Quoted from "Drake1132;448581"

That's seriously weird. There's no reason at all why it should work in the macro but not in the function. I would say, verify that the function is even trying to use the command by adding in some feedback...

Source code

1
2
3
4
5
    if (tdead) then
        Msg("Now attempting to clear your target.")
        TargetUnit("")
        Msg("You should now have no target.")
    end
If it sends the messages to your chat window, then you know it's something screwy with TargetUnit("") and should probably be submitted as a bug report, but if you don't get the messages then it would suggest a problem with the tdead check. I can't imagine you having trouble with tdead, considering how long you've been using it, but at least it would give more information and documentation for a bug report.

As I said in my PM to you, I am on pain meds currently... I feel like a tard now for missing this...

tDead, not tdead

it works now and this is my code. I have moved its location though as I am working on further streamlining vanilla DIYCE capabilities to be more in line with how some advanced solutions work.

Source code

1
2
3
4
5
6
7
8
9
    --Select Next Enemy
    if tDead then
        TargetUnit("")
        return
    end
    if (not LockedOn) or (not enemy) then
        TargetNearestEnemy()
        return
    end

Drake1132

Beginner

Posts: 11

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

  • Send private message

1,633

Friday, July 29th 2011, 10:39am

Quoted from "ghostwolf82;448764"

tDead, not tdead



Ah ha! :) Honestly, even if you had posted your entire function, such that I could see your declaration and definition for tDead, I probably would have missed it anyways. I sometimes really hate that Lua is case-sensitive (it's actually useful, but it can also cause problems... like that one).
[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.

1,634

Friday, July 29th 2011, 9:42pm

Ive been having a problem with a enhanced armor. When i use this function in game, it buffs me with all the buffs listed but when it gets to enhanced armor, i get a message in my chat window saying, "Skill not availible: Enhanced armor". I didnt have this problem until i got my 3rd class (scout). I dont know what the problem is because i am a P/K when i use it and i can manually use the skill.

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]

Drake1132

Beginner

Posts: 11

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

  • Send private message

1,635

Friday, July 29th 2011, 11:45pm

Quoted from "goldguardian;448905"

Ive been having a problem with a enhanced armor. When i use this function in game, it buffs me with all the buffs listed but when it gets to enhanced armor, i get a message in my chat window saying, "Skill not availible: Enhanced armor". I didnt have this problem until i got my 3rd class (scout). I dont know what the problem is because i am a P/K when i use it and i can manually use the skill.

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]



This sort of message appears when DIYCE thinks that the skill does not exist, or is not trained. Double check to make sure that the devs have not changed or misspelled the skill name (they sometimes change "Shot" into "Shoot" and back again, for example, so it's possible something similar has occurred with Enhanced Armor). Double check the upper vs. lower case, because Lua is case sensitive, and "Enhanced armor", "Enhanced Armor", "enhanced armor", and "enhanced Armor" are all considered to be different things. Double check that the skill is known (i.e. that the current level of your Knight side as secondary is still high enough to know the skill... 12+). Also, if you have made any customizations to your CD() or ReadSkills() functions in DIYCE.lua, it's possible that you did something to interfere with the way DIYCE finds out if a skill is known or not, so if the other checks don't turn up something and you *have* modified either of those functions, come back and post your CD() and ReadSkills() function codes so we can take a look at them and see if there's anything there.
[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.

1,636

Saturday, July 30th 2011, 2:38am

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[FONT=Courier New]function CD(skillname)[/FONT]
[FONT=Courier New]   local firstskill = GetSkillDetail(2,1)[/FONT]
[FONT=Courier New]   if (g_skill[firstskill] == nil) or (g_skill[firstskill].page ~= 2) then[/FONT]
[FONT=Courier New]       ReadSkills()[/FONT]
[FONT=Courier New]   end[/FONT]
 
[FONT=Courier New]   if g_skill[skillname] ~= nil then[/FONT]
[FONT=Courier New]       local tt,cd = GetSkillCooldown(g_skill[skillname].page,g_skill[skillname].slot)[/FONT]
[FONT=Courier New]       return cd==0[/FONT]
[FONT=Courier New]   elseif skillname == nil then[/FONT]
[FONT=Courier New]       return false[/FONT]
[FONT=Courier New]   else[/FONT]
[FONT=Courier New]       Msg("Skill not available: "..skillname)[/FONT]
[FONT=Courier New]       return false[/FONT]
[FONT=Courier New]   end[/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
[FONT=Courier New]function ReadSkills()[/FONT]
[FONT=Courier New]   g_skill = {}[/FONT]
[FONT=Courier New]   local skillname,slot[/FONT]
 
[FONT=Courier New]   Msg("- Reading Class Skills")[/FONT]
[FONT=Courier New]   for page = 1,4 do[/FONT]
[FONT=Courier New]       slot = 1[/FONT]
[FONT=Courier New]       skillname = GetSkillDetail(page,slot)[/FONT]
[FONT=Courier New]       repeat[/FONT]
[FONT=Courier New]           local a1,a2,a3,a4,a5,a6,a7,a8,skillusable = GetSkillDetail(page,slot)[/FONT]
[FONT=Courier New]           if skillusable then[/FONT]
[FONT=Courier New]               g_skill[skillname] = { ['page'] = page, ['slot'] = slot }[/FONT]
[FONT=Courier New]           end[/FONT]
[FONT=Courier New]           slot = slot + 1[/FONT]
[FONT=Courier New]           skillname = GetSkillDetail(page,slot)[/FONT]
[FONT=Courier New]       until skillname == nil[/FONT]
[FONT=Courier New]   end[/FONT]
[FONT=Courier New]end[/FONT]
[FONT=Courier New]ReadSkills() -- Read skills into g_skill table at login[/FONT]


I dont think i have made any changes to them unless I accidently deleted something while adding a new function

ghostwolf82

Professional

Posts: 859

Location: Kalvans Trunk

Occupation: It's dark in here

  • Send private message

1,637

Saturday, July 30th 2011, 3:49am

Did you make sure to check spelling as Drake suggested? Check both the skill name in the skill book (K), and check the name of the buff when you manually cast it upon yourself. Some elite skills change the name of other skills. For a S/K enhanced armor becomes Significantly Enhanced Armor

ghostwolf82

Professional

Posts: 859

Location: Kalvans Trunk

Occupation: It's dark in here

  • Send private message

1,638

Saturday, July 30th 2011, 5:33am

The new, improved, streamlined GhostWolf Method

NOTE: Before attempting anything in the following instructions, you must learn the original DIYCE method first! This is an advanced modification/optimization method with many changes that will not be understood by the novice DIYCE user.

Ok, so I realized I wanted to streamline the DIYCE once again, and below is the results of my efforts to make that happen. There are a few things you will need to pay attention to as you make the changes to move to this method of using the DIYCE. My new method only has on function for every class combo possible in the game. Yes, you read that right: one single function covers all 48 class combos in the game.

I got tired of making new functions for every new toon I decided to make, and wanted a way for the DIYCE to be able to use a "smart" detection method for determining what Class Combo I am currently playing, and then act accordingly. To have the same local variables defined over and over again made for a VERY long list of functions.

First, you will need to know the information contained here. Basically you need to know that your class names to the game engine appear as the following:
Priest = AUGUR, Druid = DRUID, Mage = MAGE, Knight = KNIGHT, Scout = RANGER, Rogue = THIEF, Warden = WARDEN, Warrior = WARRIOR

Yes, the capitalization is important for later and makes a difference. (As Drake has pointed out before, LUA is case sensitive.) You will understand where that list comes into play as you read the following function.

Secondly, class combination specific variables (such as you will see for "Surprise Attack" in the W/M section in the following) will still need to be defined by you in the proper place.

Now, without further ado, here is the new GhostWolf DIYCE methodology:

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
function KillSequence(arg1, healthpot, manapot)
    local Skill = {}
    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 melee = GetActionUsable(13) -- # is your melee range spell slot number
    local phealth = PctH("player")
    local thealth = PctH("target")
    local LockedOn = UnitExists("target")
    local boss = UnitSex("target") > 2
    local party = GetNumPartyMembers() >= 2
    
    --Determine Class-Combo
    mainClass, subClass = UnitClassToken( "player" )
    
    --Silence Logic
    local tSpell,tTime,tElapsed = UnitCastingTime("target")
    local silenceThis = tSpell and silenceList[tSpell] and ((tTime - tElapsed) > 0.1)
    
    --Potion Checks
    healthpot = healthpot or 0
    manapot = manapot or 0
    
    --Equipment and Pet Protection
    if phealth <= .04 then
            SwapEquipmentItem()
        for i=1,3 do
            if (IsPetSummoned(i) == true) then
                ReturnPet(i);
            end
        end        
    end
    
    --Health Potion Use
        i=i+1; Skill[i] = { name = "Action: "..healthpot,            use = (phealth <= .70) }
    
    --Check for level one mobs before doing combat
    if (LockedOn and (UnitLevel("target") < 2)) then
        TargetNearestEnemy()
        return
    end
        
    --Begin Player Skill Sequences
        -- Class: Warrior/Mage
            if mainClass == "WARRIOR" and subClass == "MAGE" then
                local SurpriseAttack = GetActionUsable(14)
    
            --Potions and Buffs
                i=i+1; Skill[i] = { name = "Action: "..manapot,                use = (pctEB2 <= .40) }
                i=i+1; Skill[i] = { name = "Intensification",                use = (pctEB2 >= .05) and (not pbuffs['Intensification']) and boss }
                i=i+1; Skill[i] = { name = "Electric Attack",                use = (pctEB2 >= .05) and (not pbuffs['Electric Attack'] or (pbuffs['Electric Attack'].time <= 45)) }
    
            --Combat
                if enemy then
                    if (not melee) then
                        i=i+1; Skill[i] = { name = "Silence",                    use = (silenceThis) }
                        i=i+1; Skill[i] = { name = "Fireball",                    use = (pctEB2 >= .05)    }
                        i=i+1; Skill[i] = { name = "Thunder Sword",                use = (pctEB2 >= .05)    }
                        i=i+1; Skill[i] = { name = "Lightning",                    use = (pctEB2 >= .05)    }
                            if (not CD("Thunder Sword")) then
                                if (CD("Surprise Attack")) then
                                    i=i+1; Skill[i] = { name = "Surprise Attack",    use = SurpriseAttack }
                                else
                                    i=i+1; Skill[i] = { name = "Attack",            use = (thealth == 1) }
                                end
                            end
                    else
                        i=i+1; Skill[i] = { name = "Silence",                    use = (silenceThis) }
                        i=i+1; Skill[i] = { name = "Electrical Rage",            use = (EnergyBar1 >= 15) and (pctEB2 >=.05) and (not pbuffs['High Voltage III'])    }
                        i=i+1; Skill[i] = { name = "Thunder Sword",                use = (pctEB2 >= .05)    }
                        i=i+1; Skill[i] = { name = "Lightning's Touch",            use = (pctEB2 >= .05)    }
                        i=i+1; Skill[i] = { name = "Attack",                    use = (thealth == 1) }
                    end
                end
    
        --Class: Druid/Mage
            elseif mainClass == "DRUID" and subClass == "MAGE" then
            
            --Potions and buffs
                i=i+1; Skill[i] = { name = "Action: "..manapot,                use = (pctEB1 <= .40) }
                i=i+1; Skill[i] = { name = "Savage Blessing",                use = (pctEB1 >= .05) and ((not pbuffs['Savage Blessing']) or (pbuffs['Savage Blessing'].time <= 45)) }
                i=i+1; Skill[i] = { name = "Concentration Prayer",            use = (pctEB1 >= .05) and ((not pbuffs['Concentration Prayer']) or (pbuffs ['Concentration Prayer'].time <= 45)) }
                i=i+1; Skill[i] = { name = "Intensification",                use = (pctEB1 >= .05) and (not pbuffs['Intensification']) and boss }
    
            --Combat
                if enemy then
                    i=i+1; Skill[i] = { name = "Binding Silence",            use = (silenceThis) }
                    i=i+1; Skill[i] = { name = "Silence",                    use = (silenceThis) }
                    i=i+1; Skill[i] = { name = "Weakening Seed",            use = (pctEB1 >= .05) and boss and ((not tbuffs['Weakening Seed']) or (tbuffs['Weakening Seed'].time < 4)) }
                    i=i+1; Skill[i] = { name = "Mother Nature's Wrath",        use = (pctEB1 >= .05)    }
                    i=i+1; Skill[i] = { name = "Briar Entwinement",            use = (pctEB1 >= .05) and ((not tbuffs['Briar Entwinement']) or (tbuffs['Briar Entwinement'].time < 4)) }
                    i=i+1; Skill[i] = { name = "Lightning",                    use = (pctEB1 >= .05)    }
                    i=i+1; Skill[i] = { name = "Fireball",                    use = (pctEB1 >= .05)    }
                    i=i+1; Skill[i] = { name = "Earth Arrow",                use = (pctEB1 >= .05)    }
                end
                
        --Class: Mage/Warrior
            elseif mainClass == "MAGE" and subClass == "WARRIOR" then
            
            --Potions and buffs
                    i=i+1; Skill[i] = { name = "Action: "..manapot,            use = (pctEB1 <= .40) }
                    i=i+1; Skill[i] = { name = "Intensification",            use = (pctEB1 >= .05) and (not pbuffs['Intensification']) and boss }
                    i=i+1; Skill[i] = { name = "Magical Talent",            use = (EnergyBar2 >= 20) and (not pbuffs['Magical Talent']) }
                    i=i+1; Skill[i] = { name = "Magical Enlightenment",        use = (EnergyBar2 >= 35) and (not pbuffs['Magical Enlightenment']) }
                    i=i+1; Skill[i] = { name = "Elemental Explosion",        use = (EnergyBar2 >= 35) and (not pbuffs['Elemental Explosion']) }
                    i=i+1; Skill[i] = { name = "Activate Mana",                use = (EnergyBar2 <= 90) and (not pbuffs['Magical Talent']) or (not pbuffs['Magical Enlightenment']) or (not pbuffs['Elemental Explosion']) }
                    i=i+1; Skill[i] = { name = "Enraged",                    use = ((EnergyBar2 >= 15) and (EnergyBar2 <= 35)) and (not pbuffs['Magical Talent']) or (not pbuffs['Magical Enlightenment']) or (not pbuffs['Elemental Explosion']) }
            
            --Combat
                if enemy then
                    i=i+1; Skill[i] = { name = "Silence",                    use = (silenceThis) }
                    i=i+1; Skill[i] = { name = "Fireball",                    use = (pctEB1 >= .05)    }
                    i=i+1; Skill[i] = { name = "Lightning",                    use = (pctEB1 >= .05)    }
                end
            
        --Class: Knight/Mage
            elseif mainClass == "KNIGHT" and subClass == "MAGE" then
                local LKBR = GetActionUsable(20) -- # is Lion King Battle Roar spell slot number

            --Potions and buffs
                    i=i+1; Skill[i] = { name = "Action: "..manapot,            use = (pctEB1 <= .40) }
                    i=i+1; Skill[i] = { name = "Enhanced Armor",            use = (pctEB1 >= .05) and ((not pbuffs['Enhanced Armor']) or (pbuffs['Enhanced Armor'].time <= 45)) }
                    i=i+1; Skill[i] = { name = "Holy Seal",                    use = (pctEB1 >= .05) and ((not pbuffs['Holy Seal']) or (pbuffs['Holy Seal'].time <= 45)) }
                    i=i+1; Skill[i] = { name = "Lightning Armor",            use = (pctEB1 >= .05) and ((not pbuffs['Lightning Armor']) or (pbuffs['Lightning Armor'].time <= 45)) }

            --Mana Shield
                    if IsShiftKeyDown() and (pbuffs['Mana Shield']) then
                        CancelBuff("Mana Shield")
                    end
                    i=i+1; Skill[i] = { name = "Mana Shield",                use = (pctEB1 <= .25) }

            --Combat
                if enemy then
                    i=i+1; Skill[i] = { name = "Silence",                    use = (silenceThis) }
                    i=i+1; Skill[i] = { name = "Resolution",                use = party and boss }
                    i=i+1; Skill[i] = {    name = "Shield of Discipline",        use = party and boss }
                    i=i+1; Skill[i] = { name = "Intensification",            use = party and boss }
                    i=i+1; Skill[i] = { name = "Shield of Valor",            use = party and boss }
                    i=i+1; Skill[i] = { name = "Hatred Strike",                use = (pctEB1 >= .05) and party and boss }
                    i=i+1; Skill[i] = { name = "Threaten",                    use = (pctEB1 >= .05) and party and boss and (tbuffs['Holy Seals 3']) }
                    i=i+1; Skill[i] = { name = "Action: 20",                use = (pctEB1 >= .07) and LKBR and party and boss }
                    i=i+1; Skill[i] = { name = "Custom: Holy Light Domain",    use = (pctEB1 >= .05) and (not tbuffs['Holy Illumination']) and ((tbuffs['Light Seal I']) or (tbuffs['Light Seal II']) or (tbuffs['Light Seal III'])) and (g_lastaction ~= "Holy Light Domain") }
                    i=i+1; Skill[i] = { name = "Mana Return",                use = (pctEB1 <= .80) and (tbuffs['Holy Seals 3']) }
                    i=i+1; Skill[i] = { name = "Whirlwind Shield",            use = (pctEB1 >= .05) and (tbuffs['Holy Illumination']) }
                    i=i+1; Skill[i] = { name = "Custom: Holy Strike",        use = (pctEB1 >= .05) and (not tbuffs['Light Seal III']) }
                    i=i+1; Skill[i] = { name = "Disarmament",                use = (pctEB1 >= .05) and (not tbuffs['Disarmament IV']) and (tbuffs['Holy Illumination']) and party and boss }
                    i=i+1; Skill[i] = { name = "Custom: Holy Strike",        use = (pctEB1 >= .05) }
                    i=i+1; Skill[i] = { name = "Attack",                    use = (thealth == 1) }
                end
        --Class: Mage/Druid
            elseif mainClass == "MAGE" and subClass == "DRUID" then

            --Potions and buffs
                i=i+1; Skill[i] = { name = "Action: "..manapot,                use = (pctEB1 <= .40) }
                i=i+1; Skill[i] = { name = "Intensification",                use = (pctEB1 >= .05) and (not pbuffs['Intensification']) and boss }
                i=i+1; Skill[i] = { name = "Savage Blessing",                use = (pctEB1 >= .05) and ((not pbuffs['Savage Blessing']) or (pbuffs['Savage Blessing'].time <= 45)) }
                i=i+1; Skill[i] = { name = "Perception",                    use = (pctEB1 >= .05) and ((not pbuffs['Perception']) or (pbuffs['Perception'].time <= 45)) }
                i=i+1; Skill[i] = { name = "Magic Target",                    use = (pctEB1 >= .05) and ((not pbuffs['Magic Target']) or (pbuffs['Magic Target'].time <= 45)) }

            --Combat
                if enemy then
                    i=i+1; Skill[i] = { name = "Silence",                    use = (silenceThis) }
                    i=i+1; Skill[i] = { name = "Fireball",                    use = (pctEB1 >= .05)    }
                    i=i+1; Skill[i] = { name = "Magma Blade",                use = (pctEB1 >= .05)    }
                    i=i+1; Skill[i] = { name = "Lightning",                    use = (pctEB1 >= .05)    }
                end
            end
    --End Player Skill Sequences
    
        --Interact with NPC.
        i=i+1; Skill[i] = { name = "Attack",                        use = (not combat and not enemy) }
    
        MyCombat(Skill,arg1)
        
    --Select Next Enemy
    if (tDead) then
        TargetUnit("")
        return
    end
    if (not LockedOn) or (not enemy) then
        TargetNearestEnemy()
        return
    end
end
I hope this helps many of you slim down your functions list, and speeds up your processing of skills as you go killing baddies in the world of RoM.

Continued success to you all,
GhostWolf :cool:

Edit: Take a look at the information Peryl gives here:
Basically, you need to also make this change to your BuffList function

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
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 = buffcmd(tgt, i)
        local timeRemaining = infocmd(tgt,i)
        if buff then
            list[buff:gsub('(%()(.)(%))', '%2')] = { stack = stackSize, time = timeRemaining }
        else
            break
        end
    end

    return list
end
With these changes, you can delete the following two functions from the DIYCE.lua:
BuffTimeLeft
ChkBuff

For clarification, here is the full DIYCE.lua as it should now appear (if you are using vanilla DICYE without any of Drakes or Peryls "new method" upgrades (those are further changes to DIYCE to be done following the instructions they have laid out - I will not go into detail since they have already done that previously)):

Source code

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

local g_skill  = {}
local g_lastaction = ""

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

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

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

    Msg("- DIYCE Reading Class Skills")
    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
ReadSkills() -- Read skills into g_skill table at login

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 = buffcmd(tgt, i)
        local timeRemaining = infocmd(tgt,i)
        if buff then
            list[buff:gsub('(%()(.)(%))', '%2')] = { stack = stackSize, time = timeRemaining }
        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)
        return false
    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
        if Skill[x].use then
            if string.find(Skill[x].name, "Action:") then
                action = tonumber((string.gsub(Skill[x].name, "(Action:)( *)(%d+)(.*)", "%3")))
                _1,actioncd = GetActionCooldown(action)
                actiondef,_1,actioncnt = GetActionInfo(action)
                if GetActionUsable(action) and (actioncd == 0) and (actiondef ~= nil) and (actioncnt > 0) then
                    if talktome then Msg("- "..Skill[x].name) end
                    UseAction(action)
                    return true
                end
            elseif string.find(Skill[x].name, "Custom:") then
                action = string.gsub(Skill[x].name, "(Custom:)( *)(.*)", "%3")
                if CustomAction(action) then
                    return true
                end
            elseif string.find(Skill[x].name, "Item:") then
                action = string.gsub(Skill[x].name, "(Item:)( *)(.*)", "%3")
                if talktome then Msg("- "..Skill[x].name) end
                UseItemByName(action)
                return true
            elseif CD(Skill[x].name) then
                if talktome then Msg("- "..Skill[x].name) end
                CastSpellByName(Skill[x].name)
                return true
            end
        end
    end
    if (arg1 == "v2") then Msg("- [IDLE]", 0, 1, 1) end

    return false
end

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

-->>  Custom Function Below This Line  <<--

function KillSequence(arg1, healthpot, manapot)
    local Skill = {}
    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 melee = GetActionUsable(13) -- # is your melee range spell slot number
    local phealth = PctH("player")
    local thealth = PctH("target")
    local LockedOn = UnitExists("target")
    local boss = UnitSex("target") > 2
    local elite = UnitSex("target") == 2
    local party = GetNumPartyMembers() >= 2
    
    --Determine Class-Combo
    mainClass, subClass = UnitClassToken( "player" )
    
    --Silence Logic
    local tSpell,tTime,tElapsed = UnitCastingTime("target")
    local silenceThis = tSpell and silenceList[tSpell] and ((tTime - tElapsed) > 0.1)
    
    --Potion Checks
    healthpot = healthpot or 0
    manapot = manapot or 0
    
    --Equipment and Pet Protection
    if phealth <= .04 then
            SwapEquipmentItem()
        for i=1,3 do
            if (IsPetSummoned(i) == true) then
                ReturnPet(i);
            end
        end        
    end
    
    --Health Potion Use
        i=i+1; Skill[i] = { name = "Action: "..healthpot,            use = (phealth <= .70) }
    
    --Check for level one mobs before doing combat
    if (LockedOn and (UnitLevel("target") < 2)) then
        TargetNearestEnemy()
        return
    end
    
    --If target is dead, drop target
    if (tDead) then
        TargetUnit("")
    return
    end
        
    --Begin Player Skill Sequences
        -- Class: Warrior/Mage
            if mainClass == "WARRIOR" and subClass == "MAGE" then
                local SurpriseAttack = GetActionUsable(14)
    
            --Potions and Buffs
                i=i+1; Skill[i] = { name = "Survival Instinct",                use = (phealth <= .30) }
                i=i+1; Skill[i] = { name = "Sense of Danger",                use = (phealth <= .30) }
                i=i+1; Skill[i] = { name = "Action: "..manapot,                use = (pctEB2 <= .40) }
                i=i+1; Skill[i] = { name = "Intensification",                use = (pctEB2 >= .05) and (not pbuffs['Intensification']) and boss }
                i=i+1; Skill[i] = { name = "Aggresiveness",                    use = boss }
                i=i+1; Skill[i] = { name = "Electric Attack",                use = (pctEB2 >= .05) and ((not pbuffs['Electric Attack']) or (pbuffs['Electric Attack'].time <= 45)) }
    
            --Combat
                if enemy then
                    i=i+1; Skill[i] = { name = "Silence",                    use = (silenceThis) }
                    i=i+1; Skill[i] = { name = "Surprise Attack",            use = SurpriseAttack }
                    i=i+1; Skill[i] = { name = "Attack",                    use = (thealth == 1) }
                    i=i+1; Skill[i] = { name = "Enraged",                    use = (EnergyBar1 <= 30) and (boss or elite) }
                    i=i+1; Skill[i] = { name = "Electrical Rage",            use = (EnergyBar1 >= 15) and (pctEB2 >=.05) and ((not pbuffs['High Voltage III']) or (pbuffs['High Voltage III'].time <= 2)) }
                    i=i+1; Skill[i] = { name = "Thunder Sword",                use = (pctEB2 >= .05) }
                    i=i+1; Skill[i] = { name = "Fireball",                    use = (pctEB2 >= .05) }
                    i=i+1; Skill[i] = { name = "Lightning's Touch",            use = (pctEB2 >= .05) }
                end
    
        --Class: Druid/Mage
            elseif mainClass == "DRUID" and subClass == "MAGE" then
            
            --Potions and buffs
                i=i+1; Skill[i] = { name = "Action: "..manapot,                use = (pctEB1 <= .40) }
                i=i+1; Skill[i] = { name = "Savage Blessing",                use = (pctEB1 >= .05) and ((not pbuffs['Savage Blessing']) or (pbuffs['Savage Blessing'].time <= 45)) }
                i=i+1; Skill[i] = { name = "Concentration Prayer",            use = (pctEB1 >= .05) and ((not pbuffs['Concentration Prayer']) or (pbuffs ['Concentration Prayer'].time <= 45)) }
                i=i+1; Skill[i] = { name = "Intensification",                use = (pctEB1 >= .05) and (not pbuffs['Intensification']) and boss }
    
            --Combat
                if enemy then
                    i=i+1; Skill[i] = { name = "Binding Silence",            use = (silenceThis) }
                    i=i+1; Skill[i] = { name = "Silence",                    use = (silenceThis) }
                    i=i+1; Skill[i] = { name = "Weakening Seed",            use = (pctEB1 >= .05) and boss and ((not tbuffs['Weakening Seed']) or (tbuffs['Weakening Seed'].time < 4)) }
                    i=i+1; Skill[i] = { name = "Mother Nature's Wrath",        use = (pctEB1 >= .05)    }
                    i=i+1; Skill[i] = { name = "Briar Entwinement",            use = (pctEB1 >= .05) and ((not tbuffs['Briar Entwinement']) or (tbuffs['Briar Entwinement'].time < 4)) }
                    i=i+1; Skill[i] = { name = "Lightning",                    use = (pctEB1 >= .05)    }
                    i=i+1; Skill[i] = { name = "Fireball",                    use = (pctEB1 >= .05)    }
                    i=i+1; Skill[i] = { name = "Earth Arrow",                use = (pctEB1 >= .05)    }
                end
                
        --Class: Mage/Warrior
            elseif mainClass == "MAGE" and subClass == "WARRIOR" then
            
            --Potions and buffs
                    i=i+1; Skill[i] = { name = "Action: "..manapot,            use = (pctEB1 <= .40) }
                    i=i+1; Skill[i] = { name = "Intensification",            use = (pctEB1 >= .05) and (not pbuffs['Intensification']) and boss }
                    i=i+1; Skill[i] = { name = "Magical Talent",            use = (EnergyBar2 >= 20) and (not pbuffs['Magical Talent']) }
                    i=i+1; Skill[i] = { name = "Magical Enlightenment",        use = (EnergyBar2 >= 35) and (not pbuffs['Magical Enlightenment']) }
                    i=i+1; Skill[i] = { name = "Elemental Explosion",        use = (EnergyBar2 >= 35) and (not pbuffs['Elemental Explosion']) }
                    i=i+1; Skill[i] = { name = "Activate Mana",                use = (EnergyBar2 <= 90) and ((not pbuffs['Magical Talent']) or (not pbuffs['Magical Enlightenment']) or (not pbuffs['Elemental Explosion'])) }
                    i=i+1; Skill[i] = { name = "Enraged",                    use = ((EnergyBar2 >= 15) and (EnergyBar2 <= 35)) and ((not pbuffs['Magical Talent']) or (not pbuffs['Magical Enlightenment']) or (not pbuffs['Elemental Explosion'])) }
            
            --Combat
                if enemy then
                    i=i+1; Skill[i] = { name = "Silence",                    use = (silenceThis) }
                    i=i+1; Skill[i] = { name = "Fireball",                    use = (pctEB1 >= .05)    }
                    i=i+1; Skill[i] = { name = "Lightning",                    use = (pctEB1 >= .05)    }
                end
            
        --Class: Knight/Mage
            elseif mainClass == "KNIGHT" and subClass == "MAGE" then
                local LKBR = GetActionUsable(20) -- # is Lion King Battle Roar spell slot number

            --Potions and buffs
                    i=i+1; Skill[i] = { name = "Action: "..manapot,            use = (pctEB1 <= .40) }
                    i=i+1; Skill[i] = { name = "Enhanced Armor",            use = (pctEB1 >= .05) and ((not pbuffs['Enhanced Armor']) or (pbuffs['Enhanced Armor'].time <= 45)) }
                    i=i+1; Skill[i] = { name = "Holy Seal",                    use = (pctEB1 >= .05) and ((not pbuffs['Holy Seal']) or (pbuffs['Holy Seal'].time <= 45)) }
                    i=i+1; Skill[i] = { name = "Lightning Armor",            use = (pctEB1 >= .05) and ((not pbuffs['Lightning Armor']) or (pbuffs['Lightning Armor'].time <= 45)) }

            --Mana Shield
                    if IsShiftKeyDown() and (pbuffs['Mana Shield']) then
                        CancelBuff("Mana Shield")
                    end
                    i=i+1; Skill[i] = { name = "Mana Shield",                use = (pctEB1 <= .25) }

            --Combat
                if enemy then
                    i=i+1; Skill[i] = { name = "Silence",                    use = (silenceThis) }
                    i=i+1; Skill[i] = { name = "Resolution",                use = party and boss }
                    i=i+1; Skill[i] = {    name = "Shield of Discipline",        use = party and boss }
                    i=i+1; Skill[i] = { name = "Intensification",            use = party and boss }
                    i=i+1; Skill[i] = { name = "Shield of Valor",            use = party and boss }
                    i=i+1; Skill[i] = { name = "Hatred Strike",                use = (pctEB1 >= .05) and party and boss }
                    i=i+1; Skill[i] = { name = "Threaten",                    use = (pctEB1 >= .05) and party and boss and (tbuffs['Holy Seals 3']) }
                    i=i+1; Skill[i] = { name = "Action: 20",                use = (pctEB1 >= .07) and LKBR and party and boss }
                    i=i+1; Skill[i] = { name = "Custom: Holy Light Domain",    use = (pctEB1 >= .05) and (not tbuffs['Holy Illumination']) and ((tbuffs['Light Seal I']) or (tbuffs['Light Seal II']) or (tbuffs['Light Seal III'])) and (g_lastaction ~= "Holy Light Domain") }
                    i=i+1; Skill[i] = { name = "Mana Return",                use = (pctEB1 <= .80) and (tbuffs['Holy Seals 3']) }
                    i=i+1; Skill[i] = { name = "Whirlwind Shield",            use = (pctEB1 >= .05) and (tbuffs['Holy Illumination']) }
                    i=i+1; Skill[i] = { name = "Custom: Holy Strike",        use = (pctEB1 >= .05) and (not tbuffs['Light Seal III']) }
                    i=i+1; Skill[i] = { name = "Disarmament",                use = (pctEB1 >= .05) and (not tbuffs['Disarmament IV']) and (tbuffs['Holy Illumination']) and party and boss }
                    i=i+1; Skill[i] = { name = "Custom: Holy Strike",        use = (pctEB1 >= .05) }
                    i=i+1; Skill[i] = { name = "Attack",                    use = (thealth == 1) }
                end
        --Class: Mage/Druid
            elseif mainClass == "MAGE" and subClass == "DRUID" then

            --Potions and buffs
                i=i+1; Skill[i] = { name = "Action: "..manapot,                use = (pctEB1 <= .40) }
                i=i+1; Skill[i] = { name = "Intensification",                use = (pctEB1 >= .05) and (not pbuffs['Intensification']) and boss }
                i=i+1; Skill[i] = { name = "Savage Blessing",                use = (pctEB1 >= .05) and ((not pbuffs['Savage Blessing']) or (pbuffs['Savage Blessing'].time <= 45)) }
                i=i+1; Skill[i] = { name = "Perception",                    use = (pctEB1 >= .05) and ((not pbuffs['Perception']) or (pbuffs['Perception'].time <= 45)) }
                i=i+1; Skill[i] = { name = "Magic Target",                    use = (pctEB1 >= .05) and ((not pbuffs['Magic Target']) or (pbuffs['Magic Target'].time <= 45)) }

            --Combat
                if enemy then
                    i=i+1; Skill[i] = { name = "Silence",                    use = (silenceThis) }
                    i=i+1; Skill[i] = { name = "Fireball",                    use = (pctEB1 >= .05)    }
                    i=i+1; Skill[i] = { name = "Magma Blade",                use = (pctEB1 >= .05)    }
                    i=i+1; Skill[i] = { name = "Lightning",                    use = (pctEB1 >= .05)    }
                end
            end
    --End Player Skill Sequences
    
        --Interact with NPC.
        i=i+1; Skill[i] = { name = "Attack",                        use = (not combat and not enemy) }
    
        MyCombat(Skill,arg1)
        
    --Select Next Enemy
    if (not LockedOn) or (not enemy) then
        TargetNearestEnemy()
        return
    end
end

Drake1132

Beginner

Posts: 11

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

  • Send private message

1,639

Saturday, July 30th 2011, 10:07am

Quoted from "goldguardian;448997"

I dont think i have made any changes to them unless I accidently deleted something while adding a new function



You definitely didn't change anything with the CD and ReadSkills functions. So the only thing I can think of is the spelling and case sensitivity issues I mentioned before. I don't see any other reason why it wouldn't work.
[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.

1,640

Saturday, July 30th 2011, 8:32pm

Quoted from "Drake1132;449076"

You definitely didn't change anything with the CD and ReadSkills functions. So the only thing I can think of is the spelling and case sensitivity issues I mentioned before. I don't see any other reason why it wouldn't work.


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.