|
|
Source code |
1 2 |
i=i+1; Skill[i] = { ['name'] = "Action: 1", ['use'] = (PctH("player") < .80) }
i=i+1; Skill[i] = { ['name'] = "Action: 21", ['use'] = ((not combat) and (PctM("player") < .80)) }
|
|
|
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 |
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 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
else
Msg("Skill not available: "..skillname)
return false
end
end
function MyCombat(Skill,arg1)
local spell_name = UnitCastingTime("player")
local talktome = false
if (arg1 == "v1") or (arg1 == "v2") then
talktome = true
end
if spell_name ~= nil then
if (arg1 == "v2") then Msg("- ['..spell_name..']",0,1,1) end
return false
end
for x,tbl in ipairs(Skill) do
if CD(Skill[x].name) and Skill[x].use then
if talktome then Msg("- "..Skill[x].name) end
CastSpellByName(Skill[x].name)
return true
end
end
if (arg1 == "v2") then Msg("- IDLE") end
return false
end
function RogueScout(arg1,arg2)
local Skill = {}
local i = 0
local energy = UnitMana("player")
local friendly = (not UnitCanAttack("player","target"))
local combat = GetPlayerCombatState()
local pbuffs = BuffList("player")
local tbuffs = BuffList("target")
i=i+1; Skill[i] = { ['name'] = "Action: 79", ['use'] = (PctH("player") < .60) }
i=i+1; Skill[i] = { ['name'] = "Action: 80", ['use'] = (PctH("player") < .85) }
i=i+1; Skill[i] = { ['name'] = "Combat Master", ['use'] = ((not string.find(pbuffs,"Combat Master")) and (not string.find(pbuffs,"Informer"))) }
-- i=i+1; Skill[i] = { ['name'] = "Sneak Attack", ['use'] = ((not friendly) and (energy >=30) and (arg2=="behind") and (not combat)) }
-- i=i+1; Skill[i] = { ['name'] = "Shot", ['use'] = (not friendly) }
-- 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'] = "Low Blow", ['use'] = ((not friendly) and (energy >=35) and string.find(tbuffs,"Bleed")) }
-- i=i+1; Skill[i] = { ['name'] = "Blind Spot", ['use'] = ((not friendly) and (energy >=25) and (arg2=="behind")) }
-- i=i+1; Skill[i] = { ['name'] = "Shadowstab", ['use'] = ((not friendly) and (energy >=35)) }
-- i=i+1; Skill[i] = { ['name'] = "Vampire Arrows", ['use'] = (not friendly) }
MyCombat(Skill,arg1)
end
|

Quoted from "Sixpax;264091"
You are close and gave me the idea to fix it perfectly... The 3rd value returned from GetActionInfo is a count of that item. If it's a skill it's always a 1, so it will work for both.
Anyway, I incorporated the Action and Item use code into post #1 of this thread now and removed it from post #162 so I don't have to maintain it in two places. Be sure to get the updated version of MyCombat() from there.
Quoted from "Imortalisle;265947"
So I have the code listed above in the MyFunctions.lua file and the script below as my macro ingame
![]()
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 111g_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 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 else Msg("Skill not available: "..skillname) return false end end function MyCombat(Skill,arg1) local spell_name = UnitCastingTime("player") local talktome = false if (arg1 == "v1") or (arg1 == "v2") then talktome = true end if spell_name ~= nil then if (arg1 == "v2") then Msg("- ['..spell_name..']",0,1,1) end return false end for x,tbl in ipairs(Skill) do if CD(Skill[x].name) and Skill[x].use then if talktome then Msg("- "..Skill[x].name) end CastSpellByName(Skill[x].name) return true end end if (arg1 == "v2") then Msg("- IDLE") end return false end function RogueScout(arg1,arg2) local Skill = {} local i = 0 local energy = UnitMana("player") local friendly = (not UnitCanAttack("player","target")) local combat = GetPlayerCombatState() local pbuffs = BuffList("player") local tbuffs = BuffList("target") i=i+1; Skill[i] = { ['name'] = "Action: 79", ['use'] = (PctH("player") < .60) } i=i+1; Skill[i] = { ['name'] = "Action: 80", ['use'] = (PctH("player") < .85) } i=i+1; Skill[i] = { ['name'] = "Combat Master", ['use'] = ((not string.find(pbuffs,"Combat Master")) and (not string.find(pbuffs,"Informer"))) } -- i=i+1; Skill[i] = { ['name'] = "Sneak Attack", ['use'] = ((not friendly) and (energy >=30) and (arg2=="behind") and (not combat)) } -- i=i+1; Skill[i] = { ['name'] = "Shot", ['use'] = (not friendly) } -- 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'] = "Low Blow", ['use'] = ((not friendly) and (energy >=35) and string.find(tbuffs,"Bleed")) } -- i=i+1; Skill[i] = { ['name'] = "Blind Spot", ['use'] = ((not friendly) and (energy >=25) and (arg2=="behind")) } -- i=i+1; Skill[i] = { ['name'] = "Shadowstab", ['use'] = ((not friendly) and (energy >=35)) } -- i=i+1; Skill[i] = { ['name'] = "Vampire Arrows", ['use'] = (not friendly) } MyCombat(Skill,arg1) end
"/run ScoutRogue()"
When I press the hotkey absolutely nothing happens
No errors, no glitches, no messages, nothing...... I know I'm doing something wrong, just don't know what lol
Quoted from "bobhica;266130"
Hi Sixpack and everyone else who contributes.
I was curious if it might be possible to keep an updated compiled list of complete functions for different class comboes since this engine has become quite popular and this thread is now over 35 pages to sort through. With addons like uberflex not working anymore, this engine will only continue to become more and more used as dps try to maximize their efficiency, and it would be nice to just be able to look for your class combo that has already been made and then customize it to your taste. Anyhow, just an idea, and thank you for a well organized combat engine.
Quoted from "Imortalisle;265947"
So I have the code listed above in the MyFunctions.lua file and the script below as my macro ingame
![]()
Source code
1 function RogueScout(arg1,arg2)
"/run ScoutRogue()"
When I press the hotkey absolutely nothing happens
No errors, no glitches, no messages, nothing...... I know I'm doing something wrong, just don't know what lol
|
|
Source code |
1 |
i=i+1; Skill[i] = { ['name'] = "Action: 43", ['use'] = (((PctM("player") <= .66) and (not string.find(pbuffs,"Elemental Spirit Stone"))) or (PctM("player") <= .10)) }
|
Quoted from "Calico;266223"
Will this work?
I want it to use mana potions at 2/3s of my mana but let them run all the way before using it again, unless I get down really low, then just spam them like crazy. Just wondering if bufflist works for potions.
![]()
Source code
1i=i+1; Skill[i] = { ['name'] = "Action: 43", ['use'] = (((PctM("player") <= .66) and (not string.find(pbuffs,"Elemental Spirit Stone"))) or (PctM("player") <= .10)) }
|
|
Source code |
1 2 |
i=i+1; Skill[i] = { name = "Action: 43", use = ((PctM("player") <= .66) and (not string.find(pbuffs,"Elemental Spirit Stone"))) }
i=i+1; Skill[i] = { name = "Action: 43", use = (PctM("player") <= .10) }
|
Quoted from "Imortalisle;265947"
So I have the code listed above in the MyFunctions.lua file and the script below as my macro ingame
"/run ScoutRogue()"
When I press the hotkey absolutely nothing happens
No errors, no glitches, no messages, nothing...... I know I'm doing something wrong, just don't know what lol
Quoted from "QthePhysicist;266143"
agreed. is there no way to search this forum?
Quoted from "QthePhysicist;266001"
so no local definition is needed anymore?
|
|
Source code |
1 2 3 4 5 6 7 |
local shield = (GetEquipSlotInfo(17) ~= nil)
local sword = (GetEquipSlotInfo(16) ~= nil)
local WWScd = CD("Whirlwind Shield")
i=i+1; Skill[i] = { name = "Action: 3", use = (WWScd and (not shield)) }
i=i+1; Skill[i] = { name = "Action: 2", use = (WWScd and (not sword)) }
i=i+1; Skill[i] = { name = "Action: 1", use = ((not WWScd) and shield) }
i=i+1; Skill[i] = { name = "Whirlwind Shield", use = ((not friendly) and shield) }
|
Quoted from "QthePhysicist;266441"
this switching weapons thing could be nice. i will try it soon. thanks for the clarification on the action part.
as for the thread, what I'd REALLY like to do is jump straight to one post, say for example to post #162, without scrolling up or back to it. is that possible
|
|
Source code |
1 |
http://forum.us.runesofmagic.com/showpost.php?p=266441&postcount=356 |
|
|
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 |
function RogueKnight(arg1)
local Skill = {}
local i = 0
local friendly = (not UnitCanAttack("player", "target"))
local energy = UnitMana("player")
local mana = UnitSkill("player")
local combat = GetPlayerCombatState()
local health
if friendly then
health = PctH("target")
else
health = PctH("player")
end
local pbuffs = BuffList("player")
local tbuffs = BuffList("target")
i=i+1; Skill[i] = { ['name'] = "Assassins Rage", ['use'] = ((combat) and (not string.find(pbuffs,"Assassins Rage"))) }
i=i+1; Skill[i] = { ['name'] = "Enhanced Armor", ['use'] = (not string.find(pbuffs,"Enhanced Armor")) }
i=i+1; Skill[i] = { ['name'] = "Poison", ['use'] = ((not combat) and (not string.find(pbuffs,"Poisonous"))) }
i=i+1; Skill[i] = { ['name'] = "Poison Protection", ['use'] = ((not combat) and (not string.find(pbuffs,"Poison Protection"))) }
i=i+1; Skill[i] = { ['name'] = "Premeditation", ['use'] = ((not combat) and (not string.find(pbuffs,"Hide")) and (not string.find(pbuffs,"Premeditation"))) }
i=i+1; Skill[i] = { ['name'] = "Hide", ['use'] = ((not combat) and (not string.find(pbuffs,"Hide"))) }
i=i+1; Skill[i] = { ['name'] = "Sneak Attack", ['use'] = ((not combat) and (energy >=100) and (not friendly) and (string.find(pbuffs,"Hide"))) }
i=i+1; Skill[i] = { ['name'] = "Blind Spot", ['use'] = ((combat) and (not friendly) and (energy >=70) and (string.find(tbuffs,"Sneak Attack Stun"))) }
i=i+1; Skill[i] = { ['name'] = "Low Blow", ['use'] = ((combat) and (not friendly) and (energy >=35) and (string.find(tbuffs,"Blind Spot Bleed"))) }
i=i+1; Skill[i] = { ['name'] = "Wound Attack", ['use'] = ((combat) and (not friendly) and (energy >=35) and (string.find(tbuffs,"Blind Spot Bleed")) and (string.find(tbuffs,"Grievous Wound"))) }
i=i+1; Skill[i] = { ['name'] = "Wound Attack", ['use'] = ((combat) and (not friendly) and (energy >=35) and (string.find(tbuffs,"Bleed")) and (string.find(tbuffs,"Grievous Wound"))) }
i=i+1; Skill[i] = { ['name'] = "Low Blow", ['use'] = ((combat) and (not friendly) and (energy >=35) and (string.find(tbuffs,"Bleed"))) }
i=i+1; Skill[i] = { ['name'] = "Shadowstab", ['use'] = ((combat) and (not friendly) and (energy >=35) and (not string.find(tbuffs,"Bleed"))) }
i=i+1; Skill[i] = { ['name'] = "Disarmament", ['use'] = ((combat) and (energy <=35) and (not string.find(tbuffs,"Disarmament IV"))) }
MyCombat(Skill,arg1)
|
Quoted from "gjunk1;266501"
I believe I came up with a rogue function that is not dependent on the "behind" function but instead uses your buffs and states and the targets debuffs to fire.
Please provide feedback. thanks
Quoted
function MagePriest(arg1)
local Skill = {}
local i = 0
local mana = UnitMana("player")
local friendly = (not UnitCanAttack("player","target"))
local pbuffs = BuffList("player")
local tbuffs = BuffList("target")
local phealth = PctH("player")
local thealth = PctH("target")
local health, buffs
if friendly then
health = thealth
buffs = tbuffs
else
health = phealth
buffs = pbuffs
end
i=i+1; Skill = { ['name'] = "Action: 43", ['use'] = ((PctM("player") <= .66) and (not string.find (pbuffs,"Elemental Spirit Stone"))) }
i=i+1; Skill[i] = { ['name'] = "Action: 43", ['use'] = (PctM("player") <= .10) }
i=i+1; Skill[i] = { ['name'] = "Holy Aura", ['use'] = (phealth <= .30) }
i=i+1; Skill[i] = { ['name'] = "Regenerate", ['use'] = ((health <= .90) and (not string.find(buffs, "Regenerate"))) }
i=i+1; Skill[i] = { ['name'] = "Urgent heal", ['use'] = (health <= .70) }
i=i+1; Skill[i] = { ['name'] = "Elemental Weakness", ['use'] = ((not friendly) and (not string.find(tbuffs, "Elemental Weakness"))) }
i=i+1; Skill[i] = { ['name'] = "Magic Drain", ['use'] = ((not friendly) and (not string.find(tbuffs, "Drain"))) }
i=i+1; Skill[i] = { ['name'] = "Electric Bolt", ['use'] = ((not friendly) and (not string.find(tbuffs, "Electric Flux"))) }
i=i+1; Skill[i] = { ['name'] = "Fireball", ['use'] = (not friendly) }
i=i+1; Skill[i] = { ['name'] = "Lightning", ['use'] = (not friendly) }
i=i+1; Skill[i] = { ['name'] = "Rising Tide", ['use'] = (not friendly) }
i=i+1; Skill[i] = { ['name'] = "Flame", ['use'] = (not friendly) }
MyCombat(Skill,arg1)
end