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.

441

Wednesday, May 12th 2010, 3:18pm

I'd double check the name of the buff. Mouseover the icon for it and read the tooltip, maybe it's 'Tea-Scented Waffle', or 'Exquisite Tea-Scented Waffle'? Do note that the names are case sensitive.

442

Wednesday, May 12th 2010, 5:36pm

Quoted from "QthePhysicist;272302"

when i fire the actions off, they all seem to work fine, i.e., they recognize that i have the buff on already and don't recast it, except for "Tea-scented Waffle" which continues to fire and is not recognizing that i already have that buff. could there be something wrong with the name of the buff, "Tea-scented Waffle"?


In addition to what delve posted, if you want the exact name that BuffList retrieves, run this command (either from your chat box or a macro):

Source code

1
/run Msg(BuffList("player"))
Also, I found a problem with the logic in your code. On spells that you cast on others (like Regenerate), you're checking your own health, not the target's health.

This revised version of your function should fix that:

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
function General(arg1,arg2)
   local Skill = {}
   local i = 0
   local mana = PctM("player")
   local health = PctH("player")
   local thealth = PctH("target")
   local friendly = (not UnitCanAttack("player","target"))
   local shield = (GetEquipSlotInfo(17) ~= nil)
   local tspell,ttime,telapsed = UnitCastingTime("target")
   local combat = GetPlayerCombatState()
   local bigparty = (GetNumPartyMembers() > 2)
   local pbuffs = BuffList("player")
   local tbuffs = BuffList("target")

   i=i+1; Skill[i] = { name = "Hall of Dead Heroes",         use = (health <= .10) }
   i=i+1; Skill[i] = { name = "Magic Barrier",               use = ((not combat) and (not string.find(pbuffs,"Magic Barrier"))) }
   i=i+1; Skill[i] = { name = "Blessed Spring Water",        use = ((not combat) and (not string.find(pbuffs,"Blessed Spring Water"))) }
   i=i+1; Skill[i] = { name = "Action: 20 (Mana Pot)" ,      use = (mana < .40) }
   i=i+1; Skill[i] = { name = "Action: 61 (Banquet)",        use = ((health < .99) and (not string.find(pbuffs,"Dragon's Banquet"))) }
   i=i+1; Skill[i] = { name = "Action: 62 (Tea Waffle)",     use = ((health < .99) and (not string.find(pbuffs,"Tea-scented Waffle"))) }
   i=i+1; Skill[i] = { name = "Action: 63 (Holy Power)",     use = ((health < .99) and (not string.find(pbuffs,"Potion of Holy Power"))) }
   i=i+1; Skill[i] = { name = "Action: 64 (Mana Source)",    use = ((health < .99) and (not string.find(pbuffs,"Mana Source"))) }
   i=i+1; Skill[i] = { name = "Action: 65 (Life Source)",    use = ((health < .99) and (not string.find(pbuffs,"Life Source"))) }
   i=i+1; Skill[i] = { name = "Action: 66 (Crystal Sugar)",  use = ((health < .99) and (not string.find(pbuffs,"Crystal Sugar"))) }
   i=i+1; Skill[i] = { name = "Action: 67 (Fruit Pie)",      use = ((health < .99) and (not string.find(pbuffs,"Exotic Fruit Pie"))) }
   i=i+1; Skill[i] = { name = "Action: 68 (Stim)",           use = ((health < .99) and (not string.find(pbuffs,"Stimulant"))) }
   i=i+1; Skill[i] = { name = "Action: 69 (Scent)",          use = ((health < .99) and (not string.find(pbuffs,"Stimulating Scent"))) }
   i=i+1; Skill[i] = { name = "Shock",                       use = ((not friendly) and (ttime >= 1) and (ttime - telapsed > 0.5)) }
-- i=i+1; Skill[i] = { name = "Charge",                      use = ((not friendly) and (ttime >= 1) and (ttime - telapsed > 0.5)) }
   i=i+1; Skill[i] = { name = "Enhanced Armor",              use = (not string.find(pbuffs,"Enhanced Armor")) }
   i=i+1; Skill[i] = { name = "Holy Seal",                   use = (not string.find(pbuffs,"Holy Seal")) } 
   i=i+1; Skill[i] = { name = "Charge",                      use = ((not friendly) and (not string.find(tbuffs,"Charge"))) }
   i=i+1; Skill[i] = { name = "Holy Aura",                   use = (health <= .25) }
   i=i+1; Skill[i] = { name = "Holy Shield",                 use = (health <= .33) }
   i=i+1; Skill[i] = { name = "Resolution",                  use = (health <= .40) }
   i=i+1; Skill[i] = { name = "Urgent Heal",                 use = ((not friendly) and (health <= .50)) }
   i=i+1; Skill[i] = { name = "Urgent Heal",                 use = (friendly and (thealth <= .50)) }
   i=i+1; Skill[i] = { name = "Regenerate",                  use = ((not friendly) and (health <= .95) and (not string.find(pbuffs,"Regenerate"))) }
   i=i+1; Skill[i] = { name = "Regenerate",                  use = (friendly and (thealth <= .95) and (not string.find(tbuffs,"Regenerate"))) }
   i=i+1; Skill[i] = { name = "Holy Smite",                  use = ((not friendly) and (not bigparty) and string.find(tbuffs,"Holy Light's Fury")) }
   i=i+1; Skill[i] = { name = "Holy Light's Fury",           use = ((not friendly) and (not bigparty) and (not string.find(tbuffs,"Holy Light's Fury"))) }
   i=i+1; Skill[i] = { name = "Shield of Atonement",         use = ((not friendly) and shield) }
   i=i+1; Skill[i] = { name = "Shield of Valor",             use = ((not friendly) and shield) }
   i=i+1; Skill[i] = { name = "Whirlwind Shield",            use = ((not friendly) and shield) }
   i=i+1; Skill[i] = { name = "Threaten",                    use = (string.find(tbuffs,"Holy Seals 3") and (not string.find(pbuffs,"Threaten")) and (arg2 == "threaten")) }
   i=i+1; Skill[i] = { name = "Mana Return",                 use = (string.find(tbuffs,"Holy Seals 3")) }
-- i=i+1; Skill[i] = { name = "Disarmament",                 use = ((not friendly) and (not bigparty) and (not string.find(tbuffs,"Disarmament IV"))) }   
   i=i+1; Skill[i] = { name = "Shock",                       use = ((not friendly) and string.find(tbuffs,"Light Seal III") and (arg2 == "shock")) }
   i=i+1; Skill[i] = { name = "Punishment",                  use = ((not friendly) and string.find(tbuffs,"Light Seal III")) }
   i=i+1; Skill[i] = { name = "Holy Strike",                 use = (not friendly) }

   MyCombat(Skill,arg1)
end

443

Wednesday, May 12th 2010, 5:57pm

Quoted from "Calico;272290"

List me the skills you want on it, and I'll give it a shot.

Here's the shitty attempt I had, piecing together lines from a bunch of functions. It doesn't work, but it'll give you an idea of what I was trying to do maybe?

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 ScoutWarrior(arg1)
   local Skill = {}
   local i = 0
   local friendly = (not UnitCanAttack("player","target"))
   local rage = UnitMana("player")
   local focus = UnitSkill("player")
   local tbuffs = BuffList("target")
   local tspell = UnitCastingTime("target")

   
   i=i+1; Skill[i] = { ['name'] = "Frost Arrow",       ['use'] = (not ChkBuff("player","Frost Arrow")) }
   i=i+1; Skill[i] = { ['name'] = "Battle Instinct",   ['use'] = (not ChkBuff("player","Battle Instinct") and (rage >= 30 ) }
   i=i+1; Skill[i] = { ['name'] = "Berserk",           ['use'] = (not ChkBuff("player","Berserk") and (rage >= 25 ) }
   i=i+1; Skill[i] = { ['name'] = "Throat Attack",     ['use'] = ((not friendly) and (tspell ~= nil)) }
   i=i+1; Skill[i] = { ['name'] = "Enraged",           ['use'] = (rage <= 50) }
   i=i+1; Skill[i] = { ['name'] = "Combo Shot",        ['use'] = (not friendly) }
   i=i+1; Skill[i] = { ['name'] = "Vampire Arrows",    ['use'] = ((not friendly) and (focus >= 20)) }
   i=i+1; Skill[i] = { ['name'] = "Shot",              ['use'] = (not friendly) }
   i=i+1; Skill[i] = { ['name'] = "Wind Arrows",       ['use'] = ((not friendly) and (focus >= 15)) }
   i=i+1; Skill[i] = { ['name'] = "Slash",             ['use'] = ((not friendly) and (rage >= 25)) }

   MyCombat(Skill,arg1)
end


Thanks again for correcting my idiocracy.

444

Wednesday, May 12th 2010, 6:12pm

Quoted from "Mousekawitz;272276"

Haha, tried patching one together, ended up breaking it so bad it won't even read my class skills anymore, hahaa. Have to clear it out and redo it all.. Found a good warrior/scout function on page 4, still need s/w, which is mainly using berserk and the elites.


Try this one:

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
function ScoutWarrior(arg1, arg2)
    local Skill = {}
    local i = 0
    local focus = UnitMana("player")
    local rage = UnitSkill("player")
    local friendly = (not UnitCanAttack("player", "target"))
    local pbuffs = BuffList("player")

    i=i+1; Skill[i] = { name = "Enraged",            use = (rage <= 80) }
    i=i+1; Skill[i] = { name = "Berserk",            use = ((not string.find(pbuffs, "Berserk")) and (rage >= 25)) }
    i=i+1; Skill[i] = { name = "Mental Focus",       use = ((not string.find(pbuffs, "Mental Focus")) and (rage >= 30)) }
    i=i+1; Skill[i] = { name = "Battle Instinct",    use = ((not string.find(pbuffs, "Battle Instinct")) and (rage >= 30)) }
    i=i+1; Skill[i] = { name = "Target Lock",        use = ((not string.find(pbuffs, "Target Lock")) and (focus >= 30)) }
    i=i+1; Skill[i] = { name = "Combo Shot",         use = (not friendly) }
    i=i+1; Skill[i] = { name = "Shot",               use = (not friendly) }
    i=i+1; Skill[i] = { name = "Piercing Arrow",     use = ((not friendly) and (arg2 ~= "noPA")) }
--  i=i+1; Skill[i] = { name = "Vampire Arrows",     use = ((not friendly) and (focus >= 20)) }
    i=i+1; Skill[i] = { name = "Sapping Arrow",      use = (not friendly) }
    i=i+1; Skill[i] = { name = "Wind Arrows",        use = ((not friendly) and (focus >= 15)) }
    i=i+1; Skill[i] = { name = "Frost Arrow",        use = ((not string.find(pbuffs, "Frost Arrow")) and (focus >= 50)) }
    i=i+1; Skill[i] = { name = "Snipe",              use = (not friendly) }

    return MyCombat(Skill, arg1)
end
I wasn't sure what sort of priority you put on the elites so I guessed. If you want to rearrange the order, just cut+paste the entire line wherever you like it. I commented out Vampire Arrows (because I hate the skill personally) so you can remove the "--" in front of that line if you want to use it. I also didn't include some of the Scout skills that people usually like to do manually (like Concentration, Target Area, Blood Arrow, etc).

I left Piercing Arrow in there (just remove it if you don't use it), but I added a trigger to turn it off...

If you want to use PA, use this macro:

Source code

1
/run ScoutWarrior()
If you don't want to use PA for certain fights, use this macro:

Source code

1
/run ScoutWarrior("", "noPA")

445

Wednesday, May 12th 2010, 6:20pm

Quoted from "Mousekawitz;272449"

Here's the shitty attempt I had, piecing together lines from a bunch of functions. It doesn't work, but it'll give you an idea of what I was trying to do maybe?


You have the definition for focus and rage reversed and are missing a couple of parentheses.

Here's those fixes plus a couple of tweaks:

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 ScoutWarrior(arg1)
   local Skill = {}
   local i = 0
   local friendly = (not UnitCanAttack("player", "target"))
   local rage = UnitSkill("player")
   local focus = UnitMana("player")
   local tspell,ttime,telapsed = UnitCastingTime("target")
   local pbuffs = BuffList("player")
   local tbuffs = BuffList("target")
   
   i=i+1; Skill[i] = { ['name'] = "Frost Arrow",       ['use'] = (not string.find(pbuffs, "Frost Arrow")) }
   i=i+1; Skill[i] = { ['name'] = "Battle Instinct",   ['use'] = ((not string.find(pbuffs, "Battle Instinct")) and (rage >= 30 )) }
   i=i+1; Skill[i] = { ['name'] = "Berserk",           ['use'] = ((not string.find(pbuffs, "Berserk")) and (rage >= 25 )) }
   i=i+1; Skill[i] = { ['name'] = "Throat Attack",     ['use'] = ((not friendly) and (tspell ~= nil) and (ttime >= 1) and ((ttime - telapsed) > 0.5)) }
   i=i+1; Skill[i] = { ['name'] = "Enraged",           ['use'] = (rage <= 50) }
   i=i+1; Skill[i] = { ['name'] = "Combo Shot",        ['use'] = (not friendly) }
   i=i+1; Skill[i] = { ['name'] = "Vampire Arrows",    ['use'] = ((not friendly) and (focus >= 20)) }
   i=i+1; Skill[i] = { ['name'] = "Shot",              ['use'] = (not friendly) }
   i=i+1; Skill[i] = { ['name'] = "Wind Arrows",       ['use'] = ((not friendly) and (focus >= 15)) }
   i=i+1; Skill[i] = { ['name'] = "Slash",             ['use'] = ((not friendly) and (rage >= 25)) }

   MyCombat(Skill,arg1)
end
Be aware that Throat Attack and Slash won't work if you're not in melee range. It will try to use them and you'll just get errors. You might want to use "Action:" definitions for them as that will check to make sure the skill is usable first.

446

Wednesday, May 12th 2010, 6:27pm

So they'll only go off if usable, not run to the target as if I used that attack normally? That's perfect and better than what I had hoped :D

I figured it was the rage/focus thing that was throwing me off, but when my old s/k macros would work (what skills I had) I was lost.

Thanks for the help though, very quick reply. :)

447

Wednesday, May 12th 2010, 8:00pm

Quoted from "Mousekawitz;272475"

So they'll only go off if usable, not run to the target as if I used that attack normally? That's perfect and better than what I had hoped :D


Correct. With the "Action:" definitions I'm using a function (GetActionUsable) that checks to make sure the skill isn't on cooldown and that you're in range. Using the regular method of specifying the skill names, I can only do a cooldown check, not a range check.

448

Thursday, May 13th 2010, 3:15am

Is there a way to check if I have a one handed equipped or two handed? I'm currently using two macros for my w/k depending on which weapons I'm using. It would be nice if I could just use one macro that "knows" which weapon I'm using and adjusts accordingly.
Also, Slash and Shadow Stab have the same dot name, "Bleed". Is there a way to work around this? Tactical will trigger from a rogues "Bleed" but it obviously wont hit twice as it does with the warrior "Bleed". I think they recently changed this because it was working properly for a while, but now it isn't.

449

Thursday, May 13th 2010, 4:27am

This is what i'm trying to achieve with the script (I'm very new and pants at this so be nice!)

1) Summon spirit of the Oak only if Heart of the Oak buff is not active
2) Cast Heart of the Oak only if Heart of the Oak buff is not active
then the tricky bit
3) Cast Submission only if no pet is summoned
4) Cast Summon Chiron the Centaur only if no pet is summoned

Here is what I have so far. It must be completely wrong as dont even get the message 'Checking Skills' when I log in.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
function WardenScout(arg1)
     local Skill = {}
     local i = 0
     local tgt = "player"
     local friendly = false
 
     i=i+1; Skill[i] = { ['name'] = "Summon Spirit of the Oak",                ['use'] = ((not ChkBuff("player", "Heart of the Oak") and (not combat)) }
     i=i+1; Skill[i] = { ['name'] = "Heart of the Oak",             ['use'] = (not ChkNuff("palyer", "Heart of the Oak)) }
     i=i+1; Skill[i] = { ['name'] = "Submission",                ['use'] = ((not pet)) }
     i=i+1; Skill[i] = { ['name'] = "Chiron the Centaur",                ['use'] = ((not pet)) }
 
     MyCombat(Skill, arg1)
end


Also can I save more than 1 function in the Lua file? eg. WardenScout and ScoutWarden in same file?

450

Thursday, May 13th 2010, 4:32am

Quoted from "itsishy;272645"

Is there a way to check if I have a one handed equipped or two handed? I'm currently using two macros for my w/k depending on which weapons I'm using. It would be nice if I could just use one macro that "knows" which weapon I'm using and adjusts accordingly.
Also, Slash and Shadow Stab have the same dot name, "Bleed". Is there a way to work around this? Tactical will trigger from a rogues "Bleed" but it obviously wont hit twice as it does with the warrior "Bleed". I think they recently changed this because it was working properly for a while, but now it isn't.


Take a look at post 127 in this thread (quick link http://forum.us.runesofmagic.com/showpos…2&postcount=127)

You may be able to work his changes into your script. I feel like there should be a better way to determine the weapon type in the mainhand, but what he's got there seems to do the trick for him.

Edit: he's swapping based on axe/dagger, but the concept is the same. One possibility to test is to simply check for a name in the shield slot and assume 2handed if it's empty (assuming you put a shield there anyway).

451

Thursday, May 13th 2010, 10:12am

That was everything I needed, thanks a ton. I managed to find a simple way to check if I have a shield on and to use the correct skills via macro(32 is Feint):

Source code

1
/script if GetActionUsable(32) then UseAction(32); elseif GetEquipSlotInfo(17) then Warrior1H(); else Warrior2H(); end;

452

Thursday, May 13th 2010, 1:34pm

Personal Opinion

Sixpax, the work you have done here is great and I am not sure I would still be playing this game without your contribution. What I am saying is because I do enjoy the game so much.

It seems to me that the developers continue to break the game when any add-on becomes popular. Normally an add-on becomes popular because it helps everyone to enjoy the game more. With this said, more wide spread use of the combat engine may force them to change the game in order to break the engine.

I am not saying this to be elitist, but to be selfish. You engine is a LOT better than what I created personally for myself, wife and daughter who all play this game. I would hate to loose what you have done because the engine became overly popular.

Again, your work is excellent and your knowledge of LUA is remarkable. I just don't want us to loose all your hard work, because the developers view the combat engine as a threat to what they would like to see happen in the game.

With this said, I would request that you re-think your position of posting the engine on curse.
With respect,
Geistware

jsalemi

Trainee

Posts: 133

Location: VA, USA

  • Send private message

453

Thursday, May 13th 2010, 2:51pm

The changes made to the game code are to prevent botting -- DIYCE is not a bot, and AFAIK can't be made into one. It sticks to the "one click-one action" principle quite well.

It's also a major boon for those of us with carpal tunnel, so if the devs did anything to make it not work, I think I'd go to Taiwan myself and have words with them. :)

Tigsman

Trainee

Posts: 126

Location: ATL

Occupation: Fixing Things

  • Send private message

454

Thursday, May 13th 2010, 2:56pm

Quoted from "jsalemi;272812"


It's also a major boon for those of us with carpal tunnel, so if the devs did anything to make it not work, I think I'd go to Taiwan myself and have words with them. :)

I'd have more than words with them.

Saki! j/k :D


T

455

Friday, May 14th 2010, 6:44pm

Quoted from "Geistware;272790"

It seems to me that the developers continue to break the game when any add-on becomes popular. Normally an add-on becomes popular because it helps everyone to enjoy the game more. With this said, more wide spread use of the combat engine may force them to change the game in order to break the engine.


I guess anything's possible, but I don't believe they would try to do that for several reasons:

  • As jsalemi said, they seem to be targeting code that runs automated (even partially) without your intervention. This is accomplished through event calls. Mine not only doesn't run automated, but it isn't even capable of it (without breaking the EULA anyway) because I'm not using events.
  • Mine isn't a full blown addon, but rather just a library of functions, and it can't even function without you writing the code (your custom function) to make it work. So by itself, mine essentially does nothing.
  • The only way to really break my code would be for them to disable some very key API functions and I dare say that would probably incite a riot. :eek:

456

Friday, May 14th 2010, 8:48pm

Tweaked Rogue/Scout with 45 Elites/Boss fights

function RogueScout(arg1, arg2)
local Skill = {}
local i = 0
local energy = UnitMana("player")
local focus = UnitSkill("player")
local friendly = (not UnitCanAttack("player", "target"))
local combat = GetPlayerCombatState()
local tspell,ttime,telapsed = UnitCastingTime("target")
local pbuffs = BuffList("player")
local tbuffs = BuffList("target")
local thealth = PctH("target")
local phealth = PctH("player")

i=i+1; Skill = { name = "Action: 1", use = (phealth < .30) }
i=i+1; Skill[i] = { name = "Throat Attack", use = ((not friendly) and (tspell ~= nil) and (ttime >= 1) and ((ttime - telapsed) > 0.5) and (focus >= 15) and (arg2 ~= "BOSS")) }
i=i+1; Skill[i] = { name = "Combat Master", use = ((not string.find(pbuffs, "Combat Master"))) }
i=i+1; Skill[i] = { name = "Poison", use = ((not combat) and (not string.find(pbuffs,"Poison"))) }
i=i+1; Skill[i] = { name = "Fervent Attack", use = ((not friendly) and (not string.find(pbuffs, "Fervent Attack")) and (arg2 == "BOSS") and (thealth <= .30)) }
i=i+1; Skill[i] = { name = "Energy Thief", use = ((not friendly) and (focus >= 20) and (arg2 == "BOSS") and string.find(pbuffs, "Fervent Attack") and (not string.find(pbuffs, "Energy Thief"))) }
i=i+1; Skill[i] = { name = "Assassins Rage", use = ((not friendly) and (arg2 == "BOSS") and string.find(pbuffs, "Energy Thief") and (not string.find(pbuffs, "Assassins Rage"))) }
i=i+1; Skill[i] = { name = "Vampire Arrows", use = ((not friendly) and (thealth < .99)) }
i=i+1; Skill[i] = { name = "Shot", use = ((not friendly) and (thealth < .99)) }
i=i+1; Skill[i] = { name = "Wound Attack", use = ((not friendly) and (energy >= 35) and string.find(tbuffs, "Bleed") and string.find(tbuffs, "Grievous Wound")) }
i=i+1; Skill[i] = { name = "Shadowstab", use = ((not friendly) and (energy >= 20) and (not string.find(tbuffs, "Bleed"))) }
i=i+1; Skill[i] = { name = "Low Blow", use = ((not friendly) and (energy >= 25) and string.find(tbuffs, "Bleed")) }

MyCombat(Skill,arg1)
end


Made it so you can macro two different options, one as a boss fight another as a normal creature.

On bosses, once boss gets down to 30% it casts Fervent/Energy Thief/Assassins rage.

Also set the correct skills cost (20 shadowstab, 25 low blow, 35 WA) for 45 elites Coerce.

Also tweaked so Shot/Vampire arrows only goes off if target has already been hit. This lets me lure the creature in with something else/by someone else. Great against accidentally tabbing the wrong thing in heat of combat. Changed throat attack to only work on normal creatures, few bosses can actually be silenced so I figured I can always hit throat attack if need be on the few it works on, that way doesn't waste the focus/CD on throat attack. Switched it up so casts shadowstab only if theres not a bleed, and uses Low blow basically as default skill since it hits the hardest and is only 5 more energy.

Haven't tested yet, will wait to get into hoto run tonight to test (to make sure boss function works)

457

Sunday, May 16th 2010, 8:01pm

I can not at all get this to work for my scout priest.. I tried the new dyic DL on the first page, have tried over a dozen changes to all sorts of stuff
Have deleted everything and started new 2 or 3 times


Here is the basic function I am looking for
does the scout attacks
shot
wind arrow
vamp arrow until target is below 50% hp

does the priest heals
Urgent heal a 60% hp
regen heal at 90% hp

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

g_skill = {}

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

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

	Msg("- Reading Class Skills")
	for page = 2,4 do
		slot = 1
		skillname = GetSkillDetail(page,slot)
		repeat
			local a1,a2,a3,a4,a5,a6,a7,a8,skillusable = GetSkillDetail(page,slot)
			if skillusable then
				g_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 ChkBuff(tgt,buffname)
	local cnt = 1
	local buffcmd = UnitBuff

	if UnitCanAttack("player",tgt) then
		buffcmd = UnitDebuff
	end
	local buff = buffcmd(tgt,cnt)

	while buff ~= nil do
		if string.gsub(buff, "(%()(.)(%))", "%2") == buffname then
			return true
		end
		cnt = cnt + 1
		buff = buffcmd(tgt,cnt)
	end
	return false
end

function BuffList(tgt)
	local cnt = 1
	local buffcmd = UnitBuff
	local buffstr = "/"

	if UnitCanAttack("player",tgt) then
		buffcmd = UnitDebuff
	end
	local buff = buffcmd(tgt,cnt)

	while buff ~= nil do
		buffstr = buffstr..buff.."/"
		cnt = cnt + 1
		buff = buffcmd(tgt,cnt)
	end

	return string.gsub(buffstr, "(%()(.)(%))", "%2")
end

function CD(skillname)
	local firstskill = GetSkillDetail(2,1)
	if (g_skill[firstskill] == nil) or (g_skill[firstskill].page ~= 2) then
		ReadSkills()
	end

	if g_skill[skillname] ~= nil then
		local tt,cd = GetSkillCooldown(g_skill[skillname].page,g_skill[skillname].slot)
		return cd==0
	elseif skillname == nil then
		return false
	else
		Msg("Skill not available: "..skillname)
		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, "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 ScoutPriest(arg1)
   local Skill = {}
   local i = 0
   local focus = UnitMana("player")
   local friendly = (not 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 = (not friendly) }
   i=i+1; Skill[i] = { name = "Shot",           use = (not friendly) }
-- i=i+1; Skill[i] = { name = "Piercing Arrow", use = (not friendly) }
-- i=i+1; Skill[i] = { name = "Vampire Arrows", use = ((not friendly) and (focus >= 20)) }
   i=i+1; Skill[i] = { name = "Wind Arrows",    use = ((not friendly) and (focus >= 15)) }
-- i=i+1; Skill[i] = { name = "Snipe",          use = (not friendly) }
   i=i+1; Skill[i] = { name = "Urgent Heal",    use = (health <= .50) }
   i=i+1; Skill[i] = { name = "Regenerate",     use = ((health <= .95) and (not string.find(buffs, "Regenerate"))) }
    



   MyCombat(Skill,arg1)
end

458

Sunday, May 16th 2010, 8:09pm

I can not at all get this to work for my scout priest.. I tried the new dyic DL on the first page, have tried over a dozen changes to all sorts of stuff
Have deleted everything and started new 2 or 3 times


Here is the basic function I am looking for
does the scout attacks
shot
wind arrow
vamp arrow until target is below 50% hp

does the priest heals
Urgent heal a 60% hp
regen heal at 90% hp

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

g_skill = {}

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

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

	Msg("- Reading Class Skills")
	for page = 2,4 do
		slot = 1
		skillname = GetSkillDetail(page,slot)
		repeat
			local a1,a2,a3,a4,a5,a6,a7,a8,skillusable = GetSkillDetail(page,slot)
			if skillusable then
				g_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 ChkBuff(tgt,buffname)
	local cnt = 1
	local buffcmd = UnitBuff

	if UnitCanAttack("player",tgt) then
		buffcmd = UnitDebuff
	end
	local buff = buffcmd(tgt,cnt)

	while buff ~= nil do
		if string.gsub(buff, "(%()(.)(%))", "%2") == buffname then
			return true
		end
		cnt = cnt + 1
		buff = buffcmd(tgt,cnt)
	end
	return false
end

function BuffList(tgt)
	local cnt = 1
	local buffcmd = UnitBuff
	local buffstr = "/"

	if UnitCanAttack("player",tgt) then
		buffcmd = UnitDebuff
	end
	local buff = buffcmd(tgt,cnt)

	while buff ~= nil do
		buffstr = buffstr..buff.."/"
		cnt = cnt + 1
		buff = buffcmd(tgt,cnt)
	end

	return string.gsub(buffstr, "(%()(.)(%))", "%2")
end

function CD(skillname)
	local firstskill = GetSkillDetail(2,1)
	if (g_skill[firstskill] == nil) or (g_skill[firstskill].page ~= 2) then
		ReadSkills()
	end

	if g_skill[skillname] ~= nil then
		local tt,cd = GetSkillCooldown(g_skill[skillname].page,g_skill[skillname].slot)
		return cd==0
	elseif skillname == nil then
		return false
	else
		Msg("Skill not available: "..skillname)
		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, "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 ScoutPriest(arg1)
   local Skill = {}
   local i = 0
   local focus = UnitMana("player")
   local friendly = (not 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 = (not friendly) }
   i=i+1; Skill[i] = { name = "Shot",           use = (not friendly) }
-- i=i+1; Skill[i] = { name = "Piercing Arrow", use = (not friendly) }
-- i=i+1; Skill[i] = { name = "Vampire Arrows", use = ((not friendly) and (focus >= 20)) }
   i=i+1; Skill[i] = { name = "Wind Arrows",    use = ((not friendly) and (focus >= 15)) }
-- i=i+1; Skill[i] = { name = "Snipe",          use = (not friendly) }
   i=i+1; Skill[i] = { name = "Urgent Heal",    use = (health <= .50) }
   i=i+1; Skill[i] = { name = "Regenerate",     use = ((health <= .95) and (not string.find(buffs, "Regenerate"))) }
    



   MyCombat(Skill,arg1)
end


I just scrapped it all again and just went with my /run ScoutRogue() one from before and it does work for the scout skills so far... it's odd

jsalemi

Trainee

Posts: 133

Location: VA, USA

  • Send private message

459

Sunday, May 16th 2010, 11:20pm

You're missing some variable definitions -- you don't define health, or buffs. Add this to the top of your function:

Source code

1
2
local health = PctH("player")
local buffs = BuffList("player")
You can change the first line to PctH(tgt) if you want to use it to check your target's health. The target becomes you for the heals if you have the self-cast option turned on.

460

Monday, May 17th 2010, 2:12pm

Hi guys! Im back again! =D
Im loving this combat engine, it gives so much situational adaptability, from world soloing to instance grouping. One thing I was wondering though, is there a way of checking if the target is casting a spell? I want to play with "Silence" and "Demoralize" in my function =P
Im currently playing a M/R by the way, and thoroughly enjoying it. Its now my new main at 34/25 ^_^