Do it yourself combat engine ( DIYCE ) addon little help

Talk about anything in Runes of Magic. This does not need to pertain to botting.
Post Reply
Message
Author
User avatar
lolita
Posts: 139
Joined: Thu Oct 20, 2011 5:39 am
Location: Serbia

Do it yourself combat engine ( DIYCE ) addon little help

#1 Post by lolita » Thu Aug 01, 2013 3:15 pm

Dose somebody use DIYCE addon?
this is code from original Gostewolf addon

Code: Select all

-- Title: DIY Combat Engine
-- Version: 2.4.2
-- Description: Combat Engine to help with skill rotations, and maintaining buffs/debuffs for maximizing DPS.
-- Author: Ghost Wolf

local g_skill  = {}
local DIYCE_Timers = {}
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")
			DIYCE_EventFrame:SetScripts("OnUpdate", [=[ DIYCE_TimerUpdate(elapsedTime) ]=] )
			
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)
	
	local buff = string.gsub(buff, "(Function:)( *)(.*)", "%3")
	
	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 or 0, 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

--		Example of useage of ChkBuffCount()
--			{ name = "Tactical Attack",   use = ((EnergyBar1 >= 15) and (ChkBuffCount("target",_,500081,2))) },
function ChkBuffCount(tgt,buffname,BuffID,buffcount)
    local cnt = 1
    local buffcmd = UnitBuff
    local buffcounter = 0

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

    while buff ~= nil do
        if string.gsub(buff, "(%()(.)(%))", "%2") == buffname
            or ID == BuffID then
            buffcounter = buffcounter + 1        
        end
        cnt = cnt + 1
        buff = buffcmd(tgt,cnt)
        
        if buffcounter >= buffcount then
            return true
        end
    end    
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.2
	elseif skillname == nil then
		return false
	else
        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 (Skill[x].ignoretimer or GetDIYCETimerValue(Skill[x].timer) == 0) and CD(Skill[x].name) then
                if talktome then Msg("- "..Skill[x].name) end
                CastSpellByName(Skill[x].name)
                StartDIYCETimer(Skill[x].timer)
                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
			elseif string.find(Skill[x].name, "Function:") then
                action = string.gsub(Skill[x].name, "(Function:)( *)(.*)", "%3")
                if talktome then Msg("- "..Skill[x].name) end
                RunScript(action)
                return true
			end
		end
	end
	if (arg1 == "v2") then Msg("- [IDLE]", 0, 1, 1) end

	return false
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", "Fire Ward", "Savage Blessing", "Concentration Prayer", "Shadow Fury", "Embrace of the Water Spirit"  }

    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

--[[ Timer Update function ]]--
-- Tick down any active timers
function DIYCE_TimerUpdate(elapsed)
    for k,v in pairs(DIYCE_Timers) do
        v.timeLeft = v.timeLeft - elapsed
        if v.timeLeft < 0 then
            v.timeLeft = 0
        end
    end
end

--[[ Create a named timer ]]--
-- if the named timer already exists, this does nothing.
function CreateDIYCETimer(timerName, waitTime)
    if not DIYCE_Timers[timerName] then
        DIYCE_Timers[timerName] = { timeLeft = 0, waitTime = waitTime }
    end
end

--[[ Set/reset waitTimer of an existing timer ]]--
-- if the timer doesn't exist, this does nothing
function SetDIYCETimerDelay(timerName, waitTime)
    if DIYCE_Timers[timerName] then
        DIYCE_Timers[timerName].waitTime = waitTime
    end
end

--[[ Delete named timer ]]--
-- if the timer doesn't exist, this does nothing
-- Not really needed, but added for completeness
function DeleteDIYCETimer(timerName)
    if DIYCE_Timers[timerName] then
        DIYCE_Timers[timerName] = nil
    end
end

--[[ Get a timer's current time ]]--
-- if the timer doesn't exist, this returns 0
function GetDIYCETimerValue(timerName)
    if timerName then
        return DIYCE_Timers[timerName] and DIYCE_Timers[timerName].timeLeft or 0
    end
    return 0
end

--[[ Starts a timer ticking down ]]--
-- if timer doesn't exist, this does nothing
function StartDIYCETimer(timerName)
    if timerName and DIYCE_Timers[timerName] then
        DIYCE_Timers[timerName].timeLeft = DIYCE_Timers[timerName].waitTime
    end
end

--[[ Stop a named timer ]]--
-- if timer doesn't exist, this does nothing
function StopDIYCETimer(timerName)
   if DIYCE_Timers[timerName] then
      DIYCE_Timers[timerName].timeLeft = 0
  end
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
at the moment, diyce acsept only skill names, item names, action bar slot and function() for rotation in mycombat().
I tryed to change function MyCombat() to accept and skill ID's, so diyce can be multi language, but with no luck.
if somebody is willing to help, ill appreciate it.
thx in advance
Life is a journey, not destination :D

User avatar
lolita
Posts: 139
Joined: Thu Oct 20, 2011 5:39 am
Location: Serbia

Re: Do it yourself combat engine ( DIYCE ) addon little help

#2 Post by lolita » Tue Sep 03, 2013 8:24 am

As noone answered my Question for adding Skill ID to MyCombat() i did little research.
I was thinking something like this

Code: Select all

-- skill name and ID
Frenzy = 490493
-- Skill global name
Sys490493_name
-- and global returns different names on different language
-- eneu
"Sys490493_name"="Frenzy"
-- de
"Sys490493_name"="Raserei"
-- es
"Sys490493_name"="Frenesí"
So we if someone can help me to get this work , or explain how string.gsub works, i'll appreciate that

Code: Select all

elseif string.find(Skill[x].name, "ID:") then
                action = string.gsub(Skill[x].name, "(ID:)( *)(.*)", "%3") -- at the moment this returns "ID: 490493" i need to change it to "Sys409493_name"
                                                                                           -- and here something to get name of skill from "Sys409493_name"
                if talktome then Msg("- "..Skill[x].name) end
                CastSpellByName(Skill[x].name)
                StartDIYCETimer(Skill[x].timer)
                return true
So I need to change via string.gsub or some other method
1) "ID: 490493" to "Sys409493_name"
2) then get skill name from "Sys409493_name" = "Something"
3) so i can cast at the end CastSpellByName("Something")

Thx in advancename, =
Life is a journey, not destination :D

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Do it yourself combat engine ( DIYCE ) addon little help

#3 Post by rock5 » Tue Sep 03, 2013 9:10 am

1. I can't teach you how to do the pattern matching stuff because it can be quite complex but I could do it for you. I've gotten pretty good at it. To work out the correct pattern I think I need an example of the original string, ie. "Skill[x].name".

2. To get the text name of a string you use

Code: Select all

variable = TEXT("Sys409493_name")
3. So you can do, as you probably can guess

Code: Select all

CastSpellByName(variable)
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
lolita
Posts: 139
Joined: Thu Oct 20, 2011 5:39 am
Location: Serbia

Re: Do it yourself combat engine ( DIYCE ) addon little help

#4 Post by lolita » Tue Sep 03, 2013 10:13 am

this is original code

Code: Select all

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 (Skill[x].ignoretimer or GetDIYCETimerValue(Skill[x].timer) == 0) and CD(Skill[x].name) then
                if talktome then Msg("- "..Skill[x].name) end
                CastSpellByName(Skill[x].name)
                StartDIYCETimer(Skill[x].timer)
                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
			elseif string.find(Skill[x].name, "Function:") then
                action = string.gsub(Skill[x].name, "(Function:)( *)(.*)", "%3")
                if talktome then Msg("- "..Skill[x].name) end
                RunScript(action)
                return true
			elseif string.find(Skill[x].name, "ID: ") then					-- this was added by me
                action = string.gsub(Skill[x].name, "(ID:)( *)(.*)", "%3")	-- this was added by me
                if talktome then Msg("- "..Skill[x].name) end				-- this was added by me
                CastSpellByName(Skill[x].name)								-- this was added by me
                StartDIYCETimer(Skill[x].timer)								-- this was added by me
                return true													-- this was added by me
			end
		end
	end
	if (arg1 == "v2") then Msg("- [IDLE]", 0, 1, 1) end

	return false
end
and this is exapmle how we use that code in skill rotation

Code: Select all

Skill2 = {
					{ name = "Fire Ward",                      		use = ((not pbuffs["Fire Ward"])) },
-- we wana use something like this { name = "ID: 490062",				use = ((pctEB2 >= .05) and (not pbuffs["Lightning Burn Weapon"])) }, 
					{ name = "Item: Potion: Lucky Target", 			use = ((not pbuffs["Turn of Luck Powder Dust"]) and (ltpot)) },
					{ name = "Item: Potion: Unbridled Enthusiasm", 	use = ((not pbuffs["Unbridled Enthusiasm"]) and (uepot)) },
					{ name = "Item: Potion: Clear Thought", 		use = ((not pbuffs["Clear Thought"]) and (ctpot)) },
					{ name = "Item: Potion: Scarlet Love", 			use = ((not pbuffs["Scarlet Love"]) and (slpot)) },
					{ name = "Function: UseItemOnSelf('Blessing of the Flower God')",	use = ((not pbuffs["Blessing of the Flower God"]) and (FlowerBlessing)) },
            { name = "Intensification",                     use = (not pbuffs["Intensification"]) },
					{ name = "Elemental Catalysis",                 use = (not pbuffs["Elemental Cataclysis"]) },
						}
)) },
{ name =name,
Life is a journey, not destination :D

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Do it yourself combat engine ( DIYCE ) addon little help

#5 Post by rock5 » Tue Sep 03, 2013 10:39 am

Ok try this

Code: Select all

elseif string.find(Skill[x].name, "ID: ") then
    action = string.gsub(Skill[x].name,"(ID:)( *)(.*)", "Sys%3_name")
    CastSpellByName(TEXT(action))
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
lolita
Posts: 139
Joined: Thu Oct 20, 2011 5:39 am
Location: Serbia

Re: Do it yourself combat engine ( DIYCE ) addon little help

#6 Post by lolita » Tue Sep 03, 2013 10:58 am

as always Rock5 save's the day,
it's working as intended.
Ty Rock5
Life is a journey, not destination :D

markd
Posts: 17
Joined: Sat Dec 03, 2011 6:28 pm

Re: Do it yourself combat engine ( DIYCE ) addon little help

#7 Post by markd » Fri Oct 04, 2013 2:27 pm

Is there a way to target a specific unit using DIYCE or re-target? Like the function "TargetUnit("Giant Phantom")" instead of the usual "TargetNearestEnemy()"? I use DIYCE for an in-instance combat, mostly because of DPS, and don't know how to switch targets from Boss to spawns. I tried rombot for switching targets while fighting Hoson. It detects the Giant Phantom, but for some reason it does not not re-target to the Giant Phantom when it show up. It would work if there was a way to re-target in DIYCE itself. I appreciate any help.

local _time = os.time();
repeat
player:update()
player:findTarget("Giant Phantom");
player:target("Giant Phantom");
keyboardPress(key.VK_6); <!-- DIYCE Button -->
until (os.time() - _time > 200);

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Do it yourself combat engine ( DIYCE ) addon little help

#8 Post by rock5 » Fri Oct 04, 2013 3:23 pm

Firstly player:findTarget() accepts no arguments. That is an old function that just presses the 'select next target' button.

Secondly player:target() only accepts an address or pawn.

To find a target by name and then target it use,

Code: Select all

local mob = player:findNearestNameOrId("Giant Phantom")
player:target(mob)
Hope that helps.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
lolita
Posts: 139
Joined: Thu Oct 20, 2011 5:39 am
Location: Serbia

Re: Do it yourself combat engine ( DIYCE ) addon little help

#9 Post by lolita » Fri Oct 04, 2013 5:46 pm

markd wrote:Is there a way to target a specific unit using DIYCE or re-target? Like the function "TargetUnit("Giant Phantom")" instead of the usual "TargetNearestEnemy()"?
RoM Api TargetUnit(unit) cant get target by name. unit can be "player","party1","raid2","focus3",etc
If unit is nil or "" it clears your target.
But there is a way to target specific mob in game. u can make custom function, something like this

Code: Select all

function TargetThis(_arg)
	for i=1,10 do
		if UnitName("target") == _arg then
			break
		end
		TargetNearestEnemy()
	end
end
and then make macro

Code: Select all

/script TargetThis("Giant Phantom")
Life is a journey, not destination :D

markd
Posts: 17
Joined: Sat Dec 03, 2011 6:28 pm

Re: Do it yourself combat engine ( DIYCE ) addon little help

#10 Post by markd » Sun Oct 06, 2013 5:16 pm

Thank you very much.

kuripot
Posts: 493
Joined: Mon Nov 07, 2011 9:14 pm

Re: Do it yourself combat engine ( DIYCE ) addon little help

#11 Post by kuripot » Tue Dec 03, 2013 10:37 pm

i dunno how to use the Diyce.. how can i add skill... how to execute ingame.. can anyone tell me how?? im using myScript addon from my other friend and can use this by creating macro command then spam the macro.. the role of myScript addon is to arrange to skill by sequence. but every skill executed you need to press the macro to execute the next skill.... i want only one press then execute all skill....

devrimist
Posts: 11
Joined: Mon Nov 18, 2019 4:25 am

Re: Do it yourself combat engine ( DIYCE ) addon little help

#12 Post by devrimist » Sun Nov 28, 2021 9:18 am

lolita wrote: Tue Sep 03, 2013 10:13 am
and this is exapmle how we use that code in skill rotation

Code: Select all

Skill2 = {
					{ name = "Fire Ward",                      		use = ((not pbuffs["Fire Ward"])) },
-- we wana use something like this { name = "ID: 490062",				use = ((pctEB2 >= .05) and (not pbuffs["Lightning Burn Weapon"])) }, 
					{ name = "Item: Potion: Lucky Target", 			use = ((not pbuffs["Turn of Luck Powder Dust"]) and (ltpot)) },
					{ name = "Item: Potion: Unbridled Enthusiasm", 	use = ((not pbuffs["Unbridled Enthusiasm"]) and (uepot)) },
					{ name = "Item: Potion: Clear Thought", 		use = ((not pbuffs["Clear Thought"]) and (ctpot)) },
					{ name = "Item: Potion: Scarlet Love", 			use = ((not pbuffs["Scarlet Love"]) and (slpot)) },
					{ name = "Function: UseItemOnSelf('Blessing of the Flower God')",	use = ((not pbuffs["Blessing of the Flower God"]) and (FlowerBlessing)) },
            { name = "Intensification",                     use = (not pbuffs["Intensification"]) },
					{ name = "Elemental Catalysis",                 use = (not pbuffs["Elemental Cataclysis"]) },
						}
)) },
Hello, (ltpot ctpot Uepot) can you explain where and how we define these in the code :D... for.eg. Hero Pot or foods...

devrimist
Posts: 11
Joined: Mon Nov 18, 2019 4:25 am

Re: Do it yourself combat engine ( DIYCE ) addon little help

#13 Post by devrimist » Mon Jan 17, 2022 3:12 pm

[string:"?""]:160: bad argument #1 to 'GetActionCoolDown' (number expected, got nil) ...<- Does anyone have any idea what the cause of this error is.

User avatar
Administrator
Site Admin
Posts: 5225
Joined: Sat Jan 05, 2008 4:21 pm

Re: Do it yourself combat engine ( DIYCE ) addon little help

#14 Post by Administrator » Mon Jan 17, 2022 3:48 pm

Hard to say. Was this previously working for you? Are you able to determine which script this error is actually from? That is, which file even has GetActionCoolDown() on line 160? It isn't immediately clear if this is something specific to DIYCE, or the rom-bot, or what.

EDIT: There's no reference to GetActionCoolDown() in the rom-bot scripts; it either is from DIYCE, or something extra you've got (waypoints? userfunctions?). Probably DIYCE, if I had to guess.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest