Quoted from "LaughingWolf;512796"
@Peryl I'm new to LUA but not to programming in general (turbo pascal, basic, and some minor C++ experience), and want to learn more. Any free resources you highly recommend for any of us interested in learning more? Definitely need some beginner level stuff and maybe a few advanced level resources too. I'd love to be able to figure out what I need to change in the DIYCE files to get it working right for me as I am having a few varied problems with it so far, including the "not doing a darned thing when executed by /run KillSequence() macro" problem. Surprisingly, /run KillSequence("v2") works as intended, and only gave me a list of Idle when my class combo was not listed in CustomFunctions.lua
Quoted from "darknight3z;513013"
Hi guys, this is my attempt at writing a sequence for my W/Wdn but I seem to be having some problems. The script works and doesn't give me any error messages. However, it doesn't use Open Flank when target is Vulnerable nor does it use Tactical Attack when target has bleed on it.
![]()
Source code
1 2 3 4 5 6 7 8 9 10 11 12 13 14--Class: Warrior/Warden elseif mainClass == "WARRIOR" and subClass == "WARDEN" then if enemy then Skill = { { name = "Savage Whirlwind", use = (EnergyBar2 >= 240) }, { name = "Open Flank", use = (EnergyBar1 >= 10) and (tbuffs['Vulnerable']) }, { name = "Attack Weakener", use = (EnergyBar1 <= 10) and (EnergyBar2 >= 280) and (tbuffs['Vulnerable']) }, { name = "Tactical Attack", use = (EnergyBar1 >= 15) and (tbuffs[500081]) }, { name = "Probing Attack", use = (EnergyBar1 >= 20) }, { name = "Slash", use = (EnergyBar1 >= 25) }, { name = "Power of the Wood Spirit", use = (EnergyBar2 >= 123) }, { name = "Attack", use = (thealth == 1) }, } end
Can anybody tell me why this is happening? Thanks in advance.
|
|
Source code |
1 |
/run KillSequence("debugskills")
|
Quoted from "darknight3z;513013"
Edit: Also, if there is already a Slash on target theoretically the script should use Tactical Attack immediately and skip Slash right? How can I get myself to use Slash as well even though another warrior may have put a Slash on it already?
Quoted from "BloodyArrow;513458"
Hey!
I was wondering if there was a ammocheck function for DIYCE that keeps track of how many arrows you got left and preventing you to get the red message when got 1 arrow left or even out of arrows. So I got some code from my friend that I pasted into my DIYCE.
But I'm still getting the red message "Out of arrows" when I got 1 arrow left and my Vampire Arrows skill is under cooldown?
This is the part of my CustomFunctions where I pasted the code I have got from my friend.
![]()
Source code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18local ammocheck = GetInventoryItemDurable("player", 9) >= 3 (This row is under the function KillSequence(arg1, healthpot, manapot, foodslot) where the other locals are.) if mainClass == "RANGER" and subClass == "WARRIOR" then --Combat if enemy then Skill2 = { { name = "Target Lock", use = (boss) }, { name = "Combo Shot", use = (ammocheck) and (pvp) or (boss or elite) }, { name = "Autoshot", use = (boss or elite) and (not ASon) }, { name = "Vampire Arrows", use = (EnergyBar1 >= 30) }, { name = "Piercing Arrow", use = (ammocheck) }, { name = "Reflected Shot", use = true }, { name = "Shot", use = true }, } end
/ B
Quoted from "Peryl;513473"
The way this is written, ammocheck will be true if you have three or more arrows. However, ammocheck is only used with your Piercing Arrow and Combo Shot skill lines. All other skills will still be tried and so if it uses an arrow, you could still get the message.
|
|
Source code |
1 |
[LEFT][COLOR=#000000]/run KillSequence("debugskills")[/COLOR][/LEFT]
|
Quoted from "darknight3z;513705"
Peryl, I ran the code with
![]()
Source code
1[LEFT][COLOR=#000000]/run KillSequence("debugskills")[/COLOR][/LEFT]
and as you said, Open Flank and Tactical Attack returned as False even though I had the rage and the tbuffs for it to go off.
I double checked and triple checked the tbuffs spelling and its spelled correctly.![]()
|
|
Source code |
1 |
/run KillSequence("debugtbuffs")
|
Quoted from "BloodyArrow;513630"
Thanks for your answer Peryl. What do you think if I add ammocheck to all of the skills that uses arrows and change the check from 3 arrows to 1?
Quoted from "Peryl;513715"
I really can't think of what is going wrong here, your code should be doing what you intend as far as I can tell.
Try running with
![]()
Source code
1/run KillSequence("debugtbuffs")
to get the list of debuffs that DIYCE is seeing on your target.
Other debug options are "debugpbuffs" for the player buff list, and "debugall" which does all the of them (when doing "dbugall" the first buff list is the player buffs, the second is the target debuffs).
Quoted from "Eviljo;513646"
I am new to DIYCE and not very good at the scripts can some one please help me iam looking for scout/priest, scout/rouge, rouge/scout. With easy to follow instrucations as iam not gr8 with the code. =)
. It isn't all that bad really).
Quoted from "darknight3z;513719"
The Skill List and Buffs List is coming up blank and not showing anything.
Quoted from "Peryl;513721"
Hmmmm... Not sure why the buff list is blank, but that would be the main problem since as far as DIYCE is seeing things, the target has no debuffs on him (hence it won't use the skills that rely on the target having a certain debuff).
Looking at the code you posted here , I don't see why this is so. Could something else be changing the target on you?
|
|
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 |
-- DIY Combat Engine version 2.2
local g_skill = {}
local g_lastaction = ""
function Msg(outstr,a1,a2,a3)
DEFAULT_CHAT_FRAME:AddMessage(tostring(outstr),a1,a2,a3)
end
function ReadSkills()
g_skill = {}
local skillname,slot
for page = 1,4 do
slot = 1
skillname = GetSkillDetail(page,slot)
repeat
local a1,a2,a3,a4,a5,a6,a7,a8,skillusable = GetSkillDetail(page,slot)
if skillusable then
g_skill[skillname] = { ['page'] = page, ['slot'] = slot }
end
slot = slot + 1
skillname = GetSkillDetail(page,slot)
until skillname == nil
end
end
-- Read Skills on Log-In/Class Change/Level-Up
local DIYCE_EventFrame = CreateUIComponent("Frame","DIYCE_EventFrame","UIParent")
DIYCE_EventFrame:SetScripts("OnEvent", [=[
if event == 'PLAYER_SKILLED_CHANGED' then
ReadSkills()
end
]=] )
DIYCE_EventFrame:RegisterEvent("PLAYER_SKILLED_CHANGED")
function PctH(tgt)
return (UnitHealth(tgt)/UnitMaxHealth(tgt))
end
function PctM(tgt)
return (UnitMana(tgt)/UnitMaxMana(tgt))
end
function PctS(tgt)
return (UnitSkill(tgt)/UnitMaxSkill(tgt))
end
function CancelBuff(buffname)
local i = 1
local buff = UnitBuff("player",i)
while buff ~= nil do
if buff == buffname then
CancelPlayerBuff(i)
return true
end
i = i + 1
buff = UnitBuff("player",i)
end
return false
end
function BuffList(tgt)
local list = {}
local buffcmd = UnitBuff
local infocmd = UnitBuffLeftTime
if UnitCanAttack("player",tgt) then
buffcmd = UnitDebuff
infocmd = UnitDebuffLeftTime
end
-- There is a max of 100 buffs/debuffs per unit apparently
for i = 1,100 do
local buff, _, stackSize, ID = buffcmd(tgt, i)
local timeRemaining = infocmd(tgt,i)
if buff then
-- Ad to list by name
list[buff:gsub('(%()(.)(%))', '%2')] = { stack = stackSize, time = timeRemaining, id = ID }
-- We also list by ID in case two different buffs/debuffs have the same name.
list[ID] = {stack = stackSize, time = timeRemaining, name = buff:gsub("(%()(.)(%))", "%2") }
else
break
end
end
return list
end
function CD(skillname)
local firstskill = GetSkillDetail(2,1)
if (g_skill[firstskill] == nil) or (g_skill[firstskill].page ~= 2) then
ReadSkills()
end
if g_skill[skillname] ~= nil then
local tt,cd = GetSkillCooldown(g_skill[skillname].page,g_skill[skillname].slot)
return cd <= 0.4
elseif skillname == nil then
return false
else
Msg("Skill not available: "..skillname) --Comment this line out if you do not wish to recieve this error message.
return
end
end
function MyCombat(Skill, arg1)
local spell_name = UnitCastingTime("player")
local talktome = ((arg1 == "v1") or (arg1 == "v2"))
local action,actioncd,actiondef,actioncnt
if spell_name ~= nil then
if (arg1 == "v2") then Msg("- ['..spell_name..']", 0, 1, 1) end
return true
end
for x,tbl in ipairs(Skill) do
local useit = type(Skill[x].use) ~= "function" and Skill[x].use or (type(Skill[x].use) == "function" and Skill[x].use() or false)
if useit then
if string.find(Skill[x].name, "Action:") then
action = tonumber((string.gsub(Skill[x].name, "(Action:)( *)(%d+)(.*)", "%3")))
_1,actioncd = GetActionCooldown(action)
actiondef,_1,actioncnt = GetActionInfo(action)
if GetActionUsable(action) and (actioncd == 0) and (actiondef ~= nil) and (actioncnt > 0) then
if talktome then Msg("- "..Skill[x].name) end
UseAction(action)
return true
end
elseif string.find(Skill[x].name, "Custom:") then
action = string.gsub(Skill[x].name, "(Custom:)( *)(.*)", "%3")
if CustomAction(action) then
return true
end
elseif string.find(Skill[x].name, "Item:") then
action = string.gsub(Skill[x].name, "(Item:)( *)(.*)", "%3")
if talktome then Msg("- "..Skill[x].name) end
UseItemByName(action)
return true
elseif CD(Skill[x].name) then
if talktome then Msg("- "..Skill[x].name) end
CastSpellByName(Skill[x].name)
return true
elseif string.find(Skill[x].name, "Pet Skill:") then
action = string.gsub(Skill[x].name, "(Pet Skill:)( *)(%d+)(.*)", "%3")
UsePetAction(action)
if (arg1 == "v2") then Msg(Skill[x].name.." has been fully processed") end
return true
end
end
end
if (arg1 == "v2") then Msg("- [IDLE]", 0, 1, 1) end
return false
end
function CustomAction(action)
if CD(action) then
if IsShiftKeyDown() then Msg("- "..action) end
g_lastaction = action
CastSpellByName(action)
return true
else
return false
end
end
function BuffTimeLeft(tgt, buffname)
local cnt = 1
local buff = UnitBuff(tgt,cnt)
while buff ~= nil do
if string.find(buff,buffname) then
return UnitBuffLeftTime(tgt,cnt)
end
cnt = cnt + 1
buff = UnitBuff(tgt,cnt)
end
return 0
end
function BuffParty(arg1,arg2)
-- arg1 = Quickbar slot # for targetable, instant-cast buff without a cooldown (eg. Amp Attack) for range checking.
-- arg2 = buff expiration time cutoff (in seconds) for refreshing buffs, default is 45 seconds.
local selfbuffs = { "Soul Bond", "Enhanced Armor", "Holy Seal" }
local groupbuffs = { "Grace of Life", "Amplified Attack", "Angel's Blessing", "Essence of Magic", "Magic Barrier", "Blessed Spring Water", "Fire Ward", "Savage Blessing", "Concentration Prayer", "Shadow Fury" }
local buffrefresh = arg2 or 45 -- Refresh buff time (seconds)
local spell = UnitCastingTime("player") -- Spell being cast?
local vocal = IsShiftKeyDown() -- Generate feedback if Shift key held
if (spell ~= nil) then
return
end
if vocal then Msg("- Checking self buffs on "..UnitName("player")) end
for i,buff in ipairs(selfbuffs) do
if (g_skill[buff] ~= nil) and CD(buff) and (BuffTimeLeft("player",buff) <= buffrefresh) then
if vocal then Msg("- Casting "..buff.." on "..UnitName("player")) end
TargetUnit("player")
CastSpellByName(buff)
return
end
end
if vocal then Msg("- Checking group buffs on "..UnitName("player")) end
for i,buff in ipairs(groupbuffs) do
if (g_skill[buff] ~= nil) and CD(buff) and (BuffTimeLeft("player",buff) <= buffrefresh) then
if vocal then Msg("- Casting "..buff.." on "..UnitName("player")) end
TargetUnit("player")
CastSpellByName(buff)
return
end
end
for num=1,GetNumPartyMembers()-1 do
TargetUnit("party"..num)
if GetActionUsable(arg1) and (UnitHealth("party"..num) > 0) then
if vocal then Msg("- Checking group buffs on "..UnitName("party"..num)) end
for i,buff in ipairs(groupbuffs) do
if (g_skill[buff] ~= nil) and CD(buff) and (BuffTimeLeft("target",buff) <= buffrefresh) then
if UnitIsUnit("target","party"..num) then
if vocal then Msg("- Casting "..buff.." on "..UnitName("target")) end
CastSpellByName(buff)
return
else
if vocal then Msg("- Error: "..UnitName("target").." != "..UnitName("party"..num)) end
end
end
end
else
if vocal then Msg("- Player "..UnitName("party"..num).." out of range or dead.") end
end
end
if vocal then Msg("- Nothing to do.") end
end
|
Quoted from "darknight3z;513748"
Haha, Thanks Peryl. Your the man! Works fine now. Thank you for your time, I appreciate it.![]()
Quoted from "Peryl;513774"
Aha! This means that there is some other add-on that is defining a function called BuffList as well and this is interfering. The renaming trick effectively bypasses the problem, but you may want to figure out where it is coming from. It would have to come after DIYCE 2.0.
Glad it's finally working though.
Quoted from "darknight3z;513888"
Yea, I was using an old 1.4 DIYCE function given to me by a guildie that no longer plays but felt it was time for an upgrade. But I didn't want to delete it before getting a working 2.2 one. Maybe that was what was giving me problems.
Quoted from "Peryl;513985"
Yup! I'd bet that was exactly the problem. The older version was likely being loaded after DIYCE 2.2 and therefore was replacing the BuffList function, as the two versions are drastically different, DIYCE 2.2 could no longer see the buffs/debuffs.
Now that you know where the problem was, it may be better to rename the old version to something like oldBuffList and the new version back to BuffList (with appropriate changes in remainder of code of course). This way, any other code you encounter for DIYCE 2.2 will still work, and anything that needs the older version can be fixed to use oldBuffList.