Casting Checker for instance

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Draakje
Posts: 63
Joined: Sat Aug 10, 2013 6:24 am

Casting Checker for instance

#1 Post by Draakje » Fri Aug 23, 2013 6:38 am

I don't know if it has been alrdy made, or something exists, but trying to make a casting checker from bosses. So it anounces party while boss is casting a nasty skill, so all can react quick :d
Got this so far, and it not working :(

Code: Select all

local disabled = false -- Starting value

SLASH_BossBuff1 = "/BossBuffer"
SLASH_BossBuff2 = "/BB" -- Add as many variations as you like just increment the number
SlashCmdList["BossBuff"] = function(editBox, msg)
    if msg then
        msg = string.lower(msg)
        if msg == "on" then -- on
            disabled = false
        elseif msg == "off" then -- off
            disabled = true
        else
            disabled = not disabled -- Toggles addon if 'on' or 'off' is not used.
        end
        if disabled then
            SendSystemChat("BossBuff is disabled")
			SendChatMessage("|H|h|cffFF0000BossBuff Checker has been deactivated|h", "party")
        else
            SendSystemChat("BossBuff is enabled")
			SendChatMessage("|H|h|cff16DC07BossBuff Checker has been activated|h", "party")
        end
    end
end

local BossBuff = {} -- the AddOn namespace, all your functions should be placed inside here instead of as globals.
_G.BossBuff = BossBuff -- expose it to the global scope

function BossBuff.VN()
    if (Casting("target", "Tearing Claw Attack") == true) then
       SendChatMessage("|H|h|cffFCF802Lyong is casting Tearing Claw Attack!!|h", "party")
    end
    if (Casting("target", "Rune Pulse") == true) then
        SendChatMessage("|H|h|cffFCF802Player is casting rune pulse!!|h", "say")
    end
	end;

-- Searches the target for a specified debuff.
-- Use "player", "target", "party3", "raid1" etc. for tgt parameter.
function Casting(tgt,CastingName)
  local counter=1
  local currentcasting="none"
  while currentcasting ~= nil do
      currentcasting=UnitCasting(tgt,counter)
   if currentcasting ~= nil then
      if string.find(string.lower(currentcasting),string.lower(CastingName)) then
        return true
      else
        counter=counter+1
      end
    end
  end
  return false
end


local time_remaining = 0.5 -- in seconds
function BossBuff:OnUpdate(elapsed)
	if disabled == true then
		return
	end
    -- elapsed is the amount of time in seconds since the last frame tick

    time_remaining = time_remaining - elapsed
    if time_remaining > 0 then
        -- cut out early, we're not ready yet
        return
    end
    time_remaining = 0.5 -- reset to 2
end

Draakje
Posts: 63
Joined: Sat Aug 10, 2013 6:24 am

Re: Casting Checker for instance

#2 Post by Draakje » Fri Aug 23, 2013 6:43 am

changed

Code: Select all

if (Casting("target", "Rune Pulse") == true) then
        SendChatMessage("|H|h|cffFCF802Player is casting rune pulse!!|h", "say")
    end
quick to

Code: Select all

   if (Casting("player", "Rune Pulse") == true) then
        SendChatMessage("|H|h|cffFCF802Player is casting rune pulse!!|h", "say")
    end
hope i can see if works now, as testing

Draakje
Posts: 63
Joined: Sat Aug 10, 2013 6:24 am

Re: Casting Checker for instance

#3 Post by Draakje » Fri Aug 23, 2013 6:49 am

well maybe it doesnt work, if im casting. Need find a mob or low boss to give a try out

Draakje
Posts: 63
Joined: Sat Aug 10, 2013 6:24 am

Re: Casting Checker for instance

#4 Post by Draakje » Sun Aug 25, 2013 7:47 am

Code: Select all

local disabled = false -- Starting value

SLASH_BossBuff1 = "/BossBuffer"
SLASH_BossBuff2 = "/BB" -- Add as many variations as you like just increment the number
SlashCmdList["BossBuff"] = function(editBox, msg)
    if msg then
        msg = string.lower(msg)
        if msg == "on" then -- on
            disabled = false
        elseif msg == "off" then -- off
            disabled = true
        else
            disabled = not disabled -- Toggles addon if 'on' or 'off' is not used.
        end
        if disabled then
            SendSystemChat("BossBuff is disabled")
			SendChatMessage("|H|h|cffFF0000BossBuff Checker has been deactivated|h", "party")
        else
            SendSystemChat("BossBuff is enabled")
			SendChatMessage("|H|h|cff16DC07BossBuff Checker has been activated|h", "party")
        end
    end
end

local BossBuff = {} -- the AddOn namespace, all your functions should be placed inside here instead of as globals.
_G.BossBuff = BossBuff -- expose it to the global scope

function BossBuff.VN()
    if (OnCast("target", "Tearing Claw Attack") == true) then
       SendChatMessage("|H|h|cffFCF802Lyong is casting Tearing Claw Attack!!|h", "party")
    end
    if (OnCast("target", "Heal") == true) then
        SendChatMessage("|H|h|cffFCF802Player is casting heal!!|h", "say")
    end
	end;

-- Searches the target for a specified debuff.
-- Use "player", "target", "party3", "raid1" etc. for tgt parameter.
function OnCast(tgt,CastingName)
  local counter=1
  local Casting="none"
  while Casting ~= nil do
      Casting=UnitCasting(tgt,counter)
   if Casting ~= nil then
      if string.find(string.lower(Casting),string.lower(CastingName)) then
        return true
      else
        counter=counter+1
      end
    end
  end
  return false
end


local time_remaining = 0.5 -- in seconds
function BossBuff:OnUpdate(elapsed)
	if disabled == true then
		return
	end
    -- elapsed is the amount of time in seconds since the last frame tick

    time_remaining = time_remaining - elapsed
    if time_remaining > 0 then
        -- cut out early, we're not ready yet
        return
    end
    time_remaining = 0.5 -- reset to 2
end
also not working, someone knows the correct function?

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

Re: Casting Checker for instance

#5 Post by rock5 » Sun Aug 25, 2013 8:31 am

Your onupdate function does nothing. Isn't it supposed to call the "BossBuff.VN()" function"?
  • 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

Draakje
Posts: 63
Joined: Sat Aug 10, 2013 6:24 am

Re: Casting Checker for instance

#6 Post by Draakje » Sun Aug 25, 2013 9:04 am

u mean?

Code: Select all

local time_remaining = 0.5 -- in seconds
function BossBuff.VN():OnUpdate(elapsed)
   if disabled == true then
      return
   end

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

Re: Casting Checker for instance

#7 Post by rock5 » Sun Aug 25, 2013 9:24 am

No.

This is what your code does at the moment. After you enable it with a slash command

Code: Select all

/BB on
every 0.5 seconds the onupdate function resets the time_remaining variable. It does nothing else. The BossBuff.VN() function, which seems to do the work, never gets called. So I think the onupdate function is supposed to call it every 0.5 seconds. So where is says

Code: Select all

   time_remaining = 0.5 -- reset to 2
add the line

Code: Select all

BossBuff.VN()
  • 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

Draakje
Posts: 63
Joined: Sat Aug 10, 2013 6:24 am

Re: Casting Checker for instance

#8 Post by Draakje » Sun Aug 25, 2013 9:32 am

Wrong place.

Code: Select all

local time_remaining = 0.5 -- in seconds
function BossBuff:OnUpdate(elapsed)
	if disabled == true then
		return
	end
    -- elapsed is the amount of time in seconds since the last frame tick

    time_remaining = time_remaining - elapsed
    if time_remaining > 0 then
        -- cut out early, we're not ready yet
        return
    end
    time_remaining = 0.5 -- reset to 2
    BossBuff.VN()
end

Draakje
Posts: 63
Joined: Sat Aug 10, 2013 6:24 am

Re: Casting Checker for instance

#9 Post by Draakje » Sun Aug 25, 2013 10:59 am

Trying with:

Code: Select all

local disabled = false -- Starting value

SLASH_BossBuff1 = "/BossBuffer"
SLASH_BossBuff2 = "/BB" -- Add as many variations as you like just increment the number
SlashCmdList["BossBuff"] = function(editBox, msg)
    if msg then
        msg = string.lower(msg)
        if msg == "on" then -- on
            disabled = false
        elseif msg == "off" then -- off
            disabled = true
        else
            disabled = not disabled -- Toggles addon if 'on' or 'off' is not used.
        end
        if disabled then
            SendSystemChat("BossBuff is disabled")
			SendChatMessage("|H|h|cffFF0000BossBuff Checker has been deactivated|h", "party")
        else
            SendSystemChat("BossBuff is enabled")
			SendChatMessage("|H|h|cff16DC07BossBuff Checker has been activated|h", "party")
        end
    end
end

local BossBuff = {} -- the AddOn namespace, all your functions should be placed inside here instead of as globals.
_G.BossBuff = BossBuff -- expose it to the global scope

function BossBuff.VN()
    if (OnCast("target", "Tearing Claw Attack") == true) then
       SendChatMessage("|H|h|cffFCF802Lyong is casting Tearing Claw Attack!!|h", "party")
    end
    if (OnCast("target", "Black Flame") == true) then
        SendChatMessage("Black Flame!!!", "party")
    end
	end;

-- Searches the target for a specified debuff.
-- Use "player", "target", "party3", "raid1" etc. for tgt parameter.
function OnCast(tgt,CastingName)
  local counter=1
  local Casting="none"
  while Casting ~= nil do
      Casting=UnitCasting(tgt,counter)
   if Casting ~= nil then
      if string.find(string.lower(Casting),string.lower(CastingName)) then
        return true
      else
        counter=counter+1
      end
    end
  end
  return false
end


local time_remaining = 0.5 -- in seconds
function BossBuff:OnUpdate(elapsed)
	if disabled == true then
		return
	end
    -- elapsed is the amount of time in seconds since the last frame tick

    time_remaining = time_remaining - elapsed
    if time_remaining > 0 then
        -- cut out early, we're not ready yet
        return
    end
    time_remaining = 0.5 -- reset to 2
	BossBuff.VN()
end
the on and off slash commands works, but when the boss is casting like Black Flame its not announcing my party chat :/

Draakje
Posts: 63
Joined: Sat Aug 10, 2013 6:24 am

Re: Casting Checker for instance

#10 Post by Draakje » Sun Aug 25, 2013 11:15 am

on rom wiki i find some functions:
CastingBarFrame_OnEvent
CastingBarFrame_OnLoad
CastingBarFrame_OnUpdate
Event:CASTING_START

maybe have use on of these?

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

Re: Casting Checker for instance

#11 Post by rock5 » Sun Aug 25, 2013 11:29 am

Maybe "party" is supposed to be capital, example

Code: Select all

        SendChatMessage("|H|h|cffFF0000BossBuff Checker has been deactivated|h", "PARTY")
  • 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

Draakje
Posts: 63
Joined: Sat Aug 10, 2013 6:24 am

Re: Casting Checker for instance

#12 Post by Draakje » Sun Aug 25, 2013 11:33 am

rock5 wrote:Maybe "party" is supposed to be capital, example

Code: Select all

        SendChatMessage("|H|h|cffFF0000BossBuff Checker has been deactivated|h", "PARTY")
the on - off function works, and also gets anounced in party chat, that part is written with small letters "party"

trying out function SpellCast now hope this works

Draakje
Posts: 63
Joined: Sat Aug 10, 2013 6:24 am

Re: Casting Checker for instance

#13 Post by Draakje » Sun Aug 25, 2013 11:37 am

dam whats the right function to check the boss casting :(

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

Re: Casting Checker for instance

#14 Post by rock5 » Sun Aug 25, 2013 1:46 pm

Where are you getting these function names from? Are you making them up? Try
http://runesofmagic.gamepedia.com/API:UnitCastingTime
  • 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

Draakje
Posts: 63
Joined: Sat Aug 10, 2013 6:24 am

Re: Casting Checker for instance

#15 Post by Draakje » Sun Aug 25, 2013 2:51 pm

they come from rom wiki too

so try this?

Code: Select all

local disabled = false -- Starting value

SLASH_BossBuff1 = "/BossBuffer"
SLASH_BossBuff2 = "/BB" -- Add as many variations as you like just increment the number
SlashCmdList["BossBuff"] = function(editBox, msg)
    if msg then
        msg = string.lower(msg)
        if msg == "on" then -- on
            disabled = false
        elseif msg == "off" then -- off
            disabled = true
        else
            disabled = not disabled -- Toggles addon if 'on' or 'off' is not used.
        end
        if disabled then
            SendSystemChat("BossBuff is disabled")
			SendChatMessage("|H|h|cffFF0000BossBuff Checker has been deactivated|h", "party")
        else
            SendSystemChat("BossBuff is enabled")
			SendChatMessage("|H|h|cff16DC07BossBuff Checker has been activated|h", "party")
        end
    end
end

local BossBuff = {} -- the AddOn namespace, all your functions should be placed inside here instead of as globals.
_G.BossBuff = BossBuff -- expose it to the global scope

function BossBuff.VN()
    if (UnitCastingTime("target", "Tearing Claw Attack") == true) then
       SendChatMessage("|H|h|cffFCF802Lyong is casting Tearing Claw Attack!!|h", "party")
    end
    if (UnitCastingTime("target", "Black Flame") == true) then
        SendChatMessage("Black Flame!!!", "party")
    end
	end;

-- Searches the target for a specified debuff.
-- Use "player", "target", "party3", "raid1" etc. for tgt parameter.
function UnitCastingTime(tgt,CastingName)
  local counter=1
  local currCastingTime="none"
  while currCastingTime ~= nil do
      currCastingTime=UnitCasting(tgt,counter)
   if currCastingTime ~= nil then
      if string.find(string.lower(currCastingTime),string.lower(CastingName)) then
        return true
      else
        counter=counter+1
      end
    end
  end
  return false
end


local time_remaining = 0.5 -- in seconds
function BossBuff:OnUpdate(elapsed)
	if disabled == true then
		return
	end
    -- elapsed is the amount of time in seconds since the last frame tick

    time_remaining = time_remaining - elapsed
    if time_remaining > 0 then
        -- cut out early, we're not ready yet
        return
    end
    time_remaining = 0.5 -- reset to 2
    BossBuff.VN()
end

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

Re: Casting Checker for instance

#16 Post by rock5 » Mon Aug 26, 2013 1:14 am

You obviously have a lot to learn about coding.

No, I meant use that function I linked to, not create a function by with that name. I meant use "UnitCastingTime" instead of "UnitCasting" which doesn't look like a valid game function. It's not listed under the rom wikis "List of Functions". http://runesofmagic.gamepedia.com/List_of_Functions.

So looking at the function example, you could use something like

Code: Select all

function OnCast(tgt,CastingName)
   local name = UnitCastingTime(tgt)
   if name == CastingName then
      return true
   else
      return false
   end
end
  • 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

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

Re: Casting Checker for instance

#17 Post by markd » Thu Jun 19, 2014 10:51 pm

I am trying to make this function work, but i keep getting "attempt to call global 'UnitCastingTime' (a nil value). Could someone help.

<onLoad>
function OnCast(tgt,CastingName)
local name = UnitCastingTime(tgt)
if name == CastingName then
return true
else
return false
end
end
</onLoad>
<!-- # 1 --><waypoint x="2256" z="33093" y="0" type="TRAVEL">
local mob = player:findNearestNameOrId(103980)
if mob then
player:target(mob);
if OnCast("target","Erupting Spore") == true then
sendpartychat("mob casting");
end
end
</waypoint>
</waypoints>

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

Re: Casting Checker for instance

#18 Post by rock5 » Fri Jun 20, 2014 12:08 am

Thats an in game function right? Try

Code: Select all

local name = RoMScript("UnitCastingTime(\""..tgt.."\")")
  • 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

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

Re: Casting Checker for instance

#19 Post by markd » Fri Jun 20, 2014 7:28 am

Works great. Thank you for your help.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests