Quoted from "xMagus;476616"
i need help to make a function
Thanks in Advance
Quoted from "jtanner28;476770"
I have a question for the DIYCE gurus:
Has anyone thought about creating a GUI for DIYCE in-game? Just something that would allow someone to edit their functions and reload them without exiting the game. I'm pretty sure there's an in-game lua code IDE. Perhaps that could be adapted to reference your function file(s). It might even be possible to make a "visual" DIYCE editor where you could drag a skill icon onto it and then have a parameters section where you could adjust the conditions under which the skill fires. A header section could be auto-generated based on a given class and given a set of standard variable definitions (pHealth, tDead, etc). I'm not sure how much work this would be, but it would certainly open up DIYCE to a wider audience. Some people are a little turned off by the text-based, hard-core programming feel of DIYCE and might respond better to more graphical feel. Of course it would have less flexibility and power, but one could always just edit the actual lua code once they are more comfortable with it. It's just a thought.![]()
|
|
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 |
function RogueScout(arg1,arg2)
local Skill = {}
local i = 0
--Player Data
local energy = UnitMana("player")
local focus = UnitSkill("player")
local premed = ChkBuff("player","Premeditation")
local combat = GetPlayerCombatState()
local ammo = GetInventoryItemCount("player",9)
local melee = GetActionUsable(1) -- Shadowstab action bar slot number (range checker)
--local shadow = GetActionUsable(34) -- Shadowprison action bar slot number (range checker)
local enemy = UnitCanAttack("player","target")
local phealth = PctH("player")
local pbuffs = BuffList("player")
local shift = IsShiftKeyDown()
--Target Data
local enemy = UnitCanAttack("player","target")
local tDead = UnitIsDeadOrGhost("target")
local tBleed = (BuffTimeLeft("target","Bleed") > 1)
local tWound = ChkBuff("target","Grievous Wound")
local tBlind = ChkBuff("target","Blind Spot Bleed")
local tPrison = (BuffTimeLeft("target","Shadow Prison") < .75)
local tVamp = ChkBuff("target","Vampire Arrows")
local boss = ((UnitSex("target"))>=2)
--Ammo Reminder
if (ammo == false) then
Msg("OUT OF ARROWS")
end
--i=i+1; Skill[i] = { ['name'] = "Combat Master", --['use'] = (not ChkBuff("player","Combat Master")) }
if (arg2 == "CD") then
--i=i+1; Skill[i] = { ['name'] = "Fervent Attack", ['use'] = (true) }
--i=i+1; Skill[i] = { ['name'] = "Energy Thief", ['use'] = (true) }
--i=i+1; Skill[i] = { ['name'] = "Assassins Rage", ['use'] = (true) }
end
--i=i+1; Skill[i] = { name = "Action: 17 (Caviar Sandwich)", use = ((not ChkBuff("player","Caviar Sandwich")) ) }
--i=i+1; Skill[i] = { name = "Action: 18 (Strong Stimulant)", use = ((not ChkBuff("player","Strong Stimulant")) ) }
--i=i+1; Skill[i] = { name = "Action: 19 (Potion of Annihilation)", use = ((not ChkBuff("player","Potion of Annihilation")) ) }
i=i+1; Skill[i] = { ['name'] = "Action: 20 (Health pot)", use = (phealth <= .50) and GetActionUsable(20) }
i=i+1; Skill[i] = { ['name'] = "Action: 19 (HoT pot)", use = (phealth <= .70) and GetActionUsable(19) }
--Buffs
i=i+1; Skill[i] = { ['name'] = "Premeditation", ['use'] = ((not premed) and boss)}
if (enemy and (not tDead)) then
if (not melee) then --Ranged attack
i=i+1; Skill[i] = { ['name'] = "Shot", ['use'] = ((ammo > 1) and premed) }
--i=i+1; Skill[i] = { ['name'] = "Shadow Prison", ['use'] = ((energy >= 50) and tPrison and shadow and (arg2 == "prison")) }
i=i+1; Skill[i] = { ['name'] = "Vampire Arrows", ['use'] = ((focus >= 20) and (not tVamp)) }
i=i+1; Skill[i] = { ['name'] = "Shot", ['use'] = (ammo > 1) }
else
if shift then --Behind Melee
--i=i+1; Skill[i] = { name = "Sneak Attack", use = ((not combat) and (energy >= 30)) }
i=i+1; Skill[i] = { name = "Blind Spot", use = ((energy >= 55) and (not tBlind)) }
end
--Melee Combat
if (arg2 == "prison") then
--i=i+1; Skill[i] = { ['name'] = "Shadow Prison", ['use'] = ((energy >= 50) and tPrison) }
i=i+1; Skill[i] = { ['name'] = "Vampire Arrows", ['use'] = ((focus >= 20) and (not tVamp)) }
i=i+1; Skill[i] = { ['name'] = "Shot", ['use'] = (ammo > 1) }
else
i=i+1; Skill[i] = { ['name'] = "Shot", ['use'] = (energy <= 35) }
i=i+1; Skill[i] = { ['name'] = "Vampire Arrows", ['use'] = ((energy <= 25) and (not tVamp)) }
i=i+1; Skill[i] = { ['name'] = "Wound Attack", ['use'] = ((energy >= 35) and tBleed and tWound) }
i=i+1; Skill[i] = { ['name'] = "Low Blow", ['use'] = ((energy >= 25) and tBleed and (not tWound)) }
i=i+1; Skill[i] = { ['name'] = "Shadowstab", ['use'] = ((energy >= 35)) }
end
end
MyCombat(Skill,arg1)
if (tDead) or (not lockedOn) or (not enemy) then
TargetNearestEnemy()
end
|
|
|
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 |
--Scout Rogue functions
function ScoutRogue(arg1,arg2)
local Skill = {}
local i = 0
--Player Data
local energy = UnitMana("player")
local focus = UnitSkill("player")
local premed = ChkBuff("player","Premeditation")
local combat = GetPlayerCombatState()
local ammo = GetInventoryItemCount("player",9)
local melee = GetActionUsable(21) -- Shadowstab action bar slot number (range checker)
local enemy = UnitCanAttack("player","target")
local phealth = PctH("player")
local pbuffs = BuffList("player")
--Target Data
local enemy = UnitCanAttack("player","target")
local tDead = UnitIsDeadOrGhost("target")
local tBleed = (BuffTimeLeft("target","Bleed") > 1)
local tWound = ChkBuff("target","Grievous Wound")
local tVamp = ChkBuff("target","Vampire Arrows")
local boss = ((UnitSex("target"))>=2)
--Ammo Reminder
if (ammo == false) then
Msg("OUT OF ARROWS")
end
if (melee) then --At Melee
i=i+1; Skill[i] = { ['name'] = "Shadowstab", ['use'] = ((energy >= 35)) }
i=i+1; Skill[i] = { ['name'] = "Joint Blow", ['use'] = (not friendly) }
i=i+1; Skill[i] = { ['name'] = "Blind Stab", ['use'] = ((not friendly) and (energy >= 25)) }
else --At Range
i=i+1; Skill[i] = { ['name'] = "Frost Arrow", ['use'] = (not ChkBuff("player","Frost Arrow")) }
i=i+1; Skill[i] = { ['name'] = "Vampire Arrows", ['use'] = (enemy and (focus >= 20)) }
--i=i+1; Skill[i] = { ['name'] = "Combo Shot", ['use'] = enemy }
i=i+1; Skill[i] = { ['name'] = "Piercing Arrow", ['use'] = enemy }
i=i+1; Skill[i] = { ['name'] = "Shot", ['use'] = enemy }
i=i+1; Skill[i] = { ['name'] = "Weak Spot", ['use'] = (enemy and (focus >= 30) and boss) }
--i=i+1; Skill[i] = { ['name'] = "Sapping Arrow", ['use'] = enemy }
i=i+1; Skill[i] = { ['name'] = "Wind Arrows", ['use'] = (enemy and (focus >= 15)) }
--i=i+1; Skill[i] = { ['name'] = "Snipe", ['use'] = enemy }
end
--POTS
i=i+1; Skill[i] = { ['name'] = "Action: 20 (Health pot)", ['use'] = (phealth <= .50) and GetActionUsable(20) }
i=i+1; Skill[i] = { ['name'] = "Action: 19 (HoT pot)", ['use'] = (phealth <= .70) and GetActionUsable(19) }
end
MyCombat(Skill,arg1)
if (tDead) or (not lockedOn) or (not enemy) then
TargetNearestEnemy()
end
|
Quoted from "N757QQ;476879"
I need a bit of help with two pieces of code that I am getting error from.
The first is throwing an error [String '?']:82: 'end' expected to "if" at line 52 near '<eof>'. I added an 'end' statement at the bottom, but I am not sure that is correct, and I am not sure why, since as I see it all of the statements are closed. I am still very new, and learning, but am not experienced enough to be sure the errors are fixed.
Also, feel free to bash my shoddy coding, and correct, offer suggestions. I am certainly willing to learn.
Quoted from "N757QQ;476879"
The second error I am getting is from a separate script. It is [string '?']:147: bad argument #1 to 'pairs' (table expected, got nil)
I am completely lost on this one.
Quoted from "N757QQ;476879"
Lastly, the melee check is not working in the latter code block. I have the shadowstab on button 1 I think, it is the first hotkey of the main block, and I still get nothing. Any ideas on that would be appreciated as well.
|
|
Source code |
1 |
[B]/Script DEFAULT_CHAT_FRAME:AddMessage(GetZoneID());[/B] |
|
|
Source code |
1 |
[B]/script DEFAULT_CHAT_FRAME:AddMessage(GetZoneName());[/B] |
|
|
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 |
function RogueScout(arg1,arg2)
local Skill = {}
local i = 0
--Player Data
local energy = UnitMana("player")
local focus = UnitSkill("player")
local premed = ChkBuff("player","Premeditation")
local combat = GetPlayerCombatState()
local ammo = GetInventoryItemCount("player",9)
local melee = GetActionUsable(36) -- Shadowstab action bar slot number (range checker)
local shadow = GetActionUsable(34) -- Shadowprison action bar slot number (range checker)
--Ammo Reminder
if (ammo == false) then
Msg("OUT OF ARROWS")
end
--Target Data
local enemy = UnitCanAttack("player","target")
local tDead = UnitIsDeadOrGhost("target")
local tBleed = (BuffTimeLeft("target","Bleed") > 1)
local tWound = ChkBuff("target","Grievous Wound")
local tBlind = ChkBuff("target","Blind Spot Bleed")
local tPrison = (BuffTimeLeft("target","Shadow Prison") < .75)
local tVamp = ChkBuff("target","Vampire Arrows")
i=i+1; Skill[i] = { ['name'] = "Combat Master", ['use'] = (not ChkBuff("player","Combat Master")) }
if (arg2 == "CD") then
--i=i+1; Skill[i] = { ['name'] = "Fervent Attack", ['use'] = (true) }
i=i+1; Skill[i] = { ['name'] = "Energy Thief", ['use'] = (true) }
i=i+1; Skill[i] = { ['name'] = "Assassins Rage", ['use'] = (true) }
end
if (arg2 == "pots") then
i=i+1; Skill[i] = { name = "Action: 17 (Caviar Sandwich)", use = ((not ChkBuff("player","Caviar Sandwich")) ) }
i=i+1; Skill[i] = { name = "Action: 18 (Strong Stimulant)", use = ((not ChkBuff("player","Strong Stimulant")) ) }
i=i+1; Skill[i] = { name = "Action: 19 (Potion of Annihilation)", use = ((not ChkBuff("player","Potion of Annihilation")) ) }
end
if (enemy and (not tDead)) then
if (not melee) then --Ranged attack
i=i+1; Skill[i] = { ['name'] = "Shot", ['use'] = ((ammo > 1) and premed) }
i=i+1; Skill[i] = { ['name'] = "Shadow Prison", ['use'] = ((energy >= 50) and tPrison and shadow and (arg2 == "prison")) }
i=i+1; Skill[i] = { ['name'] = "Vampire Arrows", ['use'] = ((focus >= 20) and (not tVamp)) }
i=i+1; Skill[i] = { ['name'] = "Shot", ['use'] = (ammo > 1) }
else
if (arg2 == "behind") then --Behind Melee
i=i+1; Skill[i] = { name = "Sneak Attack", use = ((not combat) and (energy >= 30)) }
i=i+1; Skill[i] = { name = "Blind Spot", use = ((energy >= 55) and (not tBlind)) }
end
--Melee Combat
if (arg2 == "prison") then
i=i+1; Skill[i] = { ['name'] = "Shadow Prison", ['use'] = ((energy >= 50) and tPrison) }
i=i+1; Skill[i] = { ['name'] = "Vampire Arrows", ['use'] = ((focus >= 20) and (not tVamp)) }
i=i+1; Skill[i] = { ['name'] = "Shot", ['use'] = (ammo > 1) }
else
i=i+1; Skill[i] = { ['name'] = "Shot", ['use'] = (energy <= 35) }
i=i+1; Skill[i] = { ['name'] = "Vampire Arrows", ['use'] = ((energy <= 25) and (not tVamp)) }
i=i+1; Skill[i] = { ['name'] = "Wound Attack", ['use'] = ((energy >= 35) and tBleed and tWound) }
i=i+1; Skill[i] = { ['name'] = "Low Blow", ['use'] = ((energy >= 25) and tBleed and (not tWound)) }
i=i+1; Skill[i] = { ['name'] = "Shadowstab", ['use'] = ((energy >= 35)) }
end
end
end
MyCombat(Skill,arg1)
end
|
|
|
Source code |
1 2 3 4 |
i=i+1; Skill[i] = { ['name'] = "Holy Shield", ['use'] = (health <= .35) }
i=i+1; Skill[i] = { name = "Action: 50", use = (PctH("player") < .35) }
i=i+1; Skill[i] = { name = "Action: 51", use = (PctM("player") < .15) }
|
Quoted from "Pandorumx;478381"
Honestly I don't know how to do that, been looking for something simular on the forum but can't find it. Been at this since last night.![]()
|
|
Source code |
1 2 |
/run SwapEquipmentItem() /run ReturnPet(# of slot your pet is in) |
|
|
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 |
function RogueScout(arg1,arg2)
local Skill = {}
local i = 0
--Player Status
local energy = UnitMana("player")
local mana = UnitSkill("player")
local focus = UnitSkill("player")
local phealth = PctH("player")
local pbuffs = BuffList("player")
local combat = GetPlayerCombatState()
local behind = (not UnitIsUnit("player", "targettarget"))
local premed = (pbuffs == string.find(pbuffs, "Premeditation"))
--Target Status
local friendly = (not UnitCanAttack("player", "target"))
local tDead = UnitIsDeadOrGhost("target")
local tbuffs = BuffList("target")
local boss = ((UnitSex("target"))>=2)
--Buffs
if(arg2 == "BUFF") then
i=i+1; Skill[i] = { name = "Combat Master", use = ((not combat and not string.find(pbuffs, "Combat Master"))) }
i=i+1; Skill[i] = { name = "Enhanced Armor", use = ((not friendly) and (not string.find(pbuffs, "Enhanced Armor"))) }
i=i+1; Skill[i] = { name = "Searing Light", use = ((not friendly) and (not string.find(pbuffs, "Searing Light"))) }
i=i+1; Skill[i] = { name = "Lion's Protection", use = ((not friendly) and (not string.find(pbuffs, "Lion's Protection"))) }
i=i+1; Skill[i] = { name = "Action: 62", use = ((not combat and not string.find(pbuffs, "Yawaka's Blessing"))) }
i=i+1; Skill[i] = { name = "Action: 69", use = ((not combat and not string.find(pbuffs, "Unbridled Enthusiasm"))) } -- Speed Potion
end
--Potions & Swap Macro
if(arg2 == "FAILSAFE") then
i=i+1; Skill[i] = { name = "Action: 42", use = (combat and (phealth < .03 and (boss))) } -- Swap Macro
i=i+1; Skill[i] = { name = "Action: 43", use = (combat and (phealth < .25 and (boss))) } -- Phirius Potion
end
--Cooldowns
if(arg2 == "CD") then
i=i+1; Skill[i] = { name = "Action: 46 (Energy Potion)", use = ((combat) and (energy < 15 and (boss))) } -- Energy Potion
i=i+1; Skill[i] = { name = "Action: 30 (Strong Stimulant)", use = ((boss) and (not string.find(pbuffs, "Fervent Attack"))) }
i=i+1; Skill[i] = { name = "Action: 34 (Extinction Potion)", use = ((boss) and (not ChkBuff("player","Extinction Potion"))) }
i=i+1; Skill[i] = { name = "Energy Thief", use = ((combat) and (boss) and (not tDead) and (energy < 50)) }
i=i+1; Skill[i] = { name = "Assassins Rage", use = ((boss) and (not tDead)) }
i=i+1; Skill[i] = { name = "Fervent Attack", use = ((boss) and (not tDead) and not string.find(pbuffs, "Strong Stimulant")) }
end
--60 Second Buffs
if(arg2 == "LONGCD") then
i=i+1; Skill[i] = { name = "Informer", use = ((not string.find(pbuffs, "Informer"))) }
i=i+1; Skill[i] = { name = "Action: 64 (Unknown Choice)", use = ((energy > 20)) }
i=i+1; Skill[i] = { name = "Action: 65 (Caviar Sandwich)", use = ((not string.find(pbuffs, "Caviar Sandwich"))) }
end
--Melee
if(arg2 == "MELEE") then
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 >= 25)) and (string.find(tbuffs, "Bleed") and ((not string.find(tbuffs, "Grievous Wound"))))) or (string.find(pbuffs, "Energy Thief"))) }
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 = "Blind Spot", use = ((not friendly) and (string.find(pbuffs, "Energy Thief") or (premed)) and (behind)) }
i=i+1; Skill[i] = { name = "Wrist Attack", use = ((not friendly) and (boss) and (focus >=50)) }
i=i+1; Skill[i] = { name = "Vampire Arrows", use = ((not friendly)) }
i=i+1; Skill[i] = { name = "Shot", use = ((not friendly)) }
end
--Ranged
if(arg2 == "RANGED") then
i=i+1; Skill[i] = { name = "Vampire Arrows", use = ((not friendly)) }
i=i+1; Skill[i] = { name = "Shot", use = ((not friendly)) }
end
--RogueKnight Section (Third Class)
if(arg2 == "RK") then
i=i+1; Skill[i] = { name = "Disarmament", use = ((not friendly)) }
i=i+1; Skill[i] = { name = "Holy Strike", use = ((not friendly)) }
end
MyCombat(Skill,arg1)
end
|
|
|
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 |
--Class: Rogue/Priest
elseif mainClass == "THIEF" and subClass == "AUGUR" then
--Potions and Buffs
Skill = {
{ name = "Regenerate", use = (phealth <= .90) and (pctEB2 >= .05) and (not pbuffs['Regenerate']) },
{ name = "Action: "..healthpot, use = (phealth <= .70) },
{ name = "Action: "..manapot, use = (pctEB2 <= .40) },
{ name = "Assassins Rage", use = boss and enemy },
{ name = "Magic Barrier", use = (pctEB2 >= .05) and (not pbuffs['Magic Barrier']) },
{ name = "Quickness Aura", use = (pctEB2 >= .05) and (not pbuffs['Quickness Aura']) },
}
--Combat
if enemy then
Skill2 = {
{ name = "Premeditation", use = (not combat) and boss and (EnergyBar1 >= 50) },
{ name = "Kick", use = (EnergyBar1 >= 20) },
{ name = "Wound Attack", use = (EnergyBar1 >= 35) and (tbuffs['Bleed']) and (tbuffs['Grievous Wound']) },
{ name = "Low Blow", use = (EnergyBar1 >= 30) and (tbuffs['Bleed']) and (not tbuffs['Grievous Wound']) },
{ name = "Shadowstab", use = (EnergyBar1 >= 20) and (not tbuffs['Bleed']) },
{ name = "Shadowstab", use = (EnergyBar1 >= 20) },
{ name = "Attack", use = (thealth == 1) },
}
end
end
|
|
|
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 |
--Class: Rogue/Priest
elseif mainClass == "THIEF" and subClass == "AUGUR" then
--Potions and Buffs
Skill = {
{ name = "Regenerate", use = (phealth <= .90) and (pctEB2 >= .05) and (not pbuffs['Regenerate']) },
{ name = "Action: "..healthpot, use = (phealth <= .70) },
{ name = "Action: "..manapot, use = (pctEB2 <= .40) },
{ name = "Assassins Rage", use = boss and enemy },
{ name = "Magic Barrier", use = (pctEB2 >= .05) and ((not pbuffs['Magic Barrier']) or (pbuffs['Magic Barrier'].time <= 45)) },
{ name = "Quickness Aura", use = (pctEB2 >= .05) and ((not pbuffs['Quickness Aura']) or (pbuffs['Quickness Aura'].time <= 45)) },
}
--Combat
if enemy then
Skill2 = {
{ name = "Premeditation", use = (not combat) and boss and (EnergyBar1 >= 50) },
{ name = "Kick", use = (EnergyBar1 >= 20) },
{ name = "Wound Attack", use = (EnergyBar1 >= 35) and ((tbuffs[620313]) and (tbuffs[620314])) },
{ name = "Low Blow", use = (EnergyBar1 >= 30) and (tbuffs[620313]) and (not tbuffs[620314]) },
{ name = "Shadowstab", use = (EnergyBar1 >= 20) and (not tbuffs[620313]) },
{ name = "Shadowstab", use = (EnergyBar1 >= 20) },
{ name = "Attack", use = (thealth == 1) },
}
end
end
|